Skip to content

Allow static tests to have dynamic addresses in pre #1750

@marioevz

Description

@marioevz
  • Static tests are here: https://github.com/ethereum/execution-spec-tests/tree/main/tests/static, there are fillers in yaml and also in json (older tests)
  • Issue is that these tests don't play well with the rest of the tests because they reuse almost always the same addresses, or deploy to addresses that are impossible to deploy on live networks, or some combination of these two.
  • pre is what we want to change in most fillers, and looks mostly like this in almost all tests:
    "pre": {
    "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b": {
    "balance": "0x38beec8feeca2598",
    "code": "",
    "nonce": "0x00",
    "storage": {}
    },
    "0xb94f5374fce5edbc8e2a8697c15331677e6ebf0b": {
    "balance": "0",
    "code": "{ [[1]] (STATICCALL 70000 (CALLDATALOAD 0) 0 0 0 0) }",
    "nonce": "0x3f",
    "storage": {
    "0x01" : "0x01"
    }
    },
    "0xc94f5374fce5edbc8e2a8697c15331677e6ebf0b": {
    "balance": "0",
    "//comment" : "Create fails due to insufficient founds",
    "code": "{ (MSTORE 1 1) [[2]] (CREATE 1 1 1) }",
    "nonce": "0x3f",
    "storage": {}
    },
    "0xd94f5374fce5edbc8e2a8697c15331677e6ebf0b": {
    "balance": "0",
    "//comment" : "Create fails due to wrong stack",
    "code": ":raw 0x60006000f0",
    "nonce": "0x3f",
    "storage": {}
    }
    },
  • Idea is to change all keys in that structure to tags that can be used in other fields in order for the static test filler to assign addresses during the fill process.
  • There are mostly only two types of accounts: EOAs and contracts.
  • We could separate the tags for each type as:
    • EOAs: "eoa_1", "eoa_2", ...
    • Contracts: Any other string
  • Places where the tags could appear (not exhaustive):
    • Other contract source code
    • tx.to
    • expect.result
    • contract data, abi
  • If a test is doing something more complex than this, e.g. introduces a circular dependency (e.g. "contract_1" has tag "contract_2" inside of its source code, and "contract_2" has tag "contract_1" inside of its source code), or is referencing a contract that is created during the tests, it might be worth it to simply update the test to python.
  • Current code to parse all of this tests can be found here: https://github.com/ethereum/execution-spec-tests/blob/main/src/ethereum_test_specs/static_state/state_static.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions