Skip to content

Commit

Permalink
Correct l1 fee diff for create-destroy-create acc with the same addre…
Browse files Browse the repository at this point in the history
…ss (#236)
  • Loading branch information
kpp authored Mar 13, 2024
1 parent 80273cb commit 83a3cae
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions module-system/module-implementations/sov-evm/src/evm/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,14 @@ fn calc_diff_size<EXT, DB: Database>(
}
JournalEntry::AccountDestroyed { address, .. } => {
let account = account_changes.entry(address).or_default();
account.destroyed = true;
if account.created {
// That's a temporary account.
// Delete it from the account changes to enable cancun support.
// Acc with the same address can be created again in the same tx.
account_changes.remove(address);
} else {
account.destroyed = true;
}
}
_ => {}
}
Expand All @@ -125,11 +132,6 @@ fn calc_diff_size<EXT, DB: Database>(
let mut diff_size = 0usize;

for (addr, account) in account_changes {
if account.created && account.destroyed {
// ignore it because it's a temporary account
continue;
}

// Apply size of address of changed account
diff_size += size_of::<Address>();

Expand Down

0 comments on commit 83a3cae

Please sign in to comment.