Skip to content

Commit 915c089

Browse files
yperbasischfast
authored andcommitted
Implement EIP-2929 for SELFDESTRUCT
1 parent 23468f8 commit 915c089

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/evmone/instructions.hpp

+6
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,12 @@ inline evmc_status_code selfdestruct(ExecutionState& state) noexcept
725725

726726
const auto beneficiary = intx::be::trunc<evmc::address>(state.stack[0]);
727727

728+
if (state.rev >= EVMC_BERLIN && state.host.access_account(beneficiary) == EVMC_ACCESS_COLD)
729+
{
730+
if ((state.gas_left -= instr::cold_account_access_cost) < 0)
731+
return EVMC_OUT_OF_GAS;
732+
}
733+
728734
if (state.rev >= EVMC_TANGERINE_WHISTLE)
729735
{
730736
if (state.rev == EVMC_TANGERINE_WHISTLE || state.host.get_balance(state.msg->destination))

0 commit comments

Comments
 (0)