Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(inspector): always call selfdestruct if entry is made #1746

Merged
merged 1 commit into from
Sep 4, 2024
Merged
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
29 changes: 19 additions & 10 deletions crates/revm/src/inspector/handler_register.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,25 @@ pub fn inspector_handle_register<DB: Database, EXT: GetInspector<DB>>(
// execute selfdestruct
prev(interpreter, host);
// check if selfdestruct was successful and if journal entry is made.
if let Some(JournalEntry::AccountDestroyed {
address,
target,
had_balance,
..
}) = host.evm.journaled_state.journal.last().unwrap().last()
{
host.external
.get_inspector()
.selfdestruct(*address, *target, *had_balance);
match host.evm.journaled_state.journal.last().unwrap().last() {
Some(JournalEntry::AccountDestroyed {
address,
target,
had_balance,
..
}) => {
host.external
.get_inspector()
.selfdestruct(*address, *target, *had_balance);
}
Some(JournalEntry::BalanceTransfer {
from, to, balance, ..
}) => {
host.external
.get_inspector()
.selfdestruct(*from, *to, *balance);
}
_ => {}
}
});

Expand Down
Loading