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

feat(tools): update invalid blockchain fixture format #322

Merged

Conversation

spencer-tb
Copy link
Collaborator

🗒️ Description

Updates the format for invalid blocks in the default fixture. Currently evmone can't consume RLP. The PR provides an alternative way for them and others to consume invalid blocks generated by tests.

The new proposed invalid block format is the following:

 {
        "rlp":"0xf902b...0c0",
        "expectException": "invalid blob gas used",
        "rlp_decoded": {
            "blockHeader": {
                "parentHash": "0x7d74f162e144609e5911d1d2287ba394b141c7d460378f804cd527bb55c86489",
                "uncleHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
                "coinbase": "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
                "stateRoot": "0x0c2e33269bc55d3b8f4be9389c14fefd5ef2f48a0fef48af770ff0f9b4af7d8c",
                "transactionsTrie": "0xe06fbc15243fb14dc4e3a9918ecdc38e11b6d831d9625855e22273ae2e950041",
                "receiptTrie": "0x167497e0db677e533dde7e46c3f485c45662ceb46281d7073354e80b5a40f454",
                "bloom": "0x000...00",
                "difficulty": "0x00",
                "number": "0x01",
                "gasLimit": "0x016345785d8a0000",
                "gasUsed": "0xa861",
                "timestamp": "0x0c",
                "extraData": "0x",
                "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
                "nonce": "0x0000000000000000",
                "baseFeePerGas": "0x07",
                "withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
                "blobGasUsed": "0x020000",
                "excessBlobGas": "0x040000",
                "parentBeaconBlockRoot": "0x00000000000000...0000000000000000",
                "hash": "0x11e37d4045ab376876077f0071e7ff1d9495e36b3193f45783a5c7c24d561e64"
            },
            "transactions": [...],
            "uncleHeaders": [],
            "withdrawals": []
        },
}

🔗 Related Issues

The new format was initially flagged here: ethereum/tests#1293.
Tagging @rodiazet and @winsvega.

✅ Checklist

  • All: Set appropriate labels for the changes.
  • All: Considered squashing commits to improve commit history.
  • All: Added an entry to CHANGELOG.md.
  • All: Considered updating the online docs in the ./docs/ directory.

@spencer-tb spencer-tb added scope:tools Scope: ethereum_test_tools package type:feat type: Feature labels Sep 26, 2023
@spencer-tb spencer-tb force-pushed the feat/invalid-blockchain-format branch 2 times, most recently from 0b3dc3e to cd25737 Compare September 26, 2023 21:55
@spencer-tb
Copy link
Collaborator Author

Tested with the geth t8n; after concerneds where addressed in the issue referenced above.

This was achieved by running evm blocktest on all invalid blocks.

@spencer-tb
Copy link
Collaborator Author

Note that #307 is rebased onto this PR.

Copy link
Member

@danceratopz danceratopz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but would appreciate a second check from someone else.

docs/CHANGELOG.md Outdated Show resolved Hide resolved
@spencer-tb
Copy link
Collaborator Author

spencer-tb commented Oct 4, 2023

I've doubled checked this today - we don't need the blocknumber for the invalid block. Previously invalid blocks would go:

  • valid_block has blocknumber=1
  • invalid_block has no blocknumber=1
  • valid_block has blocknumber=2

And hence duplicated the blocknumber. So removing it should not cause any issues in my opinion.

Copy link
Member

@danceratopz danceratopz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@danceratopz danceratopz merged commit f810be2 into ethereum:main Oct 4, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope:tools Scope: ethereum_test_tools package type:feat type: Feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants