diff --git a/node/src/command.rs b/node/src/command.rs index fc7b4f00a..96a019e18 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -234,7 +234,7 @@ impl CliConfiguration for RelayChainCli { /// Parse command line arguments into service configuration. pub fn run() -> Result<()> { #[cfg(feature = "runtime-benchmarks")] - /// Creates partial components for the runtimes that are supported by the benchmarks. + /// Creates partial components for the runtime that are supported by the benchmarks. macro_rules! construct_benchmark_partials { ($config:expr, $cli:ident, |$partials:ident| $code:expr) => {{ #[cfg(feature = "crab-runtime")] diff --git a/pallet/staking/src/lib.rs b/pallet/staking/src/lib.rs index 9bc28850b..be6b32a8d 100644 --- a/pallet/staking/src/lib.rs +++ b/pallet/staking/src/lib.rs @@ -134,7 +134,7 @@ pub mod pallet { /// Override the [`frame_system::Config::RuntimeEvent`]. type RuntimeEvent: From> + IsType<::RuntimeEvent>; - /// Weight information for extrinsics in this pallet. + /// Weight information for extrinsic in this pallet. type WeightInfo: WeightInfo; /// Unix time interface. diff --git a/runtime/crab/src/migration.rs b/runtime/crab/src/migration.rs index 75e85b19b..bf373a08e 100644 --- a/runtime/crab/src/migration.rs +++ b/runtime/crab/src/migration.rs @@ -45,47 +45,9 @@ impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade { } fn migrate() -> frame_support::weights::Weight { - // dawinia - use darwinia_staking::CacheState; - if let Some(s) = migration::get_storage_value::<(CacheState, CacheState, CacheState)>( - b"DarwinaStaking", - b"ExposureCacheStates", - &[], - ) { - migration::put_storage_value(b"DarwinaStaking", b"CacheStates", &[], s); + if let Ok(k) = array_bytes::hex2bytes("0x1da53b775b270400e7e61ed5cbc5a146ab1160471b1418779239ba8e2b847e42d53de13b56da115d3342f0588bc3614108837de0ae21c270383d9f2de4db03c7b1314632314d8c74970d627c9b4f4c42e06688a9f7a2866905a810c4b1a49b8cb0dca3f1bc953905609869b6e9d4fb794cd36c5f") { + let _ = System::kill_storage(RuntimeOrigin::root(), vec![k]); } - if let Ok(dao) = - array_bytes::hex_n_into::<_, AccountId, 20>("0x08837De0Ae21C270383D9F2de4DB03c7b1314632") - { - let _ = >::transfer_ownership( - RuntimeOrigin::signed(ROOT), - codec::Compact(AssetIds::CKton as AssetId), - dao, - ); - - if let Ok(deposit) = array_bytes::hex_n_into::<_, AccountId, 20>( - "0x46275d29113f065c2aac262f34C7a3d8a8B7377D", - ) { - let _ = >::set_team( - RuntimeOrigin::signed(dao), - codec::Compact(AssetIds::CKton as AssetId), - deposit, - deposit, - dao, - ); - - >::put(deposit); - } - } - if let Ok(who) = - array_bytes::hex_n_into::<_, AccountId, 20>("0xa4fFAC7A5Da311D724eD47393848f694Baee7930") - { - >::put(who); - } - - >::put(darwinia_staking::now::()); - - // frame_support::weights::Weight::zero() - ::DbWeight::get().reads_writes(7, 7) + ::DbWeight::get().reads_writes(0, 1) } diff --git a/runtime/darwinia/src/migration.rs b/runtime/darwinia/src/migration.rs index cd8108886..ad8fd8fe8 100644 --- a/runtime/darwinia/src/migration.rs +++ b/runtime/darwinia/src/migration.rs @@ -45,22 +45,14 @@ impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade { } fn migrate() -> frame_support::weights::Weight { - let _ = migration::clear_storage_prefix( - b"BridgeKusamaGrandpa", - b"ImportedHeaders", - &[], - Some(100), - None, - ); - - // dawinia + // darwinia use darwinia_staking::CacheState; if let Some(s) = migration::get_storage_value::<(CacheState, CacheState, CacheState)>( - b"DarwinaStaking", + b"DarwiniaStaking", b"ExposureCacheStates", &[], ) { - migration::put_storage_value(b"DarwinaStaking", b"CacheStates", &[], s); + migration::put_storage_value(b"DarwiniaStaking", b"CacheStates", &[], s); } if let Ok(dao) = @@ -85,15 +77,32 @@ fn migrate() -> frame_support::weights::Weight { >::put(deposit); } + + log::info!("successfully transfer ownership of KTON to KTON DAO"); } if let Ok(who) = array_bytes::hex_n_into::<_, AccountId, 20>("0xa4fFAC7A5Da311D724eD47393848f694Baee7930") { >::put(who); + + log::info!("successfully set RING staking contract"); } >::put(darwinia_staking::now::()); - // frame_support::weights::Weight::zero() - ::DbWeight::get().reads_writes(7, 107) + if let Some(k) = migration::take_storage_value::( + b"DarwiniaStaking", + b"KtonRewardDistributionContract", + &[], + ) { + >::put(k); + + log::info!("successfully set KTON staking contract"); + } + + if let Ok(k) = array_bytes::hex2bytes("0x1da53b775b270400e7e61ed5cbc5a146ab1160471b1418779239ba8e2b847e42d53de13b56da115d3342f0588bc3614108837de0ae21c270383d9f2de4db03c7b1314632314d8c74970d627c9b4f4c42e06688a9f7a2866905a810c4b1a49b8cb0dca3f1bc953905609869b6e9d4fb794cd36c5f") { + let _ = System::kill_storage(RuntimeOrigin::root(), vec![k]); + } + + ::DbWeight::get().reads_writes(7, 10) } diff --git a/runtime/darwinia/src/pallets/system.rs b/runtime/darwinia/src/pallets/system.rs index 7825ab56a..f00b1c9e5 100644 --- a/runtime/darwinia/src/pallets/system.rs +++ b/runtime/darwinia/src/pallets/system.rs @@ -25,11 +25,22 @@ frame_support::parameter_types! { pub const Version: sp_version::RuntimeVersion = VERSION; } +pub enum LockAndStake {} +impl frame_support::traits::Contains for LockAndStake { + fn contains(c: &RuntimeCall) -> bool { + matches!( + c, + RuntimeCall::DarwiniaStaking(darwinia_staking::Call::stake { .. }) + | RuntimeCall::Deposit(darwinia_deposit::Call::lock { .. }) + ) + } +} + #[derive_impl(frame_system::config_preludes::ParaChainDefaultConfig as frame_system::DefaultConfig)] impl frame_system::Config for Runtime { type AccountData = pallet_balances::AccountData; type AccountId = AccountId; - type BaseCallFilter = frame_support::traits::Everything; + type BaseCallFilter = frame_support::traits::EverythingBut; type Block = Block; type BlockLength = pallet_config::RuntimeBlockLength; type BlockWeights = pallet_config::RuntimeBlockWeights; diff --git a/runtime/koi/src/migration.rs b/runtime/koi/src/migration.rs index d6045cb0e..198778bb6 100644 --- a/runtime/koi/src/migration.rs +++ b/runtime/koi/src/migration.rs @@ -45,5 +45,5 @@ impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade { } fn migrate() -> frame_support::weights::Weight { - frame_support::weights::Weight::zero() + ::DbWeight::get().reads_writes(0, 0) }