feat: peers test#368
Conversation
|
@claude review |
|
Claude finished @mskrzypkows's task in 4m 3s —— View job Code Review — PR #368: Peers test
SummaryThis PR implements the IssuesBug — ENR deduplication is broken (
|
varex83agent
left a comment
There was a problem hiding this comment.
This PR turns the previously stubbed peers test category into a real implementation (~900 LOC). The overall shape of the suite (Ping / PingMeasure / PingLoad / DirectConn / Libp2pTCPPortOpen / Relay HTTP tests) maps to Charon's testpeers.go, and several non-trivial pieces (the relay reservation behaviour, ENR-hash relay routing, multistream self-probe) are well thought through. Self-tested as the commit messages note.
That said, there are two concrete bugs and a handful of meaningful parity / robustness gaps that should be addressed before merge:
Bugs
build_peer_resultsforDirectConn(peers.rs:894) gates the "no direct addresses available from identify" diagnostic onhas_load_test, which has nothing to do with whether identify produced direct addresses. Running--test-cases DirectConnalone makes that branch unreachable and yields a misleading error.PingLoad(peers.rs:866) is not actually a load test. Charon spawns a fresh continuous-ping goroutine every second overLoadTestDuration; Pluto only filters the libp2p ping-keepalive samples that happened to land in the window. Over the default 30s window that's ~2 RTT samples per peer with no real load applied — verdicts effectively duplicatePingMeasure.
Major parity / robustness issues
- DirectConn attempts a single dial after the first Identify event and never retries; Charon retries up to ~120x over
DirectConnectionTimeout(peers.rs:777). - Missing
--definition-fileflag and no mutual-exclusion validation between--enrs/--lock-file(peers.rs:86, 165). - Relay HTTP tests run sequentially before peer/self tests, with no per-request timeout and no in-flight cancellation; one stalled relay blocks the whole suite (peers.rs:216, 446).
- Self-ENR dedup uses raw string comparison against the lock file's ENR strings; canonical-vs-padded base64url encodings can produce different
enr_hashvalues across cluster peers, putting them in different relay routing rooms (peers.rs:221). Libp2pTCPPortOpenprobes addresses sequentially (and self-tests run sequentially); Charon parallelises both viaerrgroup(peers.rs:478, 504).- Zero unit tests for ~900 lines of new logic; Charon's
testpeers_internal_test.gois ~576 lines. Several pure functions (peer_is_done,build_peer_results,format_enr,fetch_enrs) are easy to cover and would have caught the bug at line 894.
Minor / nit findings cover error typing, Option<PathBuf> instead of empty-string sentinel, overflow-prone Instant + Duration, swallowed JoinError, hard-coded relay defaults, and a few code-organisation suggestions.
Verdict: requesting changes for the two bugs and the missing-flag / no-cancellation / no-tests issues.
|
Regarding ping load test: the 1s ping interval already generates load; PingLoad's |
|
@iamquang95 Resolved comments |
No description provided.