Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

question: beacon hash = 0x00..00 is implicit #413

Closed
winsvega opened this issue Jan 30, 2024 · 1 comment
Closed

question: beacon hash = 0x00..00 is implicit #413

winsvega opened this issue Jan 30, 2024 · 1 comment

Comments

@winsvega
Copy link
Contributor

so here for example

(berlin/eip2930_access_list/tests/tmp/tmptest_dc4ff734_064d_4323_bc0d_e257063e1d8a/test_acl.py::test_access_list[fork_Cancun-state_test], fork: Cancun, TrInfo: d: 0, g: 0, v: 0, TrData: ` 0x..`

this test is being generated for Cancun, but because the env now does not have beaconRoot field, it is implicitly assumed that the hash is 0x000000...00
and the pre state does not have beacon account record to indicate it. or rather the record is omited, because it is 0x00000

this makes the hash value kind of implicit.

@winsvega winsvega changed the title suggestion: beacon hash = 0x00..00 is implicit question: beacon hash = 0x00..00 is implicit Jan 30, 2024
@marioevz
Copy link
Member

Parent Beacon Root is not part of the state tests, because this is a block behavior, it happens at the start of the block, and the purpose of the state test is to evaluate a single tx state transition.

In tests where they are written with a beacon root contract interaction in mind, the env still does not have any reference to the beacon root, and the beacon root storage in the pre is already filled with the information:

{
    "tests/cancun/eip4788_beacon_root/test_beacon_root_contract.py::test_calldata_lengths[fork_Cancun-state_test-timestamp_12-valid_call_False-valid_input_False-1024_bytes]": {
        "_info": {
            "comment": "`execution-spec-tests` generated test",
            "filling-transition-tool": "evm version 1.13.9-unstable-0b471c31",
            "reference-spec": "https://github.com/ethereum/EIPs/blob/master/EIPS/eip-4788.md",
            "reference-spec-version": "e7608fe8ac8a60934ca874f5aab7d5c1f4ff7782"
        },
        "env": {
            "currentCoinbase": "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
            "currentGasLimit": "0x016345785d8a0000",
            "currentNumber": "0x01",
            "currentTimestamp": "0x0c",
            "currentRandom": "0x0000000000000000000000000000000000000000000000000000000000000000",
            "currentDifficulty": "0x00",
            "currentBaseFee": "0x07",
            "currentExcessBlobGas": "0x00"
        },
        "pre": {
            "0x000f3df6d732807ef1319fb7b8bb8522d0beac02": {
                "nonce": "0x01",
                "balance": "0x00",
                "code": "0x3373fffffffffffffffffffffffffffffffffffffffe14604d57602036146024575f5ffd5b5f35801560495762001fff810690815414603c575f5ffd5b62001fff01545f5260205ff35b5f5ffd5b62001fff42064281555f359062001fff015500",
                "storage": {
                    "0x0c": "0x0c",   <= This part
                    "0x200b": "0x6c31fc15422ebad28aaf9089c306702f67540b53c7eea8b7d2941044b027100f"   <= And this part
                }
            },

If you really want to, you can parse this storage, it will always have the correct info:
0x0c is equal to currentTimestamp, and the parent beacon root, 0x6c31fc15422ebad28aaf9089c306702f67540b53c7eea8b7d2941044b027100f in this case, is at 0x0c + 0x1fff, where 0x1fff is the HISTORY_BUFFER_LENGTH constant in the EIP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants