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@0f7c73a7.

Generate fixtures for these test cases for Prague with:

fill -v tests/cancun/eip4788_beacon_root/test_beacon_root_contract.py::test_beacon_root_equal_to_timestamp --fork Prague

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
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
@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.

Test ID (Abbreviated) auto_access_list beacon_root timestamp
...fork_Cancun-blockchain_test-auto_access_list_False-beacon_root_12-timestamp_12 False 12 12
...fork_Cancun-blockchain_test-auto_access_list_False-beacon_root_4294967296-timestamp_4294967296 False 4294967296 4294967296
...fork_Cancun-blockchain_test-auto_access_list_False-beacon_root_18446744073709551614-timestamp_18446744073709551614 False 18446744073709551614 18446744073709551614
...fork_Cancun-blockchain_test-auto_access_list_False-beacon_root_18446744073709551615-timestamp_18446744073709551615 False 18446744073709551615 18446744073709551615
...fork_Cancun-blockchain_test-auto_access_list_True-beacon_root_12-timestamp_12 True 12 12
...fork_Cancun-blockchain_test-auto_access_list_True-beacon_root_4294967296-timestamp_4294967296 True 4294967296 4294967296
...fork_Cancun-blockchain_test-auto_access_list_True-beacon_root_18446744073709551614-timestamp_18446744073709551614 True 18446744073709551614 18446744073709551614
...fork_Cancun-blockchain_test-auto_access_list_True-beacon_root_18446744073709551615-timestamp_18446744073709551615 True 18446744073709551615 18446744073709551615
...fork_Prague-blockchain_test-auto_access_list_False-beacon_root_12-timestamp_12 False 12 12
...fork_Prague-blockchain_test-auto_access_list_False-beacon_root_4294967296-timestamp_4294967296 False 4294967296 4294967296
...fork_Prague-blockchain_test-auto_access_list_False-beacon_root_18446744073709551614-timestamp_18446744073709551614 False 18446744073709551614 18446744073709551614
...fork_Prague-blockchain_test-auto_access_list_False-beacon_root_18446744073709551615-timestamp_18446744073709551615 False 18446744073709551615 18446744073709551615
...fork_Prague-blockchain_test-auto_access_list_True-beacon_root_12-timestamp_12 True 12 12
...fork_Prague-blockchain_test-auto_access_list_True-beacon_root_4294967296-timestamp_4294967296 True 4294967296 4294967296
...fork_Prague-blockchain_test-auto_access_list_True-beacon_root_18446744073709551614-timestamp_18446744073709551614 True 18446744073709551614 18446744073709551614
...fork_Prague-blockchain_test-auto_access_list_True-beacon_root_18446744073709551615-timestamp_18446744073709551615 True 18446744073709551615 18446744073709551615
...fork_Osaka-blockchain_test-auto_access_list_False-beacon_root_12-timestamp_12 False 12 12
...fork_Osaka-blockchain_test-auto_access_list_False-beacon_root_4294967296-timestamp_4294967296 False 4294967296 4294967296
...fork_Osaka-blockchain_test-auto_access_list_False-beacon_root_18446744073709551614-timestamp_18446744073709551614 False 18446744073709551614 18446744073709551614
...fork_Osaka-blockchain_test-auto_access_list_False-beacon_root_18446744073709551615-timestamp_18446744073709551615 False 18446744073709551615 18446744073709551615
...fork_Osaka-blockchain_test-auto_access_list_True-beacon_root_12-timestamp_12 True 12 12
...fork_Osaka-blockchain_test-auto_access_list_True-beacon_root_4294967296-timestamp_4294967296 True 4294967296 4294967296
...fork_Osaka-blockchain_test-auto_access_list_True-beacon_root_18446744073709551614-timestamp_18446744073709551614 True 18446744073709551614 18446744073709551614
...fork_Osaka-blockchain_test-auto_access_list_True-beacon_root_18446744073709551615-timestamp_18446744073709551615 True 18446744073709551615 18446744073709551615