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.
This commit is contained in:
parent
e6b5024ad3
commit
35a19bc37c
12 changed files with 3785 additions and 53 deletions
15
Cargo.toml
15
Cargo.toml
|
|
@ -20,6 +20,17 @@ repository = "https://github.com/sirius0xdev/onionwire"
|
|||
default = ["native-tls"]
|
||||
native-tls = ["arti-client/native-tls"]
|
||||
rustls = ["arti-client/rustls"]
|
||||
# In-process Monero chain daemon (Cuprate) as the local chain source, instead of
|
||||
# spawning `monerod`. OFF by default: `cuprated` is a pre-1.0 project that is not
|
||||
# published to crates.io, so this pins a git revision and pulls a large tree
|
||||
# (randomx, fjall, axum/hyper, rayon). See `docs/WALLET.md`, "In-process chain
|
||||
# daemon".
|
||||
#
|
||||
# Cuprate's own `arti` feature stays OFF: it would link a second, older Tor
|
||||
# stack (arti-client 0.44, which cannot unify with this crate's 0.46) next to
|
||||
# OnionWire's. The in-process daemon runs clearnet-only; OnionWire's Arti is the
|
||||
# only Tor in the process.
|
||||
cuprate-daemon = ["dep:cuprated", "dep:toml"]
|
||||
|
||||
[dependencies]
|
||||
arti-client = { version = "0.46", default-features = false, features = [
|
||||
|
|
@ -49,6 +60,10 @@ md-5 = "0.10"
|
|||
rpassword = "7"
|
||||
zeroize = { version = "1", features = ["derive"] }
|
||||
qrcode = { version = "0.14", default-features = false }
|
||||
cuprated = { git = "https://github.com/Cuprate/cuprate", rev = "4f8fcd1bf468f566fcd89c460d50de4adb6825bf", default-features = false, optional = true }
|
||||
# `cuprated::config::Config` is deserialized, not built field by field: the
|
||||
# struct's nested types move with the pinned revision, a TOML document does not.
|
||||
toml = { version = "0.8", features = ["parse", "display"], optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
tempfile = "3"
|
||||
|
|
|
|||
Loading…
Reference in a new issue