Skip to content

test_all_unreachable_terminating_opcodes_after_stop()

Documentation for tests/prague/eip7692_eof_v1/eip3540_eof_v1/test_all_opcodes_in_container.py::test_all_unreachable_terminating_opcodes_after_stop@verkle@v0.0.6.

Generate fixtures for these test cases for Pragueeip7692 with:

Pragueeip7692 only:

fill -v tests/prague/eip7692_eof_v1/eip3540_eof_v1/test_all_opcodes_in_container.py::test_all_unreachable_terminating_opcodes_after_stop --fork=PragueEIP7692 --evm-bin=/path/to/evm-tool-dev-version

For all forks up to and including Pragueeip7692:

fill -v tests/prague/eip7692_eof_v1/eip3540_eof_v1/test_all_opcodes_in_container.py::test_all_unreachable_terminating_opcodes_after_stop --until=PragueEIP7692

Test all terminating opcodes after stop.

Source code in tests/prague/eip7692_eof_v1/eip3540_eof_v1/test_all_opcodes_in_container.py
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
@pytest.mark.parametrize(
    "opcode",
    sorted(halting_opcodes | section_terminating_opcodes),
)
def test_all_unreachable_terminating_opcodes_after_stop(
    eof_test: EOFTestFiller,
    opcode: Opcode,
):
    """
    Test all terminating opcodes after stop.
    """
    match opcode:
        case Op.STOP:
            sections = [Section.Code(code=Op.STOP + Op.STOP)]
        case Op.RETF:
            sections = [
                Section.Code(code=Op.CALLF[1] + Op.STOP),
                Section.Code(code=Op.STOP + Op.RETF, code_outputs=0),
            ]
        case Op.JUMPF:
            sections = [
                Section.Code(code=Op.STOP + Op.JUMPF[1]),
                Section.Code(code=Op.STOP),
            ]
        case Op.RETURNCONTRACT:
            sections = [
                Section.Code(code=Op.EOFCREATE[0](0, 0, 0, 0) + Op.STOP),
                Section.Container(
                    container=Container(
                        sections=[
                            Section.Code(code=Op.STOP + Op.RETURNCONTRACT[0](0, 0)),
                            Section.Container(Container.Code(code=Op.STOP)),
                        ]
                    )
                ),
            ]
        case Op.RETURN | Op.REVERT | Op.INVALID:
            sections = [
                Section.Code(code=Op.PUSH0 + Op.PUSH0 + Op.STOP + opcode),
            ]
        case _:
            raise NotImplementedError(f"Opcode {opcode} is not implemented")

    eof_test(
        data=Container(
            sections=sections,
        ),
        expect_exception=EOFException.UNREACHABLE_INSTRUCTIONS
        if opcode != Op.RETURNCONTRACT
        else EOFException.INCOMPATIBLE_CONTAINER_KIND,
    )

Parametrized Test Cases

The interactive table below is also available as a standalone page.

Skipped Parameters

For more concise readability, the table below does not list the following parameter values: fork, blockchain_test, state_test, state_test_only, eof_test, eof_state_test.

Test ID opcode
opcode_STOP STOP
opcode_RETF RETF
opcode_JUMPF JUMPF
opcode_RETURNCONTRACT RETURNCONTRACT
opcode_RETURN RETURN
opcode_REVERT REVERT
opcode_INVALID INVALID