Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chainbridge constants fix #231

Merged
merged 5 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading