-
Notifications
You must be signed in to change notification settings - Fork 556
PIP-74: state-sync txs inclusion #1726
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
Conversation
…c-txs-on-block-body
…c-txs-on-block-body
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #1726 +/- ##
===========================================
- Coverage 48.19% 47.70% -0.49%
===========================================
Files 827 840 +13
Lines 135906 142707 +6801
===========================================
+ Hits 65497 68076 +2579
- Misses 66182 70181 +3999
- Partials 4227 4450 +223 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
The core logic LGTM. There are a few places where we might have to make changes.
|
|
Thanks for the comments @manav2401
I think I already checked all of them and just
Yes, it will demands a HF check. As soon as one of the PR's got merged we can fix on the other one. |
…c-txs-on-block-body
* eth: include bor receipts in ReceiptHash post HF * eth: rename to receiptListHash * eth: extrat typecasting logic for better testing, fix type matching issue * eth: add e2e tests for receipt delivery * eth/protocols/eth: apply HF logic while handling receipt query over eth69 * core: skip split receipts post HF * tests/bor: extend e2e test to check presence of state-sync in block
All 3 things seems to handled. First one is pending to be merged and needs some e2e and devnet testing. |
…c-txs-on-block-body
* fix: append tx only in FinalizeAndAssemble and use state instead of wrappedState * consensus/bor: sort logs before extracting state-sync logs * chore: revert statedb changes --------- Co-authored-by: Manav Darji <[email protected]>
There was a problem hiding this comment.
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 implements canonical inclusion of StateSync transactions in block bodies by introducing a new typed system transaction (StateSyncTx). After a hard fork activation, StateSync events are appended as transactions in block bodies, making them part of the canonical transaction/receipt sets. This allows StateSync outcomes to be committed to transactionsRoot, receiptsRoot, and logsBloom, improving observability, replay semantics, and enabling trustless snap-sync.
Key changes:
- Introduces
StateSyncTxType(0x7f) andStateSyncTxtransaction type that carries StateSync data - Modifies consensus engine methods to return updated receipts from
FinalizeandFinalizeAndAssemble - Updates P2P receipt handling to conditionally include/exclude StateSync receipts based on hard fork activation
Reviewed Changes
Copilot reviewed 34 out of 35 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| core/types/tx_state_sync.go | Implements the new StateSyncTx transaction type with encoding/decoding logic |
| core/types/state_data.go | Changes StateSyncData.Data from string to []byte for binary data handling |
| consensus/bor/bor.go | Appends StateSyncTx to block body post-fork and generates corresponding receipts |
| consensus/consensus.go | Updates Engine interface to return receipts from Finalize/FinalizeAndAssemble |
| eth/protocols/eth/handlers.go | Adjusts P2P receipt serving to handle StateSync receipts based on fork activation |
| internal/ethapi/api.go | Skips separate BorReceipt fetching post-fork since they're in normal receipts |
| params/config.go | Adds StateSyncBlock configuration field for hard fork activation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
…com/0xPolygon/bor into lmartins/state-sync-txs-on-block-body
|


Description
Implements Canonical Inclusion of StateSync Transactions in Block Bodies.
This change introduces a new typed system transaction (
StateSyncTx) appended to blocks that execute StateSync events. The transaction itself has zero gas/fees and does not run EVM code, but anchors all StateSync outcomes into the canonical transaction/receipt set.Key Effects
transactionsRoot,receiptsRoot, andlogsBloom.This proposal improves proofs, observability, and simplicity while maintaining economic neutrality and execution semantics.
Changes
Breaking changes
It's a hardfork, so it demands stablishing a block where it starts.