diff --git a/Cargo.lock b/Cargo.lock index 7c0035acf..d10cd2db0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2324,6 +2324,7 @@ dependencies = [ name = "darwinia-common-runtime" version = "6.0.0" dependencies = [ + "account", "bp-darwinia-core", "dc-primitives", "frame-support", diff --git a/node/src/chain_spec/crab.rs b/node/src/chain_spec/crab.rs index caf865dd4..1416d37b6 100644 --- a/node/src/chain_spec/crab.rs +++ b/node/src/chain_spec/crab.rs @@ -232,7 +232,7 @@ fn testnet_genesis( }, transaction_payment: Default::default(), assets: AssetsConfig { - assets: vec![(AssetIds::CKton as _, array_bytes::hex_n_into_unchecked(ALITH), true, 1)], + assets: vec![(AssetIds::CKton as _, ROOT, true, 1)], metadata: vec![( AssetIds::CKton as _, b"Crab Commitment Token".to_vec(), diff --git a/node/src/chain_spec/darwinia.rs b/node/src/chain_spec/darwinia.rs index ea3ed8dc7..9e95dacb9 100644 --- a/node/src/chain_spec/darwinia.rs +++ b/node/src/chain_spec/darwinia.rs @@ -232,7 +232,7 @@ fn testnet_genesis( }, transaction_payment: Default::default(), assets: AssetsConfig { - assets: vec![(AssetIds::Kton as _, array_bytes::hex_n_into_unchecked(ALITH), true, 1)], + assets: vec![(AssetIds::Kton as _, ROOT, true, 1)], metadata: vec![( AssetIds::Kton as _, b"Darwinia Commitment Token".to_vec(), diff --git a/node/src/chain_spec/pangolin.rs b/node/src/chain_spec/pangolin.rs index 2694b8331..58ce0c9c4 100644 --- a/node/src/chain_spec/pangolin.rs +++ b/node/src/chain_spec/pangolin.rs @@ -156,7 +156,7 @@ pub fn genesis_config() -> ChainSpec { assets: AssetsConfig { assets: vec![( AssetIds::PKton as _, - array_bytes::hex_n_into_unchecked(ALITH), + ROOT, true, 1, )], diff --git a/node/src/command.rs b/node/src/command.rs index c0a7e4baa..f7b472b3a 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -594,7 +594,7 @@ pub fn run() -> Result<()> { SubstrateCli::create_configuration(&polkadot_cli, &polkadot_cli, tokio_handle) .map_err(|err| format!("Relay chain argument error: {}", err))?; - return if chain_spec.is_crab() { + if chain_spec.is_crab() { service::start_parachain_node::( config, polkadot_config, @@ -630,7 +630,7 @@ pub fn run() -> Result<()> { .await .map(|r| r.0) .map_err(Into::into) - }; + } }) }, } diff --git a/pallet/staking/src/lib.rs b/pallet/staking/src/lib.rs index 041ce026e..dbfd80656 100644 --- a/pallet/staking/src/lib.rs +++ b/pallet/staking/src/lib.rs @@ -270,7 +270,7 @@ pub mod pallet { /// Stakers' exposure. #[pallet::storage] #[pallet::unbounded] - #[pallet::getter(fn exposure)] + #[pallet::getter(fn exposure_of)] pub type Exposures = StorageMap<_, Twox64Concat, T::AccountId, Exposure>; diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index 3bd45cee5..9815fc937 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -19,16 +19,19 @@ dc-primitives = { default-features = false, path = "../../core/primitives" } # darwinia-messages-substrate bp-darwinia-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +# moonbeam +account = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30" } + # polkadot xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } # substrate -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } [features] default = ["std"] @@ -39,6 +42,9 @@ std = [ # darwinia "dc-primitives/std", + # moonbeam + "account/std", + # polkadot "xcm/std", "xcm-executor/std", diff --git a/runtime/common/src/gov_origin.rs b/runtime/common/src/gov_origin.rs index 1d34450f1..78b4f404c 100644 --- a/runtime/common/src/gov_origin.rs +++ b/runtime/common/src/gov_origin.rs @@ -18,6 +18,8 @@ // darwinia use dc_primitives::AccountId; +// moonbeam +use account::AccountId20; // substrate use frame_support::traits::EitherOfDiverse; use frame_system::EnsureRoot; @@ -39,3 +41,7 @@ pub type RootOrAtLeastThreeFifth = pub type RootOrAll = EitherOfDiverse>; + +/// An [`AccountId20`] generated from b"root". +pub const ROOT: AccountId20 = + AccountId20([0x72, 0x6f, 0x6f, 0x74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); diff --git a/runtime/crab/src/pallets/deposit.rs b/runtime/crab/src/pallets/deposit.rs index 0ed9b9bfb..696b789e8 100644 --- a/runtime/crab/src/pallets/deposit.rs +++ b/runtime/crab/src/pallets/deposit.rs @@ -24,7 +24,7 @@ impl darwinia_deposit::Minting for CKtonMinting { type AccountId = AccountId; fn mint(beneficiary: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { - Assets::mint(RuntimeOrigin::root(), AssetIds::CKton as AssetId, *beneficiary, amount) + Assets::mint(RuntimeOrigin::signed(ROOT), AssetIds::CKton as AssetId, *beneficiary, amount) } } diff --git a/runtime/darwinia/src/pallets/deposit.rs b/runtime/darwinia/src/pallets/deposit.rs index 84dc288c3..4c46dd164 100644 --- a/runtime/darwinia/src/pallets/deposit.rs +++ b/runtime/darwinia/src/pallets/deposit.rs @@ -24,7 +24,7 @@ impl darwinia_deposit::Minting for KtonMinting { type AccountId = AccountId; fn mint(beneficiary: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { - Assets::mint(RuntimeOrigin::root(), AssetIds::Kton as AssetId, *beneficiary, amount) + Assets::mint(RuntimeOrigin::signed(ROOT), AssetIds::Kton as AssetId, *beneficiary, amount) } } diff --git a/runtime/pangolin/src/pallets/deposit.rs b/runtime/pangolin/src/pallets/deposit.rs index 023819bc4..aacc925bd 100644 --- a/runtime/pangolin/src/pallets/deposit.rs +++ b/runtime/pangolin/src/pallets/deposit.rs @@ -24,7 +24,7 @@ impl darwinia_deposit::Minting for PKtonMinting { type AccountId = AccountId; fn mint(beneficiary: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { - Assets::mint(RuntimeOrigin::root(), AssetIds::PKton as AssetId, *beneficiary, amount) + Assets::mint(RuntimeOrigin::signed(ROOT), AssetIds::PKton as AssetId, *beneficiary, amount) } }