Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions crates/state/src/bal/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ impl AccountBal {
/// Consumes AccountBal and converts it into [`AlloyAccountChanges`].
#[inline]
pub fn into_alloy_account(self, address: Address) -> AlloyAccountChanges {
let mut storage_reads = Vec::new();
let mut storage_changes = Vec::new();
let storage_len = self.storage.storage.len();
let mut storage_reads = Vec::with_capacity(storage_len);
let mut storage_changes = Vec::with_capacity(storage_len);
for (key, value) in self.storage.storage {
if value.writes.is_empty() {
storage_reads.push(key);
Expand Down Expand Up @@ -180,12 +181,14 @@ impl AccountInfoBal {
self.nonce.update(index, &original.nonce, present.nonce);
self.balance
.update(index, &original.balance, present.balance);
self.code.update_with_key(
index,
&original.code_hash,
(present.code_hash, present.code.clone().unwrap_or_default()),
|i| &i.0,
);
if original.code_hash != present.code_hash {
self.code.update_with_key(
index,
&original.code_hash,
(present.code_hash, present.code.clone().unwrap_or_default()),
|i| &i.0,
);
}
}

/// Extend account info from another account info.
Expand Down
2 changes: 1 addition & 1 deletion crates/state/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub struct Account {
pub info: AccountInfo,
/// Original account info used by BAL, changed only on cold load by BAL.
pub original_info: Box<AccountInfo>,
/// Transaction id, used to track when account was toched/loaded into journal.
/// Transaction id, used to track when account was touched/loaded into journal.
pub transaction_id: usize,
/// Storage cache
pub storage: EvmStorage,
Expand Down
Loading