refactor(p2p/discover): move discv4 encoding to new 'v4wire' package #21147#2427
refactor(p2p/discover): move discv4 encoding to new 'v4wire' package #21147#2427gzliudan 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 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
Refactors Discovery v4 by extracting wire-format packet types and (en|de)coding into a new p2p/discover/v4wire package, enabling low-level protocol testing independently from the UDP transport implementation.
Changes:
- Add
p2p/discover/v4wirepackage containing v4 packet structs, constants, andEncode/Decodehelpers. - Update
p2p/discover/v4_udp.goto usev4wiretypes and encoding/decoding, replacing inline wire logic with handler wrappers. - Move EIP-8 forward-compatibility test vectors into
v4wiretests and adjust existing UDP/lookup tests to usev4wire.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| p2p/discover/v4wire/v4wire.go | New v4 wire protocol types and encode/decode utilities extracted from UDPv4. |
| p2p/discover/v4wire/v4wire_test.go | New low-level EIP-8 forward-compatibility vectors and decode assertions for the wire package. |
| p2p/discover/v4_udp.go | Reworks UDPv4 to rely on v4wire for packet framing and to dispatch via wrapper handlers. |
| p2p/discover/v4_udp_test.go | Updates UDP tests to use v4wire packets/codec and removes duplicated EIP-8 vectors from UDP tests. |
| p2p/discover/v4_lookup_test.go | Updates lookup test harness to operate on v4wire.Packet and v4wire.Node. |
| p2p/discover/node.go | Removes recoverNodeKey from discover package (now provided by v4wire). |
f19a005 to
9657a30
Compare
…thereum#21147 This moves all v4 protocol definitions to a new package, p2p/discover/v4wire. The new package will be used for low-level protocol tests.
9657a30 to
be67e44
Compare
Proposed changes
This moves all v4 protocol definitions to a new package, p2p/discover/v4wire. The new package will be used for low-level protocol tests.
Ref: ethereum#21147
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