Skip to content

Test Endofcode Underflow

Documentation for tests/amsterdam/eip8024_dupn_swapn_exchange/test_endofcode_underflow.py@b314d18e.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/amsterdam/eip8024_dupn_swapn_exchange/test_endofcode_underflow.py --fork Amsterdam

EIP-8024 end-of-code stack underflow regression tests.

When DUPN/SWAPN/EXCHANGE is the last byte of code, the missing immediate byte decodes to 0 per EIP-8024, and the opcode must still execute with that zero-decoded immediate. When the stack is short of the resulting required depth, execution must halt with stack underflow — clients must not treat the missing immediate as a graceful STOP.

See: - EIP-8024: https://eips.ethereum.org/EIPS/eip-8024 - Bounty: ethereum-bounty/nethermind#12 - Fix: NethermindEth/nethermind#11178

Test Functions Overview

Name Type Cases (Amsterdam) Description
test_end_of_code_stack_underflow state_test 3 Test EIP-8024 opcodes at end of code with one fewer stack item than