PIP-74: state-sync txs inclusion#42
Conversation
* rlp: fix encoding/decoding of state-sync tx * chore: add state-sync tx receipt in Finalize * ssTxs: fix receiptsHash mismatch * chore: remove block hash and number * revert: add block number * fix: rpc fixes * polygon/sync: announce blocks/hashes for blocks received via hash announcements (#44) * fix: log slicing in newStateSyncReceipt --------- Co-authored-by: Manav Darji <manavdarji.india@gmail.com>
There was a problem hiding this comment.
Pull Request Overview
This PR implements canonical inclusion of state-sync transactions in block bodies per the Polygon Improvement Proposal (PIP-74). It introduces a new typed system transaction (StateSyncTxType = 127) that anchors StateSync event outcomes into the canonical transaction/receipt set without consuming gas or executing EVM code. This change requires a hard fork activation.
Key changes:
- New
StateSyncTxtransaction type with zero gas/fees that doesn't run EVM code - State-sync transactions are included in
transactionsRoot,receiptsRoot, andlogsBloom - Receipt generation for state-sync transactions to maintain canonical chain integrity
Reviewed Changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| polygon/bor/borcfg/bor_config.go | Adds StateSyncBlock hard fork configuration and accessor methods |
| execution/types/state_sync_tx.go | Implements the new StateSyncTx transaction type with encoding/decoding logic |
| execution/types/transaction.go | Adds StateSyncTxType constant and decoder support |
| execution/types/state_data.go | Updates StateSyncData.Data field type from string to []byte |
| polygon/bor/bor.go | Implements state-sync transaction and receipt assembly in block finalization |
| execution/stagedsync/stage_senders.go | Skips sender recovery for state-sync transactions |
| execution/stagedsync/exec3_serial.go | Skips execution of state-sync transactions |
| execution/stagedsync/exec3_parallel.go | Handles state-sync transaction logs in parallel execution |
| rpc/jsonrpc/eth_block.go | Conditionally excludes bor transactions post state-sync fork |
| rpc/ethapi/api.go | Handles state-sync transaction serialization without chain ID or access list |
| execution/chain/chain_config.go | Adds state-sync fork check methods |
| core/vm/evmtypes/rules.go | Adds state-sync rules to EVM context |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 21 out of 21 changed files in this pull request and generated 8 comments.
Comments suppressed due to low confidence (1)
polygon/bor/bor.go:1
- [nitpick] The comment pluralization is inconsistent. 'producers' intervals' should be 'producer intervals' to match the original meaning of delay between two producer turns/intervals.
// Copyright 2024 The Erigon Authors
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: kamuikatsurgi <shahkrishang11@gmail.com>
* StateSync txs inclusion * change pip number * refactor local cache for last ss data * test logs * process state sync txs in serial and parallel executor * enforce zero effectiveGasPrice on ssTx * chore: nits * rlp: fix encoding/decoding of state-sync tx (#43) * rlp: fix encoding/decoding of state-sync tx * chore: add state-sync tx receipt in Finalize * ssTxs: fix receiptsHash mismatch * chore: remove block hash and number * revert: add block number * fix: rpc fixes * polygon/sync: announce blocks/hashes for blocks received via hash announcements (#44) * fix: log slicing in newStateSyncReceipt --------- Co-authored-by: Manav Darji <manavdarji.india@gmail.com> * chore: remove todo Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * chore: remove todo Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * chore: rename HF to Madhugiri * chore: nits * rpc/jsonrpc, txnprovider: state-sync txn handling over rpc post HF (#46) Co-authored-by: kamuikatsurgi <shahkrishang11@gmail.com> --------- Co-authored-by: kamuikatsurgi <shahkrishang11@gmail.com> Co-authored-by: Krishang Shah <109511742+kamuikatsurgi@users.noreply.github.com> Co-authored-by: Manav Darji <manavdarji.india@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
In this PR, we implement the canonical inclusion of state-sync txs in block bodies, as per relative PIP.
This PR reflects the Erigon's changes for this PR in bor:
The PR introduces a new typed system transaction, which is included to blocks that execute StateSync events.
Such txs have zero gas/fees and does not run EVM code, but anchors all StateSync outcomes into the canonical transaction/receipt set. This results in inclusion of such txs into transactionsRoot, receiptsRoot, and logsBloom.
The changes requires a hard fork.
Test worked when enabling StateSync HF from block 0 with the following kurtosis configs
Receipt was successfully received
