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

Generate fixtures for these test cases for Osaka with:

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

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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
@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,
) -> None:
    """
    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