Skip to content

state: Extract the block body's transaction slices - #1647

Open
chfast wants to merge 1 commit into
masterfrom
state/split-block-transactions
Open

state: Extract the block body's transaction slices#1647
chfast wants to merge 1 commit into
masterfrom
state/split-block-transactions

Conversation

@chfast

@chfast chfast commented Aug 12, 2026

Copy link
Copy Markdown
Member

The blockchain test runner walked a block's serialization itself to check the transaction codec against it, so it carried two pieces of protocol knowledge inside a gtest assertion: where a block keeps its transactions, and that a typed transaction is wrapped in an RLP string there while a legacy one is a bare list.

split_block_transactions() takes over that walk. It delimits the transactions without decoding them, which is what the upcoming sender recovery in blockchain tests needs: a caller has to tell a transaction that does not decode from one whose signature does not recover, because the fixtures name those as different exceptions. expect_transactions_round_trip() becomes a decode-and-compare loop.

No behavior change. The malformed-block cases the runner used to assert on are now the std::nullopt result, with the same conditions in the same order, and the new unit tests cover the typed-vs-legacy wrapping and six rejection cases directly instead of only through fixtures.

The blockchain test runner walked a block's serialization to check the
transaction codec against it, knowing where a block keeps its transactions
and that a typed one is wrapped in an RLP string there while a legacy one
is a bare list. Recovering the senders of a block's transactions needs the
same walk.

Move it to split_block_transactions(), which delimits the transactions
without decoding them, so a caller can tell a transaction that does not
decode from one that does not recover.

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

Extracts block transaction slicing into a reusable state utility while preserving existing blockchain-test behavior.

Changes:

  • Adds split_block_transactions() for legacy and typed transactions.
  • Simplifies transaction round-trip validation.
  • Adds success and malformed-input tests.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
test/state/transaction.hpp Declares and documents the slicing API.
test/state/transaction.cpp Implements non-decoding transaction extraction.
test/blockchaintest/blockchaintest_runner.cpp Uses the new utility in round-trip checks.
test/unittests/state_rlp_decode_test.cpp Tests extraction and malformed blocks.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@codecov

codecov Bot commented Aug 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.22642% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.71%. Comparing base (6e4fc94) to head (2d4a49f).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
test/state/transaction.cpp 94.44% 0 Missing and 1 partial ⚠️
test/unittests/state_rlp_decode_test.cpp 96.87% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1647      +/-   ##
==========================================
- Coverage   97.72%   97.71%   -0.01%     
==========================================
  Files         171      171              
  Lines       15631    15669      +38     
  Branches     3617     3633      +16     
==========================================
+ Hits        15275    15311      +36     
  Misses        269      269              
- Partials       87       89       +2     
Flag Coverage Δ
eest-develop 88.49% <71.42%> (-0.10%) ⬇️
eest-develop-gmp 26.45% <0.00%> (-0.07%) ⬇️
eest-legacy 17.10% <28.30%> (-0.05%) ⬇️
eest-libsecp256k1 28.74% <0.00%> (-0.07%) ⬇️
eest-stable 88.49% <71.42%> (-0.10%) ⬇️
evmone-unittests 93.45% <96.22%> (+<0.01%) ⬆️

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

Components Coverage Δ
core 96.10% <94.44%> (-0.01%) ⬇️
tooling 91.86% <100.00%> (-0.06%) ⬇️
tests 99.79% <96.87%> (-0.02%) ⬇️
Files with missing lines Coverage Δ
test/blockchaintest/blockchaintest_runner.cpp 82.75% <100.00%> (-0.76%) ⬇️
test/state/transaction.hpp 100.00% <ø> (ø)
test/state/transaction.cpp 99.04% <94.44%> (-0.96%) ⬇️
test/unittests/state_rlp_decode_test.cpp 99.55% <96.87%> (-0.21%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants