test: Load transaction chainId as uint64#1570
Merged
Merged
Conversation
from_json_tx_common parsed the transaction "chainId" with from_json<uint8_t>, throwing `from_json<uint8_t>: value > 0xFF` for any chain ID above 255. This crashed `evmone t8n` on common networks such as Sepolia (11155111) and Arbitrum One (42161): the transaction is parsed before t8n overrides chain_id from its args, so the parse failed first and no output was produced. Parse it as uint64_t, matching the Transaction::chain_id field type. Fixes #1569.
There was a problem hiding this comment.
Pull request overview
Fixes a tooling crash in evmone t8n/statetest loaders by parsing per-transaction JSON "chainId" as uint64_t (matching state::Transaction::chain_id), instead of uint8_t which rejected real-world chain IDs > 255 (e.g. Sepolia, Arbitrum).
Changes:
- Update
from_json_tx_common()to load"chainId"withfrom_json<uint64_t>. - Add unit test coverage ensuring
chainId == UINT64_MAXis accepted/loaded correctly in both the statetest loader and t8n tooling.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
test/utils/statetest_loader.cpp |
Fixes the core parsing bug by switching "chainId" parsing from uint8_t to uint64_t. |
test/unittests/tooling_t8n_test.cpp |
Adds a regression test ensuring t8n() can parse/handle a transaction JSON with maximal chainId. |
test/unittests/statetest_loader_tx_test.cpp |
Adds a regression test ensuring the statetest transaction loader preserves maximal chainId without truncation/overflow. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1570 +/- ##
=======================================
Coverage 97.36% 97.37%
=======================================
Files 163 163
Lines 14488 14529 +41
Branches 3385 3388 +3
=======================================
+ Hits 14106 14147 +41
Misses 280 280
Partials 102 102
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
chfast
added a commit
that referenced
this pull request
Jun 17, 2026
A legacy EIP-155 transaction encodes `v` as chainId*2 + 35 + parity, so `v` exceeds 0xff for any chainId >= 110 (e.g. chainId 300 gives v=0x27c). The state-test loader narrowed `v` to `uint8_t` and `Transaction::v` was `uint8_t`, so `from_json<uint8_t>` threw `value > 0xFF` and `evmone t8n` rejected such transactions while geth `evm t8n` executes them. Widen `Transaction::v` and its loader to `uint64_t`, matching the `chainId` fix (#1570). `v` is only RLP-encoded for the transaction hash, so the wider type is encoded correctly with no other behavior change. Fixes #1487.
chfast
added a commit
that referenced
this pull request
Jun 17, 2026
A legacy EIP-155 transaction encodes `v` as chainId*2 + 35 + parity, so `v` exceeds 0xff for any chainId >= 110 (e.g. chainId 300 gives v=0x27c). The state-test loader narrowed `v` to `uint8_t` and `Transaction::v` was `uint8_t`, so `from_json<uint8_t>` threw `value > 0xFF` and `evmone t8n` rejected such transactions while geth `evm t8n` executes them. Widen `Transaction::v` and its loader to `uint64_t`, matching the `chainId` fix (#1570). `v` is only RLP-encoded for the transaction hash, so the wider type is encoded correctly with no other behavior change. Fixes #1487.
chfast
added a commit
that referenced
this pull request
Jun 17, 2026
A legacy EIP-155 transaction encodes `v` as chainId*2 + 35 + parity, so `v` exceeds 0xff for any chainId >= 110 (e.g. chainId 300 gives v=0x27c). The state-test loader narrowed `v` to `uint8_t` and `Transaction::v` was `uint8_t`, so `from_json<uint8_t>` threw `value > 0xFF` and `evmone t8n` rejected such transactions while geth `evm t8n` executes them. Widen `Transaction::v` and its loader to `uint64_t`, matching the `chainId` fix (#1570). `v` is only RLP-encoded for the transaction hash, so the wider type is encoded correctly with no other behavior change. Fixes #1487.
chfast
added a commit
that referenced
this pull request
Jun 17, 2026
A legacy EIP-155 transaction encodes `v` as chainId*2 + 35 + parity, so `v` exceeds 0xff for any chainId >= 110 (e.g. chainId 300 gives v=0x27c). The state-test loader narrowed `v` to `uint8_t` and `Transaction::v` was `uint8_t`, so `from_json<uint8_t>` threw `value > 0xFF` and `evmone t8n` rejected such transactions while geth `evm t8n` executes them. Widen `Transaction::v` and its loader to `uint64_t`, matching the `chainId` fix (#1570). `v` is only RLP-encoded for the transaction hash, so the wider type is encoded correctly with no other behavior change. Fixes #1487.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
from_json_tx_common parsed the transaction "chainId" with from_json<uint8_t>, throwing
from_json<uint8_t>: value > 0xFFfor any chain ID above 255. This crashedevmone t8non common networks such as Sepolia (11155111) and Arbitrum One (42161): the transaction is parsed before t8n overrides chain_id from its args, so the parse failed first and no output was produced.Parse it as uint64_t, matching the Transaction::chain_id field type.
Fixes #1569.