diff --git a/frame/evm-system/src/lib.rs b/frame/evm-system/src/lib.rs index 9e72b2f720..577bb3cc52 100644 --- a/frame/evm-system/src/lib.rs +++ b/frame/evm-system/src/lib.rs @@ -96,7 +96,7 @@ pub mod pallet { /// The full account information for a particular account ID. #[pallet::storage] #[pallet::getter(fn full_account)] - pub type FullAccount = StorageMap< + pub type Account = StorageMap< _, Blake2_128Concat, ::AccountId, @@ -125,7 +125,7 @@ pub mod pallet { impl Pallet { /// Check the account existence. pub fn account_exists(who: &::AccountId) -> bool { - FullAccount::::contains_key(who) + Account::::contains_key(who) } /// An account is being created. @@ -142,12 +142,12 @@ impl Pallet { /// Retrieve the account transaction counter from storage. pub fn account_nonce(who: &::AccountId) -> ::Index { - FullAccount::::get(who).nonce + Account::::get(who).nonce } /// Increment a particular account's nonce by 1. pub fn inc_account_nonce(who: &::AccountId) { - FullAccount::::mutate(who, |a| a.nonce += ::Index::one()); + Account::::mutate(who, |a| a.nonce += ::Index::one()); } /// Create an account. @@ -156,7 +156,7 @@ impl Pallet { return Err(Error::::AccountAlreadyExist.into()); } - FullAccount::::insert(who.clone(), AccountInfo::<_, _>::default()); + Account::::insert(who.clone(), AccountInfo::<_, _>::default()); Self::on_created_account(who.clone()); Ok(()) } @@ -167,7 +167,7 @@ impl Pallet { return Err(Error::::AccountNotExist.into()); } - FullAccount::::remove(who); + Account::::remove(who); Self::on_killed_account(who.clone()); Ok(()) } @@ -175,7 +175,7 @@ impl Pallet { impl StoredMap<::AccountId, ::AccountData> for Pallet { fn get(k: &::AccountId) -> ::AccountData { - FullAccount::::get(k).data + Account::::get(k).data } fn try_mutate_exists>( @@ -183,13 +183,13 @@ impl StoredMap<::AccountId, ::AccountData> f: impl FnOnce(&mut Option<::AccountData>) -> Result, ) -> Result { let mut maybe_account_data = if Self::account_exists(k) { - Some(FullAccount::::get(k).data) + Some(Account::::get(k).data) } else { None }; let r = f(&mut maybe_account_data)?; if let Some(account_data) = maybe_account_data { - FullAccount::::mutate(k, |a| a.data = account_data); + Account::::mutate(k, |a| a.data = account_data); } Ok(r) } diff --git a/frame/evm-system/src/tests.rs b/frame/evm-system/src/tests.rs index 71703ceca6..978ddad7a4 100644 --- a/frame/evm-system/src/tests.rs +++ b/frame/evm-system/src/tests.rs @@ -49,7 +49,7 @@ fn create_account_fails() { new_test_ext().execute_with(|| { // Prepare test data. let account_id = H160::from_str("1000000000000000000000000000000000000001").unwrap(); - >::insert(account_id.clone(), AccountInfo::<_, _>::default()); + >::insert(account_id.clone(), AccountInfo::<_, _>::default()); // Invoke the function under test. assert_noop!( @@ -65,7 +65,7 @@ fn remove_account_works() { new_test_ext().execute_with(|| { // Prepare test data. let account_id = H160::from_str("1000000000000000000000000000000000000001").unwrap(); - >::insert(account_id.clone(), AccountInfo::<_, _>::default()); + >::insert(account_id.clone(), AccountInfo::<_, _>::default()); // Set block number to enable events. System::set_block_number(1);