Skip to content

Commit

Permalink
Chainbridge constants fix (#231)
Browse files Browse the repository at this point in the history
### Description
<!-- Describe what change this PR is implementing -->

Constant declarations were accidentally removed in #210 

### Types of Changes
<!--- What types of changes does your code introduce? -->
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] Dependency upgrade (A change in substrate or any 3rd party crate
version)

### Migrations and Hooks
<!--- Check the following box with an x if the following applies: -->
- [ ] This change requires a runtime migration.
- [ ] Modifies `on_initialize`
- [ ] Modifies `on_finalize`

### Checklist
<!--- All boxes need to be checked. Follow this checklist before
requiring PR review -->
- [x] Change has been tested locally.
- [ ] Change adds / updates tests.
- [ ] Changelog doc updated.
  • Loading branch information
rakanalh authored Jan 12, 2024
1 parent 2463f9e commit 7ae2021
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 2 deletions.
7 changes: 6 additions & 1 deletion pallets/chainbridge/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,14 @@ pub mod pallet {
/// The identifier for this chain.
/// This must be unique and must not collide with existing IDs within a set of bridged
/// chains.
#[pallet::constant]
type ChainId: Get<ChainId>;

type ProposalLifetime: Get<Self::BlockNumber>;
#[pallet::constant]
type ProposalLifetime: Get<<Self as frame_system::Config>::BlockNumber>;

#[pallet::constant]
type BridgeAccountId: Get<Self::AccountId>;
}

/// All whitelisted chains and their respective transaction counts
Expand Down
2 changes: 2 additions & 0 deletions pallets/chainbridge/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ impl pallet_balances::Config for Test {
parameter_types! {
pub const TestChainId: u8 = 5;
pub const ProposalLifetime: u64 = 50;
pub BridgeAccountId: u64 = AccountIdConversion::<u64>::into_account_truncating(&MODULE_ID);
}

impl crate::pallet::Config for Test {
Expand All @@ -80,6 +81,7 @@ impl crate::pallet::Config for Test {
type Proposal = RuntimeCall;
type ChainId = TestChainId;
type ProposalLifetime = ProposalLifetime;
type BridgeAccountId = BridgeAccountId;
}

type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
Expand Down
3 changes: 3 additions & 0 deletions pallets/erc20/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,11 @@ pub mod pallet {
type Currency: Currency<Self::AccountId>;

/// Ids can be defined by the runtime and passed in, perhaps from blake2b_128 hashes.
#[pallet::constant]
type HashId: Get<ResourceId>;
#[pallet::constant]
type NativeTokenId: Get<ResourceId>;
#[pallet::constant]
type Erc721Id: Get<ResourceId>;
}

Expand Down
4 changes: 3 additions & 1 deletion runtime/cere-dev/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
// and set impl_version to 0. If only runtime
// implementation changes and behavior does not, then leave spec_version as
// is and increment impl_version.
spec_version: 48500,
spec_version: 48501,
impl_version: 0,
transaction_version: 10,
apis: RUNTIME_API_VERSIONS,
Expand Down Expand Up @@ -1226,6 +1226,7 @@ impl pallet_vesting::Config for Runtime {
parameter_types! {
pub const ChainId: u8 = 1;
pub const ProposalLifetime: BlockNumber = 1000;
pub BridgeAccountId: AccountId = AccountIdConversion::<AccountId>::into_account_truncating(&pallet_chainbridge::MODULE_ID);
}

/// Configure the send data pallet
Expand All @@ -1235,6 +1236,7 @@ impl pallet_chainbridge::Config for Runtime {
type Proposal = RuntimeCall;
type ChainId = ChainId;
type ProposalLifetime = ProposalLifetime;
type BridgeAccountId = BridgeAccountId;
}

parameter_types! {
Expand Down
2 changes: 2 additions & 0 deletions runtime/cere/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1231,6 +1231,7 @@ impl pallet_vesting::Config for Runtime {
parameter_types! {
pub const ChainId: u8 = 1;
pub const ProposalLifetime: BlockNumber = 1000;
pub BridgeAccountId: AccountId = AccountIdConversion::<AccountId>::into_account_truncating(&pallet_chainbridge::MODULE_ID);
}

/// Configure the send data pallet
Expand All @@ -1240,6 +1241,7 @@ impl pallet_chainbridge::Config for Runtime {
type Proposal = RuntimeCall;
type ChainId = ChainId;
type ProposalLifetime = ProposalLifetime;
type BridgeAccountId = BridgeAccountId;
}

parameter_types! {
Expand Down

0 comments on commit 7ae2021

Please sign in to comment.