Skip to content

Commit b07e24b

Browse files
committed
Support using system storage directly for EVM balance and nonce (#6659)
1 parent f43cfc8 commit b07e24b

File tree

3 files changed

+193
-118
lines changed

3 files changed

+193
-118
lines changed

src/backend.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use frame_support::traits::Get;
99
use frame_support::storage::{StorageMap, StorageDoubleMap};
1010
use sha3::{Keccak256, Digest};
1111
use evm::backend::{Backend as BackendT, ApplyBackend, Apply};
12-
use crate::{Trait, Accounts, AccountStorages, AccountCodes, Module, Event};
12+
use crate::{Trait, AccountStorages, AccountCodes, Module, Event};
1313

1414
#[derive(Clone, Eq, PartialEq, Encode, Decode, Default)]
1515
#[cfg_attr(feature = "std", derive(Debug, Serialize, Deserialize))]
@@ -100,7 +100,7 @@ impl<'vicinity, T: Trait> BackendT for Backend<'vicinity, T> {
100100
}
101101

102102
fn basic(&self, address: H160) -> evm::backend::Basic {
103-
let account = Accounts::get(&address);
103+
let account = Module::<T>::account_basic(&address);
104104

105105
evm::backend::Basic {
106106
balance: account.balance,
@@ -141,9 +141,9 @@ impl<'vicinity, T: Trait> ApplyBackend for Backend<'vicinity, T> {
141141
Apply::Modify {
142142
address, basic, code, storage, reset_storage,
143143
} => {
144-
Accounts::mutate(&address, |account| {
145-
account.balance = basic.balance;
146-
account.nonce = basic.nonce;
144+
Module::<T>::mutate_account_basic(&address, Account {
145+
nonce: basic.nonce,
146+
balance: basic.balance,
147147
});
148148

149149
if let Some(code) = code {

0 commit comments

Comments
 (0)