feat(eth): implement EIP-2464 - xdc/165 transaction fetcher #20234 #21032 #22181 #32210#2490
feat(eth): implement EIP-2464 - xdc/165 transaction fetcher #20234 #21032 #22181 #32210#2490gzliudan wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Adds support for the new xdc/165 (eth/65-style) transaction announcement + pooled transaction retrieval flow (EIP-2464-style), introducing a dedicated transaction fetcher and updating the protocol manager/peer logic to use announcements instead of eager full-tx sync for 165+.
Changes:
- Add
xdc165protocol version + new tx fetch message codes (NewPooledTransactionHashes,GetPooledTransactions,PooledTransactions). - Split the legacy block fetcher into
BlockFetcherand newTxFetcher, and wire both into the syncer/handler paths. - Update tests and devp2p eth test helpers to reflect renamed message codes and the new 165 tx announcement behavior.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| eth/sync.go | Announce tx hashes to xdc/165+ peers during initial tx sync; start/stop new fetchers in syncer. |
| eth/sync_test.go | Run fast-sync disabling test across protocol versions (63/164/165); update peer creation signature. |
| eth/protocol.go | Introduce xdc165, add new message codes, rename TxMsg → TransactionMsg, extend txPool interface. |
| eth/protocol_test.go | Extend protocol tests to 165, update tx send/recv expectations, add tx propagation/announcement tests. |
| eth/peer.go | Add async tx announce/broadcast loops and pooled-tx request/response helpers; update handshake for 165. |
| eth/metrics.go | Update metering switch from TxMsg to TransactionMsg. |
| eth/helper_test.go | Update test txpool to support Has/Get + tx feed; update peer creation signature in tests. |
| eth/handler.go | Wire BlockFetcher + new TxFetcher, implement 165 message handling, revamp tx broadcast strategy. |
| eth/handler_test.go | Add BroadcastBlock test, move malformed-block test, update DAO timeout var naming and txpool init. |
| eth/fetcher/tx_fetcher.go | New transaction fetcher implementation for announcement-driven pooled tx retrieval. |
| eth/fetcher/tx_fetcher_test.go | Comprehensive test suite for the new transaction fetcher. |
| eth/fetcher/metrics.go | Remove old fetcher metrics file (metrics moved into block/tx fetchers). |
| eth/fetcher/block_fetcher.go | Rename/adjust existing fetcher to BlockFetcher, move metrics here, minor logging/comment updates. |
| eth/fetcher/block_fetcher_test.go | Update tests to use NewBlockFetcher. |
| eth/downloader/peer.go | Allow idle peers up to protocol 165. |
| eth/backend.go | Update backend hooks to reference blockFetcher instead of fetcher. |
| cmd/devp2p/internal/ethtest/suite.go | Use TransactionMsg instead of TxMsg. |
| cmd/devp2p/internal/ethtest/conn.go | Decode TransactionMsg instead of TxMsg. |
| cmd/devp2p/internal/ethtest/conn_decode_test.go | Update decode test to use TransactionMsg. |
Comments suppressed due to low confidence (1)
eth/peer.go:854
- Per-peer broadcaster goroutines are started here, but there is no corresponding termination signal on disconnect:
peer.close()is never invoked when a peer is unregistered, so these goroutines will leak for every connection churn.
go p.broadcastBlocks()
go p.broadcastTransactions()
if p.version >= xdc165 {
go p.announceTransactions()
}
c277381 to
11c2ab3
Compare
Proposed changes
implement eth/65 protocol
Ref:
Types of changes
What types of changes does your code introduce to XDC network?
Put an
✅in the boxes that applyImpacted Components
Which parts of the codebase does this PR touch?
Put an
✅in the boxes that applyChecklist
Put an
✅in the boxes once you have confirmed below actions (or provide reasons on not doing so) that