state: Extract the block body's transaction slices - #1647
Open
chfast wants to merge 1 commit into
Open
Conversation
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.
There was a problem hiding this comment.
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 Report❌ Patch coverage is
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
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
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.
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::nulloptresult, 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.