Skip to content

Test Beacon Root Contract

Documentation for tests/cancun/eip4788_beacon_root/test_beacon_root_contract.py@206854b5.

Generate fixtures for these test cases for Prague with:

fill -v tests/cancun/eip4788_beacon_root/test_beacon_root_contract.py --fork Prague
Tests beacon block root for EIP-4788: Beacon block root in the EVM

Test the exposed beacon chain root in the EVM for EIP-4788: Beacon block root in the EVM

Adding a new test

Add a function that is named test_<test_name> and takes at least the following arguments:

  • state_test
  • env
  • pre
  • tx
  • post
  • valid_call

All other pytest.fixtures can be parametrized to generate new combinations and test cases.

Test Functions Overview

Name Type Cases (Prague) Description
test_beacon_root_contract_calls blockchain_test 10 Tests the beacon root contract call using various call contexts:(📖🐛?)
test_beacon_root_contract_timestamps blockchain_test 24 Tests the beacon root contract call across for various valid and invalid timestamps.
test_calldata_lengths blockchain_test 5 Tests the beacon root contract call using multiple invalid input lengths.
test_beacon_root_equal_to_timestamp blockchain_test 8 Tests the beacon root contract call where the beacon root is equal to the timestamp.
test_tx_to_beacon_root_contract blockchain_test 8 Tests the beacon root contract using a transaction with different types and data lengths.
test_invalid_beacon_root_calldata_value blockchain_test 1 Tests the beacon root contract call using invalid input values:(📖🐛?)
test_beacon_root_selfdestruct blockchain_test 1 Tests that self destructing the beacon root address transfers actors balance correctly.
test_multi_block_beacon_root_timestamp_calls blockchain_test 5 Tests multiple blocks where each block writes a timestamp to storage and contains one
test_beacon_root_transition blockchain_test 0 Tests the fork transition to cancun and verifies that blocks with timestamp lower than the
test_no_beacon_root_contract_at_transition blockchain_test 0 Tests the fork transition to cancun in the case where the beacon root pre-deploy was not
test_beacon_root_contract_deploy blockchain_test 0 Tests the fork transition to cancun deploying the contract during Shanghai and verifying the