Skip to content

test_slotnum_genesis()

Documentation for tests/amsterdam/eip7843_slotnum/test_slotnum.py::test_slotnum_genesis@ffe48572.

Generate fixtures for these test cases for Bogota with:

fill -v tests/amsterdam/eip7843_slotnum/test_slotnum.py::test_slotnum_genesis --fork Bogota

Test that the slot number header field can be set at genesis.

The genesis header of this fixture carries a nonzero slot_number, so a client must decode the field to reproduce the genesis hash. The following block then exposes its own slot number via SLOTNUM.

Source code in tests/amsterdam/eip7843_slotnum/test_slotnum.py
@EIPChecklist.BlockHeaderField.Test.Genesis()
def test_slotnum_genesis(
    blockchain_test: BlockchainTestFiller,
    pre: Alloc,
) -> None:
    """
    Test that the slot number header field can be set at genesis.

    The genesis header of this fixture carries a nonzero `slot_number`,
    so a client must decode the field to reproduce the genesis hash.
    The following block then exposes its own slot number via SLOTNUM.
    """
    genesis_slot = 999
    block_slot = 1000

    contract = pre.deploy_contract(
        Op.SSTORE(0, Op.SLOTNUM), storage={0: 0xBA5E}
    )
    tx = Transaction(sender=pre.fund_eoa(), to=contract)

    blockchain_test(
        genesis_environment=Environment(slot_number=genesis_slot),
        pre=pre,
        blocks=[Block(slot_number=block_slot, txs=[tx])],
        post={contract: Account(storage={0: block_slot})},
    )

Parametrized Test Cases

This test generates 1 parametrized test case across 2 forks.