Three small classes of fix across 12 test files (uncovered by a local
`nim c` sweep of tests/all_tests_common.nim + tests/all_tests_waku.nim):
1. `rng` no longer auto-calls when used as an argument: libp2p v2.0.0
exports its own `rng` symbol (SwitchBuilder field), so Nim's resolver
sees the testlib `common.rng` template ambiguously and stops auto-
calling it. Add explicit `()`:
- tests/test_helpers.nim
- tests/waku_filter_v2/waku_filter_utils.nim
- tests/waku_lightpush/lightpush_utils.nim
- tests/waku_lightpush_legacy/lightpush_utils.nim
- tests/node/test_wakunode_filter.nim
- tests/waku_store/store_utils.nim
2. `PeerId.random()` zero-arg form removed in v2.0.0; new signature
takes `rng: Rng`. Add `newRng()` + `libp2p/crypto/crypto` import:
- tests/common/test_requestratelimiter.nim
- tests/common/test_ratelimit_setting.nim
3. `some()` ambiguity vs `Opt.some` — files that don't directly
`import std/options` get `Opt.some` template only, breaking calls
intended for `Option[T]`. Add `std/options` to imports:
- tests/waku_store/test_wakunode_store.nim
- tests/waku_relay/test_wakunode_relay.nim
4. Two more API removals:
- tests/testlib/wakunode.nim — `builders.MaxConnections` was removed;
use `DefaultMaxConnections` from `libp2p/connmanager`.
- tests/waku_rln_relay/utils_onchain.nim — `keys.PrivateKey.random
(rng[])` `rng` ambiguous between testlib/common and eth/keys
exports; qualify as `common.rng()[]`.
There are still more test-compile errors past this point — this is
incremental progress, not a complete v2.0.0 test-suite migration.
libp2p v2.0.0's 3-arg `random(T, scheme, rng)` overload now takes the
`Rng` wrapper type instead of `var HmacDrbgContext`. My prior
`common.rng()[]` (deref) attempt resolves to `HmacDrbgContext` which
no longer matches.
Wrap our existing `ref HmacDrbgContext` (from `common.rng`) via
`newBearSslRng` to get an `Rng` value, satisfying the new signature
without re-seeding a fresh PRNG on every key generation.
nimble.lock:
Stale lockfile (inherited from master at rebase time) pinned libp2p
to ff8d51857, jwt to 18f8378de, json_rpc to status-im 43bbf499, etc.
— all incompatible with this PR's waku.nimble pin set, and nimble's
vnext SAT solver was falling back to the global packages.json
registry (which still maps `jwt` → yglukhov/nim-jwt) when the
lockfile/active-pin conflict couldn't be reconciled. That registry
lookup tried to clone yglukhov/nim-jwt at SHA 057ec95… which only
exists on the vacp2p fork, so the build aborted.
Regenerated via `nimble lock`. Resulting pins now reflect what
waku.nimble + libp2p v2.0.0 actually require: libp2p c43199378,
jwt 057ec95, websock 387a8eb7, json_rpc f05fad25 (chaitanyaprem
fork), lsquic 3813b849, libp2p_mix 50c4ab4f, mix_rln_spam_protection
23b278b4.
Hand-fixed one nimble vnext bug: mix_rln_spam_protection's
`vcsRevision` was generated as the local logos-delivery HEAD SHA
instead of the plugin's HEAD; replaced with 23b278b4… (matches
`version` field's URL+SHA spec and the cached package).
tests/testlib/wakucore.nim:
libp2p v2.0.0 also exports a `rng` symbol (the new `Rng` wrapper
type), making the unqualified `rng[]` calls here ambiguous against
the local `common.rng` template (returns `ref HmacDrbgContext`).
Qualify the three call sites as `common.rng()[]` so we keep the
`ref HmacDrbgContext` value that `libp2p_keys.PrivateKey.random` /
`KeyPair.random` expect.
libp2p v2.0.0's `crypto.newRng()` returns the new `Rng` wrapper type,
which can't be assigned to a `ref HmacDrbgContext` field. The two test
helper modules (tests/testlib/common.nim and tests/test_helpers.nim)
both fall in this pattern; rest of the codebase migrated in the prior
sweep but these two test-only files were missed because they don't
compile during the wakunode2 / chat2mix builds — only when the test
target is built (which CI does, locally we didn't until this PR).
Same fix pattern as the other newRng → HmacDrbgContext.new() migrations.
* any port set to 0 on conf results in a random port bound
* Debug API MyBoundPorts reports actually bound ports for all services, reports 0 if disabled
* write back bound values to both WakuConf and WakuNode.ports
* setupDiscoveryV5 returns Result and errors out on port 0
* rename setupAndStartDiscv5WithAutoPort to setupAndStartDiscv5
* updateWaku ENR rebuild now runs after discv5 startup
* Add DefaultP2pTcpPort, DefaultDiscv5UdpPort, DefaultWebSocketPort, DefaultRestPort, DefaultMetricsHttpPort
* add tests
* introduce createNode
# Conflicts:
# apps/wakunode2/cli_args.nim
* remove confutils dependency on the library
* test: remove websocket in default test config
* update to latest specs
* test: cli_args
* align to spec changes (sovereign, message conf, entrypoints
* accept enr, entree and multiaddr as entry points
* post rebase
* format
* change from "sovereign" to "core"
* add example
* get example to continue running
* nitpicks
* idiomatic constructors
* fix enum naming
* replace procs with consts
* remove messageConfirmation
* use pure enum
* rename example file
* Reserve `networkconfig` name to waku network related settings
* Rename cluster conf to network conf
A `NetworkConf` is a Waku network configuration.
# Conflicts:
# tests/factory/test_waku_conf.nim
# Conflicts:
# tests/factory/test_waku_conf.nim
* Improve sharding configuration
A smarter data types simplifies the logic.
* Fixing tests
* fixup! rename to endpointConf
* wip: autosharding is a specific configuration state and treat it like
it
# Conflicts:
# waku/factory/external_config.nim
* refactor lightpush handler
some metrics error reporting were missing
# Conflicts:
# waku/waku_lightpush/protocol.nim
* test_node_factory tests pass
* remove warnings
* fix tests
* Revert eager previous replace-all command
* fix up build tools compilation
* metadata is used to store cluster id
* Mount relay routes in static sharding
* Rename activeRelayShards to subscribeShards
To make it clearer that these are the shards the node will subscribe to.
* Remove unused msg var
* Improve error handling
* Set autosharding as default, with 1 shard in network
Also makes shards to subscribe to all shards in auto sharding, none in
static sharding.
* properly pass userMessageLimit to OnchainGroupManager
* waku.nimble 2.2.4 Nim compiler
* rm stew/shims/net import
* change ValidIpAddress.init with parseIpAddress
* fix serialize for zerokit
* group_manager: separate if statements
* protocol_types: add encode UInt32 with zeros up to 32 bytes
* windows build: skip libunwind build and rm libunwind.a inlcusion step
* bump nph to overcome the compilation issues with 2.2.x
* bump nim-libp2p to v1.10.1
Split `WakuNodeConfig` object for better separation of concerns and to introduce a tree-like structure to configuration.
* fix: ensure twn cluster conf is still applied when clusterId=1
* test: remove usage of `WakuNodeConf`
* Remove macro, split builder files, remove wakunodeconf from tests
* rm network_conf_builder module as it is not used
---------
Co-authored-by: NagyZoltanPeter <113987313+NagyZoltanPeter@users.noreply.github.com>
Co-authored-by: Ivan Folgueira Bande <ivansete@status.im>
* queue driver refactor (#2753)
* chore(archive): archive refactor (#2752)
* chore(archive): sqlite driver refactor (#2754)
* chore(archive): postgres driver refactor (#2755)
* chore(archive): renaming & copies (#2751)
* posgres legacy: stop using the storedAt field
* migration script 6: we still need the id column
The id column is needed because it contains the message digest
which is used in store v2, and we need to keep support to
store v2 for a while
* legacy archive: set target migration version to 6
* waku_node: try to use wakuLegacyArchive if wakuArchive is nil
* node_factory, waku_node: mount legacy and future store simultaneously
We want the nwaku node to simultaneously support store-v2
requests and store-v3 requests.
Only the legacy archive is in charge of archiving messages, and the
archived information is suitable to fulfill both store-v2 and
store-v3 needs.
* postgres_driver: adding temporary code until store-v2 is removed
---------
Co-authored-by: Ivan FB <128452529+Ivansete-status@users.noreply.github.com>
Co-authored-by: gabrielmer <101006718+gabrielmer@users.noreply.github.com>
Co-authored-by: Ivan Folgueira Bande <ivansete@status.im>
* Add postgres_driver/migrations.nim
* Postgres and archive logic adaptation to the migration implementation
* libwaku: adapt node_lifecycle_request.nim to migration refactoring
* test_app.nim: add more detail for test that only fails in CI
* postgres migrations: store the migration scripts inside the resulting wakunode binary instead of external .sql files.
* Add ligthpush payload tests.
* Add end to end lightpush tests.
* updating vendor/nim-unittest2 to protect against core dump issue
* Enable "Valid Payload Sizes" test again
---------
Co-authored-by: Ivan FB <128452529+Ivansete-status@users.noreply.github.com>
* message.nim: set max message size to 150KiB according to spec
Using KiB instead of KB because that seems more aligned with
the actual default defined in nim-libp2p (1024 * 1024)
Spec details: https://rfc.vac.dev/spec/64/#message-size
* test_protocol.nim: align test to current WakuMessage limit
* test_waku_client.nim: adapt test to MaxWakuMessageSize change
* make maxMessageSize configurable for wakunode2
* wakunode2 app now accepts max-num-bytes-msg-size with KiB, KB, or B units
* testlib/wakunode.nim: set maxMessageSize: "1024 KiB"
* test_waku_client.nim: remove duplicate check in "Valid Payload Sizes"
* set DefaultMaxWakuMessageSizeStr as the only source of truth
* external_config.nim: rename max-num-bytes-msg-size -> max-msg-size
This reverts commit dc1d6ce4bf7390e23b73d96634ff87ca9341e129.
We need to revert this commit because
the waku-simulator stopped working. i.e. the nodes couldn't establish
connections among them: 054ba9e33f
Also, the following js-waku test fails due to this commit:
"same cluster, different shard: nodes connect"
* waku_lightpush/protocol.nim: minor changes to make it compile after revert