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 revert account destroyed with nonexistent target #1282

Closed
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
20 changes: 15 additions & 5 deletions evm/src/cpu/kernel/asm/journal/account_destroyed.asm
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,26 @@ revert_account_destroyed_contd:
// Remove `prev_balance` from `target`'s balance.
// stack: target, address, prev_balance, retdest
%mpt_read_state_trie
%add_const(1)
// Only remove `prev_balance` if `target` exists.
// stack: target_balance_ptr, address, prev_balance, retdest
DUP3
DUP2 %mload_trie_data
// stack: target_balance, prev_balance, target_balance_ptr, address, prev_balance, retdest
SUB SWAP1 %mstore_trie_data
DUP1 ISZERO ISZERO %jumpi(remove_target_balance)
recreate_account:
// Undo the account destruction.
// stack: target_balance_ptr, address, prev_balance, retdest
POP
// Set `address`'s balance to `prev_balance`.
// stack: address, prev_balance, retdest
%mpt_read_state_trie
%add_const(1)
%mstore_trie_data
JUMP

remove_target_balance:
%add_const(1)
// stack: target_balance_ptr, address, prev_balance, retdest
DUP3
DUP2 %mload_trie_data
// stack: target_balance, prev_balance, target_balance_ptr, address, prev_balance, retdest
SUB DUP2 %mstore_trie_data
// stack: target_balance_ptr, address, prev_balance, retdest
%jump(recreate_account)
Loading