Skip to content

test_beacon_root_equal_to_timestamp()

Documentation for tests/cancun/eip4788_beacon_root/test_beacon_root_contract.py::test_beacon_root_equal_to_timestamp@verkle@v0.0.6.

Generate fixtures for these test cases for Cancun with:

Cancun only:

fill -v tests/cancun/eip4788_beacon_root/test_beacon_root_contract.py::test_beacon_root_equal_to_timestamp --fork=Cancun --evm-bin=/path/to/evm-tool-dev-version

For all forks up to and including Cancun:

fill -v tests/cancun/eip4788_beacon_root/test_beacon_root_contract.py::test_beacon_root_equal_to_timestamp --until=Cancun

Tests the beacon root contract call where the beacon root is equal to the timestamp.

The expected result is that the contract call will return the parent_beacon_block_root, as all timestamps used are valid.

Source code in tests/cancun/eip4788_beacon_root/test_beacon_root_contract.py
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
@pytest.mark.parametrize(
    "beacon_root, timestamp",
    [
        (12, 12),  # twelve
        (2**32, 2**32),  # arbitrary
        (2**64 - 2, 2**64 - 2),  # near-max
        (2**64 - 1, 2**64 - 1),  # max
    ],
    indirect=["beacon_root"],
)
@pytest.mark.parametrize("auto_access_list", [False, True])
@pytest.mark.valid_from("Cancun")
def test_beacon_root_equal_to_timestamp(
    blockchain_test: BlockchainTestFiller,
    beacon_root: bytes,
    timestamp: int,
    pre: Alloc,
    tx: Transaction,
    post: Dict,
):
    """
    Tests the beacon root contract call where the beacon root is equal to the timestamp.

    The expected result is that the contract call will return the `parent_beacon_block_root`,
    as all timestamps used are valid.
    """
    blockchain_test(
        pre=pre,
        blocks=[Block(txs=[tx], parent_beacon_block_root=beacon_root, timestamp=timestamp)],
        post=post,
    )

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 beacon_root auto_access_list timestamp
auto_access_list_False-beacon_root_12-timestamp_12 12 False 12
auto_access_list_False-beacon_root_4294967296-timestamp_4294967296 4294967296 False 4294967296
auto_access_list_False-beacon_root_18446744073709551614-timestamp_18446744073709551614 18446744073709551614 False 18446744073709551614
auto_access_list_False-beacon_root_18446744073709551615-timestamp_18446744073709551615 18446744073709551615 False 18446744073709551615
auto_access_list_True-beacon_root_12-timestamp_12 12 True 12
auto_access_list_True-beacon_root_4294967296-timestamp_4294967296 4294967296 True 4294967296
auto_access_list_True-beacon_root_18446744073709551614-timestamp_18446744073709551614 18446744073709551614 True 18446744073709551614
auto_access_list_True-beacon_root_18446744073709551615-timestamp_18446744073709551615 18446744073709551615 True 18446744073709551615