mirror of
https://github.com/logos-messaging/logos-delivery.git
synced 2026-08-26 11:01:13 +00:00
Three related fixes that together let `nimble test` (the
`all_tests_waku` aggregate target) compile and link cleanly against
libp2p v2.0.0:
1) `tests/test_peer_manager.nim` — nph reformat. Three hunks reflowed
around `SwitchBuilder.new().withRng(...).build()` line wrapping. No
logic changes; purely whitespace to satisfy the Lint workflow which
gates PRs stacked on top of this one.
2) Excise the orphan `waku_noise` module from the test build. The
noise code is not part of any production code path (verified: the
wakunode2 / chat2mix builds pass without it), and its
`noise_utils.genKeyPair` no longer compiles against libp2p v2.0.0
(`EllipticCurveKey.random` now takes the `Rng` wrapper). Rather
than port noise (which would be wasted effort for unreachable
code), drop it from the test aggregate:
- `tests/all_tests_waku.nim`: remove `./test_waku_noise` and
`./test_waku_noise_sessions` entries with a comment pointing at
the rationale.
- `tests/testlib/common.nim`: add a `randomSeqByte` sibling of the
existing `rng()` template (copied verbatim from
`waku_noise/noise_utils.randomSeqByte`). This is the only helper
three non-noise tests were reusing from `noise_utils`.
- `tests/test_waku_keystore.nim`,
`tests/test_waku_keystore_keyfile.nim`,
`tests/node/test_wakunode_relay_rln.nim`: drop the
`from waku/waku_noise/noise_utils import randomSeqByte` line.
They already import `./testlib/common` which now provides it.
The `waku/waku_noise/` source files themselves are not deleted —
that's a larger cleanup PR's job. They just stop being compiled.
3) Complete the v2.0.0 `Rng` wrapper migration in two more sites
that the noise excision exposed:
- `tests/test_waku_switch.nim`: `.withRng(rng())` and the two
`newWakuSwitch(rng = rng(), ...)` call sites now use
`crypto.newRng()` (the `Rng` wrapper). Added the
`libp2p/crypto/crypto` import.
- `channels/reliable_channel.nim`: the `rng` field is typed
`ref HmacDrbgContext`, but `libp2p_crypto.newRng()` now returns
the `Rng` wrapper. Construct an `HmacDrbgContext` directly via
`HmacDrbgContext.new()` (from `bearssl/rand`) to match the
field shape without changing surface area.
Validation: `nim c --passL:librln_v2.0.2.a --passL:-lm tests/all_tests_waku.nim`
exits 0 (60 MB binary produced). The previous tip failed compile at
`noise_utils.nim:154`, then would have cascaded through `test_waku_switch`,
`reliable_channel.nim`. All three are now fixed.
Out of scope:
- Deleting waku_noise/ source files (separate cleanup).
- Windows boringssl key-not-found (#48 — separate platform issue).