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

invalid block json description #417

Closed
winsvega opened this issue Jan 30, 2024 · 2 comments
Closed

invalid block json description #417

winsvega opened this issue Jan 30, 2024 · 2 comments

Comments

@winsvega
Copy link
Collaborator

winsvega commented Jan 30, 2024

(cancun/eip4844_blobs/tests/tmp/tmptest_e63dbf6c_a8b3_42b0_92dd_7f524cd5686f/test_excess_blob_gas_fork_transition.py::test_invalid_post_fork_block_without_blob_fields[fork_ShanghaiToCancunAtTime15k-blockchain_test-excess_blob_gas_missing_False-blob_gas_used_missing_True], step: BlockchainTest)

Error: BlockchainTestInFilled convertion error: BlockchainTestBlock convertion error: BlockHeader4844 parse error: Expected field 'blobGasUsed' not found in config: BlockHeader4844 blockHeader
"blockHeader" : {
    "baseFeePerGas" : "0x07",
    "bloom" : "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
    "coinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
    "difficulty" : "0x00",
    "excessBlobGas" : "0x00",
    "extraData" : "0x",
    "gasLimit" : "0x016345785d8a0000",
    "gasUsed" : "0x00",
    "hash" : "0x5155c84b69a8af6ee6f06d7414f1e434d01dbd8a5eab1ac429b246525e319e16",
    "mixHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
    "nonce" : "0x0000000000000000",
    "number" : "0x10",
    "parentBeaconBlockRoot" : "0x0000000000000000000000000000000000000000000000000000000000000000",
    "parentHash" : "0x64177ba1942c915cc9c4d95a69b27befb29a3e0c2a56882fba4fb8c5bf367fea",
    "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
    "stateRoot" : "0x28415a6a7e08c2fb01beaa4d4e8397ed3c51f8c7400d3619803652afedf658c1",
    "timestamp" : "0x3a98",
    "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
    "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
    "withdrawalsRoot" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
}

the json is not a plain transcript of rlp.
it is a static structure. because rlp does not have meaning (keys) of its elements. if we add or substruct one element from the rlp we can't just do the same in json. (substraction in this case) because some clients are trying to construct a block from this jsons (instead of rlps) and because it violates the validity of rlp structure making it an invalid rlp structure test.

in blockchain tests we assume that the rlp are all of a valid structure. (no wrong rlp length bytes, no wrong rlp bytes, correct ethereum structures (field count and field type) )

all the cases when rlp is invalid is another type of a test. so we can provide such vectors there (tx with missing or extra fields, invalid rlp encoding, invalid rlp field types, over 256 bit values)

@winsvega winsvega changed the title invalid block json decription invalid block json description Jan 30, 2024
@spencer-tb
Copy link
Collaborator

This should potentially be a hive only test. Where we get the appropriate error response from the engine API.

Using geth evm blocktest we get:

Block decoding failed  index=15 err="rlp: input string too long for uint64, decoding into (types.Block)(types.extblock).Header.BlobGasUsed"

Which is technically not the correct invalidity. And like you mention I don't think there is a way to deterministically get the appropriate error response solely from the rlp

@winsvega
Copy link
Collaborator Author

The invalid rlps or block import of invalid structure rlps should be in a separate class of tests. Thats why I added rlp decoded field, because otherwise it's impossoble to decode an invalid rlp

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