| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
35a19bc37c |
wallet: in-process Cuprate chain daemon behind the cuprate-daemon feature
Phase 1 of the Cuprate integration strategy: the chain daemon can run inside
the OnionWire process instead of a spawned `monerod`. `monero-wallet-rpc` is
unchanged — it still dials the unrestricted loopback RPC on 127.0.0.1:18081,
which is the address `WalletChild::daemon_address` already returned — so no
wallet-layer code moves.
- Cargo.toml: `cuprated` (git, rev 4f8fcd1b) + `toml`, both optional, behind a
`cuprate-daemon` feature that is OFF by default. Cuprate's own `arti` feature
stays off: its arti-client 0.44 cannot unify with this crate's 0.46, and the
in-process daemon is clearnet-only, so this keeps one Tor stack in the
process. `Cargo.lock` gains the graph; no arti 0.44 appears in it.
- src/cuprate.rs (new): `CuprateNode` builds the cuprated config as TOML
(testnet, unrestricted RPC on loopback, restricted RPC disabled, inbound P2P
off), launches it, and owns it. Dropping the value is the teardown;
`shutdown()` is called before the drop so the services can drain. The type
exists in every build: without the feature `launch` fails with the feature
name instead of silently doing nothing, so the chain-source type, its stored
record and the picker do not fork on a cargo feature.
- src/wallet.rs: `ChainSource::InProcessCuprate { datadir }`.
- src/wallet_child.rs: starts/holds/stops the node, serializes the choice as
`kind = "cuprate"`, and adds `chain_datadir` so the storage gate covers both
local sources. It takes the app's Tokio handle (`with_runtime`): the launch is
async and `start()` runs on the TUI's blocking thread.
- src/node.rs: `wallet_child_start(runtime)`, `default_in_process_chain_source`.
- src/tui.rs: a fourth picker row, its testnet caveat, the chain block copy, and
a stop of the app-owned children on the quit path so they are not orphaned.
- tests/wallet.rs: a `cuprate-daemon`-gated end-to-end test that launches the
node and drives get_info / get_height / get_block through the typed daemon
client, including the above-the-tip 500 and the listener closing on drop.
- docs/WALLET.md: the fourth chain source, the feature flag, the +5.6 MB
stripped overhead, and the two limits (testnet only, no Tor in the chain
path).
Also repaired tests/tui_spec.rs, which the parent commit left un-compilable
(the Phase 2a commit had dropped all but the new imports and four new tests,
1221 lines of body); it is restored from the pre-breakage version, with the
Phase 2a imports and tests re-applied.
|
||
|
|
e6b5024ad3 |
wallet: typed chain-daemon client for the Cuprate parity gaps
The chain probe was a hand-rolled brace-scanner in `src/node.rs`. Cuprate
breaks three of its assumptions, all measured in Spike A
(`docs/cuprate-launch-spike.md` §Parity gaps, evidence in that spike's
`rpc-evidence/`):
1. **A height above the tip is a bare HTTP 500 with an empty body.** monerod
answers a JSON-RPC error object instead (`TOO_BIG_HEIGHT`, code -2). The
client now parses the HTTP status once, de-chunks `Transfer-Encoding:
chunked` bodies (axum/hyper; the old brace-scan is not a parse once a blob
spans more than one chunk), and maps both spellings of the height failure to
one typed `WalletError::DaemonHeightOutOfRange`. `get_height` and `get_block`
are height-addressed: their 5xx is the height error. `get_info` is not: its
5xx is `WalletError::DaemonHttpStatus`.
2. **`get_info` metrics are not measurements.** Cuprate reports zero peers while
it downloads blocks, its restricted server answers a placeholder
`database_size` (exactly 5 GiB) and an empty `version`, and `free_space` is
`u64::MAX` on both servers. `DaemonInfo` carries height and target only, so
there is no field for a placeholder to reach the UI. The wallet screen's sync
line is now built from block-height movement between two probes: "connected
to P2P" needs the height to have moved, "no new blocks" is what a stalled
daemon gets, and Cuprate's at-rest `synchronized = true` with
`target_height = 0` reads as unknown instead of `1160/0`.
3. **`get_height` is a URI endpoint**: `{"method":"get_height"}` over
`/json_rpc` is rejected with 422, so the client uses `GET /get_height`, which
both daemons answer. The wallet-child routing rule is pinned too: it dials
the daemon's *unrestricted* listener (monerod's `--rpc-bind-port`, and
whatever port an in-process Cuprate binds for `[rpc.unrestricted]`), never the
restricted one — a restricted listener answers, so a mix-up shows up as a
wrong number rather than as an error.
Scope deviations, stated plainly:
- the card names `src/wallet.rs` + the TUI bindings. The probe itself lived in
`src/node.rs`; it now delegates (net -100 lines there), and the routing
constant/test live in `src/wallet_child.rs`. Tests are in `tests/wallet.rs`,
`tests/tui_spec.rs` and `src/wallet_child.rs`'s test module.
- `daemon_get_block()` is **not called by anything yet**: it is the entry point
the wallet's own block scan (Phase 2) needs, and the out-of-range answer it has
to survive is item 1, so the mapping lives with the client.
- the card's item 3 gives the unrestricted port as 18089 and the restricted one
as 28089. In monerod's numbering 18089 *is* the restricted port; the app's
local source already dials the unrestricted 18081. The rule is what is pinned,
not those numbers.
- `docs/cuprate-launch-spike.md` merged to `main` after this branch's base
commit, so it is not in this tree and its Recommendation bullets are not
updated here.
- based on `feat/wallet-create-import` (the wallet line, unmerged): the daemon
client has no home on `main`. Retarget to `main` when that line lands.
Proof: `cargo test --locked` 306 passed / 0 failed, `cargo clippy --locked
--all-targets -- -D warnings` clean, `rustfmt --edition 2024 --check` adds no
hunk to any file (the inherited hunks in `src/node.rs`/`src/tui.rs`/
`tests/tui_spec.rs` are unchanged in count or region).
|
||
|
|
cee53cfd73 |
tui: F7 wallet config screen + wallet/chain setup redesign + doc sync
Implement the F7 wallet-endpoint config screen (Screen::WalletConfig): - Fields: rpc_url, rpc_login masked with reveal toggle, no_spend checkbox - Test connection (t → PingResult::line), Save (s → wallet_save_config) - Status line: 'saved · not connected', 'connected — ...', 'error: ...' - NO_COLOR distinguishability: '·' bullets, username visible, password masked - Password never leaks: WalletConfig::secret() redaction on all status lines - ConfigField cycle (Tab/Esc), footer hints, help overlay entries Redraw draw_wallet_setup (CreateWarn→CreatePass→CreateSeed→ImportPass, CreateWarn→ImportSeq→ImportPass) with spend-authority warning, SEEN challenge, zeroizing buffers preserved on submit/mismatch/Esc. Update help_overlay_text() with F6 h, F7, copy key; main_footer_hints() for F7. Extend tui_chrome.rs needle list (F6 h, F7 added). Reconcile docs: README key table gains F6 s/n/h and F7; WALLET.md wallet-screen paragraph updated; TUI.md Deliverable 5 marked implemented with after frames for each config state at 80x24 and 120x40. Tests: 30 tui_spec (incl. 7 new wallet-config tests), tui_chrome green. cargo test --locked: 0 failures. cargo clippy --all-targets: clean. |
||
|
|
d7e91f850a |
wallet: stored config (F7), WalletStatus snapshot, pay/tip readiness guard
The only input path for the wallet was env. Add the same three remote-mode
fields as stored config so the F7 screen can set them and headless runs read
one source of truth:
- `wallet_config` table in the encrypted store (one row; the login is sealed
with the store data key under `onionwire/wallet-config/v1`, on top of
SQLCipher). Empty URL clears it. `Store::load_wallet_config` /
`save_wallet_config`.
- `WalletConfig { rpc_url, rpc_login: Zeroizing<String>, no_spend }` with a
redacting `Debug`; `Wallet::from_config`, and `Wallet::for_boot` which
prefers stored config, falls back to env, and refuses to dial a bad stored
endpoint. Node::start* now reads the store before constructing the wallet.
- `WalletStatus { configured, connected, last_error, balance_line,
receive_address }`: `connected` only ever comes from a probe
(`Wallet::status`, get_address + get_balance); config alone leaves it false.
`Node::wallet_status` is the cheap draw-path read, `wallet_refresh` the
probe that folds into it.
- One-shot `Wallet::ping(rpc_url, rpc_login) -> PingResult { ok, status,
error }` for the Test-connection button: same loopback/digest rules, errors
redacted and capped.
- `readiness(configured, connected, no_spend, is_tip) -> Readiness` plus
`Node::wallet_readiness` (async, block_on-friendly): not configured →
NOT_CONFIGURED_MSG; /tip on a no-spend wallet → VIEW_ONLY_MSG before any
dial; configured but not connected → NOT_CONNECTED_MSG; else ready.
- `Node::wallet_save_config` persists, validates first, then re-reads so the
live wallet and snapshot follow a Save without a restart.
- `Node::wallet` is now a Mutex<Wallet> (cloned out before each await) so the
wallet can be re-pointed mid-session.
Local-mode fields stay reserved: the child lifecycle is t_69ce8e46 and is not
wired here. docs/WALLET.md documents the stored config, boot precedence and
the exact guard copy.
Tests: 38 in tests/wallet.rs including exact-refusal-copy, boot precedence,
sealed-on-disk login, ping sanitization and connected-only-after-probe.
|
||
|
|
8331a2dde6 |
wallet: app-owned child lifecycle + user-chosen ChainSource
The app now owns monero-wallet-rpc (and monerod when the chain source is
local) instead of requiring the user to start them and export
ONIONWIRE_WALLET_RPC.
- ChainSource enum: None / Local { monerod_bin, datadir } / Remote { host,
port }. No default remote node; Remote is only constructed from explicit
user input. A .onion Remote is refused without a SOCKS proxy (separate
card).
- WalletChild in src/wallet_child.rs spawns monero-wallet-rpc with
--rpc-bind-ip 127.0.0.1, a random free loopback port, generated
--rpc-login, and --wallet-dir /wallet; monerod too for a
local source. --trusted-daemon is never passed.
- Generated RPC creds are sealed in the encrypted SQLCipher store
(wallet_child table, AEAD on top of whole-db encryption), never a
plaintext file. The Wallet client is built from the generated loopback
URL, not from_env.
- Readiness predicate: chain_ready() requires synchronized==true, height>0,
height>=target_height; can_spend() and can_verify_receipts() gate on it.
Unsynced -> receipts stay verified=0, spend refused with a clear message.
- Backend-aware timeouts: local management calls keep 5s; chain-dependent
calls (get_info, get_transfers, transfer) get 60s (CHAIN_RPC_TIMEOUT),
because a first sync or a remote daemon outlasts 5s and a 5s cap there
is what left receipts permanently unverified.
- node.rs ingest_receipt gates on can_verify_receipts() instead of
configured() alone.
- docs/WALLET.md rewritten for the child lifecycle + chain source.
Base: feat/wallet-create-import (PR #66). Do not rebase onto main.
Co-Authored-By: Hermes Agent <agent@local>
|
||
|
|
cf0a517cd2 |
wallet: create/import in-app (no key paste on create) + opt-in spend
/ wallet create generates a wallet on the RPC and shows the 25-word seed once for backup; /wallet import is the only path that takes an existing seed, and it is collected on a dedicated screen so it never reaches the composer line or chat history. Threat model now states the real policy: payments are opt-in, default is no spend key, spend is a local authority at create/restore, and the chain source is the user's choice (spawned local monerod or a daemon address they supply). WALLET.md and README follow. Tests: canned-RPC create/restore, slash parse, help overlay. |
||
|
|
323100b162 |
wallet: no-spend mode + view-only detection over RPC
All checks were successful
ci / test (pull_request) Successful in 4m11s
/tip needs monero-wallet-rpc `transfer`, which a view-only wallet cannot do. With ONIONWIRE_WALLET_NO_SPEND=1 (`1`/`true`/`yes`/`on`) `Wallet::transfer` refuses locally, before any RPC dial, and /pay + receipt verification are unchanged. When a transfer does fail, ask the documented signal before surfacing the raw wallet error: `query_key` key_type=spend_key answers WALLET_RPC_ERROR_CODE_WATCH_ONLY (-29) on a view-only wallet (wallet_rpc_server.cpp on_query_key). Both paths return one sentence — "wallet is in view-only/no-spend mode — /tip is disabled; /pay and receipt verification still work". Fail closed: if the probe cannot answer, the wallet's own error stands; no fabricated detection. New docs/WALLET.md: --generate-from-view-key / generate_from_keys watch-only setup, --rpc-login Digest, why loopback still needs auth, the local spend-authority warning, and the detection trade-off (a spend-capable wallet answers the probe with its spend key, which is discarded). Linked from docs/THREAT_MODEL.md. |
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
35a19bc37c |
||
|
|
e6b5024ad3 |
||
|
|
cee53cfd73 |
||
|
|
d7e91f850a |
||
|
|
8331a2dde6 |
||
|
|
cf0a517cd2 |
||
|
|
323100b162 |