Skip to content

Test DUPN

Documentation for tests/amsterdam/eip8024_dupn_swapn_exchange/test_dupn.py@tests-bal@v5.7.0.

Generate fixtures for these test cases for Amsterdam with:

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

DUPN instruction tests.

Tests for DUPN instruction in EIP-8024: Stack Access Instructions.

Test Functions Overview

Name Type Cases (Amsterdam) Description
test_dupn_basic state_test 8 Test DUPN with various stack indices (17-235).
test_dupn_invalid_immediate_aborts state_test 37 Test DUPN with invalid immediate values (90 < x < 128) aborts execution.
test_dupn_jump_to_immediate_byte_0x5b_succeeds state_test 1 Test that jumping to 0x5b after DUPN succeeds (backward compatibility).
test_dupn_jump_to_valid_immediate_fails state_test 1 Test jumping to a valid immediate byte fails.
test_dupn_stack_underflow state_test 6 Test DUPN causes transaction failure on stack underflow.
test_dupn_valid_immediates state_test 6 Test DUPN with valid immediate values (0-90 and 128-255).
test_dupn_with_dup1_sequence state_test 1 Test DUPN duplicating the bottom item after building stack with DUP1.
test_endofcode_behavior state_test 1 Test DUPN when the immediate byte is beyond the end of code.