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 journal order in sys_selfdestruct #1287

Merged
merged 2 commits into from
Oct 11, 2023
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
21 changes: 8 additions & 13 deletions evm/src/cpu/kernel/asm/core/terminate.asm
Original file line number Diff line number Diff line change
Expand Up @@ -92,25 +92,20 @@ global sys_selfdestruct:
%mstore_trie_data

%stack (balance, address, recipient, kexit_info) ->
(address, recipient, balance, address, recipient, recipient, balance, kexit_info)
%journal_add_account_destroyed
(address, recipient, address, recipient, balance, kexit_info)

// If the recipient is the same as the address, then we're done.
// Otherwise, send the balance to the recipient.
// stack: address, recipient, recipient, balance, kexit_info
EQ %jumpi(sys_selfdestruct_same_addr)
// stack: recipient, balance, kexit_info
// stack: address, recipient, address, recipient, balance, kexit_info
EQ %jumpi(sys_selfdestruct_journal_add)
%stack (address, recipient, balance, kexit_info) -> (recipient, balance, address, recipient, balance, kexit_info)
%add_eth

// stack: kexit_info
%leftover_gas
// stack: leftover_gas
PUSH 1 // success
%jump(terminate_common)
sys_selfdestruct_journal_add:
// stack: address, recipient, balance, kexit_info
%journal_add_account_destroyed

sys_selfdestruct_same_addr:
// stack: recipient, balance, kexit_info
%pop2
// stack: kexit_info
%leftover_gas
// stack: leftover_gas
PUSH 1 // success
Expand Down
Loading