Repository navigation
Support NU7 recovery after Sprout removal - #302
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| permissions: | ||
| contents: read | ||
| steps: | ||
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 |
A donation split comes from propose_transfer, whose change strategy emits a zero-valued change output when the transaction balances exactly. bound_send_max refused any proposal with change, so after NU7 every sweep too large for one transaction failed outright whenever a donation was set (the default). The donation-free fallback runs before batching, so it never caught this. Zero-valued change holds no value and the batches are built without change, so it is now dropped. Real change is still refused. The existing donation test built its proposal by hand with no change, which is why it missed the shape the SDK actually produces. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
poldsam
left a comment
There was a problem hiding this comment.
Post-merge review of the NU7 carry-forward. This is now most of the code in v2.0.0, and the v2.0.0 release run is signing.
Checked and sound:
- Tip and branch checks.
nu7.rschecks the server's branch against the tip height and refuses signed bytes whose branch or version is wrong for the next block, or whose encoded expiry has passed. Exact-byte retry runs the same check throughvalidate_retry_at_tip, and nothing is rebuilt or rewritten. Prior-branch V5/V6 transactions and V4 are refused after activation, and the tests cover this on both networks. - Reviews are bound to the branch.
canonical_proposalnow hashes the branch id, so a review made under NU6.3 cannot authorize a V6 transaction under NU7. - Batching keeps every note.
bound_send_maxassigns every selected note to exactly one batch, drops no pool, and refuses anything other than an independent shielded send-max (transparent inputs, chained steps or real change are all refused). Each batch's fee comes from the SDK's own padded action counts. The donation stays in payment 0 in every batch, with the destination taking the rounding remainder, matchingbuild_donation_split_proposal. - Partial donations are counted correctly. Each batch's donation is tied to its txid before submission. Mined and unknown results count; unsent, rejected and expired ones don't.
- Imported Sapling batches go through
independent_step, which refuses chained steps. The whole account's fee is authorized against--max-feebefore the first batch is signed, and each batch is checked again for size and branch after extraction. - Confirmation waits don't threaten expiry. Batches are proved up front with a 120-block expiry (about 50 min at 25 s), and the wait per batch is bounded at 24 × 5 s, so later batches can't expire waiting behind earlier ones.
- Key identities are unchanged. The secp256k1/sapling-crypto API moves keep the same derivations,
derive_internal/masterfailures now return errors instead of being assumed infallible, andLegacyTransparentAddresskeeps wallet provenance restricted to P2PKH/P2SH. - I checked the
zcash_client_backend0.25.0 source: the SDK does not enforce the ZIP 218 budgets itself (its only size gate isTransactionTooLargeagainstMAX_BLOCK_BYTES), so Argos has to enforce them, and does. - CI is green on
0d08052and on the merge commit.
Findings (details inline):
- Should fix: batches are sized at the per-block budget, so they compete with every other shielded transaction for space. ZIP 218's limits are per block, and a 298-note Sapling batch fills the whole Sapling budget. See
nu7_limits.rs:197. - Coverage gap: no end-to-end test spends under NU7 rules.
regtest_local_networkleavesnu7: None, and the only live NU7 CI job mines coinbase and parses compact blocks. That is the gate waived for 2.0.0; the ZIP 218 constants and the 25 s spacing have never met a node with a spend. - Low: the 5-minute future-timestamp tolerance can refuse legitimate tips. See
nu7.rs:26. - Nit: a stale birthday-estimate response leaves the hint stuck. See
main.js:1240.
Untested (also listed in #303): migration of an imported-key 1.x workspace has no test; pre_nu7_database_migrates_without_losing_account_or_scan_work covers only a seed-only database.
| // A batch with 298 notes plus the mandatory two Sapling outputs fits the | ||
| // Sapling budget. Other pools' padded outputs still fit the global budget. | ||
| // Balance batch lengths to avoid leaving an uneconomic one-note tail. | ||
| let batch_count = notes.len().div_ceil(SAPLING_IO_LIMIT - 2); |
There was a problem hiding this comment.
ZIP 218's limits are per block, not per transaction: "The total number of Sapling inputs and outputs across all transactions in the block MUST NOT exceed 300", and the same for the 330 global budget. Sizing batches at 298 notes + 2 outputs makes each one consume the block's entire Sapling budget. It can only be mined in a block that contains no other Sapling component, and in a block whose other shielded components total at most about 30.
Whether that is a problem depends on how block templates are selected. If a template adds transactions in weighted-random order and skips any that no longer fit the budget, a full-budget batch only lands when it happens to be picked before any other shielded transaction. Under real shielded traffic it can sit in the mempool until its 120-block expiry. The sweep then reports Expired, the notes come back and the user has to re-run, so no funds are lost, but this is exactly the case batching exists for (large wallets).
Suggest sizing batches well below the block budget, e.g. a quarter of it (~75 Sapling components / ~80 actions per transaction). The extra fee is small: ZIP 317 charges per logical action, so splitting the same notes across more transactions adds only the 2-output padding per batch. The module comment on line 3 ("a transaction must fit by itself") also reads as if the limit were per transaction; it would help to say that it is per block and how much headroom is left.
| nu6_1: h, | ||
| nu6_2: h, | ||
| nu6_3: h, | ||
| nu7: None, |
There was a problem hiding this comment.
With nu7: None here, every regtest sweep (regtest_integration, transparent_only_wallet_sweeps_to_a_shielded_destination and the rest) still runs under NU6.3 rules. The nu7-node-tests CI job mines and parses blocks across activation but never submits a spend. So nothing has checked against a node that a V6/NU7-branch sweep, an imported-Sapling PCZT, or a near-budget batch is accepted and mined. That is the rehearsal the qualification doc waives for 2.0.0. Even one funded NU7 sweep on the nu7-fast profile, including a batch near the size from the previous comment, would close most of it.
| pub const TESTNET_ACTIVATION_HEIGHT: u32 = 4_465_026; | ||
| const QUERY_TIMEOUT: Duration = Duration::from_secs(15); | ||
| const MAX_TIP_AGE: u64 = 30 * 60; | ||
| const MAX_FUTURE_TIME: u64 = 5 * 60; |
There was a problem hiding this comment.
A tip whose timestamp is more than 5 minutes ahead of the local clock is treated as invalid evidence and blocks submission. Two things can trigger that besides a bad server: the local clock running slow (the #303 known gap), and miners' timestamps running ahead. Consensus accepts block times well beyond 5 minutes in the future, so a legitimately mined tip can trip this. With 25 s blocks it usually clears within a block or two, but the error ("tip timestamp is stale or in the future") doesn't tell the user to retry or check their clock. Suggest a wider future tolerance (the staleness bound is what protects against a stale server), or at least wording that names both causes and says to retry.
| lightwalletdUrl: $("lightwalletd-url").value.trim(), | ||
| }); | ||
| const height = await invoke("estimate_birthday_from_date", request); | ||
| if (!isCurrent()) return; |
There was a problem hiding this comment.
Nit: when the response is discarded because the date, network or endpoint changed, this returns without touching the hint, so "Looking up block height for that date…" stays on screen until the user clicks again. The auto-detect path prints "result discarded: …" in the same situation. Doing the same here would match.
After #301 removes Sprout recovery, Argos still needs the coordinated NU7 SDK and submission rules for supported pools. This carries the non-Sprout work from #291 onto current main, preserving the newer dependency fixes and private-workspace protections.
Validation of runtime commit
e3bf129(later commits change CI annotations only):Local Docker/node infrastructure was unavailable. The live NU7 block/proxy CI job passed on final head
d6858f3; remaining platform/full-suite CI is still running. Funded full-height supported sweeps and signed imported-Sapling PCZT rehearsal remain an unexecuted release gate. Empty fixtures and coinbase/proxy tests do not establish funded recovery acceptance. Exact-version exemptions carried from #291 remain exemptions, not new source-audit claims; newer uncovered aes/ctutils patches were avoided.Qualification record. This supersedes the supported-recovery scope of #291; it does not merge or close that PR.