-
Notifications
You must be signed in to change notification settings - Fork 221
Fix tx pool restore on bootstrap #7588
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
base: feat/supernova-async-exec
Are you sure you want to change the base?
Conversation
The base branch was changed.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## feat/supernova-async-exec #7588 +/- ##
=============================================================
- Coverage 77.69% 77.69% -0.01%
=============================================================
Files 875 875
Lines 120898 120945 +47
=============================================================
+ Hits 93931 93967 +36
+ Misses 20774 20772 -2
- Partials 6193 6206 +13 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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 fixes the transaction pool restoration during bootstrap by ensuring transactions from historical blocks are properly restored to the pool. The key changes simplify the sync preparation logic and add functionality to explicitly save transactions to the pool during bootstrap.
- Removed the
withTxsparameter fromprepareForSyncIfNeeded, making transaction syncing unconditional - Added new
saveProposedTxsToPoolandsaveTxsToPoolmethods to restore transactions from storage to the pool for HeaderV3 blocks - Improved error message in txcache to include the transaction hash when a transaction is not found
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| process/sync/baseSync.go | Simplified prepareForSyncIfNeeded by removing withTxs parameter and added new methods to restore transactions to pool from storage during bootstrap |
| process/sync/baseSync_test.go | Added comprehensive test TestBaseBootstrap_SaveProposedTxsToPool covering all transaction types (normal, invalid, smart contract results, rewards, peer) |
| process/sync/export_test.go | Exported SaveProposedTxsToPool method for testing purposes |
| txcache/blocks.go | Enhanced error message to include transaction hash when a transaction is not found in cache |
| txcache/blocks_test.go | Updated test assertion to use require.ErrorIs for proper error wrapping validation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| TxHashes: [][]byte{[]byte("txHash1")}, | ||
| Type: block.TxBlock, | ||
| }, | ||
| &block.MiniBlock{ |
Copilot
AI
Jan 5, 2026
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.
Composite literal uses unkeyed fields. This is not idiomatic Go and can break if the struct definition changes. Consider using keyed fields instead.
| TxHashes: [][]byte{[]byte("txHash2")}, | ||
| Type: block.InvalidBlock, | ||
| }, | ||
| &block.MiniBlock{ |
Copilot
AI
Jan 5, 2026
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.
Composite literal uses unkeyed fields. This is not idiomatic Go and can break if the struct definition changes. Consider using keyed fields instead.
| TxHashes: [][]byte{[]byte("txHash3")}, | ||
| Type: block.SmartContractResultBlock, | ||
| }, | ||
| &block.MiniBlock{ |
Copilot
AI
Jan 5, 2026
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.
Composite literal uses unkeyed fields. This is not idiomatic Go and can break if the struct definition changes. Consider using keyed fields instead.
| TxHashes: [][]byte{[]byte("txHash4")}, | ||
| Type: block.RewardsBlock, | ||
| }, | ||
| &block.MiniBlock{ |
Copilot
AI
Jan 5, 2026
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.
Composite literal uses unkeyed fields. This is not idiomatic Go and can break if the struct definition changes. Consider using keyed fields instead.
| TxHashes: [][]byte{[]byte("txHash1")}, | ||
| Type: block.TxBlock, | ||
| }, | ||
| &block.MiniBlock{ | ||
| TxHashes: [][]byte{[]byte("txHash2")}, | ||
| Type: block.InvalidBlock, | ||
| }, | ||
| &block.MiniBlock{ | ||
| TxHashes: [][]byte{[]byte("txHash3")}, | ||
| Type: block.SmartContractResultBlock, | ||
| }, | ||
| &block.MiniBlock{ | ||
| TxHashes: [][]byte{[]byte("txHash4")}, | ||
| Type: block.RewardsBlock, | ||
| }, | ||
| &block.MiniBlock{ | ||
| TxHashes: [][]byte{[]byte("txHash5")}, |
Copilot
AI
Jan 5, 2026
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.
Composite literal uses unkeyed fields. This is not idiomatic Go and can break if the struct definition changes. Consider using keyed fields instead.
| TxHashes: [][]byte{[]byte("txHash1")}, | |
| Type: block.TxBlock, | |
| }, | |
| &block.MiniBlock{ | |
| TxHashes: [][]byte{[]byte("txHash2")}, | |
| Type: block.InvalidBlock, | |
| }, | |
| &block.MiniBlock{ | |
| TxHashes: [][]byte{[]byte("txHash3")}, | |
| Type: block.SmartContractResultBlock, | |
| }, | |
| &block.MiniBlock{ | |
| TxHashes: [][]byte{[]byte("txHash4")}, | |
| Type: block.RewardsBlock, | |
| }, | |
| &block.MiniBlock{ | |
| TxHashes: [][]byte{[]byte("txHash5")}, | |
| TxHashes: [][]byte{0: []byte("txHash1")}, | |
| Type: block.TxBlock, | |
| }, | |
| &block.MiniBlock{ | |
| TxHashes: [][]byte{0: []byte("txHash2")}, | |
| Type: block.InvalidBlock, | |
| }, | |
| &block.MiniBlock{ | |
| TxHashes: [][]byte{0: []byte("txHash3")}, | |
| Type: block.SmartContractResultBlock, | |
| }, | |
| &block.MiniBlock{ | |
| TxHashes: [][]byte{0: []byte("txHash4")}, | |
| Type: block.RewardsBlock, | |
| }, | |
| &block.MiniBlock{ | |
| TxHashes: [][]byte{0: []byte("txHash5")}, |
Reasoning behind the pull request
Proposed changes
Testing procedure
Pre-requisites
Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:
featbranch created?featbranch merging, do all satellite projects have a proper tag insidego.mod?