Conversation
|
@claude review this PR |
|
Claude finished @varex83's task in 3m 53s —— View job PR Review: feat: add bootnode.rsTasks:
SummaryThis PR adds Findings[High]
|
| Component | Go | Rust | Match | Notes |
|---|---|---|---|---|
| HTTP relay URL detection | checks scheme explicitly | starts_with("http") |
partial | fragile; should match Go's URL parsing |
| ENR → QUIC-v1 multiaddr | UDP port → /udp/{}/quic-v1 |
same | yes | |
| ENR → TCP multiaddr | TCP port → /tcp/{} |
same | yes | |
| Retry backoff | expbackoff.FastConfig: 100ms/5s/1.6x |
same via backon | yes | |
| Poll interval | 2 minutes | RELAY_POLL_INTERVAL = 120s |
yes | |
| Resolve timeout | 1 minute | BOOTNODE_RESOLVE_TIMEOUT = 60s |
yes | |
| IPv4 support | yes | yes | yes | |
| IPv6 support | yes (ip6 field) | no | no | missing record.ip6() fallback |
| Charon-Cluster header | yes | yes | yes | |
| MutablePeer threading | Go interface + goroutines | Arc<Mutex<...>> |
partial | should use tokio::sync::Mutex |
resolve_relay loop on error |
continues polling | exits task | no | Go keeps the goroutine alive |
Tests
Tests were not run as this is a review-only pass.
Open Questions
- Should
new_relaysreturn an error or succeed empty when cancellation fires during the 60-second wait? Currently returnsTimeoutResolvingBootnodeEnron cancellation which is misleading. - Is the
P2PConfig::relays: Vec<Multiaddr>intentionally different fromnew_relays's&[String]? If both are used for relay configuration, one of them should be updated for consistency.
emlautarom1
left a comment
There was a problem hiding this comment.
LGTM, some small things only.
| let relay_addrs = utils::multi_addrs_via_relay(&relay_peer, target_peer_id); | ||
|
|
||
| self.events.push_back(ToSwarm::Dial { | ||
| opts: DialOpts::peer_id(*target_peer_id) |
There was a problem hiding this comment.
Question: Go only add addresses to peerstore, this Dial will explicitly send event to dial, which then leads to multiple dials. Not sure it's what you want here
There was a problem hiding this comment.
I've tried using NewExternalAddrOfPeer instead but what it does is just notifying other behaviour, so I think dialing is the only option (or at least for now)
crates/p2p/src/bootnode.rs
Outdated
|
|
||
| /// Failed resolving a single relay ID from addresses. | ||
| #[error("failed resolving a single relay ID from addresses: got {0}")] | ||
| NotSingleRelayId(usize), |
emlautarom1
left a comment
There was a problem hiding this comment.
LGTM, only nits from me.
| //! curl http://localhost:8888 | ||
| //! ``` | ||
| //! | ||
| //! This returns the relay's ENR or multiaddrs that clients can use to connect. |
There was a problem hiding this comment.
The ENR is available at http://localhost:8888/enr
| //! This returns the relay's ENR or multiaddrs that clients can use to connect. | |
| //! This returns the relay's multiaddrs that clients can use to connect. |
| let mut circuit_addrs = Vec::new(); | ||
| for addr in &peer.addresses { | ||
| let mut relay_addr = addr.clone(); | ||
| relay_addr.push(MaProtocol::P2p(peer.id)); | ||
| relay_addr.push(MaProtocol::P2pCircuit); | ||
| circuit_addrs.push(relay_addr); | ||
| } |
There was a problem hiding this comment.
This is the same code as in pluto_p2p::utils::multi_addrs_via_relay right?
| } | ||
| } | ||
| _ = signal::ctrl_c() => { | ||
| println!("Ctrl+C received, shutting down..."); |
There was a problem hiding this comment.
nit: println! instead of tracing
|
|
||
| let resp = client | ||
| .get(relay_url) | ||
| .header("Charon-Cluster", &lock_hash_hex_owned) |
There was a problem hiding this comment.
nit: no need to clone
| .header("Charon-Cluster", &lock_hash_hex_owned) | |
| .header("Charon-Cluster", &*lock_hash_hex) |
Closes #130