Skip to content

Commit

Permalink
Check gas in sys_stop (0xPolygonZero#1297)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nashtare authored Oct 19, 2023
1 parent 817e3e7 commit 49976ea
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions evm/src/cpu/kernel/asm/core/terminate.asm
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ global sys_stop:
// Set the parent context's return data size to 0.
%mstore_parent_context_metadata(@CTX_METADATA_RETURNDATA_SIZE, 0)

// This makes sure the gas used hasn't overflowed the gaslimit.
// This could happen when executing a native instruction (i.e. not a syscall).
%charge_gas_const(0)

%leftover_gas
// stack: leftover_gas
PUSH 1 // success
Expand Down

0 comments on commit 49976ea

Please sign in to comment.