Skip to content

test(p2p): cover peer, utils, quic_upgrade, force_direct, bootnode - #666

Merged
iamquang95 merged 2 commits into
mainfrom
feat/fix-620
Aug 28, 2026
Merged

test(p2p): cover peer, utils, quic_upgrade, force_direct, bootnode#666
iamquang95 merged 2 commits into
mainfrom
feat/fix-620

Conversation

@iamquang95

Copy link
Copy Markdown
Collaborator

Fix #620

  • peer.rs — replaced the three #[ignore]d todo!() stubs with ports of charon's p2p/peer_test.go: new_tcp_host, new_quic_host, verify_p2p_key_accepts_cluster_keys, peer_id_key. Plus new_host_without_listen_addrs, charon's own assertion that both node types build from an empty config (outgoing-only nodes).
  • utils.rs — address classifiers with positive/negative multiaddrs, addr_type/addr_protocol, filter_direct_quic_addrs, has_direct_{quic,tcp}_conn, and a verbatim port of charon's TestFilterAdvertisedAddrs table.
  • quic_upgrade.rsQuicUpgradeBackoff table test (1 → doubling → 512 cap), should_skip countdown, per-peer isolation, clear_backoff.
  • force_direct.rs — the forcing path plus every skip condition, including the all-relay guard. Asserts the selected addresses, not just the dialled peer ID.
  • proto.rs — varint framing round-trip across the 1→2 byte prefix boundary, sequential frames, oversize and truncation.
  • bootnode.rsmulti_addr_from_enr_str: port mapping table, EnrNoIp, EnrNoPort, garbage inputs.

33 tests added; no #[ignore] or todo!() left in crates/p2p.

@emlautarom1 emlautarom1 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only one potential issue by relying on the debug format of an external type (a bit too brittle). The deviation is minor considering that at the end of the day the ordering does not matter since it's consumed by a hashset, but we can cleanup the code by matching the exact behavior. Rest are nits.

Comment thread crates/p2p/src/force_direct.rs Outdated
Comment thread crates/p2p/src/utils.rs Outdated
Comment thread crates/p2p/src/utils.rs Outdated
Comment thread crates/p2p/src/peer.rs Outdated
@iamquang95
iamquang95 requested a review from emlautarom1 August 26, 2026 11:03
@iamquang95
iamquang95 merged commit 6c83d7a into main Aug 28, 2026
17 checks passed
@iamquang95
iamquang95 deleted the feat/fix-620 branch August 28, 2026 02:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement the missing p2p peer tests and cover the zero-test modules

2 participants