nim-chat-poc/RUN_SLIM_TESTNET.md

30 lines
1.8 KiB
Markdown
Raw Normal View History

feat: mix+LEZ+RLN chat over the testnet via 2-phase gifter Chat-side integration of the LEZ-backed RLN mix protocol: - src/chat/delivery/waku_client.nim: mount waku_mix with onchain RLN spam protection wired to logos_core_client fetchers; gate the first publish on (a) gifter status confirmation, (b) cushion of 2 poll intervals after confirmation, and (c) proof root stability in the local valid_roots window; wrap mix lightpush in withTimeout so vanished SURB replies surface as Err instead of pinning the send coroutine. - src/chat/client.nim: surface sendBytes errors via asyncSpawn wrapped try/except instead of discarding the future (was hiding every mix-publish failure). - chat-side gifter client invocation (RLN membership service wire format, EIP-191 ethereum-allowlist auth). - Background membership status watcher that reconciles the optimistic leaf returned by the gifter against the chain's authoritative leaf via the status RPC. Simulation harness (simulations/mix_lez_chat/): - Spin up sequencer + run_setup + 4 mix nodes (one of which runs the gifter service) + chat sender + chat receiver. - SIM_NETWORK={local,testnet}, SIM_SLIM for testnet (reuses shipped config_account + cached payment_account), Docker image + GHCR for cross-platform testing. - Strict mix-pool readiness gate, kademlia + RLN root activity checks, gifter EIP-191 auth fixture, slim-mode submodule minimization. - TREE_ID_HEX pinned to the canonical testnet deployment. Submodule bumps: - vendor/nwaku to 8e6ba04 (LEZ-backed RLN mix + 2-phase gifter). - vendor/logos-lez-rln to 950f287 (SPEL RLN program + mix sim infrastructure + canonical testnet deploy). Docs: - RUN_SLIM_TESTNET.md: slim sim recipe. - cleanup/MODE_A_GIFTER_SLOT_BUG.md: per-signer nonce collision postmortem driving the queue+worker fix.
2026-05-28 10:53:36 -06:00
# Slim sim against latest testnet deployment
```bash
git clone -b feat/sim-rln-gifter-auth-v2 git@github.com:logos-messaging/logos-chat.git
cd logos-chat && git submodule update --init --recursive
SIM_NETWORK=testnet SIM_SLIM=1 SIM_DELIVERY_TIMEOUT=1800 \
bash simulations/mix_lez_chat/run_simulation.sh --fresh
```
~15-25 min depending on testnet block timing. Pass: **ALL 15 CHECKS PASSED**.
Slim mode reuses the on-chain RLN programs at the shipped `TREE_ID` (committed in `vendor/logos-lez-rln/testnet/`) — no fresh deploy. The shipped payment account holds 1B RLNTOK (~1000 registrations) drawn from a 10B supply, refilled by re-running `vendor/logos-lez-rln/lez-rln/target/debug/run_setup` against testnet when needed.
`SIM_DELIVERY_TIMEOUT=1800` (30 min) is required: the gifter now serializes registrations through a single-writer worker that awaits chain confirmation between submissions to avoid per-signer nonce collisions. With testnet's ~60-90 s block cadence and up to ~6 jobs ahead in the queue, the chat sender (last in line) needs the longer delivery window. The default 300 s value would expire before its registration confirms.
If a run still fails after a clean retry: the most likely cause is a stale `~/.logos-lez-rln/payment_account_<TREE_ID>.txt` cache from a previous shipped TREE_ID. Wipe with:
```bash
rm -f ~/.logos-lez-rln/payment_account_*.txt \
~/.logos-lez-rln/supply_holding_*.txt \
vendor/logos-lez-rln/testnet/storage.json \
vendor/logos-lez-rln/testnet/wallet_config.json
```
and re-run — `seed_copy` will then re-seed from the shipped sidecars.
If you haven't built the modules on this machine before, run `bash simulations/mix_lez_chat/setup_and_run.sh` once first to build the dylibs.
Background on the bug class this used to hit: `cleanup/MODE_A_GIFTER_SLOT_BUG.md`.