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.
This commit is contained in:
Arseniy Klempner 2026-05-17 22:17:20 -06:00
parent d0a7927844
commit b3b71bc2a5
No known key found for this signature in database
GPG Key ID: 51653F18863BD24B
4 changed files with 34 additions and 4 deletions

View File

@ -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 <repo> 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:

View File

@ -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; }

View File

@ -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)

@ -1 +1 @@
Subproject commit 61d366173cd095f9491f9fd49c3c452b14f930d8
Subproject commit 430998ec9e19cabe2f0dd50915566bc6ddffaa41