Skip to content

test: Load transaction signature v as uint64#1571

Merged
chfast merged 1 commit into
masterfrom
test/tx-v-uint64
Jun 17, 2026
Merged

test: Load transaction signature v as uint64#1571
chfast merged 1 commit into
masterfrom
test/tx-v-uint64

Conversation

@chfast

@chfast chfast commented Jun 17, 2026

Copy link
Copy Markdown
Member

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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes evmone-t8n rejecting valid legacy EIP-155 transactions whose signature v exceeds 0xff (common when chainId is large), by widening the transaction v field and its JSON loader to uint64_t.

Changes:

  • Widen state::Transaction::v from uint8_t to uint64_t.
  • Update the state-test JSON loader to parse v as uint64_t instead of uint8_t.
  • Add/extend unit tests to cover large v values and the maximum legacy-EIP-155 chainId representable via uint64_t v.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
test/utils/statetest_loader.cpp Parse transaction v as uint64_t to avoid JSON parsing failures for v > 0xff.
test/state/transaction.hpp Widen Transaction::v to uint64_t to match loader and legacy EIP-155 encoding needs.
test/unittests/tooling_t8n_test.cpp Add a t8n regression test ensuring very large v values are accepted.
test/unittests/statetest_loader_tx_test.cpp Add loader regression test for maximum legacy chainId / v representable in uint64_t.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/unittests/tooling_t8n_test.cpp Outdated
{
evmc::VM vm{evmc_create_evmone()};

// Legacy EIP-155 `v` is chainId*2 + 35 + parity, exceeding 0xff for chainId >= 110.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good catch — at chainId 110 with parity 0, v is exactly 0xff, not above it. Tightened the threshold to chainId > 110, where v exceeds 0xff for either parity.

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 chfast force-pushed the test/tx-v-uint64 branch from 29691af to 93305c7 Compare June 17, 2026 13:03
@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.37%. Comparing base (f200c0d) to head (93305c7).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1571   +/-   ##
=======================================
  Coverage   97.37%   97.37%           
=======================================
  Files         163      163           
  Lines       14529    14572   +43     
  Branches     3388     3393    +5     
=======================================
+ Hits        14147    14190   +43     
  Misses        280      280           
  Partials      102      102           
Flag Coverage Δ
eest-develop 89.66% <100.00%> (ø)
eest-develop-gmp 26.24% <0.00%> (-0.08%) ⬇️
eest-legacy 17.62% <2.27%> (-0.06%) ⬇️
eest-libsecp256k1 27.89% <0.00%> (-0.09%) ⬇️
eest-stable 89.75% <100.00%> (ø)
evmone-unittests 92.56% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
core 95.95% <ø> (ø)
tooling 90.21% <100.00%> (ø)
tests 99.80% <100.00%> (+<0.01%) ⬆️
Files with missing lines Coverage Δ
test/state/transaction.hpp 100.00% <ø> (ø)
test/unittests/statetest_loader_tx_test.cpp 100.00% <100.00%> (ø)
test/unittests/tooling_t8n_test.cpp 100.00% <100.00%> (ø)
test/utils/statetest_loader.cpp 93.11% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@chfast chfast merged commit 3616ba6 into master Jun 17, 2026
25 checks passed
@chfast chfast deleted the test/tx-v-uint64 branch June 17, 2026 13:34
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

Successfully merging this pull request may close these issues.

t8n: legacy tx with v>255 (high chainId) is rejected by JSON parser

2 participants