From b3b71bc2a5081a623624b96774500da8768dfe49 Mon Sep 17 00:00:00 2001 From: Arseniy Klempner Date: Sun, 17 May 2026 22:17:20 -0600 Subject: [PATCH] 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. --- simulations/mix_lez_chat/README.md | 21 +++++++++++++++++++++ simulations/mix_lez_chat/run_simulation.sh | 2 +- simulations/mix_lez_chat/setup_and_run.sh | 13 +++++++++++-- vendor/logos-lez-rln | 2 +- 4 files changed, 34 insertions(+), 4 deletions(-) diff --git a/simulations/mix_lez_chat/README.md b/simulations/mix_lez_chat/README.md index 1622be1..cfbc91b 100644 --- a/simulations/mix_lez_chat/README.md +++ b/simulations/mix_lez_chat/README.md @@ -119,6 +119,27 @@ What stays shared vs. fresh: **Security:** the supply signing key being in the repo is acceptable only because testnet does not charge gas and the tokens are test tokens with no real value. +### Slim mode (`SIM_SLIM=1`, testnet only) + +`SIM_SLIM=1 SIM_NETWORK=testnet ./run_simulation.sh --fresh` skips `run_setup` entirely and reuses the shipped `config_account` + cached `payment_account` from `vendor/logos-lez-rln/testnet/`. Two consequences: + +- No `lez-rln/run_setup` binary build is required. Combined with the submodule split below, a fresh clone can run the sim without ever invoking `cargo` from `lez-rln/`. +- All slim-mode runs share one on-chain payment account — concurrent runs across devs will race on its nonce. Use serially. + +**Minimum submodule set for slim mode:** + +```bash +git clone --branch feat/logos-delivery logos-chat +cd logos-chat +git submodule update --init vendor/logos-lez-rln vendor/nwaku vendor/nimbus-build-system vendor/nim-protobuf-serialization vendor/npeg vendor/blake2 vendor/libchat vendor/nim-ffi +(cd vendor/logos-lez-rln && git submodule update --init logos-delivery-module) +(cd vendor/logos-lez-rln/logos-delivery-module && git submodule update --init --recursive vendor/logos-delivery) +``` + +The previously-required `lssa` (~11 GB) and `logos-execution-zone-module` clones are unnecessary for slim mode — both are fetched via nix flake from GitHub when building the wallet/RLN modules. The top-level `vendor/logos-lez-rln/logos-delivery` submodule was removed entirely (the active copy is the nested `logos-delivery-module/vendor/logos-delivery`). + +For the local-sequencer flow (`SIM_NETWORK=local`) or to hack on the wallet/sequencer source, init the extras: `(cd vendor/logos-lez-rln && git submodule update --init lssa logos-execution-zone-module)`. The Docker bootstrap (`setup_and_run.sh`) gates these on `SIM_NETWORK=local` automatically; pass `SIM_FULL_SUBMODS=1` to force the wide init. + ## `--fresh` behavior When `--fresh` is passed: diff --git a/simulations/mix_lez_chat/run_simulation.sh b/simulations/mix_lez_chat/run_simulation.sh index e4db098..26afbc2 100755 --- a/simulations/mix_lez_chat/run_simulation.sh +++ b/simulations/mix_lez_chat/run_simulation.sh @@ -22,7 +22,7 @@ if [ -z "$LEZ_RLN_DIR" ] && [ -d "$LOGOS_CHAT_DIR/vendor/logos-lez-rln/lez-rln" fi for candidate in "$LOGOS_CHAT_DIR/.." "$LOGOS_CHAT_DIR/../logos-lez-rln"; do [ -n "$LEZ_RLN_DIR" ] && break - [ -d "$candidate/lez-rln" ] && [ -d "$candidate/lssa" ] && LEZ_RLN_DIR="$(cd "$candidate" && pwd)" && break + [ -d "$candidate/lez-rln" ] && LEZ_RLN_DIR="$(cd "$candidate" && pwd)" && break done [ -z "$LEZ_RLN_DIR" ] && { echo "FATAL: Cannot find logos-lez-rln repo. Set LEZ_RLN_DIR or run: git submodule update --init --recursive"; exit 1; } diff --git a/simulations/mix_lez_chat/setup_and_run.sh b/simulations/mix_lez_chat/setup_and_run.sh index 15b61fc..ede0b4d 100755 --- a/simulations/mix_lez_chat/setup_and_run.sh +++ b/simulations/mix_lez_chat/setup_and_run.sh @@ -63,10 +63,19 @@ elif [ -f "/tmp/guest-bins/rln_registration.bin" ]; then log "Using guest binaries from /tmp/guest-bins/" fi log "Initializing nested submodules in vendor/logos-lez-rln..." +# Slim default: only logos-delivery-module (+ its nested logos-delivery) is +# required to build the chat/delivery/mix Nim modules. lssa and +# logos-execution-zone-module are fetched via flake.nix from GitHub when nix +# builds the wallet/rln modules, so the local clones aren't needed unless the +# dev is running a local sequencer (SIM_NETWORK=local) or hacking those repos. +SUBMODS=(logos-delivery-module) +if [ "${SIM_NETWORK:-testnet}" = "local" ] || [ "${SIM_FULL_SUBMODS:-0}" = "1" ]; then + SUBMODS+=(lssa logos-execution-zone-module) +fi (cd vendor/logos-lez-rln && \ - git submodule update --init lssa logos-delivery logos-delivery-module logos-execution-zone-module && \ + git submodule update --init "${SUBMODS[@]}" && \ git checkout -- . && \ - for d in lssa logos-delivery logos-delivery-module logos-execution-zone-module; do \ + for d in "${SUBMODS[@]}"; do \ (cd "$d" && git checkout -- .); \ done && \ cd logos-delivery-module && git submodule update --init vendor/logos-delivery) diff --git a/vendor/logos-lez-rln b/vendor/logos-lez-rln index 61d3661..430998e 160000 --- a/vendor/logos-lez-rln +++ b/vendor/logos-lez-rln @@ -1 +1 @@ -Subproject commit 61d366173cd095f9491f9fd49c3c452b14f930d8 +Subproject commit 430998ec9e19cabe2f0dd50915566bc6ddffaa41