diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 28118e9..21772ff 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,4 +44,10 @@ jobs: # Catches anything that typechecks but won't bundle (native module # resolution, Metro config drift). - name: Bundle - run: npx expo export --platform android --output-dir .expo-export + run: npx expo export --platform android + + # The size budget gate must measure the real export: without this step + # the report would pass on an absent dist/ and the 4 MB budget would be + # advisory in CI. Fails the pipeline on a measured over-budget bundle. + - name: Size gate (measured export) + run: node scripts/size-report.mjs diff --git a/.gitignore b/.gitignore index d0b2fd2..a702cfd 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ node_modules/ .expo-export/ .expo-export-web/ dist/ +/plans/ /ios/ /android/ .env* diff --git a/README.md b/README.md index 6e78a88..b4070b4 100644 --- a/README.md +++ b/README.md @@ -11,19 +11,30 @@ mobile app, rebuilt in React Native. --- -## ⚠️ Project status · M5 (card) +## ⚠️ Project status · M6 (release readiness) -**This repository is the card milestone: everything M4 shipped (keys, vault, live chain data, the send pipeline, the trade surfaces) plus the card screen with its early-access waitlist. The join flow runs on a validated, normalized email through a sealed device-local store (one slot per install), the confirmation view masks the address, duplicates, transport failures and retries land in honest states, and both Leave and wallet sign-out wipe the sealed email from the device.** +**This repository is the release milestone: a feature-complete v1 candidate on top of M0 to M5 (keys and vault, live chain data, the send pipeline, the trade surfaces, the card waitlist), with the release gates run and recorded in `docs/REVIEW-RUNBOOK.md` and the device matrix finalized in `docs/MANUAL-QA.md`. The machine gates are green; store submission waits on the ship blockers below and the device pass.** + +### Ship blockers (consolidated; each ships honest-gated until it closes) + +1. **Card waitlist backend (R4)**: v1 persistence is device-local only; a production build refuses to start without a configured `waitlistBase` (`LocalWaitlistShipBlockerError` in `createWaitlistProvider`). This is the enforced gate, not a warning. +2. **ML transaction broadcast endpoint (R3, action item A1)**: the Mintlayer-operated production API refuses submissions (403); real-mode ML send reviews and signs, then stops honestly at broadcast. Enabling later is a URL change in `src/config/endpoints.ts`. +3. **Mintlayer-operated testnet URL (action item A2, R6)**: testnet ships typed-offline; release builds hide the network switch (dev-only until the URL lands). +4. **BTC data backend deployment (F13)**: no production btc-api base is configured; the BTC surface degrades honestly (chains list drops Bitcoin) until a deployment URL is set. +5. **EVM signer decision (R5 sub-question)**: the bridge's Ethereum-to-Mintlayer direction stays disabled with explanatory copy; the M2E direction is wired to the bridge api but gated until the deposit intent encoder and the ML submission route exist. +6. **Bindings call-through device verification**: the vendored artifacts are linked and the facades compile, but no build machine has verified the native call-through; the TS key paths do not depend on it. + +Release configuration shipped in M6: final EAS profiles (`development`, `preview`, `production-android`, `production-ios`; Android local, iOS via Mac mini or CI per D5), production identifiers `org.mintlayer.mojito.me`, CI-stamped build numbers, the static perf and size gates in `npm run check`, and the honesty audit in `docs/REVIEW-RUNBOOK.md` section 3. Measured JS bundle: 4.40 MiB against the 4 MB budget, waived in writing in the runbook. Timing and installed-size numbers await the device pass (`docs/MANUAL-QA.md`). Real in M5: -- **Card waitlist**: the form machine (RFC-validated input, no double submits, submit-time address freeze so a mid-flight edit cannot rename the confirmation), the masked confirmation and duplicate callouts, the provider-state counter, the Settings membership row with Leave, and the sign-out wipe. **R4 ship blocker (decision R4, 2026-11-17): the waitlist backend does not exist; v1 persistence is device-local only, and a production build must never ship it. `createWaitlistProvider` refuses release construction without a configured `waitlistBase` (plans/mojito-neo/decisions.md, missing-architecture gap 4).** +- **Card waitlist**: the form machine (RFC-validated input, no double submits, submit-time address freeze so a mid-flight edit cannot rename the confirmation), the masked confirmation and duplicate callouts, the provider-state counter, the Settings membership row with Leave, and the sign-out wipe. **R4 ship blocker (decision R4, 2026-11-17): the waitlist backend does not exist; v1 persistence is device-local only, and a production build must never ship it. `createWaitlistProvider` refuses release construction without a configured `waitlistBase` (project decision log R4, missing-architecture gap 4).** Real in M4: - **Order book**: Dex depth rows come from GET /order/pair/{base}_{quote}/book with keyset cursor pagination and an invalid-cursor page-1 restart; stale and error states are explicit, never fixture rows in real mode. - **Orders**: place (confirm sheet with the exact amounts and a slippage guard against the book mid), fill and conclude run the bindings order encoders with the F11 witness mix (no-signature on the order input, signed payer inputs); the order id derives through the bindings from the create tx inputs, and fill and conclude inputs carry the account nonce and block height per the vendored wallet-bindings v0.1.0 signatures (pinned by src/trade/bindingsParity.test.ts). -- **Atomic swap**: the ML-side HTLC flow (lock, claim, refund, secret extraction) per the docs guide; sessions persist across restarts with the secret hash only (the preimage never persists and never logs; the keep-open warning explains what is at stake), and the lock bytes are stored before the broadcast so a crash cannot strand the refund. The BTC counterparty leg is the scripted demo (see scripts/e2e-testnet.mjs); the timelock guard returns with real offers (plans/mojito-neo/decisions.md). +- **Atomic swap**: the ML-side HTLC flow (lock, claim, refund, secret extraction) per the docs guide; sessions persist across restarts with the secret hash only (the preimage never persists and never logs; the keep-open warning explains what is at stake), and the lock bytes are stored before the broadcast so a crash cannot strand the refund. The BTC counterparty leg is the scripted demo (see scripts/e2e-testnet.mjs); the timelock guard returns with real offers (project decision log). - **Bridge**: quotes and status ride the bridge_v2 api-server per R5 (per-token fees per direction, the Mintlayer treasury deposit address, m2e deposit confirmations); E2M stays disabled with explanatory copy (no EVM signer, scoped decision open). M2E initiation is honestly gated until the deposit intent encoder and the ML submission route exist. The EVM demo fixtures (Arbitrum, Polygon, BNB) are removed from the bridge chains and pickers in this milestone. M3 (still accurate): BTC sends are end-to-end real on scure against the configured btc-api base; ML sends prepare and sign over the bindings interface but honestly refuse to broadcast (R3, action item A1); the send lifecycle tracks pending to confirmed with fresh-address rotation. @@ -56,8 +67,11 @@ Still fixture-backed or deferred, deliberately: - **BTC device verification** is pending: balances and sends come from the configured btc-api deployment, and an end-to-end check against a funded device has not run yet. - **Testnet** ships typed-offline: no Mintlayer-operated testnet indexer URL is documented (action item A2), so nothing points at a guess. The E2E harness (`npx tsx scripts/e2e-testnet.mjs`) states this honestly and runs its BTC leg when a btc-api testnet base is provided. - The **vendored bindings call-through** (transaction assembly, signing, native encoders) still rejects; the artifacts are vendored and linked, the facades are real code that compiles on EAS, and the TS key paths above do not depend on the call-through. See the Storage section and `vendor/mintlayer/`. -- **QR encoding** rides the battle-tested `react-native-qrcode-svg` library at error correction H: the spec's pure-TypeScript encoder deliverable (ECC M) was replaced deliberately, and the substitution is recorded in `plans/mojito-neo/decisions.md` (D14). -- **Camera scanning** (the send screen's ScanSheet over expo-camera) ships with a later milestone: the QR button explains this honestly in an alert, and the deferral is recorded in `plans/mojito-neo/decisions.md` (D15). +- **QR encoding** rides the battle-tested `react-native-qrcode-svg` library at error correction H: the spec's pure-TypeScript encoder deliverable (ECC M) was replaced deliberately, and the substitution is recorded in the project decision log (D14). +- **Camera scanning** (the send screen's ScanSheet over expo-camera) ships with a later milestone: the QR button explains this honestly in an alert, and the deferral is recorded in the project decision log (D15). The store's camera usage string rides with it. +- **DEX Trades/Depth segment** sets state but no trades panel consumes it yet (carried from the M1-gate UX list through the M6 reconciliation in `docs/REVIEW-RUNBOOK.md` 4.2): the house rule (wire, visibly disable, or remove) applies at the fix pass that owns the panel. +- **Timing and installed-size numbers** (cold start, tab switch, sheet open, QR; installed iOS and Android sizes) await the device pass per `docs/MANUAL-QA.md`; the static halves ship in `npm run check` (`scripts/perf.mjs`, `scripts/size-report.mjs`). +- **Native biometric prompt strings** are English-only (the module has no locale channel yet; recorded in the external deferred-UX notes), and **NFT rows** render text-only (no image dependency in the set). Do not point this at real funds you cannot afford to lose, and do not treat any screen here as a security control until the corresponding logic is implemented and audited. @@ -108,7 +122,7 @@ src/keys/ the M1 key stack, pure TypeScript and vector-tested mlAccounts.ts Mintlayer account derivation and bech32m addresses BtcKeyring.ts BIP84 P2WPKH accounts on scure customPath.ts generic m/… account-path parse for the discovery scan - session.ts KeySession: short-lived vault handle (M2 consumers, see plans/) + session.ts KeySession: short-lived vault handle (M2 consumers, see decision log D17) src/data/ the M2 chain data layer, service by service ml/ typed indexer client, BalanceService, NftService @@ -153,6 +167,8 @@ vendor/mintlayer/ vendored wallet-bindings v0.1.0 artifacts CHECKSUMS.txt upstream SHA256SUMS provenance, verified in CI scripts/api-smoke.mjs read-only live endpoint smoke run (manually or nightly) +scripts/perf.mjs static startup-path review with the timing budget status +scripts/size-report.mjs static size inventory plus the measured-export budget grade scripts/no-em-dash.ts dash gate (no em or en dashes in code or specs; vendored artifacts excluded: checksum-pinned) scripts/no-console.ts secret-logging gate (keys, storage, data, onboarding, module) @@ -188,6 +204,20 @@ npm run ios:dev # build + launch on an iOS simulator The first dev-client build takes a while; after that `npm start` plus a relaunch of the installed app is enough. Changes to `modules/mojito-core` native sources require a rebuild. +### Release builds (M6) + +```bash +npx eas build -p android --profile production-android # local machine per D5 +npx eas build -p ios --profile production-ios # Mac mini or CI per D5 +npx eas build -p android --profile preview # real-mode internal APK +``` + +Identifiers are `org.mintlayer.mojito.me` (owner-confirmable before submission); version and +build numbers are CI-stamped (`appVersionSource: remote`, `autoIncrement`). No secrets live in +`eas.json`; the release profiles set `EXPO_PUBLIC_DATA_MODE=real`. Production profiles refuse to +start while the R4 waitlist backend is unconfigured (`LocalWaitlistShipBlockerError`): that is +the designed ship blocker, not a bug. The full gate picture lives in `docs/REVIEW-RUNBOOK.md`. +
Android troubleshooting · real issues hit during development @@ -245,7 +275,7 @@ npm run lint # eslint only npx tsx src/theme.test.ts ``` -`npm run check` runs forty things: +`npm run check` runs forty-two things: 1. **`src/theme.test.ts`**: asserts the oklch→sRGB conversion against the known sRGB primaries. Every colour in the app flows through it, so it's the one piece of non-trivial logic with a @@ -334,13 +364,26 @@ npx tsx src/theme.test.ts transitions, no double submits, the submit-time address freeze and retry scoping. -34. **`src/keys/session.test.ts`**: KeySession closure isolation, zeroize of the seed buffer, +36. **`src/keys/session.test.ts`**: KeySession closure isolation, zeroize of the seed buffer, release semantics, xpub parity. 37. **`scripts/no-console.ts`**: no `console.*` in the native facade or the secret-handling modules (keys, send, storage, data, onboarding, trade, screens, waitlist). -38. **`scripts/no-em-dash.ts`**: no em or en dashes anywhere in code, specs or docs. +38. **`scripts/no-em-dash.ts`**: no em or en dashes anywhere in code, specs or docs + (`docs/` added to the scan roots in M6). 39. **`tsc --noEmit`**: strict TypeScript. 40. **`eslint .`**: `eslint-config-expo`, including the `react-hooks` rules. +41. **`scripts/perf.mjs`**: the static startup-path review (splash gate, lazy bindings + require, synchronous provider construction, eager-import inventory) with the timing + budget status; device numbers stay a `docs/MANUAL-QA.md` deliverable. +42. **`scripts/size-report.mjs`**: the static size inventory (app source, dependency + trees, vendored artifacts) grading the JS-bundle budget only against a measured metro + export (an export directory can be passed as an argument or `SIZE_REPORT_DIR`; + default `dist/`), never an estimate. + +CI measures the gate for real: the Bundle step exports the Android app to `dist/` and a +follow-up step runs the size report against that export, so an over-budget bundle fails +the pipeline. Locally, with no export present, the report says NOT MEASURED and stays +non-failing. **There is no UI/component test suite yet.** Adding one (React Native Testing Library + `jest-expo`) is a welcome contribution: start with the onboarding flow, which holds the most @@ -350,6 +393,8 @@ swallowed every touch typechecked and bundled perfectly). ### Manual checks (device, gated-vault and waitlist paths) +The release QA list consolidating this whole section lives in `docs/MANUAL-QA.md`; the items +below stay for the day-to-day device loop. The native auth gate cannot be exercised in Node; verify these by hand on a device build. The waitlist matrix (18 to 24) runs in mock mode on a dev build: it needs no backend. @@ -499,7 +544,7 @@ import and verification steps. Mojito ME is pre-production: the key stack is real and vector-tested, but the bindings call-through, transaction sending and BTC device verification are still pending (see -[Project status](#️-project-status--m3-send-and-receive)). Findings against mock chain data or the +[Project status](#️-project-status--m6-release-readiness)). Findings against mock chain data or the not-yet-wired bindings facades are out of scope and not eligible for a reward. The bounty becomes valid for this repository when it ships to production, at which point this diff --git a/app.json b/app.json index 1d72d3d..7a4967e 100644 --- a/app.json +++ b/app.json @@ -8,9 +8,11 @@ "scheme": "mojito-me", "backgroundColor": "#0b0a09", "ios": { - "supportsTablet": false + "supportsTablet": false, + "bundleIdentifier": "org.mintlayer.mojito.me" }, "android": { + "package": "org.mintlayer.mojito.me", "adaptiveIcon": { "backgroundColor": "#0b0a09" } diff --git a/docs/MANUAL-QA.md b/docs/MANUAL-QA.md new file mode 100644 index 0000000..1583435 --- /dev/null +++ b/docs/MANUAL-QA.md @@ -0,0 +1,245 @@ +# Manual QA (release matrix) + +The M6 release QA list. It consolidates the accumulated per-milestone manual +matrix (the project notes manual-tests file) into the final pre-submission +run. Nothing here is optional at submission time except the items explicitly +marked blocked (they name their external dependency). Machine gates live in +`npm run check`; this file is the device half. + +## 1. Builds and sizes to run + +| Build | Profile | Mode | Use | +|---|---|---|---| +| Dev client | `development` (local or EAS) | mock unless `EXPO_PUBLIC_DATA_MODE=real` | functional matrix, vault and auth paths | +| Preview APK | `preview` | real | real-mode honesty matrix on mainnet | +| Production AAB / IPA | `production-android` / `production-ios` | real | store-metadata, installed-size and release-security pass. NOTE: the production profiles refuse to start while the R4 waitlist backend is unconfigured (`LocalWaitlistShipBlockerError`). That is the designed ship blocker: run the release-security pass on the preview APK until the backend lands, then re-run items 40 to 45 on the production builds | + +Device sizes (decision D8): 375x667, 360x740 (perf baseline), 390x844, +412x915, 430x932. Full matrix on 360x740 and 390x844; every screen's layout +items on all five; the remaining sizes walk the full list once. + +## 2. Performance measurement protocol (360x740 baseline) + +Record device model and OS version next to every number; emulator numbers +are labeled as such and never substitutes. Budgets are release blockers +unless waived in `docs/REVIEW-RUNBOOK.md` section 5. + +1. Cold start to interactive Home: launch from a killed process, stop the + clock at the first interactive Home frame. Budget under 2500 ms. +2. Tab switch: Wallet to DEX to Swap to Bridge to Card and back, worst tab. + Budget under 250 ms. +3. Send sheet open: tap Send from Home, stop at the rendered details step. + Budget under 400 ms. +4. QR render: open Receive, stop at the drawn QR. Budget under 300 ms. +5. Scan-ready camera: the scan entry (when the ScanSheet milestone lands). + Budget under 1200 ms. + +## 3. Installed-size protocol + +1. JS bundle: `npx expo export --platform android`, read the hbc size with + `node scripts/size-report.mjs` (grade against the 4 MB budget; the M6 + measured 4.40 MiB is waived in the runbook). +2. Installed sizes: install the production artifacts, read the reported + app size from OS storage settings (iOS) and `adb shell pm dump` or + settings (Android). Budgets: 90 MB iOS, 60 MB Android, bindings + artifacts included. Record the numbers in `docs/REVIEW-RUNBOOK.md` 5. + +## 4. Per-screen release checklist + +Items carry the milestone that shipped them. "release" means: repeat on a +release-mode build (preview APK or production where it can start). + +### Onboarding and unlock (M1) + +1. Create flow end to end: 24-word generation (12-word switch works), the + verify quiz rejects a wrong chip, PIN set/confirm persists, discovery + shows five real tmt1 addresses and lands on none. +2. Import flow: abandon x23 + art passes the real checksum, clipboard is + cleared after paste, discovery shows the tmt1qyxqfq37rra32sq6zhayqcpjwh4trc07mcfardwt + parity address as funded (fixture probe). +3. Import rejection: swapped word shows the checksum error, a foreign word + names the word, a 6-word paste names the allowed counts. +4. Discovery custom path: m/84'/0'/3' (or m/44'/1'/2') actually derives that + account; an unsupported path shows the path-invalid error, never a silent + rescan of the defaults. +5. Lock and unlock with PIN: 5 wrong PINs arms the escalating countdown, + input frozen, countdown resumes after relaunch mid-lock, correct PIN + clears the attempt counter. +6. Biometric unlock: prompt fires on lock when enrolled and enabled, + biometry-only (no device-credential escape), in-app PIN always unlocks, + no-biometrics device goes straight to PIN, fingerprint devices see + fingerprint copy. +7. Change PIN from settings: current PIN verified first (wrong ones feed the + lockout), new PIN unlocks at the next lock. +8. Seed at rest: kill and relaunch keeps the wallet behind the lock screen; + sign-out wipes the vault, the PIN verifier and the session, returning to + onboarding. +9. Capture guard: seed, verify and import screens block screenshots on + Android and warn on iOS. +10. Auto-lock: background and return, the lock screen is up (default on); + toggle off and the session stays; relaunch respects the persisted + toggle and the persisted Face ID choice. +11. Step-up auth on phrase reveal: Settings > Recovery phrase and the Home + deferred-backup banner both re-lock; the words are never reachable from + an unlocked session without PIN or biometric. +12. Vault gate on device: decrypt paths run the OS biometric prompt or the + step-up prompt on refusal (`VaultAuthRequiredError`); enrolling a new + biometric invalidates the key and surfaces the re-auth guidance. +13. Enable/disable biometrics re-seal and killed-mid-upgrade relaunch (the + three M1 upgrade items in the accumulated matrix). +14. Release-build settings persistence smoke: enrol biometrics, kill, + relaunch, the lock screen still leads with biometrics, no surprise + re-seal prompt, Settings still shows Face ID on. + +### Home (M2) + +15. Live mainnet portfolio (real mode): totals and asset rows match the + explorer for two spot-checked derived addresses; USD figures carry the + demo chip (mock price provider per R1). +16. Demo chip per mode: mock shows "Demo data", real shows "Demo prices"; + never absent in either (prices are fixture-backed in both per R1). +17. Pull-to-refresh: spinner stops when data lands, the last-update banner + clears, the chain tip moves without a restart. +18. Offline vs stale banners: airplane mode shows offline and pull cannot + clear it while down; restored network clears it on the next poll; three + minutes without a successful sync shows stale. +19. Polling on network loss: the balance error card, reconnect recovery, one + immediate refresh on foreground (no duplicate bursts). +20. Fresh-address rotation on Receive; the address stays stable across + reopen and rotates after on-chain use. +21. BTC portfolio sums across used addresses (no zero row on a used-history + wallet). +22. NFT tab: empty state with no holdings; name, collection, shortened owner + with a holding; metadata-unavailable copy instead of a blank row. +23. Lock screen shows no data prompts behind it; requests start only after + unlock. + +### Receive and QR (M2/M3) + +24. Receive chains: exactly Mintlayer and Bitcoin in the picker with i18n + labels, each with its own real address; copy and share write the visible + address. +25. QR honesty: both modes render the scannable library QR decoding to + exactly the string under it (phone camera on each chain segment); the + decorative grid is gone. + +### Send (M3) + +26. Mock send demo end to end with demo-labelled fake id and pending status; + the Home activity list refreshes via the tx tracker. +27. Address validation UX: wrong-chain, wrong-network, malformed; error + clears as soon as the address is fixed. +28. Amount validation UX: parse message, too-many-decimals, MAX fills the + full balance, over-balance fails the quote. +29. Percent buttons render clean amounts for every asset and percent (no + float tails, no NaN, no negatives) on Send, Swap and Bridge. +30. ML real-mode honesty: send tile enabled, Review states broadcasting is + not enabled for the network (R3), confirm ends with the device-pending + signing message or the disabled-broadcast message, never fabricated + success. (release) +31. BTC send real end to end against a configured btc-api base: live + sat/vB tiers, real txid with explorer link, confirmed flip; flagged + fallback callout when fee-estimates is unreachable. +32. Fresh-address rotation after a send; second send spends the change + (including unconfirmed change policy); concurrent send refusal; + unconfirmed incoming is not spendable; fee divergence re-review; long + change history stays spendable and failures do not burn indexes. +33. Error and retry flows: broadcast failure keeps review with retry, + timeout copy shows, no raw server text ever. + +### DEX, orders, swap, bridge (M4) + +34. Live order book (real mode): aggregated depth rows, bars per level, + 30s refresh, airplane-mode error copy instead of fixtures; stale banner + at 90s with tap-to-refetch; cursor-page recovery never mixes row + generations. +35. Place-order confirm sheet (mock): exact amounts, demo-order note with + fake id, My orders strip, demo chip honesty holds. +36. Place-order honesty (real): device-pending or disabled-broadcast copy, + never a fabricated order; over-drift price refused with the slippage + copy before anything is built. +37. My orders fill and conclude: phase chips, foreign conclude refused as + not-mine, frozen orders refuse fills client-side. +38. Swap session flow (mock): four protocol steps advance off the persisted + session, keep-open warning while in flight; refund path after expiry + with honest banners; real mode ends device-pending, the preimage never + persists or logs. +39. Bridge: exactly Mintlayer and Ethereum in pickers; quote rows from the + configured fees route in real mode and fixtures with the mock banner in + dev; E2M carries the R5 unavailable copy and stays disabled; M2E CTA + ends with the unsupported copy (intent encoder and ML submission route + pending), never a fabricated handle; indicative-price caption in real + mode. Known carried limitation (do not re-flag, it is in the README + pending list): the DEX Trades/Depth segment does not switch panels yet. + +### Card waitlist (M5) + +40. Join end to end: empty form with the seeded counter (dev build while + unconfigured), valid email lands the confirmation with the position line + or the graceful no-position copy, counter shows seed plus one, join + survives kill and relaunch, rejoin is idempotent. +41. Invalid entry: malformed emails show the specific error, the provider is + never called, the callout clears on edit. +42. Duplicate flow: a different address shows the duplicate callout with the + masked stored address; view-confirmation opens the confirmation screen; + the stored address is untouched. +43. Unavailable and retry: with a backend configured and airplane mode on, + submit parks in unavailable with the email kept and a working retry; + with the v1 local provider the join always succeeds offline. +44. Settings leave-then-rejoin: joined row with the masked email, Leave + confirms then wipes, rejoining works after the wipe. +45. Small devices: form, callouts and confirmation usable at 375x667 and + 360x740 with the keyboard up (field visible or scrollable, submit + reachable, nothing truncated). Email hygiene: never logged, only sealed + at rest, no analytics anywhere. + +### Settings and i18n (M2/M5/M6) + +46. Network switch (dev build): warn, confirm rebuilds providers, sub-label + flips, mainnet restores live data; testnet shows the honest not-connected + banner while A2 is pending. +47. Release-build network row: the switch is gone and the unavailable status + row shows instead (M6 gate). (release) +48. i18n extraction walk: every screen at 360 and 430 width, no truncated or + overlapping copy (CardScreen error callout, Send fee row with BTC). +49. A11y spot check with a screen reader: icon-only controls announce their + purpose (Home eye, Swap flip, Bridge swap sides, Unlock bio switch, + BioCircle, Verify clear word). +50. api smoke: `node scripts/api-smoke.mjs` passes against the mainnet base + and fails loudly against a dead base. + +## 5. Release security block (production build) + +Run on the build that ships (preview APK until the R4 backend lands, then +the production profiles). + +1. Sealed seed at rest verified on the release build, not only dev. +2. PIN lockout survives process death on the release build. +3. No secrets or API keys in the bundle: grep the export and artifact + output for key material patterns; EXPO_PUBLIC vars limited to the mode + flag; no secrets in eas.json. +4. No debug flags: `developmentClient` only on the development profile. +5. Screen-capture prevention active on seed and import screens. +6. Biometric prompt not bypassable by backgrounding during a gated flow. +7. Lockfile audit: critical and high findings resolved or waived in writing. +8. Bindings artifact checksums re-verified against + `vendor/mintlayer/CHECKSUMS.txt` (CI re-hashes). +9. Privacy strings: camera usage rides the scanning milestone (deferred, + project decision log D15); Face ID usage present; no tracking, no analytics, + no third-party SDK data collection. + +## 6. Testnet E2E and faucet flow (blocked: A2) + +The Mintlayer-operated testnet indexer URL is still open (action item A2, +decision R6), so the M3 testnet E2E demo stays blocked; nothing points at a +guessed URL. When the URL lands, configure it in +`src/config/endpoints.ts` (TESTNET indexerBase) and run: + +1. `npx tsx scripts/e2e-testnet.mjs` with no config exits with the + A2-blocked message (exit 2); the honesty check, not a failure. +2. Faucet: fund the public test vector wallet (abandon x23 + art) at + https://faucet.mintlayer.org, then re-run the harness with the testnet + base exported. +3. BTC leg: set `MOJITO_BTC_BASE` to a btc-api testnet deployment; the + harness runs derive, plan, sign, broadcast and track end to end. +4. Record the run against the final build in `docs/REVIEW-RUNBOOK.md` 7. diff --git a/docs/REVIEW-RUNBOOK.md b/docs/REVIEW-RUNBOOK.md new file mode 100644 index 0000000..d3c670b --- /dev/null +++ b/docs/REVIEW-RUNBOOK.md @@ -0,0 +1,203 @@ +# Release review runbook (M6) + +The M6 gate document: how this repository is reviewed, what the release gates +found, and the acceptance decision for store readiness. Companion documents: +`docs/MANUAL-QA.md` (the device matrix that must still run) and the pending +list in `README.md`. Decisions cited as D and R live in the project decision +log, kept with the project notes outside this repository; gaps in the +missing-architecture notes and the milestone specs live there too. + +## 1. Review model + +Two nested cycles (review-model decision, external project notes): + +| Cycle | Reviewers | Scope | Gate | +|---|---|---|---| +| Per commit | OCR pass plus security pass | every commit, max depth 5 | 0 critical, 0 medium | +| Milestone gate | UI/UX, i18n, mobile, DRY | whole milestone diff | findings closed or explicitly waived | + +The M6 pass re-runs the milestone checklist across the finished app as an +integration-drift check, plus the release-specific audits in sections 3 to 5. + +### Reviewer matrix + +| Reviewer | Owns | Release input | +|---|---|---| +| OCR | per-commit correctness read | commit history M0 to M5 re-skimmed for drift | +| Security | secrets, storage, auth surfaces | release security block (section 5) | +| UI/UX | layout, honesty of states, affordances | ux-deferred reconciliation (section 4.2) | +| i18n | completeness test, hardcoded-string grep, English read-through | section 3 deviations | +| Mobile | five-size matrix, safe areas, notch and dynamic island | `docs/MANUAL-QA.md` | +| DRY | provider interfaces, facade duplication, fixture leftovers | provider seam audit (section 4.1) | + +### Escalation rules + +1. A release blocker found at any gate stops the train: fix or waive in + writing in this file before any store submission step. +2. Decisions (product, identifiers, endpoints) belong to the owner; the + runbook records open ones in section 6 and the build waits. +3. A missed perf or size budget is a blocker unless waived in writing here + (section 5 records the one waiver). +4. Bindings upgrades after M6 re-run `scripts/parity` coverage and re-hash + `vendor/mintlayer/CHECKSUMS.txt`: treat as a release event, not a bump. + +## 2. Milestone gate results (recorded) + +Per-milestone gates ran on their branches during M0 to M5 (commit history, +155 commits from `feat/baseline-ts` to `feat/m5-card`, one line each). The +M6 integration pass confirms the cross-milestone invariants below; each +invariant is machine-checked or referenced to its evidence. + +| Invariant | Evidence | Status | +|---|---|---| +| npm run check green on the release branch | gate script, 36 tests plus tsc, eslint, perf, size | pass | +| i18n completeness (every key referenced, no orphans) | `src/i18n/strings.test.ts` | pass | +| Vendored bindings signatures pinned | `src/trade/bindingsParity.test.ts` | pass | +| No console in secret paths | `scripts/no-console.ts` | pass | +| No em or en dashes | `scripts/no-em-dash.ts` (docs/ added to the scan roots in M6) | pass | +| Provider seam single registration point | `src/data/providers/index.ts` (screens never construct providers) | pass | +| Storage release policy one spelling | `src/config/runtime.ts` (`devFallbackAllowed`) | pass | + +## 3. Release honesty audit (production build behavior) + +Every pending-config gate must render its honest state in a production +build. Production means an EAS release profile: `__DEV__ false`, so +`devFallbackAllowed()` (`src/config/runtime.ts`) returns false and dev +memory fallbacks refuse. + +| Surface | Config state | Production behavior | Evidence | +|---|---|---|---| +| ML broadcast (R3, A1 open) | `broadcastBase: null` (endpoints.ts:38), `FLAGS.realBroadcastEnabled: false` (endpoints.ts:83) | real-mode send reviews and signs, then refuses with the broadcast-disabled copy; never a fabricated success. Trade surfaces refuse typed (order placement, swap lock) | `src/i18n/strings/en.ts:129` (`send.error.broadcast.disabled`), `:202` (`dex.order.broadcastOff`), `:254` (`swap.broadcastOff`) | +| Testnet (A2 open, R6) | every TESTNET read endpoint null (endpoints.ts:51 to 56) | the network switch is dev-only: release builds render the unavailable status row instead of the toggle; dev builds keep the switch with the pending-base warning; testnet data surfaces show the honest not-connected banner | `src/screens/SettingsScreen.tsx:249` (dev gate, added M6), `src/i18n/strings/en.ts:388` (`errors.indexer.testnet`), HomeScreen testnet banner branch | +| BTC backend (F13, unconfigured) | `btcBase: null` (endpoints.ts:39) | no BTC chain client is constructed; chains lists drop Bitcoin instead of promising a dead chain; BTC send fee fallback flags itself when a configured base is unreachable | `src/data/real/account.ts:53`, `src/data/real/realWalletData.ts:204,216` | +| Card waitlist (R4 ship blocker) | `waitlistBase: null` (endpoints.ts:41), `FLAGS.localWaitlistOnly: true` (endpoints.ts:87) | release construction of the provider REFUSES with `LocalWaitlistShipBlockerError`; the taken-counter gauge release-hides while local-only. Consequence: a production build cannot start until a real waitlist backend is configured. This is the deliberate R4 gate | `src/data/providers/WaitlistProvider.ts:38-55`, `src/data/providers/WaitlistProvider.test.ts:89`, `src/screens/CardScreen.tsx:97` | +| Prices (R1, direction chosen, implementation pending) | `priceBase: null` (endpoints.ts:40) | fixture price provider in both modes, `pricesAreMock: true`; the home chip discloses the mode: "Demo data" in mock, "Demo prices" in real | `src/data/providers/index.ts:40-43`, `App.tsx` chip (`home.demoData` / `home.demoPrices`) | +| Bridge (R5, E2M signer open) | `bridgeBase` configured (api.bridge.mintlayer.org/api/v1) | quotes and status ride the bridge api; E2M direction disabled with the signer-decision copy; M2E initiation honestly gated until the deposit intent encoder and the ML submission route exist | `src/i18n/strings/en.ts:284` (`bridge.route.e2m.unavailable`) | +| Bindings call-through (pending device verification) | artifacts vendored and linked | facades compile and reject typed until a dev build on a machine verifies the native call-through; TS key paths do not depend on it | README pending list, `src/trade/bindingsParity.test.ts` | +| Demo path (R3) | mock mode only | demo-labelled fake ids stay inside mock mode; the chip, send success and order copy disclose demo status | `src/i18n/strings/en.ts:114,207` | + +Machine-verifiable gates (`grep` over `src/config/endpoints.ts`): +`realBroadcastEnabled: false`, `localWaitlistOnly: true`, +`defaultDataMode: 'mock'`, and the null fields listed above. The gate values +are constants in one file; flipping any of them is a reviewed config change, +not a code change. + +## 4. Drift checks + +### 4.1 DRY and provider seams + +One registration point (`createProviders`), one selection factory per gap +provider, the runtime policy single-spelled in `src/config/runtime.ts`. The +M4-to-M5 reconciliation ledger (project decision log D13) remains the record +for consumed, trimmed and deferred chain-client methods. + +### 4.2 ux-deferred reconciliation + +The deferred-UX lists (external project notes) close as follows; each item +is either resolved by a later milestone or carried explicitly. + +| Item | Outcome | +|---|---| +| Swap 1/2 and Max vs balance | resolved in the M2 cycle-4 fix pass (provider balance semantics) | +| Send address book link | resolved by removal (recipient chips plus paste; contact list is mock-mode only) | +| Send scan and QR icons | carried as the honest alert (`send.scan.unavailable`); camera scanning ships with its milestone (project decision log D15); MANUAL-QA item | +| Receive request-specific-amount row | resolved by removal (lands with the payment-request flow; comment at the site) | +| Home profile chevron | resolved: static label now, lock and settings buttons wired | +| Home bell with unread badge | resolved by removal (no notification feature exists) | +| Home Tokens/NFTs/DeFi segment | resolved: wired in M2 (NFT and DeFi branches render) | +| Home "See all" | resolved by removal | +| Settings "Edit" | resolved by removal (comment at the site) | +| Settings "Connected dApps" | resolved by removal | +| Settings "Manage networks" | resolved: rendered as a status row, not a button | +| Bridge chain tiles | resolved: informational cards (no tap affordance), honest two-chain set | +| DEX Trades/Depth segment | CARRIED (known limitation): the segment sets state that no panel consumes. Recorded in the README pending list and MANUAL-QA; the house rule (wire, disable or remove) applies at the fix pass that owns the trades panel | +| ICU plural migration | resolved by removal: the `{plural}` substitution keys no longer exist in the dictionary (English-only D7; the trap is gone with the reworded copy) | +| Waitlist join-failure path | resolved (recorded fix; invalid and duplicate callouts ship in M5) | +| Native vault-prompt locale plumb (external project notes) | carried: native BiometricPrompt strings stay English; no locale channel exists; release note item | +| NFT thumbnails (external project notes) | carried: text-only rows; no image dependency in the set; release note item | +| Receive QR below 360 dp | carried (no supported target below 360; scale rule recorded at the site) | +| Waitlist duplicate copy local-store semantics | carried with R4: accurate for v1; revisit with the backend milestone | + +## 5. Performance and size pass + +Static scope in this environment (no device runs, no native builds); +`scripts/perf.mjs` and `scripts/size-report.mjs` are in the `npm run check` +gate and grade what they can grade honestly. CI measures the JS budget +against the real export: the Bundle step writes `dist/` and a follow-up step +runs the report, so a measured breach fails the pipeline instead of passing +on an absent tree. + +### Timing budgets (spec M6) + +Not measured here: they need the 360x740 device baseline. The measurement +protocol is in `docs/MANUAL-QA.md` section 2; the numbers are a MANUAL-QA +deliverable and a store-submission precondition. Deviation recorded: the +spec's timing harness scope is delivered as the static startup-path review +(eager-import inventory, splash gate, lazy bindings require, synchronous +provider construction) plus the documented protocol. + +### Size budgets + +| Budget | Measured | Verdict | +|---|---|---| +| JS bundle under 4 MB | 4,608,641 bytes (4.40 MiB Hermes bytecode, 1488 modules, zero image assets; `npx expo export --platform android`) | MISS, waived below | +| Installed app under 90 MB iOS | not measured (needs a native build); static contributions: bindings device slice 49.69 MB + bundle 4.40 MB + framework and asset overhead, estimate well under budget | pending device-pass record | +| Installed app under 60 MB Android | not measured; AAR 7.94 MB all ABIs (app bundle splits per ABI) + bundle 4.40 MB, estimate well under budget | pending device-pass record | + +**Written waiver (JS bundle):** the measured 4.40 MiB misses the 4 MB +budget by roughly 10 percent. The budget predates any measurement; the app +ships the complete BIP39 wordlist, the scure and noble crypto stack, five +full surfaces and the trade encoders. Trimming before release without +device verification trades a bounded byte miss for unbounded regression +risk. Waived for this release with the trim plan in order: (1) lazy-mount +the trade surfaces (Bridge, Swap, DEX behind their tab), (2) prune unused +icon paths, (3) re-grade. Owner sign-off of this waiver is part of the +submission checklist (section 7). The gate fails on any future measured +breach unless this waiver is renewed. + +## 6. Deviations and open items (spec M6 vs shipped) + +| Spec item | Shipped | Reason | +|---|---|---| +| Runbook and QA docs in-repo | `docs/REVIEW-RUNBOOK.md`, `docs/MANUAL-QA.md` created in-repo per spec deliverables 1 and 2 | the working notes stay outside the repository; the release gate documents live with the code they gate | +| `update.required.title` / `update.required.body` reserved keys | NOT added | the i18n completeness gate fails on unreferenced keys; reserved-but-unwired entries are exactly the orphan class it exists to prevent. They land with the endpoint-version gate wiring | +| `send.disabled.title` / `send.disabled.body` | NOT added | superseded by the shipped M3 honesty: send stays enabled through review and sign and refuses at broadcast with existing keys; a disabled-send copy would describe a flow that does not exist | +| `release.network.mainnetOnly` | NOT added | the release UI hides the switch and shows `settings.network.unavailable`; a second mainnet-only string has no call site | +| `settings.network.unavailable` | added and wired (SettingsScreen release branch) | as specified | +| Camera usage string in app.json | NOT added | no camera dependency exists (scanning deferred, project decision log D15); a usage string without the feature is a store-rejection and honesty risk. Becomes a submission precondition together with the ScanSheet milestone | +| Production app identifiers | `org.mintlayer.mojito.me` (iOS bundleIdentifier, Android package) | derived from the project slug; owner confirms before submission (section 7) | +| EAS profile names | `development`, `preview`, `production-android`, `production-ios` per the spec profile contract | as specified; `EXPO_PUBLIC_DATA_MODE=real` set on preview and production, mock explicit on development; no secrets in eas.json and no endpoint literals outside `src/config/endpoints.ts` | +| Privacy declarations | none beyond framework defaults: no analytics, no tracking, no third-party SDK data collection anywhere in the dependency set | as specified | +| Version policy | `appVersionSource: remote` with `autoIncrement` on both production profiles; the semver display version stays owner-owned at submission | CI-stamped build numbers, never hand-edited in release commits | + +## 7. Release acceptance checklist + +Statuses: pass (machine or recorded evidence), pending (device pass, +`docs/MANUAL-QA.md`), blocked (external dependency), waived (section 5). + +- [x] All six milestone specs have their acceptance criteria checked or explicitly waived in the branch history and the project decision log (external notes); residual deferrals are enumerated in section 4.2 and the README pending list. (pass) +- [x] Reviewer gate history: per-commit cycle through M5; M6 integration pass recorded in sections 2 and 4. (pass) +- [ ] EAS profiles configured per the profile contract; identifiers and version policy applied. Builds not run here. (pending: builds; configuration recorded) +- [ ] Five-size matrix executed per `docs/MANUAL-QA.md` with results recorded; safe areas on notch and dynamic-island devices. (pending device pass) +- [ ] Perf budgets recorded from the 360x740 baseline. (pending device pass) +- [ ] Size pass: measured JS bundle recorded; installed sizes pending real artifacts; the one budget miss waived in writing. (pending: installed sizes; JS waiver recorded) +- [x] Production endpoints locked in `src/config/endpoints.ts`; undecided gaps flag-hidden or mock-gated with honest states (section 3). (pass) +- [ ] Security release checks on a release build: sealed seed, lockout persistence, no secrets in the bundle, checksums re-verified, dependency audit clean or waived. (pending device pass; the static half - no secrets in eas.json, no console in secret paths, checksums in CI - passes here) +- [x] Store metadata readiness minus the camera string: bundle id, version strings, Face ID usage string, privacy posture recorded. Camera string rides the scanning milestone (waiver note in section 6). (pass with noted exception) +- [ ] Testnet E2E demo (M3 script) against the final build; faucet flow documented in `docs/MANUAL-QA.md`. (blocked: A2 testnet URL open; the BTC leg runs when a btc-api testnet base is configured) +- [x] npm run check green on the release commit; commits small with one-line messages through M6. (pass) + +### Submission preconditions (owner) + +1. Confirm or replace the app identifiers (`org.mintlayer.mojito.me`). +2. Sign the JS-bundle waiver (section 5) or run the trim plan first. +3. Configure `waitlistBase` (R4 backend) - without it the release build refuses to start by design. +4. A1 (ML submission endpoint) and A2 (testnet URL) remain open; their surfaces ship honest-gated (section 3). +5. Record installed sizes and timing numbers from the device pass in this file. + +## 8. Sign-off + +| Role | Name | Result | +|---|---|---| +| Release engineering | M6 branch `feat/m6-release` | gates recorded above | +| Owner | pending | submission preconditions in section 7 | diff --git a/eas.json b/eas.json index 25057a6..2a49440 100644 --- a/eas.json +++ b/eas.json @@ -9,22 +9,41 @@ "distribution": "internal", "ios": { "simulator": true - } + }, + "env": { + "EXPO_PUBLIC_DATA_MODE": "mock" + }, + "channel": "development" }, "preview": { "distribution": "internal", "android": { "buildType": "apk" - } + }, + "env": { + "EXPO_PUBLIC_DATA_MODE": "real" + }, + "channel": "preview" }, - "production": { + "production-android": { "autoIncrement": true, "android": { "buildType": "app-bundle" }, + "env": { + "EXPO_PUBLIC_DATA_MODE": "real" + }, + "channel": "production" + }, + "production-ios": { + "autoIncrement": true, "ios": { "autoProvision": true - } + }, + "env": { + "EXPO_PUBLIC_DATA_MODE": "real" + }, + "channel": "production" } } } diff --git a/modules/mojito-core/android/src/main/java/expo/modules/mojitocore/MojitoCoreModule.kt b/modules/mojito-core/android/src/main/java/expo/modules/mojitocore/MojitoCoreModule.kt index 87f4b82..cf4a024 100644 --- a/modules/mojito-core/android/src/main/java/expo/modules/mojitocore/MojitoCoreModule.kt +++ b/modules/mojito-core/android/src/main/java/expo/modules/mojitocore/MojitoCoreModule.kt @@ -380,7 +380,7 @@ class MojitoCoreModule : Module() { }, ) val info = BiometricPrompt.PromptInfo.Builder() - // i18n exception (plans/ux-deferred.md): these strings are hardcoded + // i18n exception (deferred-UX notes): these strings are hardcoded // English inside the module; there is no app-locale channel across // the bridge yet, so the full plumb is deferred. The wording mirrors // the in-app copy (onboarding.unlock.bioReason) so the vault prompt diff --git a/package.json b/package.json index da705b9..457541b 100644 --- a/package.json +++ b/package.json @@ -9,8 +9,10 @@ "ios:dev": "expo run:ios", "android:dev": "expo run:android", "prebuild": "expo prebuild", - "check": "tsx src/theme.test.ts && tsx src/i18n/strings.test.ts && tsx src/money.test.ts && tsx src/data/polling.test.ts && tsx src/data/ml/indexerClient.test.ts && tsx src/data/btc/btcChainService.test.ts && tsx src/data/addresses/addressManager.test.ts && tsx src/storage/addressStore.test.ts && tsx src/data/activity/activityService.test.ts && tsx src/storage/secureStore.test.ts && tsx src/storage/walletVault.test.ts && tsx src/storage/pinStore.test.ts && tsx src/storage/appSettings.test.ts && tsx src/data/real/realWalletData.test.ts && tsx src/data/providers/providers.test.ts && tsx src/data/providers/broadcast.test.ts && tsx src/data/providers/bridge.test.ts && tsx src/data/providers/WaitlistProvider.test.ts && tsx src/trade/orderBookService.test.ts && tsx src/trade/orders.test.ts && tsx src/trade/htlc.test.ts && tsx src/trade/swapSession.test.ts && tsx src/trade/priceGuards.test.ts && tsx src/trade/bindingsParity.test.ts && tsx src/keys/bip39.test.ts && tsx src/keys/mlAccounts.test.ts && tsx src/keys/BtcKeyring.test.ts && tsx src/send/validation.test.ts && tsx src/send/mlTxBuilder.test.ts && tsx src/send/btcTxBuilder.test.ts && tsx src/send/TxTracker.test.ts && tsx src/data/real/realSend.test.ts && tsx src/data/mock/mockSend.test.ts && tsx src/data/mock/localWaitlist.test.ts && tsx src/waitlist/waitlistForm.test.ts && tsx src/keys/session.test.ts && tsx scripts/no-console.ts && tsx scripts/no-em-dash.ts && tsc --noEmit && eslint .", - "lint": "eslint ." + "check": "tsx src/theme.test.ts && tsx src/i18n/strings.test.ts && tsx src/money.test.ts && tsx src/data/polling.test.ts && tsx src/data/ml/indexerClient.test.ts && tsx src/data/btc/btcChainService.test.ts && tsx src/data/addresses/addressManager.test.ts && tsx src/storage/addressStore.test.ts && tsx src/data/activity/activityService.test.ts && tsx src/storage/secureStore.test.ts && tsx src/storage/walletVault.test.ts && tsx src/storage/pinStore.test.ts && tsx src/storage/appSettings.test.ts && tsx src/data/real/realWalletData.test.ts && tsx src/data/providers/providers.test.ts && tsx src/data/providers/broadcast.test.ts && tsx src/data/providers/bridge.test.ts && tsx src/data/providers/WaitlistProvider.test.ts && tsx src/trade/orderBookService.test.ts && tsx src/trade/orders.test.ts && tsx src/trade/htlc.test.ts && tsx src/trade/swapSession.test.ts && tsx src/trade/priceGuards.test.ts && tsx src/trade/bindingsParity.test.ts && tsx src/keys/bip39.test.ts && tsx src/keys/mlAccounts.test.ts && tsx src/keys/BtcKeyring.test.ts && tsx src/send/validation.test.ts && tsx src/send/mlTxBuilder.test.ts && tsx src/send/btcTxBuilder.test.ts && tsx src/send/TxTracker.test.ts && tsx src/data/real/realSend.test.ts && tsx src/data/mock/mockSend.test.ts && tsx src/data/mock/localWaitlist.test.ts && tsx src/waitlist/waitlistForm.test.ts && tsx src/keys/session.test.ts && tsx scripts/no-console.ts && tsx scripts/no-em-dash.ts && tsc --noEmit && eslint . && node scripts/perf.mjs && node scripts/size-report.mjs", + "lint": "eslint .", + "perf": "node scripts/perf.mjs", + "size:report": "node scripts/size-report.mjs" }, "dependencies": { "@noble/curves": "^2.4.0", diff --git a/plans/mojito-neo/decisions.md b/plans/mojito-neo/decisions.md deleted file mode 100644 index e337455..0000000 --- a/plans/mojito-neo/decisions.md +++ /dev/null @@ -1,200 +0,0 @@ -# Decision log - -Decisions referenced from code comments live here. Earlier entries (R2 pure -TypeScript keyring, D7 English-only strings, D9 no dash characters) are recorded -in the branch history and in the code comments that cite them; this file -consolidates the decisions taken from the M1 gate review onward so future -changes have one place to check. - -## D10. KeySession stays an unlock-time abstraction, wired in M2 - -`src/keys/session.ts` (`openKeySession` / `KeySession`) has no production -caller in M1: discovery derives from onboarding state, and the unlock flow -calls `walletVault.meta()` / `openWords()` directly. The M1-gate review flagged -the module as production-dead code narrating phantom callers. - -Decision: defer the wiring, do not delete the module. Receive and address -management in M2 are the intended consumers (an unlocked session derives -accounts through `withSeed` so seed bytes stay inside the closure). The module -stays in M1 because its closure-isolation, zeroize and release semantics are -vector-tested in `src/keys/session.test.ts`, and the header states the deferral -instead of describing callers that do not exist. - -## D11. btcPrivateKeyAt lands with the M3 signer - -`BtcKeyring.btcPrivateKeyAt` (and the `mnemonicToSeedSync` dependency it -carries) is test-only in M1; its production consumer is M3's BtcTxBuilder -signing path. Deferred with that milestone rather than landed as a -forward-declared API; the function doc says so. - -## D12. Shared per-tick address scan deferred - -Portfolio and activity each call `addressInfo` per derived address on every -refresh cycle, so one tick issues two sequential scans. A shared per-tick -scan carried on the home bundle would halve the request count. Deferred: -the duplicate work is bounded by the gap scan, the 60 second cadence and -the rate-limit-friendly sequential probing, so the simplification is not -worth the state coupling yet. Revisit with M3 send bookkeeping, which needs -fresh per-address summaries for coin selection anyway. - -## D13. Chain-client methods without M2 consumers stay, deferred to their milestones - -The M2 gate review counted 13 production-dead methods across the chain -clients: `src/data/ml/IndexerClient.ts` (`tip`, `spendableUtxos`, `allUtxos`, -`tokensByTicker`, `feerate`, `coinStatistics`, `orderBook`, `walkCursor`, -`walkOffset`) and `src/data/btc/BtcChainService.ts` (`utxos`, `txStatus`, -`tipHeight`, `feeEstimates`) have no caller outside their own tests. That is -the forward-declared-API shape D11 rejected, so the surface is recorded here -instead of being silently kept or silently trimmed. - -Decision: defer, do not delete. Each method maps to a named milestone -consumer: `feerate`, the UTXO listings and the BTC `utxos`/`txStatus`/ -`tipHeight`/`feeEstimates` set land with the M3 signer and fee bookkeeping; -`orderBook`, `coinStatistics`, `tokensByTicker` and the cursor walkers land -with the M4 market and activity paging. The client module headers cite this -entry instead of narrating callers that do not exist, and M3/M4 must consume -or trim these methods when their consumers land. - -M4 outcome (reconciliation): consumed in production are `feerate`, -`spendableUtxos`, `tip`, the BTC set, `orderBook` (OrderBookService), -`tokensByTicker` (ticker disambiguation) and `walkOffset` (orders and -ordersByPair). Trimmed with the M4 fix pass: `allUtxos` and `coinStatistics` -(production-dead, untested, and no remaining milestone consumer). Deferred: -`walkCursor`, the only survivor, because M4's cursor walking lives inside -OrderBookService with restart semantics of its own; the generic walker stays -test-only until a second cursor endpoint needs it, and a later milestone must -consume or delete it like the rest of this ledger. - -## D14. QR encoding uses react-native-qrcode-svg, not the spec's pure-TS encoder - -The M3 spec's deliverable 1 asked for a hand-rolled pure TypeScript QR encoder -(`src/qr/QrCode.ts`, ECC M) with a reference-decoder round-trip test. Shipped -instead: the `react-native-qrcode-svg` library at error correction level H. - -Rationale: a QR encoder is exactly the kind of byte-level state machine a -hand-rolled copy gets subtly wrong (mask selection, version negotiation, -padding), and a bug there produces codes that scan unreliably or encode the -wrong payload. The battle-tested library removes that entire failure class, -and ECC H keeps the code decodable under the center badge overlay the receive -screen renders. The price is one well-audited dependency instead of a -maintained in-tree deliverable, and the ECC M to H drift (more redundancy, -no functional change). The pure-TS deliverable and its round-trip test are -dropped, not deferred; if the dependency ever has to go, reintroduce the -deliverable with its reference-decoder test in the same change. - -## D15. ScanSheet and expo-camera deferred past M3 - -The M3 spec's deliverable 2 (a scan sheet for pasting-free recipient entry) -is not shipped: there is no camera dependency and no ScanSheet. The send -screen's QR button shows an honest alert ("Camera scanning ships with the -next milestone; paste an address for now") and paste remains the entry path. - -Rationale: a camera permission surface is a native build and store-review -cost that a paste-first send flow does not need yet, and shipping it half -wired would be worse than an honest alert. The `scan.*` i18n keys land with -the sheet, not before. Revisit when the milestone that owns scanning picks -the camera library. - -## R4. The waitlist ships local-only in v1 (option C), real backend before ship - -2026-11-17. The M5 card screen needs an early-access waitlist, but no waitlist -backend exists: missing-architecture gap 4 proposes the POST /v1/waitlist -contract, with options A and B for the hosted or self-hosted backend. Decision: -ship v1 as option C, the sealed device-local store -(`src/data/mock/localWaitlist.ts`): one slot per install, the email sealed -under the `waitlist.email.v1` key id, never logged, never sent anywhere. The -HTTP provider (`src/data/providers/WaitlistProvider.ts`) is complete against -the proposed contract and activates on a config flip only -(`endpoints.waitlistBase`), so going real stays a URL change. - -This is a ship blocker: a production build must never run the local-only -waitlist. The gate lives in `createWaitlistProvider` behind -`FLAGS.localWaitlistOnly`: where dev fallbacks are not allowed (a release -build), construction without a configured backend refuses with -`LocalWaitlistShipBlockerError` instead of silently shipping the device-local -store. - -Retention: the email is personal data, so it joins the destructive boundaries. -Settings > Leave wipes the sealed entry (a failed wipe surfaces and the row -stays joined), and wallet sign-out wipes it together with the vault and the -PIN, verifying the blob is gone before the app returns to onboarding. - -## M4 change log - -### Bindings seam corrected to the vendored signatures (M4 review, critical) - -The first M4 implementation mirrored an imagined UniFFI API. The TS mirror -in `modules/mojito-core/mintlayer/MintlayerBindings.ts` is reshaped to the -pinned vendored surface (`vendor/mintlayer`, wallet-bindings v0.1.0): -`getOrderId(inputs, network)` derives the order id from the create tx -inputs (no output index exists); `encodeInputForFillOrder` and -`encodeInputForConcludeOrder` take the bech32 id strings plus the account -nonce and the current block height (they select the orders V0/V1 input -form; conclude carries no destination argument); `encodeOutputHtlc` takes -a hex secret hash, no spend pubkey, and a `refundTimelock` blob produced -by the `encodeLock*` encoders (`encodeLockForSeconds` is added to the -mirror for the seconds-denominated offers); `extractHtlcSecret` consumes -the `encodeOutpointSourceId` blob, not the bare 32-byte id; -`decodeTransactionToJson` is only ever fed serialized transaction bytes. -The seam is pinned by `src/trade/bindingsParity.test.ts` (per-line literal -asserts plus a checksum over the vendored signature lines), so either side -drifts only through a failing gate. - -Account-nonce policy: the bindings docs require the fill and conclude -nonces to sequence with the filler's other account spendings. The flows -use an in-session counter (`createOrderFlows`); the wallet must persist -the account nonce with its state before the native call-through goes live -on real funds, otherwise the first order transaction after a restart can -sit at the wrong nonce. Recorded here as a gate condition for the -call-through landing. - -### Deviations reviewed and kept (M4 change log consolidation) - -The three M4 deviations the review flagged as sound stay, consolidated -here so the code comments can cite one entry: - -- Raw claim bytes on `extractSecret`: the public Mintlayer indexer serves - no raw-transaction route, so a txId-only signature cannot honestly fetch - what the bindings extraction consumes. The lock transaction bytes are - now captured at initiate (before the broadcast) and persisted with the - swap session (`lockTxHex`); claim and refund take those bytes and feed - them to `decodeTransactionToJson`, which consumes serialized transaction - bytes, never a tx id. -- Optional `secret` on the shared `WitnessParams`: localizes the pinned - htlc-spend-only reveal field at the seam level; `encodeWitnessHtlcSpend` - is the only consumer (the M4 fix pass removed the dead secret parameter - and the unreachable spend branch from the multi-input order/HTLC signer, - so the field now rides the dedicated single-input witness paths only). -- Optional `BridgeQuote.minAmount/etaSeconds/confirmationsRequired`: - encodes the fixture-vs-bridge_v2 API divergence; the screen honors each - (null hides the row, the eta derives from confirmations). - -### Swap initiate gated in real mode (M4 change log) - -The M4 demo locked Mintlayer against the public BIP39 test vector as both -counterparty spend path and refund path. The fix pass gates real-mode -initiation with a typed unsupported error (mirroring -`BridgeProvider.initiate`) until an offer entry supplies the counterparty -spend address and key; the refund address comes from the wallet's own -address allocation; mock mode keeps the scripted demo flow with the demo -callout. The tautological timelock guard (a fabricated BTC leg derived -from the ML value) was removed from the entry path; -`checkTimelockRule` returns with real offers, taking `btcSeconds` from -the offer instead of the scripted half. - -### Swap initiate split so the lock bytes rest before the broadcast (M4 fix) - -`initiate` now only builds and signs the lock transaction (locally -computed tx id, unsigned bytes, signed hex); `broadcastLock` is the -second half and verifies the answered id against the locally computed -one. The swap screen persists the session row (state 'offered', -`lockTxHex` set) between the two calls, so a crash after the broadcast -still leaves the bytes the claim and refund decodes consume, and the -offered -> locked transition fires only after the broadcast answers. -The transition table now also allows offered -> refunded: an 'offered' -row whose post-broadcast save failed still refunds from its stored -bytes, and a failed save maps to an explicit funds-locked error naming -the tx id (the generic nothing-sent copy would invite a second lock). -The retired spend pubkey column is dropped with the split: the vendored -`encodeOutputHtlc` carries no spend pubkey, the decoded descriptor never -read one, and the screen no longer fabricates a 33-byte key to persist. diff --git a/plans/ux-deferred.md b/plans/ux-deferred.md deleted file mode 100644 index 8928fc0..0000000 --- a/plans/ux-deferred.md +++ /dev/null @@ -1,48 +0,0 @@ -# Deferred UX items - -UX work flagged in the M1 gate review that is deliberately not done in this -milestone, with the reason and the milestone that owns it. - -## Native vault-prompt locale plumb (deferred, owner: M2+) - -The Android `BiometricPrompt` strings inside -`modules/mojito-core/android/.../MojitoCoreModule.kt` are hardcoded English -("Unlock the wallet" / "Verify it is you to unlock" / "Cancel"). The module has -no channel for the app locale yet, and the prompt fires from inside native -crypto operations where no JS round-trip exists at prompt time. - -Interim state: the wording mirrors the in-app copy -(`onboarding.unlock.bioReason`, `common.cancel`) so the vault prompt and the -unlock screen do not diverge, and the exception is documented at the call site. - -Full fix: pass the locale (or a small strings bundle) into the module at -startup and resolve the prompt strings from it on both platforms; iOS shows -system-managed text for Keychain access-control prompts and needs no strings -today. No M1 UI copy contradicts the native prompts. - -## NFT thumbnails (deferred, owner: M3) - -NftRow already carries `mediaUri` and `iconUri` (parsed by NftService), but -the NFT rows render text-only. The M2 audit accepted the text rows and -flagged thumbnails as the next expectation once real collections show up. -Deferred because there is no image component in the dependency set yet, and -remote artwork needs a caching and failure-story decision (a broken or -hostile URI must degrade to the text row, never a broken tile). The data -contract is ready; only the rendering lands. - -## Receive QR below 360 dp (deferred, owner: M3) - -The 240 px QR plus the card paddings clips on 320-class screens (224 pt -inner width); every audited device width (360 to 430) is safe. Deferred -because no supported target sits below 360 today. If one lands, scale the -QR size from the measured inner width instead of shrinking the quiet zone. - -## Waitlist duplicate copy assumes the local store (revisit with the backend) - -`card.waitlist.duplicate.body` ("This device already holds a spot for {email}") -hardcodes local semantics for a provider-agnostic machine: once the HTTP -backend lands (missing-architecture gap 4), a duplicate may be server-side, -meaning the address joined from another device, and the status-refusal -fallback masks the typed address instead of a verified on-file one. The copy -is accurate for the v1 local-only store (decision R4 in -plans/mojito-neo/decisions.md); revisit it with that milestone. diff --git a/scripts/api-smoke.mjs b/scripts/api-smoke.mjs index 4ee41bb..b7e5966 100644 --- a/scripts/api-smoke.mjs +++ b/scripts/api-smoke.mjs @@ -5,7 +5,7 @@ // MOJITO_INDEXER_BASE=http://127.0.0.1:3000/api/v2 node scripts/api-smoke.mjs const base = (process.env.MOJITO_INDEXER_BASE ?? 'https://api-server.mintlayer.org/api/v2').replace(/\/+$/, ''); -// Public derivation test vector (decisions.md F5, mainnet). A 404 +// Public derivation test vector (project decision log F5, mainnet). A 404 // AddressNotFound is a VALID answer here: it proves the endpoint contract // for an unused address without depending on any particular funded account. const VECTOR_ADDRESS = 'mtc1q82twmwwxa3l2pe26gf0zgghu69jtez3qq2ajqyl'; diff --git a/scripts/e2e-testnet.mjs b/scripts/e2e-testnet.mjs index 6e5f6c6..6794a15 100644 --- a/scripts/e2e-testnet.mjs +++ b/scripts/e2e-testnet.mjs @@ -5,7 +5,7 @@ // manager and the seeded KeySession closure shape). Headless thin harness. // Runs under tsx because the service is TypeScript: npx tsx scripts/e2e-testnet.mjs // -// BTC-ONLY status (decisions.md R6 / action items A1, A2): the Mintlayer- +// BTC-ONLY status (project decision log R6 / action items A1, A2): the Mintlayer- // operated testnet indexer URL is not documented (A2) and the ML broadcast // switch needs the A1 submission endpoint, so there is no ML leg here yet. // The BTC leg is fully real on scure and needs MOJITO_BTC_BASE (btc-api diff --git a/scripts/no-em-dash.ts b/scripts/no-em-dash.ts index b4b4fc2..6194e18 100644 --- a/scripts/no-em-dash.ts +++ b/scripts/no-em-dash.ts @@ -8,7 +8,7 @@ import { readdirSync, readFileSync, statSync } from 'node:fs'; import { join } from 'node:path'; -const SCAN_ROOTS = ['src', 'modules', 'specs', 'scripts', '.github']; +const SCAN_ROOTS = ['src', 'modules', 'specs', 'scripts', '.github', 'docs']; // Root config files and docs that sit outside the scanned roots (decision D9: // no dash characters anywhere in specs or code). const SCAN_FILES = [ diff --git a/scripts/perf.mjs b/scripts/perf.mjs new file mode 100644 index 0000000..10a5f27 --- /dev/null +++ b/scripts/perf.mjs @@ -0,0 +1,88 @@ +// Static startup-path review for the M6 release gate (spec M6 deliverable 5, +// static scope: no device runs in this repo's gate). The timing budgets +// below are graded ONLY from recorded device numbers (docs/MANUAL-QA.md, +// 360x740 baseline); this script grades the code-level startup properties +// that keep those budgets reachable and fails when they regress. +// node scripts/perf.mjs +import { readFileSync } from 'node:fs'; + +const fails = []; +const notes = []; + +// Timing budgets (spec M6): graded from device runs, never here. +const TIMING_BUDGETS = [ + 'cold start to interactive Home under 2500 ms', + 'tab switch under 250 ms', + 'Send sheet open under 400 ms', + 'QR render under 300 ms', + 'scan-ready camera under 1200 ms', +]; + +const app = readFileSync('App.tsx', 'utf8'); +const providers = readFileSync('src/data/providers/index.ts', 'utf8'); + +// Check 1: the splash covers startup until the shell is ready (App keeps the +// Splash layer up via splashDone; removing it would expose the pre-data UI). +// Match the stable tokens (the gate variable and the Splash element) instead +// of a formatting-sensitive source literal: a benign reformat must not fail +// the gate, removing either token still does. +const splashGate = app.includes('splashDone'); +const splashElement = app.includes('= 0 ? context.slice(ctxStart, ctxEnd === -1 ? undefined : ctxEnd) : ''; +if (ctxBody.length === 0) { + fails.push('ProvidersProvider not found in src/data/providers/context.tsx'); +} else if (/\bawait\b/.test(ctxBody) || /\.then\(/.test(ctxBody)) { + fails.push('ProvidersProvider contains await/then: construction must stay synchronous (first-frame cost)'); +} else { + notes.push('provider construction is synchronous closure wiring; reads start behind usePoll/useData after mount'); +} + +// Check 4 (informational): eager screen imports. Every tab and overlay ships +// in one bundle by design (1488 modules measured by the export step); lazy +// screens are the first post-release trim lever if the budgets slip. +const eagerImports = [...app.matchAll(/^import .+ from '(.+)';$/gm)].length; +notes.push(`App.tsx carries ${eagerImports} eager static imports (all screens in one bundle; lazy screens are the first trim lever)`); + +console.log('startup-path review (static) + timing budget status'); +console.log('---------------------------------------------------'); +for (const n of notes) console.log(`note: ${n}`); +console.log('timing budgets (graded from recorded device runs only):'); +for (const b of TIMING_BUDGETS) console.log(` NOT MEASURED here - ${b} (record numbers in docs/REVIEW-RUNBOOK.md)`); + +if (fails.length > 0) { + console.error('perf: startup-path gate FAILED'); + for (const f of fails) console.error(` ${f}`); + process.exit(1); +} +console.log('perf: startup-path gate pass'); diff --git a/scripts/size-report.mjs b/scripts/size-report.mjs new file mode 100644 index 0000000..5d45a84 --- /dev/null +++ b/scripts/size-report.mjs @@ -0,0 +1,138 @@ +// Static size report for the M6 release gate (spec M6 deliverable 5). +// Machine-static by design: it inventories the shipped bytes that exist in +// the repo (app source, runtime dependency trees, vendored bindings +// artifacts) and evaluates the JS-bundle budget ONLY against a measured +// metro export (dist/ from `npx expo export`), never an estimate dressed up +// as a measurement. No device and no native build is involved here; the +// installed-size checks are recorded from real build artifacts by hand in +// docs/MANUAL-QA.md and docs/REVIEW-RUNBOOK.md. +// npx expo export --platform android (machine step, produces the export) +// node scripts/size-report.mjs [exportDir] (default dist/, or $SIZE_REPORT_DIR) +import { readdirSync, readFileSync, statSync } from 'node:fs'; +import { join } from 'node:path'; + +const MB = 1024 * 1024; +// Spec M6 size budgets: JS bundle under 4 MB, installed app under 90 MB on +// iOS and 60 MB on Android (bindings artifacts count against it). +const JS_BUDGET = 4 * MB; +const IOS_INSTALL_BUDGET = 90 * MB; +const ANDROID_INSTALL_BUDGET = 60 * MB; + +const JS_EXT = new Set(['.js', '.jsx', '.ts', '.tsx', '.json', '.cjs', '.mjs']); +const SKIP_DIRS = new Set(['node_modules', '.expo', 'dist', '.git', '__tests__']); + +const fails = []; + +function walkBytes(root, extensions) { + let bytes = 0; + let files = 0; + const visit = (dir) => { + let entries; + try { + entries = readdirSync(dir); + } catch { + return; + } + for (const entry of entries) { + const path = join(dir, entry); + const stats = statSync(path); + if (stats.isDirectory()) { + if (SKIP_DIRS.has(entry)) continue; + visit(path); + } else if (extensions.has(entry.slice(entry.lastIndexOf('.')))) { + bytes += stats.size; + files += 1; + } + } + }; + visit(root); + return { bytes, files }; +} + +function dirBytes(root) { + try { + statSync(root); + } catch { + return null; // absent tree: the caller reports NOT MEASURED + } + let bytes = 0; + const visit = (dir) => { + let entries; + try { + entries = readdirSync(dir); + } catch { + return; + } + for (const entry of entries) { + const path = join(dir, entry); + const stats = statSync(path); + if (stats.isDirectory()) visit(path); + else bytes += stats.size; + } + }; + visit(root); + return bytes; +} + +const fmt = (n) => (n === null ? 'not present' : `${(n / MB).toFixed(2)} MB`); + +// Export directory: argv wins over the SIZE_REPORT_DIR env var over the +// default dist/ (where `npx expo export` writes). CI points the gate at the +// export it just produced; locally the default keeps the check honest when +// no export exists yet. +const exportDir = process.argv[2] ?? process.env.SIZE_REPORT_DIR ?? 'dist'; + +// 1. Measured metro export (the only number evaluated against the JS budget). +// The export dir is gitignored: without an export the report says NOT +// MEASURED and stays informational; a present export that breaches the +// budget fails the gate (waivers live in docs/REVIEW-RUNBOOK.md, in +// writing). +const distJs = dirBytes(join(exportDir, '_expo/static/js')); +const distAssets = dirBytes(join(exportDir, 'assets')); +if (distJs === null) { + console.warn(`size-report: no export found in ${exportDir}; JS bundle NOT MEASURED (machine step: npx expo export --platform android)`); +} else if (distJs >= JS_BUDGET) { + fails.push(`measured JS bundle ${(distJs / MB).toFixed(2)} MB is over the 4 MB budget (spec M6); waive in writing in docs/REVIEW-RUNBOOK.md or trim`); +} + +// 2. App-authored source inventory (what this repo ships and controls). +const appSource = walkBytes('src', JS_EXT).bytes + walkBytes('modules', JS_EXT).bytes; +for (const f of ['App.tsx', 'index.js']) { + try { + appSource += statSync(f).size; + } catch { + // optional file + } +} + +// 3. Runtime dependency upper bound (unminified JS-relevant bytes; context +// only, never graded: the bundler tree-shakes and minifies this inventory). +const pkg = JSON.parse(readFileSync('package.json', 'utf8')); +let depBytes = 0; +for (const dep of Object.keys(pkg.dependencies ?? {})) { + depBytes += walkBytes(join('node_modules', dep), JS_EXT).bytes; +} + +// 4. Vendored bindings artifacts (they count against the installed budgets). +const aar = statSync('vendor/mintlayer/mintlayer-wallet-bindings-0.1.0.aar').size; +const iosDevice = dirBytes('vendor/mintlayer/MintlayerWalletBindings.xcframework/ios-arm64'); +const iosSim = dirBytes('vendor/mintlayer/MintlayerWalletBindings.xcframework/ios-arm64-simulator'); + +console.log('size report (static inventory + measured export)'); +console.log('------------------------------------------------'); +console.log(`measured JS bundle (${exportDir}, Hermes): ${fmt(distJs)} budget < 4 MB ${distJs === null ? 'NOT MEASURED' : distJs < JS_BUDGET ? 'pass' : 'FAIL'}`); +console.log(`measured export assets: ${fmt(distAssets)}`); +console.log(`app source (src + modules): ${fmt(appSource)}`); +console.log(`runtime deps inventory: ${fmt(depBytes)} (direct deps, unminified; not graded)`); +console.log(`bindings AAR (all ABIs): ${fmt(aar)} (app bundles split per ABI: arm64-v8a, armeabi-v7a, x86_64)`); +console.log(`bindings iOS device slice: ${fmt(iosDevice)} (ships in the installed app)`); +console.log(`bindings iOS simulator slice: ${fmt(iosSim)} (never ships; build-time only)`); +console.log(`installed-size budgets (${IOS_INSTALL_BUDGET / MB} MB iOS, ${ANDROID_INSTALL_BUDGET / MB} MB Android) are graded`); +console.log('build artifacts only; record the numbers in docs/REVIEW-RUNBOOK.md.'); + +if (fails.length > 0) { + console.error('size-report: budget gate FAILED'); + for (const f of fails) console.error(` ${f}`); + process.exit(1); +} +console.log('size-report: gate pass'); diff --git a/src/config/endpoints.ts b/src/config/endpoints.ts index 84722ee..b2b198c 100644 --- a/src/config/endpoints.ts +++ b/src/config/endpoints.ts @@ -1,6 +1,6 @@ // Per-network endpoint sets, selected by the active network flag. No URL is -// hardcoded in screens or providers. Facts and decisions live in -// plans/mojito-neo/decisions.md: mainnet indexer is live-verified (F6), +// hardcoded in screens or providers. Facts and decisions live in the +// project decision log: mainnet indexer is live-verified (F6), // broadcast stays null until the R3 decision lands (action item A1), the // testnet base is pending action item A2 (R6), btcBase needs a btc-api // deployment URL (F13), priceBase stays null because v1 mocks prices (R1). diff --git a/src/data/btc/BtcChainService.ts b/src/data/btc/BtcChainService.ts index 8279576..f1c7f86 100644 --- a/src/data/btc/BtcChainService.ts +++ b/src/data/btc/BtcChainService.ts @@ -1,5 +1,6 @@ -// Esplora-shaped BTC chain client (decisions.md F13): balances, UTXOs, tx -// history and fee estimates against btc-api under its /api/bitcoin base. +// Esplora-shaped BTC chain client (project decision log F13): balances, +// UTXOs, tx history and fee estimates against btc-api under its +// /api/bitcoin base. // The base URL is config only (endpointsFor().btcBase); when it is null no // third-party fallback is ever hardcoded here and callers surface the // unconfigured state instead. Shapes per the btc-api API.md, which mirrors @@ -7,7 +8,8 @@ // // Methods with an M3 consumer (`utxos`, `txStatus`, `tipHeight`, // `feeEstimates`) are a recorded deferral, not an implied caller: -// decisions.md D13 lists each one with the milestone that consumes it. +// project decision log D13 lists each one with the milestone that +// consumes it. // // The retry/timeout/response-cap transport and the JSON parse guards come // from ../transport.ts; this module owns only the Esplora parse layer and diff --git a/src/data/ml/BalanceService.ts b/src/data/ml/BalanceService.ts index 408eb0a..8f57b70 100644 --- a/src/data/ml/BalanceService.ts +++ b/src/data/ml/BalanceService.ts @@ -1,6 +1,6 @@ // Portfolio aggregation across the derived ML receiving and change // addresses (spec M2): coin balance plus MLS-01 token balances straight from -// the indexer address summaries (api-coverage.md finding 2), summed on +// the indexer address summaries (api-coverage notes finding 2), summed on // BigInt atom strings. Address scanning is sequential, one request per // address, rate-limit friendly per the spec security note. Token metadata // (ticker, decimals) is cached in session memory only. diff --git a/src/data/ml/IndexerClient.ts b/src/data/ml/IndexerClient.ts index f963272..5ad6e43 100644 --- a/src/data/ml/IndexerClient.ts +++ b/src/data/ml/IndexerClient.ts @@ -1,12 +1,12 @@ // Typed REST client for the public Mintlayer indexer under /api/v2 -// (decisions.md F6). Read-only and unauthenticated: no secrets ride in query -// strings, and address scanning stays sequential one-request-per-address -// (see BalanceService). +// (project decision log F6). Read-only and unauthenticated: no secrets ride +// in query strings, and address scanning stays sequential +// one-request-per-address (see BalanceService). // // Methods with an M3/M4 consumer (`feerate`, the UTXO listings, the order // book, the statistics and cursor walkers) are a recorded deferral, not an -// implied caller: decisions.md D13 lists each one with the milestone that -// consumes it. Do not treat their presence as a caller claim. +// implied caller: project decision log D13 lists each one with the +// milestone that consumes it. Do not treat their presence as a caller claim. // // Failure policy: network failures, timeouts and non-JSON bodies map to // typed IndexerError values (transport, http, parse); raw server bodies @@ -258,7 +258,7 @@ export class IndexerClient { /** * GET /address/{addr}. The documented 404 AddressNotFound (no history, * fresh wallet address) maps to the zero form: an unused address, never - * a user-facing error (api-coverage.md, finding 1). + * a user-facing error (api-coverage notes, finding 1). */ async addressInfo(address: string): Promise { const path = `/address/${encodeURIComponent(address)}`; diff --git a/src/data/ml/NftService.ts b/src/data/ml/NftService.ts index 40e8e0e..1fae97c 100644 --- a/src/data/ml/NftService.ts +++ b/src/data/ml/NftService.ts @@ -1,7 +1,7 @@ // NFT holdings (spec M2): the indexer has no reverse address-to-NFT route, // so ownership comes from the token ids the address summaries already carry // (IssueNft outputs are indexed into per-address balances, one unit each, -// api-coverage.md finding 2) and each id is probed once against GET /nft/{id}. +// api-coverage notes finding 2) and each id is probed once against GET /nft/{id}. // A 404 means the id is a fungible token, not an error. Probes and metadata // are cached in session memory; probing stays sequential to stay // rate-limit friendly. diff --git a/src/data/ml/types.ts b/src/data/ml/types.ts index 20c6deb..90f1fef 100644 --- a/src/data/ml/types.ts +++ b/src/data/ml/types.ts @@ -1,5 +1,6 @@ // Normalized shapes for the public Mintlayer indexer responses (/api/v2, -// facts in api-coverage.md and decisions.md F6). Amounts arrive as +// facts in the project notes: api-coverage and decision log F6). Amounts +// arrive as // {"atoms": "...", "decimal": "..."} pairs, bare strings, or Uint64 encoded // as a number or a string; the AmountJson tolerance is the single place that // absorbs every documented shape. Field names mirror the web-server JSON @@ -86,7 +87,7 @@ export type MlNftInfo = { /** One currency side of an order: the base coin or a token id (F11). */ export type MlOrderCurrency = { type: 'Coin' | 'Token' | (string & {}); tokenId?: string }; -/** One entry of GET /order and GET /order/{id} (api-coverage.md). The +/** One entry of GET /order and GET /order/{id} (api-coverage notes). The * balances shrink as takers fill; initially_given/asked anchor the fill * progress; conclude_destination anchors the myOrders membership filter. */ export type MlOrderInfo = { diff --git a/src/data/mock/localWaitlist.ts b/src/data/mock/localWaitlist.ts index 481fa16..c38c7ec 100644 --- a/src/data/mock/localWaitlist.ts +++ b/src/data/mock/localWaitlist.ts @@ -7,7 +7,7 @@ // TODO (SHIP BLOCKER, decision R4, 2026-11-17): this LOCAL-ONLY provider // MUST be replaced by a real backend (gap 4 option A or B) before any // production ship; a production build must never run the local waitlist. -// See plans/mojito-neo/decisions.md R4 and the provider selection in +// See project decision log R4 and the provider selection in // WaitlistProvider.ts. // // Semantics (spec M5): one waitlist slot per install. A second join of the diff --git a/src/data/prices/PriceProvider.ts b/src/data/prices/PriceProvider.ts index d4e6c8a..2b404d2 100644 --- a/src/data/prices/PriceProvider.ts +++ b/src/data/prices/PriceProvider.ts @@ -1,4 +1,5 @@ -// Real price provider per missing-architecture gap 1 and decisions.md R1: +// Real price provider per missing-architecture gap 1 and the project +// decision log (R1): // the production direction is self-hosted Mintlayer-operated infrastructure // (direction chosen 2026-11-17, implementation pending). v1 always runs the // mock price provider; this stub exists so wiring a configured priceBase diff --git a/src/data/providers/WaitlistProvider.ts b/src/data/providers/WaitlistProvider.ts index 7743bfc..60d0c8d 100644 --- a/src/data/providers/WaitlistProvider.ts +++ b/src/data/providers/WaitlistProvider.ts @@ -8,7 +8,7 @@ // any production ship; the build must not ship to production with the // local-only waitlist. Enforced in createWaitlistProvider: release // construction without a configured waitlistBase refuses. See -// plans/mojito-neo/decisions.md R4 and missing-architecture gap 4. +// project decision log R4 and missing-architecture gap 4. // // Security note (spec M5): the email is personal data. It is stored sealed // on device (src/data/mock/localWaitlist.ts), never logged, never sent diff --git a/src/data/providers/types.ts b/src/data/providers/types.ts index 7c60ab9..8e6e9ea 100644 --- a/src/data/providers/types.ts +++ b/src/data/providers/types.ts @@ -1,7 +1,7 @@ // Single source for the data-provider seams. Every later milestone implements // against these interfaces; the mock | real mode switch lives in // src/data/providers/index.ts. Shapes mirror the gap interfaces in -// missing-architecture.md so the real implementations slot in unchanged. +// the missing-architecture notes so the real implementations slot in unchanged. import type { ChainName, Tone } from '../../theme'; import type { IconName } from '../../ui/icons'; import type { TxTracker } from '../../send/TxTracker'; diff --git a/src/i18n/strings/en.ts b/src/i18n/strings/en.ts index f40ddb2..f0c7464 100644 --- a/src/i18n/strings/en.ts +++ b/src/i18n/strings/en.ts @@ -348,6 +348,7 @@ export const en = { 'settings.network.mainnet': 'Mainnet', 'settings.network.testnet': 'Testnet', 'settings.network.switchWarn': 'Switching networks reloads balances and activity for the selected network. The testnet index URL is not configured yet, so testnet shows no live data.', + 'settings.network.unavailable': 'Testnet is not available in this build: the Mintlayer testnet endpoint is still pending (A2).', 'settings.dex': 'Default DEX', 'settings.display.hideBalances': 'Hide balances', 'settings.display.hideBalancesSub': 'Until you tap to reveal', diff --git a/src/keys/BtcKeyring.ts b/src/keys/BtcKeyring.ts index c6358ec..fde46b3 100644 --- a/src/keys/BtcKeyring.ts +++ b/src/keys/BtcKeyring.ts @@ -1,5 +1,5 @@ -// BTC keyring per decisions.md R2: pure TypeScript on @scure/bip32 and -// @scure/btc-signer. BIP84-style P2WPKH accounts from the same BIP39 seed +// BTC keyring per project decision log R2: pure TypeScript on @scure/bip32 +// and @scure/btc-signer. BIP84-style P2WPKH accounts from the same BIP39 seed // that backs the Mintlayer accounts. Derivation path m/84'/'/0' // (coin 0 mainnet, 1 testnet), receiving /0/i, change /1/i. // Signing ships with M3 (BtcTxBuilder); M1 covers keys and addresses. @@ -88,8 +88,8 @@ export async function btcReceiveAddresses( /** * Extended private key at a path under the account (m/branch/index), for the - * signing path (decisions.md D11): the M3 BtcTxBuilder derives input keys - * with it inside the KeySession closure and never caches or logs the key. + * signing path (project decision log D11): the M3 BtcTxBuilder derives input + * keys with it inside the KeySession closure and never caches or logs the key. */ export function btcPrivateKeyAt( words: string[], diff --git a/src/keys/session.ts b/src/keys/session.ts index da7fe50..e831505 100644 --- a/src/keys/session.ts +++ b/src/keys/session.ts @@ -71,8 +71,8 @@ class OpenKeySession implements KeySession { /** * Unlock-time session: decrypts the vault phrase (after PIN or biometrics) - * and returns a short-lived handle. Wired in M2 per decisions.md D10: the - * real data providers open one to derive account xpubs + * and returns a short-lived handle. Wired in M2 per project decision log + * D17: the real data providers open one to derive account xpubs * (src/data/providers/index.ts). There is at most one at a time; callers * call release() when done (the zeroize guarantee of withSeed does not * extend to the mnemonic string, see the header comment). One sanctioned UI diff --git a/src/money.test.ts b/src/money.test.ts index a29fd0b..e164c64 100644 --- a/src/money.test.ts +++ b/src/money.test.ts @@ -1,5 +1,5 @@ // Money helper gate: roundtrips, formatting edge cases and the no-float -// rules (decisions.md F9 semantics). Runs in the Node gate: +// rules (project decision log F9 semantics). Runs in the Node gate: // npx tsx src/money.test.ts import { strict as assert } from 'node:assert/strict'; diff --git a/src/money.ts b/src/money.ts index d91da54..e8d8985 100644 --- a/src/money.ts +++ b/src/money.ts @@ -1,5 +1,5 @@ -// Atom and decimal string helpers (decisions.md F4 and F9): amounts cross -// the chain, the indexer and storage as decimal atom strings, and every +// Atom and decimal string helpers (project decision log F4 and F9): amounts +// cross the chain, the indexer and storage as decimal atom strings, and every // arithmetic on them runs on BigInt with pure string parsing and formatting. // No float value ever represents money here; Number() conversions live only // at the UI render boundary, never inside these helpers or provider state. diff --git a/src/onboarding/UnlockScreen.tsx b/src/onboarding/UnlockScreen.tsx index b186c5c..fb92d2e 100644 --- a/src/onboarding/UnlockScreen.tsx +++ b/src/onboarding/UnlockScreen.tsx @@ -137,8 +137,8 @@ export function UnlockScreen({ bio, biometrics, onUnlock }: { bio: Bio; biometri : msg} {/* No bio switch while a lockout is active: bio attempts during the - countdown would bypass the app's escalating counter (decisions.md - records the biometry-only product decision). */} + countdown would bypass the app's escalating counter (the project + decision log records the biometry-only product decision). */} { void (async () => { - // Deviation from spec M1-keys (recorded in decisions.md): the PIN + // Deviation from spec M1-keys (recorded in the project decision log): the PIN // change flow swaps only the verifier; it does not re-key or re-seal // the vault. The vault key is independent of the PIN, so re-sealing // on a PIN change adds no security; the seed.v2 slot exists for the diff --git a/src/onboarding/ui/useBioScan.tsx b/src/onboarding/ui/useBioScan.tsx index 48aa8be..9e1581c 100644 --- a/src/onboarding/ui/useBioScan.tsx +++ b/src/onboarding/ui/useBioScan.tsx @@ -42,10 +42,11 @@ export type BioScan = { * succeeds; failures drop back to idle with the failure count for the PIN * fallback copy. Biometry-only by product decision: the OS device credential * is not offered on the wallet's prompt (the in-app PIN fallback in - * usePinEntry is the always-working path; see decisions.md). This is the - * UI-level check for enrolment and the unlock screen only: vault cipher - * operations are authorized by the native module's own BiometricPrompt, and - * a generic prompt without a CryptoObject cannot authorize those keys. + * usePinEntry is the always-working path; see the project decision log). + * This is the UI-level check for enrolment and the unlock screen only: + * vault cipher operations are authorized by the native module's own + * BiometricPrompt, and a generic prompt without a CryptoObject cannot + * authorize those keys. */ export function useBioScan(onDone: () => void, onFail?: () => void): BioScan { const [phase, setPhase] = useState('idle'); diff --git a/src/screens/SettingsScreen.tsx b/src/screens/SettingsScreen.tsx index d9eebc6..b9aee03 100644 --- a/src/screens/SettingsScreen.tsx +++ b/src/screens/SettingsScreen.tsx @@ -9,6 +9,7 @@ import { maskEmail } from '../waitlist/WaitlistForm'; import { loadAppSettings, saveAppSettings } from '../storage/appSettings'; import { Keypad, PinDots, pinEntryCheck, usePinEntry } from '../onboarding/ui'; import { detectBio } from '../onboarding/ui/useBioScan'; +import { devFallbackAllowed } from '../config/runtime'; import { C, G } from '../theme'; import { Avatar, Btn, Card, ListRow, PickerSheet, Screen, Section, SheetHeader, Toggle, Txt, tint } from '../ui'; @@ -240,6 +241,12 @@ export function SettingsScreen({ onClose, onBackup, onChangePin, onLock, onSignO switch does not exist yet, and the sub must not overclaim a custom-RPC editor. */} + {/* M6 release honesty (spec data section): the switch stays available + in development builds only. Production defaults to mainnet, and the + Mintlayer-operated testnet indexer is still pending (action item + A2, decision R6), so a release build shows the unavailable status + instead of a switch that can only reach a null endpoint set. */} + {devFallbackAllowed() ? ( + ) : ( + + )} setSheet('dex')} /> diff --git a/src/screens/SwapScreen.tsx b/src/screens/SwapScreen.tsx index ecb4746..a81e002 100644 --- a/src/screens/SwapScreen.tsx +++ b/src/screens/SwapScreen.tsx @@ -22,7 +22,7 @@ const TIMELOCK_SECONDS: Record = { '12h': 43_200, '24h': * off-band and the BTC side is the scripted counterpart. Real mode never * reaches this constant: initiate is gated with a typed unsupported until * a real offer entry supplies the counterparty spend address and key - * (see swapGateError and plans/mojito-neo/decisions.md). */ + * (see swapGateError and the project decision log). */ const COUNTERPARTY_ADDRESS = 'mtc1q82twmwwxa3l2pe26gf0zgghu69jtez3qq2ajqyl'; /** Real-mode initiate gate in the BridgeError shape (typed unsupported, diff --git a/src/send/BtcTxBuilder.ts b/src/send/BtcTxBuilder.ts index 67680f6..18e8bce 100644 --- a/src/send/BtcTxBuilder.ts +++ b/src/send/BtcTxBuilder.ts @@ -1,7 +1,7 @@ // Bitcoin send pipeline (spec M3 deliverable 7): P2WPKH build and sign on -// the confirmed scure stack (decisions.md R2: @scure/bip32 + @scure/ -// btc-signer, audited, pure TS, Hermes-safe) end to end real in the Node -// gate. Fees come from btc-api /fee-estimates through the injected rate +// the confirmed scure stack (project decision log R2: @scure/bip32 + +// @scure/btc-signer, audited, pure TS, Hermes-safe) end to end real in the +// Node gate. Fees come from btc-api /fee-estimates through the injected rate // source (tier buckets chosen by the caller); when the backend is not // configured the injected source reports a fixed fallback and the plan // flags it (rateIsFallback) so the UI can say the rate is a guess. diff --git a/src/send/MlTxBuilder.ts b/src/send/MlTxBuilder.ts index fdf0e5d..5df31ed 100644 --- a/src/send/MlTxBuilder.ts +++ b/src/send/MlTxBuilder.ts @@ -1,8 +1,9 @@ // Mintlayer transaction planner and assembler (spec M3 deliverable 4). // -// Fee semantics follow the production pattern (decisions.md F8): there is no -// explicit fee field, so fee = ceil(sizeBytes / 1000) * max(rate, 1) with the -// rate from GET /feerate (atoms per kB, in_top_x_mb selected by tier: +// Fee semantics follow the production pattern (project decision log F8): +// there is no explicit fee field, so fee = ceil(sizeBytes / 1000) * +// max(rate, 1) with the rate from GET /feerate (atoms per kB, in_top_x_mb +// selected by tier: // economy 5, standard 1, fast 1; uplift multiplier 1 in v1). The size comes // from bindings.estimateTransactionSize with one destination per input, so // the implicit-fee invariant (sum inputs - sum outputs = fee) holds for diff --git a/src/send/mlTxBuilder.test.ts b/src/send/mlTxBuilder.test.ts index 0978bb5..13b32a5 100644 --- a/src/send/mlTxBuilder.test.ts +++ b/src/send/mlTxBuilder.test.ts @@ -21,7 +21,8 @@ import { MlTxBuilder, mlFeeAtoms, selectMlInputs } from './MlTxBuilder'; import { MlTxSigner } from './MlTxSigner'; import { SendError } from './errors'; -// Public test vector (decisions.md F5): abandon x23 + art, mainnet account 0. +// Public test vector (project decision log F5): abandon x23 + art, +// mainnet account 0. const VECTOR_WORDS = [...Array(23).fill('abandon'), 'art']; const VECTOR_ADDRESS = 'mtc1q82twmwwxa3l2pe26gf0zgghu69jtez3qq2ajqyl'; diff --git a/src/send/validation.test.ts b/src/send/validation.test.ts index b3aaca9..d8bf3aa 100644 --- a/src/send/validation.test.ts +++ b/src/send/validation.test.ts @@ -8,8 +8,9 @@ import { bech32, bech32m } from '@scure/base'; import { validateAddress, parseSendAmount, exceedsBalance } from './validation'; -// Parity vectors from decisions.md F5 (public test mnemonic, account 0 -// receiving index 0) and the BIP84 vector from src/keys/BtcKeyring.test.ts. +// Parity vectors from project decision log F5 (public test mnemonic, +// account 0, receiving index 0) and the BIP84 vector from +// src/keys/BtcKeyring.test.ts. const ML_MAINNET = 'mtc1q82twmwwxa3l2pe26gf0zgghu69jtez3qq2ajqyl'; const ML_TESTNET = 'tmt1qyxqfq37rra32sq6zhayqcpjwh4trc07mcfardwt'; const BTC_MAINNET = 'bc1qcr8te4kr609gcawutmrza0j4xv80jy8z306fyu'; diff --git a/src/send/validation.ts b/src/send/validation.ts index a413db4..4672304 100644 --- a/src/send/validation.ts +++ b/src/send/validation.ts @@ -2,7 +2,7 @@ // deliverable 3 and the security note on decimal strings). Pure functions: // no network, no state, fully Node-testable against published vectors. // -// Address rules (decisions.md F5 and src/keys/mlAccounts.ts): Mintlayer +// Address rules (project decision log F5 and src/keys/mlAccounts.ts): Mintlayer // addresses are bech32m with the mtc (mainnet) or tmt (testnet) human // readable part and the 0x01 pubkeyhash variant byte; BTC addresses on the // v1 wallet are bech32 P2WPKH (bc1 / tb1, version 0, 20-byte program). diff --git a/src/storage/appSettings.ts b/src/storage/appSettings.ts index 8758c82..1f17571 100644 --- a/src/storage/appSettings.ts +++ b/src/storage/appSettings.ts @@ -15,7 +15,7 @@ export type AppSettings = { autoLock: boolean; /** Active-network switch (M2): selects the endpoint set and rebuilds the * data providers. Mainnet is the default; the testnet base itself stays - * pending action item A2 (decisions.md R6). */ + * pending action item A2 (project decision log R6). */ testnet: boolean; /** The recovery phrase passed the verify step at least once. False (never * verified, or the read failed) keeps Receive gated at cold start, so a diff --git a/src/storage/walletVault.ts b/src/storage/walletVault.ts index 8ce6a64..9a5ab8e 100644 --- a/src/storage/walletVault.ts +++ b/src/storage/walletVault.ts @@ -24,7 +24,8 @@ // Meta rides inside the sealed payload: meta() decrypts metadata only and // never hands out phrase bytes; openWords is the single decryption path. Its // callers are the backup reveal, the unlock gating upgrade and the real -// providers' xpub derivation through openKeySession (decisions.md D10). +// providers' xpub derivation through openKeySession (project decision log +// D17). import type { MlNetwork, SealedBlob } from '../../modules/mojito-core'; import { getSecureStore } from './secureStore'; import type { SecureStore } from './secureStore'; diff --git a/src/trade/OrderBookService.ts b/src/trade/OrderBookService.ts index 0734620..ee3d40d 100644 --- a/src/trade/OrderBookService.ts +++ b/src/trade/OrderBookService.ts @@ -81,7 +81,7 @@ export function createOrderBookService(cfg: OrderBookServiceConfig): OrderBookSe return rows; } - /** Page walk with one invalid-cursor restart (api-coverage.md: cursors + /** Page walk with one invalid-cursor restart (api-coverage notes: cursors * are opaque and can go stale; refetching page 1 is the documented * recovery). Depth flicker on the restart is accepted for v1. */ async function walkLevels(base: string, quote: string, side: OrderBookSide, depth: number, allowRestart: boolean): Promise { diff --git a/src/trade/htlc.ts b/src/trade/htlc.ts index 13c88b6..6ab01ed 100644 --- a/src/trade/htlc.ts +++ b/src/trade/htlc.ts @@ -11,7 +11,7 @@ // SHA-256(secret) crosses the wire and storage. TIMELOCK_RULE records the // F10 ordering (the BTC timelock must be shorter than the ML one); the // guard call returns with real offer entry, which supplies the BTC leg -// the demo path had to fabricate (plans/mojito-neo/decisions.md). +// the demo path had to fabricate (project decision log). // // Honest states: every transaction assembles and signs through the // MintlayerBindings seam, so without the native call-through the flows diff --git a/src/trade/orders.ts b/src/trade/orders.ts index dc1f085..6e66f40 100644 --- a/src/trade/orders.ts +++ b/src/trade/orders.ts @@ -166,7 +166,7 @@ export function createOrderFlows(cfg: OrderFlowsConfig): OrderFlows { * bindings docs: the nonce must sequence with the filler's other * account spendings). Session-scoped until the wallet persists the * account nonce with its state; the native call-through must not go - * live before that (recorded in plans/mojito-neo/decisions.md). */ + * live before that (project decision log). */ let accountNonce = 0; /** One order transaction at a time: selection reads live UTXOs and the * change allocation mutates the persisted counters (realSend pattern). */ diff --git a/src/waitlist/WaitlistForm.ts b/src/waitlist/WaitlistForm.ts index aefef48..d502d70 100644 --- a/src/waitlist/WaitlistForm.ts +++ b/src/waitlist/WaitlistForm.ts @@ -6,8 +6,8 @@ // // TODO (SHIP BLOCKER, decision R4, 2026-11-17): the waitlist backend does // not exist; v1 persistence is device-local. This MUST be replaced by a -// real backend before any production ship (plans/mojito-neo/decisions.md -// R4, missing-architecture gap 4). +// real backend before any production ship (project decision log R4, +// missing-architecture gap 4). import type { WaitlistProvider, WaitlistResult } from '../data/providers/types'; export type WaitlistPhase = 'idle' | 'invalid' | 'submitting' | 'duplicate' | 'done' | 'unavailable';