11 Commits

Author SHA1 Message Date
Arseniy Klempner
720867c2ef
sim+chain: strict mix-pool readiness gate + bump nwaku for RLN race work
simulations/mix_lez_chat/run_simulation.sh:
- Strict mix-pool readiness wait: now requires NUM_NODES-1 client
  registrations succeeded on the gifter (one per non-gifter mix node)
  AND a "Gifter self-registered as mix relay" log line on node0 —
  not just GR>=3 which could pass while node0 itself hadn't yet
  finished its own membership flow. Lets every mix node actually be
  ready to generate forward proofs before sender starts.
- Bumps testnet KADEMLIA_HARD_CAP to 1800s (30 min). Testnet block
  times + finality lag put 4 sequential mix-node registrations well
  beyond the old 600s ceiling.

vendor/nwaku bump pulls in:
- unified get_merkle_proofs that returns valid_roots atomically;
- self-verify in spam_protection.generateProof;
- ExternalMerkleProof.validRoots field + pollLoop refresh from it;
- proofRoot/getPollInterval accessors on OnchainLEZGroupManager;
- confirmMembershipLeafIndex helper (unused — wiring foundation for a
  follow-up background watcher to close the slot-allocation race).
2026-05-20 21:13:20 -06:00
Arseniy Klempner
0257fdf443
feat(chat): gate first publish on proof root stability in valid_roots
Replaces the blind 30s post-RLN-ready sleep in sendBytes with a
poll-based wait: capture our cachedProof's merkle root, then wait
until it has been present in our own rootTracker for ≥2 poll cycles
(cap 180s, warn-and-publish on cap). Adaptive to the underlying
chain's block cadence — solves the testnet RLN root-drift race
where a 30-42s sleep wasn't enough for mix-node verifiers to poll
the post-registration root, so proofs failed with
"Spam protection proof verification failed" at mix entry.

Non-OnchainLEZ group managers retain the 30s fallback.

Bumps vendor/nwaku to pick up the OnchainLEZGroupManager.proofRoot +
getPollInterval accessors this gate uses.

Also drops the deprecated logos-cpp-sdk override on the nix-fetched
LOGOSCORE: overriding the SDK breaks liblogos 7df6195's source
(stale requestObject/onEvent shape). Plugins via logos-module-builder
ship the newer SDK and are ABI-compatible with the native build.
2026-05-20 11:54:57 -06:00
Arseniy Klempner
5c3a85a063
chore: bump logos-cpp-sdk to 1468180b in sim runner + lez-rln submodule
Cascades the chain-wide SDK pin bump (a4bd66c → 1468180b) into:
  - simulations/mix_lez_chat/run_simulation.sh: logoscore nix-build
    override-input
  - vendor/logos-lez-rln submodule pointer

All override-inputs in the build chain now agree on rev 1468180b, which
provides invokeRemoteMethodAsync. Avoids the mixed-rev ABI hazard where
a plugin compiled against one SDK rev would silently segfault against
a libsdk compiled against a different rev.
2026-05-19 12:51:29 -06:00
Arseniy Klempner
b3b71bc2a5
feat(sim): slim-mode submodule minimization
Three changes:
- vendor/logos-lez-rln bump: drops unused top-level logos-delivery
  submodule (~1.3 GB saved per fresh clone).
- setup_and_run.sh: gate lssa + logos-execution-zone-module init on
  SIM_NETWORK=local (or SIM_FULL_SUBMODS=1). Default Docker setup now
  pulls only logos-delivery-module (+ nested logos-delivery), saving
  ~11 GB of lssa for slim/testnet fresh clones.
- run_simulation.sh: stop requiring lssa/ to exist when discovering
  LEZ_RLN_DIR in the sibling-checkout layout.
- README: slim-mode minimum-submodule recipe + rationale.
2026-05-17 22:17:20 -06:00
Arseniy Klempner
8977064671
feat(sim): testnet pipeline with seed bootstrap, slim mode, polish
Adds a SIM_NETWORK=testnet path to mix_lez_chat that:

- Skips local sequencer launch; reachability-checks the testnet RPC
  up front.
- Selects vendor/logos-lez-rln/testnet/ for wallet config + persistent
  state. Default flow runs run_setup against the deployed RLN program
  (is_initialized short-circuits to create_funded_user).
- Bootstraps from the submodule-shipped artifacts on first run:
  copies testnet/storage.json.seed -> testnet/storage.json and
  testnet/{supply_holding,payment_account}.txt ->
  ~/.logos-lez-rln/{supply_holding,payment_account}_<tree>.txt. Lets
  a fresh-clone dev reuse the canonical deployment.
- Adds SIM_SLIM=1 opt-in: skip run_setup entirely, use the shipped
  config_account + cached payment_account. Saves devs from building
  the lez-rln Rust toolchain (and transitively the lssa nested
  submodule).
- Raises timing floors for testnet block times (~60s vs local ~15s);
  adds KADEMLIA_HARD_CAP and SIM_PERSIST_LOCAL escape hatches.
- Polled-readiness loops replace fixed sleeps (kademlia mesh, mix
  peer counts, receiver join, delivery — each with bounded retry).
- Extracted seed_copy and wait_method_calls helpers; dropped a stale
  mix-peer kademlia gate (static mixNodes config seeds the pool via
  processBootNodes — kademlia counts are diagnostics only).

README updated with the testnet-flow + slim-mode + fresh-clone story.
2026-05-17 18:59:31 -06:00
Arseniy Klempner
bba01ee9dc
feat(sim): exercise rln-gifter EIP-191 auth in mix_lez_chat sim
Wires the existing mix_lez_chat simulation to drive the gifter's
EIP-191 allowlist auth path end-to-end:

* bumps vendor/nwaku and vendor/logos-lez-rln (and, transitively,
  logos-delivery-module and its bundled logos-delivery copy) to pick up
  the auth plugin, the auto-registering client's EIP-191 signing, and
  the new --mix-gifter-allowlist / --mix-gifter-auth-key CLI flags.
* adds a `gifterAuthKey` knob on WakuConfig + the JSON config bridge in
  client_api so chat sender/receiver instances sign their gifter
  requests too.
* commits 5 fixed test secp256k1 keys (one per non-gifter mix node and
  per chat client) under simulations/mix_lez_chat/fixtures/gifter_auth/
  along with their derived addresses.
* run_simulation.sh sources keys.env+addresses.env, sets
  `mixGifterAllowlist` on mix node 0, and threads the matching
  `mixGifterAuthKey` / `gifterAuthKey` into nodes 1-3 and the
  receiver/sender configs.

Test fixtures only — keys must never be reused outside this sim.
2026-05-13 11:10:27 -06:00
Arseniy Klempner
6c12e6a003
fix: fetch tags when pinning lssa for sequencer build 2026-05-13 10:09:28 -06:00
Arseniy Klempner
1a01e93c02
docs: update sim instructions for SPEL backend 2026-05-12 13:54:10 -06:00
Arseniy Klempner
932627d636
fix: update sim for SPEL 32-byte tree_id and submodule restore
TREE_ID_HEX updated from 24 to 32 bytes to match SPEL's tree_id format,
fixing stale payment account lookup that caused silent registration
failures (KeyNotFound error 8).

setup_and_run.sh now restores working tree files in all nested
submodules after git submodule update --init, which resets them.
2026-05-12 13:24:46 -06:00
Arseniy Klempner
9d368aeb44
build: add Docker image + GHCR for cross-platform simulation testing
Multi-stage Dockerfile pre-builds all heavy nix dependencies. Runtime
image (~8.5GB) at ghcr.io/adklempner/logos-chat-sim:latest includes
nix store closure + Rust + cargo-risczero/r0vm + system clang.

run_in_docker.sh pulls from GHCR, symlinks pre-built modules, builds
sequencer + run_setup from source (~10 min per run).

Update vendor/logos-lez-rln to a591645 (rebased onto main with
member-expiry merged, single squashed commit).

Add INSTRUCTIONS.md with macOS, Linux (native), and Docker instructions.
2026-05-11 18:30:28 -06:00
Arseniy Klempner
695ecb42bc
feat: add mix+LEZ chat simulation with Docker support
End-to-end simulation: 4 mix nodes with RLN spam protection, LEZ
sequencer, gifter service, and two logos-chat-module clients exchanging
double-ratchet-encrypted messages through 3-hop Sphinx onion routes.

Simulation scripts:
- run_simulation.sh: orchestrates sequencer, mix nodes, chat clients,
  with poll-based readiness checks and 15 verification checks
- setup_and_run.sh: one-shot build + run for fresh clones
- run_in_docker.sh: Docker-based Linux testing with pre-built modules
- README.md: configuration, troubleshooting, architecture guide

Configurable via SIM_* env vars (ports, timeouts, log level).
Cross-platform: macOS native + Linux via Docker.

Docker image (Dockerfile.sim) uses multi-stage build:
- Stage 1: builds all LEZ modules, sequencer, liblogoschat, chat-module
- Stage 2: copies only runtime nix closure (~1.9GB) + output artifacts
- Pre-built modules are symlinked at runtime, skipping build_all.sh
2026-05-06 10:50:14 -06:00