test_dupn_empty_stack()
Documentation for tests/amsterdam/eip8024_dupn_swapn_exchange/test_dupn.py::test_dupn_empty_stack@ffe48572.
Generate fixtures for these test cases for Bogota with:
fill -v tests/amsterdam/eip8024_dupn_swapn_exchange/test_dupn.py::test_dupn_empty_stack --fork Bogota
Test DUPN on an empty stack aborts with a stack underflow.
Source code in tests/amsterdam/eip8024_dupn_swapn_exchange/test_dupn.py
| @EIPChecklist.Opcode.Test.StackComplexOperations.StackHeights.Zero()
@EIPChecklist.Opcode.Test.StackUnderflow()
def test_dupn_empty_stack(
pre: Alloc,
state_test: StateTestFiller,
) -> None:
"""
Test DUPN on an empty stack aborts with a stack underflow.
"""
sender = pre.fund_eoa()
code = Op.SSTORE(0, 1) # leaves the stack empty
code += Op.DUPN[Spec.MIN_STACK_INDEX]
code += Op.STOP
contract_address = pre.deploy_contract(code=code)
tx = Transaction(to=contract_address, sender=sender)
# Transaction should fail, contract storage unchanged.
post = {contract_address: Account(storage={0: 0})}
state_test(pre=pre, post=post, tx=tx)
|
Parametrized Test Cases
This test generates 1 parametrized test case across 2 forks.