From 858e304de6ea66f276eebd09ca70ba9fa8f44023 Mon Sep 17 00:00:00 2001 From: Andrea Franz Date: Thu, 30 Jul 2026 15:09:21 +0000 Subject: [PATCH] test(amm-ui): feed setup password via stdin so bootstrap never blocks --- apps/amm/tests/README.md | 17 ++++++++--------- apps/amm/tests/testnet/setup-amm-testnet.sh | 14 +++++++------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/apps/amm/tests/README.md b/apps/amm/tests/README.md index 62fdf8f..b316c6b 100644 --- a/apps/amm/tests/README.md +++ b/apps/amm/tests/README.md @@ -52,15 +52,14 @@ nix build .#integration-test -L ## Notes -- **Wallet password.** The wallet's key storage is encrypted with a password, - which you enter to **unlock** the wallet so the app can sign transactions (the - UI's **Connect** modal). During first-time setup you're prompted once for a - password (read from the terminal — it can't be scripted), but **that wallet is - a throwaway**: `restore-keys` then rebuilds it from the test mnemonic and sets - the **real** password to `TEST_WALLET_PASSWORD` (default `test`). So type - anything at the setup prompt; **unlock the UI with `test`** — not whatever you - typed there. Prefer no password? Run with `TEST_WALLET_PASSWORD=""` and unlock - with an empty password everywhere. +- **Wallet password.** The wallet's key storage is encrypted with a password — + the one you enter to **unlock** it (the UI's **Connect** modal) so the app can + sign transactions. First-time setup reads a throwaway password (the script + feeds it via stdin, so it doesn't block), then `restore-keys` rebuilds the + wallet from the test mnemonic and sets the **real** password to + `TEST_WALLET_PASSWORD` (default `test`). So **unlock the UI with `test`**. + Prefer no password? Run with `TEST_WALLET_PASSWORD=""` and unlock with an empty + password. - **Re-bootstrap.** `FORCE_BOOTSTRAP=1 apps/amm/tests/testnet/setup-amm-testnet.sh` re-restores the isolated `.wallet` (rewrites only that directory). - **Overrides.** `TEST_WALLET_HOME`, `TEST_MNEMONIC`, `TEST_WALLET_PASSWORD`, diff --git a/apps/amm/tests/testnet/setup-amm-testnet.sh b/apps/amm/tests/testnet/setup-amm-testnet.sh index c522f9d..65155a5 100755 --- a/apps/amm/tests/testnet/setup-amm-testnet.sh +++ b/apps/amm/tests/testnet/setup-amm-testnet.sh @@ -182,13 +182,13 @@ bootstrap_test_wallet() { if [ -n "$TEST_SEQUENCER_ADDR" ]; then log "${DIM}\$ wallet config set sequencer_addr $TEST_SEQUENCER_ADDR${RST}" - # NOTE: on a fresh home this triggers first-time wallet setup, which - # generates a THROWAWAY random-seed wallet and prompts once for a password - # (read from the terminal, so it can't be piped — just type anything, even - # empty). That wallet is immediately discarded: restore-keys below rebuilds - # the wallet from the test mnemonic and sets the REAL password to - # $TEST_WALLET_PASSWORD, which is what unlocks the wallet afterward. - wallet config set sequencer_addr "$TEST_SEQUENCER_ADDR" \ + # On a fresh home the first wallet command triggers one-time setup, which + # reads a password from STDIN ("Input password:") and generates a THROWAWAY + # random-seed wallet. Feed the password so it never blocks; restore-keys + # below immediately rewrites storage from the test mnemonic and sets the real + # password to $TEST_WALLET_PASSWORD. + printf '%s\n' "$TEST_WALLET_PASSWORD" \ + | wallet config set sequencer_addr "$TEST_SEQUENCER_ADDR" \ || log "${YEL}⚠ 'wallet config set sequencer_addr' failed — configure the wallet manually.${RST}" fi