docs(android): rewrite Android docs to match the tree
All checks were successful
android-ci / android (pull_request) Successful in 10m14s
All checks were successful
android-ci / android (pull_request) Successful in 10m14s
android/README.md, CUPRATE_DAEMON.md and MONERO_BINARIES.md were the half PR #133 left out. Releases are two manual dispatches, not a push to main; the APK version comes from the tag android-release checks out; the layout now includes wallet/ and keepalive/; the status line's sync h/t is documented; the APK poller still calls wallet_status, not wallet_child_refresh.
This commit is contained in:
parent
fa0e4b2f6c
commit
c65946bfd5
3 changed files with 308 additions and 78 deletions
|
|
@ -5,10 +5,13 @@ OnionWire process** — is compiled into the Android build. This document is the
|
|||
provenance record for that: how the feature is enabled, why the link line looks
|
||||
the way it does, what CI checks, and what has *not* been proven.
|
||||
|
||||
Companion reading: `docs/WALLET.md` ("The in-process chain daemon") for what the
|
||||
daemon is, `docs/cuprate-android-spike.md` for the cross-compile spike this
|
||||
plumbing comes from, and `MONERO_BINARIES.md` for the `monero-wallet-rpc`
|
||||
executable, which is still a child process — Cuprate has no wallet layer.
|
||||
Companion reading: [docs/WALLET.md](../docs/WALLET.md) ("The in-process chain
|
||||
daemon") for what the daemon is, [docs/cuprate-android-spike.md](../docs/cuprate-android-spike.md)
|
||||
for the cross-compile spike this plumbing comes from,
|
||||
[MONERO_BINARIES.md](MONERO_BINARIES.md) for the `monero-wallet-rpc` executable
|
||||
(still a child process — Cuprate has no wallet layer), and
|
||||
[README.md](README.md#wallet-child-and-chain-sources-as-android-sees-them) for
|
||||
how the Android wallet screen drives it.
|
||||
|
||||
## What changed in the build
|
||||
|
||||
|
|
@ -34,6 +37,10 @@ the request rather than only the task name:
|
|||
cargo ndk build for arm64-v8a features=cuprate-daemon api=26 ndk=28.2.13676358
|
||||
```
|
||||
|
||||
There is no `-P` knob that turns the feature off. A build that silently dropped
|
||||
it would ship an APK whose on-device node can only fail; `android-ci.yml` greps
|
||||
the artifact (below) so that is not only a log line.
|
||||
|
||||
## The link line
|
||||
|
||||
RandomX is C++ and its aarch64 JIT calls `__clear_cache`, and `randomx-rs`'s build
|
||||
|
|
@ -88,6 +95,10 @@ else:
|
|||
the `rust-version = "1.91"` MSRV are untouched, because the feature-off workspace
|
||||
does not need the bump and moving the MSRV is a separate decision.
|
||||
|
||||
`:sdk:preBuild` also runs `verifyDynamicLibc`: `libonionwire_sdk.so` must have
|
||||
`libc.so` in `DT_NEEDED`. Linking the NDK's static `libc.a` instead null-derefs
|
||||
inside `dlopen` on the first SDK call.
|
||||
|
||||
## What ends up in the APK
|
||||
|
||||
```
|
||||
|
|
@ -103,8 +114,9 @@ lib/arm64-v8a/librandomx_rs-<hash>.so <- new, see below
|
|||
RandomX code is statically inside the SDK's own `.so` (its symbols and strings are
|
||||
there). `cargo-ndk` copies every cdylib the target directory produced into
|
||||
`jniLibs`, and `randomx-rs` also builds one. It is left in place rather than
|
||||
filtered out: it is 1,122,296 bytes uncompressed / 387,996 deflated, and dropping
|
||||
it would be a packaging rule that silently breaks the day something *does* link it.
|
||||
filtered out: it is 1,122,296 bytes uncompressed / 387,996 deflated (sizes from
|
||||
the feature-on CI run in the table below), and dropping it would be a packaging
|
||||
rule that silently breaks the day something *does* link it.
|
||||
|
||||
## The CI gate
|
||||
|
||||
|
|
@ -125,11 +137,12 @@ above is the other half of the proof — request and artifact, separately checka
|
|||
|
||||
* Selecting **On-device node (Cuprate)** stores `ChainChoice.InProcessCuprate` with
|
||||
an **empty** `monerod_datadir`, which the SDK resolves to
|
||||
`$ONIONWIRE_HOME/chain` — the same directory a spawned `monerod` would use. Kotlin
|
||||
never invents an absolute path.
|
||||
`$ONIONWIRE_HOME/chain/{testnet,mainnet-pruned,mainnet-full}` from the stored
|
||||
`mainnet` / `prune` flags — Kotlin never invents an absolute path.
|
||||
* `monero-wallet-rpc` is still required and still a subprocess: Start is gated on
|
||||
the bundled binary exactly as before, and an in-process node does not bundle
|
||||
`arti`, so a `.onion` daemon is still refused.
|
||||
`arti`, so a `.onion` daemon is still refused. Wallet RPC is loopback only.
|
||||
Chain traffic stays off until the user opted into a wallet and chose a source.
|
||||
* The status line renders the core's words verbatim and grows a `node <word>`
|
||||
segment from `WalletChildStatus.node_state` for this source only. An unrecognised
|
||||
word is never rendered as ready.
|
||||
|
|
@ -141,19 +154,29 @@ above is the other half of the proof — request and artifact, separately checka
|
|||
`node` segment) whenever either is non-zero: `0/0` means the last probe failed
|
||||
or the daemon is not up, so it is *unknown*, not `0%` — there is no percent, no
|
||||
progress bar and no ETA anywhere in the UI, and a zero target still prints as
|
||||
`/0`. This is the **daemon's** chain height, not the wallet's scan height. The
|
||||
same string is what the status row's screen-reader `contentDescription` carries
|
||||
(`walletChildStatusDescription`), so the spoken row is never shorter than the
|
||||
visible one. Cross-compiled and unit-tested on the JVM; still not device-proven.
|
||||
`/0` when height is non-zero. This is the **daemon's** chain height, not the
|
||||
wallet's scan height. The same string is what the status row's screen-reader
|
||||
`contentDescription` carries (`walletChildStatusDescription`), so the spoken row
|
||||
is never shorter than the visible one. Cross-compiled and unit-tested on the
|
||||
JVM; still not device-proven.
|
||||
* **What writes that snapshot on Android.** The wallet screen's 2 s loop
|
||||
(`WireViewModel.refreshWalletChild`) calls `Wire.walletStatus()` — the cached
|
||||
UniFFI read, no dial. The live probe `Wire.walletChildRefresh()`
|
||||
(`Wire::wallet_child_refresh` in `crates/onionwire-sdk`) exists and is what
|
||||
makes height/target move between calls; the TUI uses it. The APK poller on
|
||||
this tree does not. See [README.md](README.md#what-the-apk-refresh-loop-actually-calls).
|
||||
* **Storage honesty.** The card shows the free space on the filesystem the fjall
|
||||
store grows into (`StatFs` on the app's data dir) and refuses Start below a
|
||||
3 GiB floor, or when that filesystem cannot be read at all. The floor is a
|
||||
*floor*, not a sync estimate, and the doc comment says why: nothing in this stack
|
||||
floor, or when that filesystem cannot be read at all. The floor is a *floor*,
|
||||
not a sync estimate, and the doc comment says why: nothing in this stack
|
||||
exposes one — `WalletChildStatus` has no size field, and Cuprate's restricted RPC
|
||||
reports a hardcoded 5 GiB `database_size` placeholder.
|
||||
reports a hardcoded 5 GiB `database_size` placeholder. Floors in
|
||||
`ui/WalletChildStatusText.kt`: 3 GiB testnet, 64 GiB mainnet-pruned, 280 GiB
|
||||
mainnet-full.
|
||||
* **Pre-production warning**, above the Start button, in a sentence:
|
||||
`CUPRATE_PREPRODUCTION_WARNING` — quoted user book, testnet-only, and Cuprate
|
||||
issue #278, assertable in `WalletChildStatusTextTest`. Opt-in, never a default.
|
||||
`CUPRATE_PREPRODUCTION_WARNING` — quoted user book, testnet-only / mainnet
|
||||
unvalidated, and Cuprate issue #278, assertable in `WalletChildStatusTextTest`.
|
||||
Opt-in, never a default.
|
||||
|
||||
## What it costs in CI
|
||||
|
||||
|
|
@ -164,6 +187,9 @@ the feature on. There are two feature-on regimes, and the second is the one a PR
|
|||
author feels — the first build after the feature lands compiles the whole cuprated
|
||||
graph, every later build is incremental against the same volume.
|
||||
|
||||
These figures are the **recorded** costs from the runs that landed the feature
|
||||
(not re-measured on `fa0e4b2`):
|
||||
|
||||
| | feature off — `main` 773dacb, run 402 | feature on — PR #113 head 3860c3d (merged as 8626da2), run 412 |
|
||||
|---|---|---|
|
||||
| Gradle | `BUILD SUCCESSFUL in 6m 10s` | `BUILD SUCCESSFUL in 7m 14s` |
|
||||
|
|
@ -182,29 +208,42 @@ cargo job on the runner. After that it settles to roughly **+2 minutes over the
|
|||
feature-off build** (7m 14s vs 6m 10s), because only this repo's own crates
|
||||
recompile.
|
||||
|
||||
Nothing needed mitigating: the job's `timeout-minutes` is 120, so even the 44-minute
|
||||
first build fits with room to spare, and the volume grows to 5.6 G on a runner
|
||||
filesystem with 37 G free (the `df -h` in the run log). The feature is **not** gated
|
||||
on a build variant, a label or a manual dispatch — the release path builds exactly
|
||||
what CI verifies.
|
||||
`android-ci.yml`'s job `timeout-minutes` is **120**; `android-release.yml`'s
|
||||
Android job is **90**. Even the 44-minute first build fits both with room to
|
||||
spare, and the volume grew to 5.6 G on a runner filesystem with 37 G free (the
|
||||
`df -h` in the run log). The feature is **not** gated on a build variant, a label
|
||||
or a manual dispatch — the release path builds exactly what CI verifies.
|
||||
|
||||
`android-ci.yml` prints `du -sh /cargo-target`, the length/method/deflated size of
|
||||
every native lib, and both artifact digests, and the workflow echoes
|
||||
`build_wall_clock_seconds`: the next person changing this graph reads the cost and
|
||||
the artifact's identity out of the run log rather than re-deriving either.
|
||||
|
||||
## Not verified
|
||||
## What has not been proven
|
||||
|
||||
The daemon was **not executed on a device or an emulator**. There is no
|
||||
`arm64-v8a` AVD on the build host (the same gap `MONERO_BINARIES.md` records), and
|
||||
no aarch64 Android sysroot to run it under `qemu-user`. What is proven: it
|
||||
cross-compiles and links against the NDK's C++ runtime, the feature is in the
|
||||
shipped `.so`, the artifact packages, and the Kotlin that drives it compiles and
|
||||
passes its unit tests. What is not: that `cuprated` starts, opens its fjall store
|
||||
and answers on loopback under Android's runtime — and, on top of that, Cuprate
|
||||
itself is pre-production and testnet-only.
|
||||
`arm64-v8a` AVD on the build host (the same gap [MONERO_BINARIES.md](MONERO_BINARIES.md)
|
||||
records), and no aarch64 Android sysroot to run it under `qemu-user`. What is
|
||||
proven: it cross-compiles and links against the NDK's C++ runtime, the feature is
|
||||
in the shipped `.so`, the artifact packages, and the Kotlin that drives it
|
||||
compiles and passes its unit tests. What is not:
|
||||
|
||||
To close the gap, on an arm64 device or a software-emulated arm64 AVD:
|
||||
* that `cuprated` starts, opens its fjall store and answers on loopback under
|
||||
Android's runtime;
|
||||
* **mainnet remains unvalidated.** Cuprate itself is pre-production and its own
|
||||
user book says not to use `cuprated` for serious purposes. The Android screen
|
||||
can store a mainnet-pruned or mainnet-full mode; that is not a claim this build
|
||||
has run either. Core still surfaces `testnet only — mainnet is unvalidated`
|
||||
(`cuprate::TESTNET_ONLY`);
|
||||
* **a daemon that dies after the wallet child came up cannot be reported
|
||||
`exited`.** The in-process node is a value this app owns, not a process with a
|
||||
pid. The SDK derives `node_state` from the wallet-child state
|
||||
(`crates/onionwire-sdk/src/lib.rs`, `node_state`). If the daemon dies after its
|
||||
wallet child is up, the chain probe fails and the state stays `syncing`. It is
|
||||
never reported `ready` from that failure. `exited` still means what it says:
|
||||
the `monero-wallet-rpc` child is gone.
|
||||
|
||||
To close the device gap, on an arm64 device or a software-emulated arm64 AVD:
|
||||
|
||||
```bash
|
||||
sdkmanager "system-images;android-35;google_apis;arm64-v8a"
|
||||
|
|
@ -217,4 +256,6 @@ then unlock the node, open Wallet, tap **On-device node (Cuprate)**, read the
|
|||
warning, press **Start wallet**, and watch the status line for
|
||||
`connecting → syncing · in-process node · node starting → node syncing`. A wallet
|
||||
balance needs the chain synced, which on a phone is a long wait — the status line
|
||||
is the thing to watch, not the balance.
|
||||
is the thing to watch, not the balance. On this tree the APK loop will not itself
|
||||
refresh height from the daemon; a live probe is a separate SDK call the TUI
|
||||
makes and the Android poller does not.
|
||||
|
|
|
|||
Loading…
Reference in a new issue