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).
This commit is contained in:
Arseniy Klempner 2026-05-20 21:13:20 -06:00
parent 0257fdf443
commit 720867c2ef
No known key found for this signature in database
GPG Key ID: 51653F18863BD24B
2 changed files with 15 additions and 4 deletions

View File

@ -95,7 +95,9 @@ esac
# Timing floors: local sequencer ~15s blocks vs testnet ~60s + more variance.
if [ "$SIM_NETWORK" = testnet ]; then
KADEMLIA_MIN_WAIT=${SIM_KADEMLIA_MIN_WAIT:-120}
KADEMLIA_HARD_CAP=${SIM_KADEMLIA_HARD_CAP:-600}
# Testnet block times + finality lag can stretch RLN tx confirmations to
# multiple minutes per mix node. 4 nodes × ~5 min each + slack ≈ 30 min.
KADEMLIA_HARD_CAP=${SIM_KADEMLIA_HARD_CAP:-1800}
RECEIVER_MIN_WAIT=${SIM_RECEIVER_MIN_WAIT:-60}
DELIVERY_TIMEOUT=${SIM_DELIVERY_TIMEOUT:-300}
NODE_STARTUP_SLEEP=${SIM_NODE_STARTUP_SLEEP:-30}
@ -433,9 +435,18 @@ done
# the kad-peer count is logged only for diagnostics.
echo " Waiting for kademlia propagation + RLN convergence..."
KADEMLIA_T0=$SECONDS
# Mix circuits drop sphinx packets at any hop whose RLN credentials aren't
# yet confirmed on-chain (Plugin not ready). Wait for ALL mix nodes to be
# fully registered before starting chat:
# - node0 (gifter) self-registers — logs "Gifter self-registered as mix relay"
# - node1..N-1 each register via gifter — node0 logs "RLN gifter
# registration succeeded" once per client.
# Required: 1 self-reg + (NUM_NODES - 1) client regs.
REQUIRED_CLIENT_REGS=$((NUM_NODES - 1))
while true; do
ELAPSED=$((SECONDS - KADEMLIA_T0))
GR=$(sed 's/\x1b\[[0-9;]*m//g' "$STATE_DIR/node0.log" 2>/dev/null | grep -c "RLN gifter registration succeeded" || true); GR=${GR:-0}
SELF=$(sed 's/\x1b\[[0-9;]*m//g' "$STATE_DIR/node0.log" 2>/dev/null | grep -c "Gifter self-registered as mix relay" || true); SELF=${SELF:-0}
LR=0
MIX_PEERS_PER_NODE=""
for i in $(seq 0 $((NUM_NODES - 1))); do
@ -445,11 +456,11 @@ while true; do
MP=$(sed 's/\x1b\[[0-9;]*m//g' "$LOG" 2>/dev/null | grep -c "mix peer added via kademlia lookup" || true); MP=${MP:-0}
MIX_PEERS_PER_NODE="${MIX_PEERS_PER_NODE}n${i}=${MP} "
done
if [ "$ELAPSED" -ge "$KADEMLIA_MIN_WAIT" ] && [ "$GR" -ge 3 ] && [ "$LR" -ge 40 ]; then break; fi
if [ "$ELAPSED" -ge "$KADEMLIA_MIN_WAIT" ] && [ "$GR" -ge "$REQUIRED_CLIENT_REGS" ] && [ "$SELF" -ge 1 ] && [ "$LR" -ge 40 ]; then break; fi
[ "$ELAPSED" -ge "$KADEMLIA_HARD_CAP" ] && break
sleep 1
done
log " Kademlia ready after $((SECONDS - KADEMLIA_T0))s ($GR gifter regs, $LR LEZ root events, kad mix peers: $MIX_PEERS_PER_NODE)"
log " Kademlia ready after $((SECONDS - KADEMLIA_T0))s ($GR/$REQUIRED_CLIENT_REGS client regs, self=$SELF, $LR LEZ root events, kad mix peers: $MIX_PEERS_PER_NODE)"
RECEIVER_LOG="$STATE_DIR/chat_receiver.log"
SENDER_LOG="$STATE_DIR/chat_sender.log"

2
vendor/nwaku vendored

@ -1 +1 @@
Subproject commit 81c700ad80197069b4fdb9d43fb8886c1fca54a6
Subproject commit 33d9d89e00be774d33ceafd3d59755d5a1089bb4