Skip to content

Commit

Permalink
run cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
JereSalo committed Nov 7, 2024
1 parent 169bfd9 commit 910f5af
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
5 changes: 4 additions & 1 deletion crates/vm/levm/src/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ impl Account {

/// New account with info and empty storage
pub fn new_with_info(info: AccountInfo) -> Self {
Self { info, storage: HashMap::new() }
Self {
info,
storage: HashMap::new(),
}
}

pub fn has_code(&self) -> bool {
Expand Down
15 changes: 12 additions & 3 deletions crates/vm/levm/src/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,25 @@ impl VM {

// Add sender, coinbase and recipient (in the case of a Call) to cache [https://www.evm.codes/about#access_list]
let sender_account_info = db.get_account_info(env.origin);
cache.add_account(&env.origin, &Account::new_with_info(sender_account_info.clone()));
cache.add_account(
&env.origin,
&Account::new_with_info(sender_account_info.clone()),
);

let coinbase_account_info = db.get_account_info(env.coinbase);
cache.add_account(&env.coinbase, &Account::new_with_info(coinbase_account_info));
cache.add_account(
&env.coinbase,
&Account::new_with_info(coinbase_account_info),
);

match to {
TxKind::Call(address_to) => {
// add address_to to cache
let recipient_account_info = db.get_account_info(address_to);
cache.add_account(&address_to, &Account::new_with_info(recipient_account_info.clone()));
cache.add_account(
&address_to,
&Account::new_with_info(recipient_account_info.clone()),
);

// CALL tx
let initial_call_frame = CallFrame::new(
Expand Down

0 comments on commit 910f5af

Please sign in to comment.