diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index bec034909..121f80868 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -179,7 +179,7 @@ jobs: cd tool/state-processor mkdir -p data cd data - curl -L https://github.com/darwinia-network/darwinia-2.0/releases/download/crab2/crab-state.tar.zst | tar x -I pzstd + curl -L https://github.com/darwinia-network/darwinia/releases/download/crab2/crab-state.tar.zst | tar x -I pzstd cd .. - name: Check state run: | diff --git a/pallet/account-migration/src/lib.rs b/pallet/account-migration/src/lib.rs index 3e56a0bc9..8ec8b0389 100644 --- a/pallet/account-migration/src/lib.rs +++ b/pallet/account-migration/src/lib.rs @@ -56,7 +56,7 @@ use frame_support::{ }; use frame_system::{pallet_prelude::*, AccountInfo, RawOrigin}; use pallet_balances::AccountData; -use pallet_identity::Registration; +use pallet_identity::{Judgement, Registration}; use pallet_vesting::VestingInfo; use sp_core::sr25519::{Public, Signature}; use sp_io::hashing; @@ -361,9 +361,12 @@ pub mod pallet { } fn migrate_inner(from: AccountId32, to: AccountId20) -> DispatchResult { - let account = >::take(&from) + let mut account = >::take(&from) .expect("[pallet::account-migration] already checked in `pre_dispatch`; qed"); + account.data.free += account.data.reserved; + account.data.reserved = 0; + >::insert(to, account); if let Some(a) = >::take(&from) { @@ -411,7 +414,14 @@ pub mod pallet { // https://github.dev/paritytech/substrate/blob/19162e43be45817b44c7d48e50d03f074f60fbf4/frame/vesting/src/lib.rs#L86 >::set_lock(*b"vesting ", &to, locked, reasons); } - if let Some(i) = >::take(&from) { + if let Some(mut i) = >::take(&from) { + i.deposit = 0; + i.judgements.iter_mut().for_each(|(_, j)| { + if let Judgement::FeePaid(f) = j { + *f = 0; + }; + }); + migration::put_storage_value( b"Identity", b"IdentityOf", diff --git a/runtime/common/src/test.rs b/runtime/common/src/test.rs index afa5fd86a..e117b29cb 100644 --- a/runtime/common/src/test.rs +++ b/runtime/common/src/test.rs @@ -384,9 +384,9 @@ macro_rules! impl_account_migration_tests { }, ); - assert_ok!(migrate(from, to,)); + assert_ok!(migrate(from, to)); assert_eq!(Identity::identity(to).unwrap().info, info); - assert_eq!(Identity::identity(to).unwrap().deposit, RING_AMOUNT); + assert_eq!(Identity::identity(to).unwrap().deposit, 0); assert_eq!(Identity::identity(to).unwrap().judgements.len(), 0); }); } diff --git a/runtime/crab/src/pallets/evm.rs b/runtime/crab/src/pallets/evm.rs index 2e28a9ff1..950984e3b 100644 --- a/runtime/crab/src/pallets/evm.rs +++ b/runtime/crab/src/pallets/evm.rs @@ -49,7 +49,7 @@ where Self(Default::default()) } - pub fn used_addresses() -> [sp_core::H160; 15] { + pub fn used_addresses() -> [sp_core::H160; 14] { [ addr(1), addr(2), @@ -66,7 +66,7 @@ where addr(1026), addr(1536), addr(1537), - addr(2048), + // addr(2048), ] } } @@ -118,8 +118,8 @@ where a if a == addr(1537) => Some(>::execute(handle)), // [2048..) reserved for the experimental precompiles. - a if a == addr(2048) => - Some(>::execute(handle)), + // a if a == addr(2048) => + // Some(>::execute(handle)), _ => None, } } diff --git a/runtime/darwinia/src/pallets/evm.rs b/runtime/darwinia/src/pallets/evm.rs index 49ba628dd..258dde402 100644 --- a/runtime/darwinia/src/pallets/evm.rs +++ b/runtime/darwinia/src/pallets/evm.rs @@ -49,7 +49,7 @@ where Self(Default::default()) } - pub fn used_addresses() -> [sp_core::H160; 15] { + pub fn used_addresses() -> [sp_core::H160; 14] { [ addr(1), addr(2), @@ -66,7 +66,7 @@ where addr(1026), addr(1536), addr(1537), - addr(2048), + // addr(2048), ] } } @@ -118,8 +118,8 @@ where a if a == addr(1537) => Some(>::execute(handle)), // [2048..) reserved for the experimental precompiles. - a if a == addr(2048) => - Some(>::execute(handle)), + // a if a == addr(2048) => + // Some(>::execute(handle)), _ => None, } } diff --git a/tool/state-processor/src/tests.rs b/tool/state-processor/src/tests.rs index c8d166318..10a0031b7 100644 --- a/tool/state-processor/src/tests.rs +++ b/tool/state-processor/src/tests.rs @@ -33,7 +33,7 @@ impl Tester { let mut solo_state = State::from_file("data/crab-solo.json").unwrap(); let mut para_state = State::from_file("data/crab-para.json").unwrap(); - let mut shell_state = State::from_file("data/crab-processed.json").unwrap(); + let mut shell_state = State::from_file("data/crab-processed-test.json").unwrap(); // solo chain let mut solo_accounts = >::default(); @@ -181,7 +181,8 @@ fn solo_chain_substrate_account() { assert_eq!(m_account.consumers, 2); assert_eq!(m_account.providers, 1); assert_eq!(m_account.sufficients, 1); - assert_eq!(m_account.data.free, solo_account.data.free * GWEI); + // 30_976_316_716_418_406_400 is the unclaimed staking reward + assert_eq!(m_account.data.free, solo_account.data.free * GWEI + 30_976_316_716_418_406_400); assert_eq!(m_account.data.free_kton_or_misc_frozen, 0); // the kton part moved to the asset pallet let asset_account = tester.migration_kton_accounts.get(addr).unwrap(); @@ -319,7 +320,7 @@ fn ring_total_issuance() { ); assert_eq!( - migrated_total_issuance - 155_223_151_710_u128, + migrated_total_issuance - 161_223_151_710_u128, solo_issuance * GWEI + para_issuance ); }); @@ -349,8 +350,7 @@ fn kton_total_issuance() { &blake2_128_concat_to_string(KTON_ID.encode()), &mut details, ); - - assert_eq!(details.supply - 4_999_999_999_u128, total_issuance * GWEI); + assert_eq!(details.supply - 5_999_999_999_u128, total_issuance * GWEI); }); } @@ -730,7 +730,17 @@ fn stake_ledgers_values() { &blake2_128_concat_to_string(addr.encode()), &mut m_ledger, ); - assert_eq!(m_ledger.staked_ring, ledger.active * GWEI); + + let mut m_deposits: Vec = Vec::new(); + tester.shell_state.get_value( + b"AccountMigration", + b"Deposits", + &blake2_128_concat_to_string(addr.encode()), + &mut m_deposits, + ); + + assert_eq!(ledger.active * GWEI, m_deposits.iter().map(|d| d.value).sum()); + assert_eq!(m_ledger.staked_ring, 0); assert_eq!(m_ledger.staked_kton, ledger.active_kton * GWEI); }); }