chore(p2p/discv5): add deprecation warning and remove unused code #20367#2382
chore(p2p/discv5): add deprecation warning and remove unused code #20367#2382gzliudan 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
This PR deprecates the p2p/discv5 package (prototype Discovery v5 implementation) and trims unused/legacy code and tests within that package.
Changes:
- Mark
p2p/discv5as deprecated and add a brief README pointing to the upstream Discovery v5 spec. - Remove unused helpers/fields and leftover commented/debug code in
discv5implementation files. - Delete unused/disconnected files/tests (e.g.,
ntp.go,udp_test.go) and test-only helpers no longer referenced.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| p2p/discv5/udp.go | Removes unused NAT field/import and unused helper methods. |
| p2p/discv5/udp_test.go | Deletes unused/obsolete UDP tests and related test scaffolding. |
| p2p/discv5/ticket.go | Removes unused constants/helpers and cleans up commented debug code. |
| p2p/discv5/table.go | Adds package-level deprecation notice (doc comment). |
| p2p/discv5/table_test.go | Removes unused test transport/helper code. |
| p2p/discv5/README | Adds short warning that discv5 is a prototype and links to spec. |
| p2p/discv5/ntp.go | Removes NTP drift detection code from discv5. |
| p2p/discv5/node.go | Removes unused node address/pubkey helpers. |
| p2p/discv5/net.go | Removes unused findnodeQuery field and simplifies shutdown TODO block. |
| p2p/discv5/net_test.go | Removes unused testnet mining helper and an unused import. |
Comments suppressed due to low confidence (1)
p2p/discv5/ticket.go:456
- There is a stray commented closing brace (
//}) left inside searchLookupDone, which makes the control flow harder to read and looks like an unfinished edit. It should be removed.
func (s *ticketStore) searchLookupDone(lookup lookupInfo, nodes []*Node, query func(n *Node, topic Topic) []byte) {
now := mclock.Now()
for i, n := range nodes {
if i == 0 || (binary.BigEndian.Uint64(n.sha[:8])^binary.BigEndian.Uint64(lookup.target[:8])) < s.radius[lookup.topic].minRadius {
if lookup.radiusLookup {
if lastReq, ok := s.nodeLastReq[n]; !ok || time.Duration(now-lastReq.time) > radiusTC {
s.nodeLastReq[n] = reqInfo{pingHash: nil, lookup: lookup, time: now}
}
}
if s.canQueryTopic(n, lookup.topic) {
hash := query(n, lookup.topic)
if hash != nil {
s.addTopicQuery(common.BytesToHash(hash), n, lookup)
}
}
//}
}
}
…ereum#20367 * p2p/discv5: add deprecation warning and remove unused code * p2p/discv5: remove unused variables
ae48d56 to
0c0266b
Compare
Proposed changes
p2p/discv5: add deprecation warning and remove unused code
p2p/discv5: remove unused variables
Ref: ethereum#20367
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