What has actually run
566 TypeScript tests, plus the Rust and LiteSVM suites below, all green, all on every push. Everything but the LiteSVM suite runs with no phone and no validator — which is the whole reason the arithmetic was pulled out of the app and the program in the first place.
The LiteSVM tests were the long-standing gap. They went unexecuted for weeks because no machine that had the repo had the Solana toolchain —
release.anza.xyz is unreachable from the development environment. The first run scored 39 of 40, and the one failure was worth more than the 39 passes.
What CI runs
.github/workflows/ci.yml, on every push and every pull request:
The Rust job is deliberately separate from the Anchor one: the curve carries no Anchor types precisely so it can be checked without a validator, and it answers in seconds instead of waiting on a toolchain install. The Anchor job pins from
Anchor.toml’s own solana_version and anchor_version, and is week 4’s graded deliverable — clone → install → anchor test green — run on a machine that starts with nothing.
The typecheck job exists because of a pattern, not a principle. Every defect that has reached
main was a TypeScript error found by a person reading code. See below.Each check is negative-tested rather than trusted: removing the ScrollView import gives TS2304, renaming an export in @nelo/pay gives TS2724, and a malformed function makes cargo fmt --check exit 1. A job that cannot fail is not worth adding.What still has never run
Both apps now run on handsets (30 Sep – 1 Oct, development builds). What ran, on two phones, one with StrongBox:
- The till renders and works online. It charges in naira, its Solana Pay code is paid from Solflare (devnet transactions landed), and its balance reads the chain.
- The payer enrolled for real. StrongBox key generated, vault opened and funded ($15 set aside), offline limit read back from the chain.
- The offline sale works, both ways. Payer scans the till’s code and signs; the till scans the payer’s code, checks it offline and records the sale (“2 offline payments to settle”).
- Settling on the handset has not completed yet. Every attempt so far failed on the network between the till and the relayer, not in the code: first a Helius key answering 401, then a placeholder relay address, then a network that blocks cloudflared (port 7844). Each was fixed or worked around; the stable address in Release builds is the fix for the last. The same settlement path passed on devnet in
pnpm rehearse.
main: @nelo/rpc did not fail over on 401; the till said “no signal” when only the relayer was down; the keypad screen overlapped once an offline payment was waiting; the payer’s vault setup failed in the wallet with only “simulation failed”; nelo Pay’s flow did not say the till has to scan back.What the handset did answer. Four checks passed on a real device: BigInt and DataView under Hermes, P-256 sign and verify under Hermes, and the 202-byte round-trip. None of those could be settled off-device — Hermes handles both BigInt and
DataView differently from Node.It also produced the finding: no StrongBox, on ordinary mid-range hardware. packages/attest’s capability record now writes that answer down in a fixed form on every device the probe runs on, because how common that is across the launch markets is an input the reserve model currently guesses at.Where the handset tests stopped
Paused 24 Sep, no Android device available. Resuming within three days. Recorded here rather than remembered, because the next session starts cold.Answered, and not worth repeating
The first row retires the risk that mattered most. Android Keystore returns DER with an S
that may sit in the upper half of the curve order — it verifies on the phone and is
rejected on chain.
derToRawSignature was only ever checked against @noble/curves, a
library agreeing with a library. It is now checked against real Keystore output.
The one test still open
A payment that registers on the till. Money arrives, the balance reads it back on reload, and the terminal does not flip to Paid. Three defects were found and fixed off-device — a malformedgetSignaturesForAddress (the
commitment was a loose third parameter), a catch {} that hid it, and polling that stopped
after 120 seconds while the screen still said the code was live. None of that is confirmed
on a handset. The last attempt was against a bundle whose provenance is unverified: the
dev client could not reach Metro, and it is not established whether the fix was in the
bundle that finally loaded.
So the fix is proven by nine tests and unproven in the field.
First three things when a device is available.
cd ~/nelo && git pull && git log --oneline -1— confirm the working tree carries the fix before reading anything into a result.- Take one payment through Solflare’s home scanner. The charge screen now prints the
reference and the full
solana:request under the QR in development builds. - Read the status line, which now discriminates:
Waiting for payment…means the RPC is answering and no transaction names the reference;Cannot reach the networkmeans it is not; red text means detection worked and validation refused.
The offline path on handsets. These steps have now run on two phones; they are kept as the procedure for a new device.
- Rebuild both development clients.
expo-camerais a new native module in both apps, and the payer app also gained Mobile Wallet Adapter, SQLite and SecureStore:pnpm --filter @nelo/merchant build:devandpnpm --filter @nelo/payer build:dev, then install both APKs. - Start the relay on the Mac and put its tunnel URL and token in
apps/merchant/.env. See Relay. It pays for settlement, so the merchant needs no SOL and signs nothing, however they signed up. - Open the till online once. It syncs every vault for devnet USDC. The payer’s vault must exist on chain before the till goes offline, or the scan says the payer is not on the list.
- Set up the payer phone online first: Connect wallet (it needs devnet SOL and devnet USDC), enter an amount, Open my offline wallet. One wallet approval opens the vault and locks the USDC. Then open the till online once more so it syncs the new vault.
- Both phones in airplane mode. Till: enter an amount, Charge. Payer: Pay a merchant, scan the till’s code, Pay. Till: Customer has no signal? Scan their code, scan the payer’s code, Hand over the goods. Scan the same payer code again: it must be refused.
- Reconnect and tap the orange bar. No wallet prompt: the relay submits. The bar reports
each voucher paid, waiting to confirm, or held. The relay’s terminal shows nothing on success;
relay-ledger.jsonrecords every submission.
Blocked on something other than a device
- SMS onboarding. Privy has not enabled SMS for Nigeria on this app. Dashboard setting, not code. The flow machine’s 29 tests and the screens are unaffected.
- A no-StrongBox handset, to exercise the degradation path deliberately rather than by accident.
What that gap already cost
Not hypothetical. While adding the balance display:packages/pay/src/index.ts never re-exported either of them. awaitPayment would have been undefined at runtime — the till would have crashed the moment a merchant pressed Charge.
No test caught it, and at the time none could have: the app had never been bundled and there was no CI. It was found by reading imports while adding an unrelated feature.
Then it happened again. While wiring onboarding:
ScrollView was never imported. Tapping Today would have thrown. Found the same way — by eye, adding something else.
Then a third, when tsc was pointed at the apps for the first time: they could not typecheck the packages at all. The config error stopped the check before it reached a line of app code.
All three are TypeScript errors. All three were found by a person reading code. None needed an emulator, a handset or an Android toolchain to catch.That is why the typecheck job exists, and why it is four separate invocations rather than a hopeful one. Reading is not a method; it is what is left when there is nothing to run — and now there is.
How the tests are written
Negative tests before positive ones
Negative tests before positive ones
Everywhere in the vault. The first test in
vault.rs is the one that must fail: a valid P-256 signature over different bytes has to be rejected.Get the precompile offsets wrong and every positive test below still passes while the program verifies nothing at all. A test that passes because nothing was checked is worse than no test.Golden vectors across the language boundary
Golden vectors across the language boundary
packages/voucher/vectors/voucher-v1.json is generated by the Rust side — the chain is authoritative — and asserted by both. TypeScript also verifies signatures that Rust produced, so the check covers the crypto and not only the byte layout.Properties, not just examples
Properties, not just examples
The curve is tested for sublinearity at every doubling across six orders of magnitude, not at one convenient point.
isqrt is brute-forced against its floor property including at u128::MAX. The money splits are checked to add back exactly, at every amount in a list chosen to include the awkward ones.Read the balance, not the field
Read the balance, not the field
The LiteSVM tests read the SPL token account, deliberately not the vault’s
balance field. The two must agree, and reading the field to check the field proves nothing.Things that went wrong, and were caught
Kept because they are more informative than the passes:
Most were caught by a tool or a test rather than by reading. The one that was not — the FX legs — was a design error, and the ledger’s own balance rule would have rejected it at runtime anyway.
The one worth reading twice
The first-everanchor test run scored 39 of 40. The failure was only_the_risk_authority_can_publish_reputation, and it was not the program.
The test helper passed the same keypair twice — once as fee payer, once as the instruction’s signer. A message dedupes its account keys, so it required one signature while the transaction builder was handed two, and failed with NotEnoughSigners before the program was entered.
So the test got an error, is_err() was satisfied, and the property it names — reputation you can set yourself is not reputation — had never been checked. The authority constraint was there and correct, but correct-by-inspection is not proven.
Failing was the good outcome. Had the assertion been on
is_err() alone, it would be green today and still empty. Its sibling test passes only because an impostor keypair happens to differ from the payer, so it never hit the trap at all.That is the argument for asserting on the reason rather than the fact of a refusal, and it is why every check added to CI was negative-tested before being trusted.The gate rehearsal
The offline gate, two phones in airplane mode, a sale completes, both reconnect, it settles, and the replayed voucher is refused, run against a real validator with the product’s own code rather than a test’s. The payer’s vault is opened with@nelo/redeem’s builders, the voucher issued by @nelo/issue, the tills sync with @nelo/enrol, decide with @nelo/till and keep what they take in its SQLite store, and they settle with @nelo/queue through the relayer from services/relay, over HTTP. While the phones are offline, fetch is switched off in the process, so anything that reached for the network would fail the run.
- Offline sale. The payer’s phone reads till A’s code and signs; till A checks it with no network and takes it. The same code shown again is refused.
- Settle. Till A reconnects and settles through the relayer. The merchant is paid exactly the sale, holds no SOL, and the vault pays out exactly that.
- Replay. Asked again, the relayer answers with the transaction that already landed and sends nothing. Sent straight to the program, bypassing the relayer, it is refused by the replay window (
SequenceTooOldonce the window’s base has moved past it,SequenceAlreadyRedeemedinside it). - Double spend. A tampered phone signs a second voucher at the same sequence for till B. Till B takes it offline, as it must. On reconnect it is not paid, the relayer reports the conflict, and the vault freezes on chain.
- Slash. The relayer’s sweep moves the vault’s whole stake into the reserve.
- After the freeze. The payer’s phone will not sign once it has synced. A voucher signed before the freeze is still taken by a till, with the frozen-vault warning shown, and the chain pays it from the locked collateral, as the program intends.
- Devnet, 26 Sep: passed, with slashing skipped. Offline sale, settle through the relayer (the redemption), replay refused by the relayer and by the program (
SequenceTooOld), double spend caught at the second till and the vault frozen on chain, and a pre-freeze voucher paid from the frozen vault (that redemption). Slashing was skipped because the run could not stake: see the note below. - A local
solana-test-validator(Agave 4.2.2, the program built from this commit): passed, every step including the slash, on a fresh validator and again with the risk config already present.
Slashing on devnet depends on who controls the stake mint. The risk config is created once per cluster, and its stake mint is whatever the first run gave it. On a fresh validator the rehearsal creates both and makes the funder the mint authority. On devnet it reads the stake mint’s authority and, unless it is the funder, stakes nothing and reports the slash step as skipped rather than passed. If the devnet risk config was created by the week-1
devnet.rs run, its stake mint and its update authority were a throwaway key from that run, and neither can be used again.The devnet gate
The trust model has been run end to end on devnet against the Trust Stake build: vault funded,RiskConfig initialised, voucher redeemed with the device signature verified by the secp256r1 precompile on a real validator, double-spend refused, signature-over-other-bytes refused.
That distinction matters. The gate had passed before, but against a build that predated the Trust Stake. This run is the first time RiskConfig has existed on a real validator and the first time redeem_voucher has been exercised on chain with its new account struct — exactly the kind of change LiteSVM can accept and a validator reject.
#[ignore] so it never runs in the default suite. It creates its own 6-decimal mint, so a run is self-contained, and it costs devnet SOL.
It uses a software P-256 key in place of StrongBox. That is deliberate: it isolates “does the chain do what we think” from “does the handset do what we think”. The second question is still open.