diff --git a/runtime/crab/Cargo.toml b/runtime/crab/Cargo.toml index 18112da41..2bee6be71 100644 --- a/runtime/crab/Cargo.toml +++ b/runtime/crab/Cargo.toml @@ -274,7 +274,8 @@ on-chain-release-build = [ runtime-benchmarks = [ # crates.io - # "array-bytes", + # TODO: optional + # "array-bytes # cumulus "cumulus-pallet-parachain-system/runtime-benchmarks", diff --git a/runtime/crab/src/migration.rs b/runtime/crab/src/migration.rs index 60e8bb20f..4392b3457 100644 --- a/runtime/crab/src/migration.rs +++ b/runtime/crab/src/migration.rs @@ -41,47 +41,33 @@ impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade { } fn migrate() -> frame_support::weights::Weight { - let items: &[(&[u8], &[&[u8]])] = &[ - (b"MessageGadget", &[b"CommitmentContract"]), - ( - b"EcdsaAuthority", - &[ - b"Authorities", - b"NextAuthorities", - b"Nonce", - b"AuthoritiesChangeToSign", - b"MessageRootToSign", - ], - ), - ( - b"Council", - &[b"Proposals", b"ProposalOf", b"Voting", b"ProposalCount", b"Members", b"Prime"], - ), - ( - b"Democracy", - &[ - b"PublicPropCount", - b"PublicProps", - b"DepositOf", - b"ReferendumCount", - b"LowestUnbaked", - b"ReferendumInfoOf", - b"VotingOf", - b"LastTabledWasExternal", - b"NextExternal", - b"Blacklist", - b"Cancellations", - b"MetadataOf", - ], - ), - ]; + // substrate + use pallet_balances::Locks; - let w = items.iter().fold(0, |w, (p, is)| { - w + is.iter().fold(0, |w, i| { - w + migration::clear_storage_prefix(p, i, &[], None, None).backend as u64 - }) + [ + ("0xd891ce6a97b4f01a8b9b36d0298aa3631fe2eef5", b"phrelect"), + ("0xabcf7060a68f62624f7569ada9d78b5a5db0782a", b"phrelect"), + ("0x88a39b052d477cfde47600a7c9950a441ce61cb4", b"phrelect"), + ("0x9f33a4809aa708d7a399fedba514e0a0d15efa85", b"phrelect"), + ("0x0a1287977578f888bdc1c7627781af1cc000e6ab", b"phrelect"), + ("0xe59261f6d4088bcd69985a3d369ff14cc54ef1e5", b"phrelect"), + ("0x7ae2a0914db8bfbdad538b0eac3fa473a0e07843", b"democrac"), + ("0xacfa39b864e42d1bd3792783a571d2958af0bf1f", b"democrac"), + ("0x3e25247cff03f99a7d83b28f207112234fee73a6", b"phrelect"), + ("0xb2960e11b253c107f973cd778bbe1520e35e8602", b"phrelect"), + ("0x4ed7ae57608cf4f60753cde4f49cf821c293ed2a", b"democrac"), + ("0x5b7544b3f6abd9e03fba494796b1ee6f9543e2e4", b"phrelect"), + ("0x44cda595218ddb3810fb66c2e982f50ea00255ee", b"phrelect"), + ] + .iter() + .for_each(|(acct, lid)| { + if let Ok(acct) = array_bytes::hex_n_into::<_, AccountId, 20>(acct) { + >::mutate(acct, |ls| { + ls.retain(|l| &l.id != *lid); + }); + } }); // frame_support::weights::Weight::zero() - ::DbWeight::get().reads_writes(0, w) + ::DbWeight::get().reads_writes(0, 26) } diff --git a/runtime/darwinia/Cargo.toml b/runtime/darwinia/Cargo.toml index 42497a5e3..4521d67b5 100644 --- a/runtime/darwinia/Cargo.toml +++ b/runtime/darwinia/Cargo.toml @@ -18,7 +18,8 @@ scale-info = { workspace = true } static_assertions = { workspace = true } strum = { workspace = true, features = ["derive"] } # crates.io optional -array-bytes = { workspace = true, optional = true } +# TODO: optional +array-bytes = { workspace = true } # cumulus cumulus-pallet-aura-ext = { workspace = true } @@ -117,21 +118,21 @@ pallet-transaction-payment = { workspace = true } pallet-transaction-payment-rpc-runtime-api = { workspace = true } pallet-treasury = { workspace = true } # pallet-tx-pause = { workspace = true } -pallet-utility = { workspace = true } -pallet-vesting = { workspace = true } -pallet-whitelist = { workspace = true } -sp-api = { workspace = true } -sp-block-builder = { workspace = true } -sp-consensus-aura = { workspace = true } -sp-core = { workspace = true } -sp-inherents = { workspace = true } -sp-offchain = { workspace = true } -sp-runtime = { workspace = true } -sp-session = { workspace = true } -sp-staking = { workspace = true } -sp-std = { workspace = true } -sp-transaction-pool = { workspace = true } -sp-version = { workspace = true } +pallet-utility = { workspace = true } +pallet-vesting = { workspace = true } +pallet-whitelist = { workspace = true } +sp-api = { workspace = true } +sp-block-builder = { workspace = true } +sp-consensus-aura = { workspace = true } +sp-core = { workspace = true } +sp-inherents = { workspace = true } +sp-offchain = { workspace = true } +sp-runtime = { workspace = true } +sp-session = { workspace = true } +sp-staking = { workspace = true } +sp-std = { workspace = true } +sp-transaction-pool = { workspace = true } +sp-version = { workspace = true } # substrate optional frame-benchmarking = { workspace = true, optional = true } frame-system-benchmarking = { workspace = true, optional = true } @@ -293,7 +294,8 @@ on-chain-release-build = [ runtime-benchmarks = [ # crates.io - "array-bytes", + # TODO: optional + # "array-bytes", # cumulus "cumulus-pallet-parachain-system/runtime-benchmarks", diff --git a/runtime/darwinia/src/migration.rs b/runtime/darwinia/src/migration.rs index 7d109d3ce..0ade34422 100644 --- a/runtime/darwinia/src/migration.rs +++ b/runtime/darwinia/src/migration.rs @@ -42,20 +42,27 @@ impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade { fn migrate() -> frame_support::weights::Weight { // substrate - use frame_support::pallet_prelude::StorageVersion; - use sp_core::H160; - use sp_std::str::FromStr; + use pallet_balances::Locks; - const REVERT_BYTECODE: [u8; 5] = [0x60, 0x00, 0x60, 0x00, 0xFD]; - // CONVICTION_VOTING_ADDRESS equals to the addr(1538) in the pallet-evm runtime. - const CONVICTION_VOTING_ADDRESS: &str = "0x0000000000000000000000000000000000000602"; - if let Ok(addr) = H160::from_str(CONVICTION_VOTING_ADDRESS) { - EVM::create_account(addr, REVERT_BYTECODE.to_vec()); - return RuntimeBlockWeights::get().max_block; - } - - StorageVersion::new(1).put::>(); + [ + ("0xabcf7060a68f62624f7569ada9d78b5a5db0782a", b"phrelect"), + ("0x88a39b052d477cfde47600a7c9950a441ce61cb4", b"phrelect"), + ("0x9f33a4809aa708d7a399fedba514e0a0d15efa85", b"phrelect"), + ("0x0a1287977578f888bdc1c7627781af1cc000e6ab", b"phrelect"), + ("0xe59261f6d4088bcd69985a3d369ff14cc54ef1e5", b"phrelect"), + ("0x7ae2a0914db8bfbdad538b0eac3fa473a0e07843", b"phrelect"), + ("0x3e25247cff03f99a7d83b28f207112234fee73a6", b"phrelect"), + ("0xb2960e11b253c107f973cd778bbe1520e35e8602", b"phrelect"), + ] + .iter() + .for_each(|(acct, lid)| { + if let Ok(acct) = array_bytes::hex_n_into::<_, AccountId, 20>(acct) { + >::mutate(acct, |ls| { + ls.retain(|l| &l.id != *lid); + }); + } + }); // frame_support::weights::Weight::zero() - ::DbWeight::get().reads_writes(0, 5) + ::DbWeight::get().reads_writes(0, 16) }