Coder Social home page Coder Social logo

Comments (1)

marioevz avatar marioevz commented on September 6, 2024

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.

from execution-spec-tests.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.