tui: the wallet-rpc binary is a path the app resolves, not a bare name #171

Owner

Follows #170. Base is that branch, not main: these four commits sit strictly on top of the F7 save/start work, so the diff here is only this card's. Retarget to main once #170 lands. Task t_35a220dd.

What was wrong

The F7 screen could save a wallet-RPC endpoint and a chain source, but nothing decided which monero-wallet-rpc the child would spawn: the stored value was the bare name monero-wallet-rpc, so a host with no such file on PATH had no way to start a wallet at all, and the release tarball did not carry the binary either.

The resolver

wallet_child::resolve_wallet_rpc_bin (src/wallet_child.rs), in order:

  1. the explicit path — a user's choice is never second-guessed and is not existence-checked (a wrapper script is legitimate, a bad path is named by the spawn error);
  2. <directory of the running executable>/monero-wallet-rpc — where the release tarball puts it, so an unpacked release needs nothing configured;
  3. <exe dir>/share/onionwire/monero-wallet-rpc — a packaged install;
  4. the first executable monero-wallet-rpc on PATH.

DEFAULT_WALLET_RPC_BIN ("monero-wallet-rpc") is deliberately the last step, never the assumed default: a bare name that is not on PATH is exactly the failure this card is about. default_wallet_rpc_bin() is that resolution with no explicit path, and it is now what ChildConfig::default, ChildConfig::from_node, and the node's three chain-source setters (set_in_process_chain, set_remote_daemon, set_local_chain) use, so there is one entry point. The split resolve_wallet_rpc_bin_in(explicit, exe_dir, path_var) is the same function with both ambient inputs spelled out, which is what makes the search order testable without mutating the process environment.

F7 grows a binary row that prints the resolved answer (or NO_WALLET_RPC_MESSAGE), typed into the wallet-RPC half of the same read-modify-write as the endpoint, with Ctrl-U clearing back to auto. The row sits directly above the chain picker.

Release: the binary ships beside the app

Both release build jobs (aarch64, x86_64) now fetch the official Monero release tarball inside the build container and check it three ways before anything can be published: hashes.txt from getmonero.org must list the pinned tarball, the tarball must match its pinned sha256, and the extracted monero-wallet-rpc must match its own pinned sha256. The binary is copied out of the container and published as monero-wallet-rpc-<target> plus a .sha256, and the publish job's allow-list names all eight assets so a missing one fails the release instead of silently shipping without it. scripts/build-release-local.sh does the same for the x86_64 host fallback. Monero's C++ tree is never built here.

Pins: Monero v0.18.5.1 (Monero 'Fluorine Fermi' (v0.18.5.1-release)).

x86_64 aarch64
tarball sha256 22a7dda7...cc9958 c0caf042...7b9398dbc
extracted sha256 c1e3aff7...ce2019a656 75e254b8...e8aca0ba7a48dbf

The aarch64 target uses Monero's armv8 tarball name; no monero-linux-arm64-* asset exists. That naming difference is written down in docs/WALLET.md so the next version bump does not go hunting for it. The extracted binaries are neither stripped nor rewritten: their sha256 is the record of the bytes that ship.

Evidence

cargo test   --locked --target x86_64-unknown-linux-gnu --lib                                          145 passed; 0 failed
cargo test   --locked --target x86_64-unknown-linux-gnu --lib --features cuprate-daemon -- --test-threads=1   151 passed; 0 failed
cargo clippy --locked --target x86_64-unknown-linux-gnu --all-targets -- -D warnings                  exit 0
cargo clippy --locked --target x86_64-unknown-linux-gnu --all-targets --features cuprate-daemon -- -D warnings  exit 0
cargo check  --locked --target x86_64-unknown-linux-gnu                                               exit 0
cargo test   --locked --target x86_64-unknown-linux-gnu --no-run                                      every target compiles

New tests: 3 in wallet_child (explicit wins over everything; the bundled copy beside the exe beats a PATH name; a non-executable or missing candidate is not an answer), 4 in tui (the row exists, prints the resolved path or the not-found wording, is in the Tab order, and its value reaches the store), 1 adjusted in node (the old assertion pinned the bare name; it now pins the resolver's answer, so the test no longer depends on this host's PATH).

Real end-to-end, no test harness: a probe crate against the crate's public API (resolve_wallet_rpc_bin, ChildConfig::build, WalletChild::start), run from two directories with PATH stripped of monero-wallet-rpc — the host happens to have one in ~/.local/bin, so the stripped PATH is what makes the probe honest:

# A: nothing beside the binary
resolved = None
default  = monero-wallet-rpc
START FAILED: spawn monero-wallet-rpc: No such file or directory (os error 2)   <- the bug this card is about

# B: the fetched official binary beside the app
resolved = Some("/.../e2e-b/monero-wallet-rpc")
default  = /.../e2e-b/monero-wallet-rpc
Monero 'Fluorine Fermi' (v0.18.5.1-release)
I Binding on 127.0.0.1 (IPv4):36487
STARTED  url=http://[email protected]:36487/json_rpc        (2.3 s)

That is current_exe → resolver → spawn → readiness gate, on the real binary, in a real process.

The workflow was checked without CI: the YAML parses (all four jobs, both new env blocks), every run body passes bash -n, and the fetch/verify/extract chain was executed verbatim on this host for both targets — each matched getmonero's hashes.txt, its tarball sha256 and its extracted sha256, and the x86_64 binary runs (--version reports v0.18.5.1-release, ldd lists only libm/libpthread/libc). The x86_64 pinned hash was independently reproduced by a second download of the same release.

Not verified

  • The aarch64 tarball is verified by hash and file(1) only; an x86_64 host cannot execute it. docs/WALLET.md says this plainly.
  • No real TUI session was driven on this branch: the resolver, the wiring, the spawn and the readiness gate are covered above, but nobody typed Ctrl-S in a terminal here. #170 carries the live F7 run.
  • wallet_child::tests::in_process_source_launches_a_daemon_and_stop_shuts_it_down flakes under --test-threads=8 with cuprate-daemon (in-process daemon: launch: Address already in use (os error 98) on 18081, racing node::tests' own 18081 holders). It is pre-existing and unrelated: that test overrides the binary with with_wallet_rpc_bin and this diff binds nothing. It passes 151/0 serially and 3/3 in isolation, and no CI job runs that feature-gated suite. Left alone rather than fixed inside this card.

F7 row position in the Tab order

Row 3 of 10, between the view-only toggle and the chain picker:

url (0), login (1), view-only (2), binary (3), chain (4), daemon (5), monerod (6), datadir (7), prune (8), network (9) — SETUP_ROWS is 10, and Tab/BackTab cycle the whole list and wrap. Adding the row shifted SETUP_ROW_CHAIN and everything after it by one, which the F7 tests pin (the_wallet_rpc_row_is_reachable_and_drawn walks the order and asserts the row above the chain picker is this one; the_in_process_network_is_still_selectable still reaches the network picker and picks a network).

The in-process Cuprate network

Unchanged by this card, and still mainnet remains unvalidated — testnet only. Nothing here touches src/cuprate.rs, the chain source, or the F7 network picker; the binary row only decides which monero-wallet-rpc a start will spawn.

Notes for the reviewer

  • docs/WALLET.md carries the provenance record (source URL, version, both hashes per target, and the three checks). docs/TUI.md's F7 row table and its two-half save wording are now one row and one half stale, but that file is outside this card's scope, so it was left untouched on purpose.
  • No src/store.rs, no schema, no SDK and no Android change: crates/onionwire-sdk does not touch the wallet child, and the Android build already ships its own monero-wallet-rpc per ABI (android/MONERO_BINARIES.md).
Follows #170. Base is **that branch, not `main`**: these four commits sit strictly on top of the F7 save/start work, so the diff here is only this card's. Retarget to `main` once #170 lands. Task `t_35a220dd`. ## What was wrong The F7 screen could save a wallet-RPC endpoint and a chain source, but nothing decided which `monero-wallet-rpc` the child would spawn: the stored value was the bare name `monero-wallet-rpc`, so a host with no such file on `PATH` had no way to start a wallet at all, and the release tarball did not carry the binary either. ## The resolver `wallet_child::resolve_wallet_rpc_bin` (`src/wallet_child.rs`), in order: 1. the explicit path — a user's choice is never second-guessed and is not existence-checked (a wrapper script is legitimate, a bad path is named by the spawn error); 2. `<directory of the running executable>/monero-wallet-rpc` — where the release tarball puts it, so an unpacked release needs nothing configured; 3. `<exe dir>/share/onionwire/monero-wallet-rpc` — a packaged install; 4. the first executable `monero-wallet-rpc` on `PATH`. `DEFAULT_WALLET_RPC_BIN` (`"monero-wallet-rpc"`) is deliberately the **last** step, never the assumed default: a bare name that is not on `PATH` is exactly the failure this card is about. `default_wallet_rpc_bin()` is that resolution with no explicit path, and it is now what `ChildConfig::default`, `ChildConfig::from_node`, and the node's three chain-source setters (`set_in_process_chain`, `set_remote_daemon`, `set_local_chain`) use, so there is one entry point. The split `resolve_wallet_rpc_bin_in(explicit, exe_dir, path_var)` is the same function with both ambient inputs spelled out, which is what makes the search order testable without mutating the process environment. F7 grows a `binary` row that prints the resolved answer (or `NO_WALLET_RPC_MESSAGE`), typed into the wallet-RPC half of the same read-modify-write as the endpoint, with `Ctrl-U` clearing back to auto. The row sits directly above the chain picker. ## Release: the binary ships beside the app Both release build jobs (aarch64, x86_64) now fetch the **official Monero release** tarball inside the build container and check it three ways before anything can be published: `hashes.txt` from getmonero.org must list the pinned tarball, the tarball must match its pinned sha256, and the extracted `monero-wallet-rpc` must match its own pinned sha256. The binary is copied out of the container and published as `monero-wallet-rpc-<target>` plus a `.sha256`, and the publish job's allow-list names all eight assets so a missing one fails the release instead of silently shipping without it. `scripts/build-release-local.sh` does the same for the x86_64 host fallback. Monero's C++ tree is never built here. Pins: Monero `v0.18.5.1` (`Monero 'Fluorine Fermi' (v0.18.5.1-release)`). | | x86_64 | aarch64 | |---|---|---| | tarball sha256 | `22a7dda7...cc9958` | `c0caf042...7b9398dbc` | | extracted sha256 | `c1e3aff7...ce2019a656` | `75e254b8...e8aca0ba7a48dbf` | The aarch64 target uses Monero's `armv8` tarball name; no `monero-linux-arm64-*` asset exists. That naming difference is written down in `docs/WALLET.md` so the next version bump does not go hunting for it. The extracted binaries are neither stripped nor rewritten: their sha256 is the record of the bytes that ship. ## Evidence ``` cargo test --locked --target x86_64-unknown-linux-gnu --lib 145 passed; 0 failed cargo test --locked --target x86_64-unknown-linux-gnu --lib --features cuprate-daemon -- --test-threads=1 151 passed; 0 failed cargo clippy --locked --target x86_64-unknown-linux-gnu --all-targets -- -D warnings exit 0 cargo clippy --locked --target x86_64-unknown-linux-gnu --all-targets --features cuprate-daemon -- -D warnings exit 0 cargo check --locked --target x86_64-unknown-linux-gnu exit 0 cargo test --locked --target x86_64-unknown-linux-gnu --no-run every target compiles ``` New tests: 3 in `wallet_child` (explicit wins over everything; the bundled copy beside the exe beats a `PATH` name; a non-executable or missing candidate is not an answer), 4 in `tui` (the row exists, prints the resolved path or the not-found wording, is in the `Tab` order, and its value reaches the store), 1 adjusted in `node` (the old assertion pinned the bare name; it now pins the resolver's answer, so the test no longer depends on this host's `PATH`). Real end-to-end, no test harness: a probe crate against the crate's **public** API (`resolve_wallet_rpc_bin`, `ChildConfig::build`, `WalletChild::start`), run from two directories with `PATH` stripped of `monero-wallet-rpc` — the host happens to have one in `~/.local/bin`, so the stripped `PATH` is what makes the probe honest: ``` # A: nothing beside the binary resolved = None default = monero-wallet-rpc START FAILED: spawn monero-wallet-rpc: No such file or directory (os error 2) <- the bug this card is about # B: the fetched official binary beside the app resolved = Some("/.../e2e-b/monero-wallet-rpc") default = /.../e2e-b/monero-wallet-rpc Monero 'Fluorine Fermi' (v0.18.5.1-release) I Binding on 127.0.0.1 (IPv4):36487 STARTED url=http://[email protected]:36487/json_rpc (2.3 s) ``` That is `current_exe` → resolver → spawn → readiness gate, on the real binary, in a real process. The workflow was checked without CI: the YAML parses (all four jobs, both new env blocks), every `run` body passes `bash -n`, and the fetch/verify/extract chain was executed verbatim on this host for **both** targets — each matched getmonero's `hashes.txt`, its tarball sha256 and its extracted sha256, and the x86_64 binary runs (`--version` reports `v0.18.5.1-release`, `ldd` lists only libm/libpthread/libc). The x86_64 pinned hash was independently reproduced by a second download of the same release. ## Not verified - The **aarch64** tarball is verified by hash and `file(1)` only; an x86_64 host cannot execute it. `docs/WALLET.md` says this plainly. - No real TUI session was driven on this branch: the resolver, the wiring, the spawn and the readiness gate are covered above, but nobody typed `Ctrl-S` in a terminal here. #170 carries the live F7 run. - `wallet_child::tests::in_process_source_launches_a_daemon_and_stop_shuts_it_down` flakes under `--test-threads=8` with `cuprate-daemon` (`in-process daemon: launch: Address already in use (os error 98)` on 18081, racing `node::tests`' own 18081 holders). It is pre-existing and unrelated: that test overrides the binary with `with_wallet_rpc_bin` and this diff binds nothing. It passes 151/0 serially and 3/3 in isolation, and no CI job runs that feature-gated suite. Left alone rather than fixed inside this card. ## F7 row position in the `Tab` order Row 3 of 10, between the view-only toggle and the chain picker: `url` (0), `login` (1), `view-only` (2), **`binary` (3)**, `chain` (4), `daemon` (5), `monerod` (6), `datadir` (7), `prune` (8), `network` (9) — `SETUP_ROWS` is 10, and `Tab`/`BackTab` cycle the whole list and wrap. Adding the row shifted `SETUP_ROW_CHAIN` and everything after it by one, which the F7 tests pin (`the_wallet_rpc_row_is_reachable_and_drawn` walks the order and asserts the row above the chain picker is this one; `the_in_process_network_is_still_selectable` still reaches the network picker and picks a network). ## The in-process Cuprate network Unchanged by this card, and still **mainnet remains unvalidated — testnet only**. Nothing here touches `src/cuprate.rs`, the chain source, or the F7 network picker; the `binary` row only decides which `monero-wallet-rpc` a start will spawn. ## Notes for the reviewer - `docs/WALLET.md` carries the provenance record (source URL, version, both hashes per target, and the three checks). `docs/TUI.md`'s F7 row table and its two-half save wording are now one row and one half stale, but that file is outside this card's scope, so it was left untouched on purpose. - No `src/store.rs`, no schema, no SDK and no Android change: `crates/onionwire-sdk` does not touch the wallet child, and the Android build already ships its own `monero-wallet-rpc` per ABI (`android/MONERO_BINARIES.md`).
sirius changed title from wallet: the app resolves monero-wallet-rpc beside itself, and the release ships it to tui: the wallet-rpc binary is a path the app resolves, not a bare name 2026-09-28 04:17:14 +00:00
sirius merged commit f71d5e2af0 into onionwire/t_fcd38efc-onionwire-tui-f7-can-save-and-start-an-a 2026-09-28 05:10:14 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
sirius/onionwire!171
No description provided.