Skip to content

fix(nu7): leave block headroom in recovery batches - #304

Open
poldsam wants to merge 1 commit into
mainfrom
fix/nu7-batch-headroom
Open

poldsam wants to merge 1 commit into
mainfrom
fix/nu7-batch-headroom

Conversation

@poldsam

@poldsam poldsam commented Nov 7, 2026

Copy link
Copy Markdown
Collaborator

Fixes from the post-merge reviews of #302 and #303 (#302 review, #303 review). Intended for 2.0.1, or for 2.0.0 if the draft is re-cut.

Batches fill a whole block's shielded budget

ZIP 218's limits are per block: "The total number of Sapling inputs and outputs across all transactions in the block MUST NOT exceed 300", and likewise the global budget of 330. bound_send_max sized batches at 298 notes + 2 outputs, so each one used the block's entire Sapling budget. A batch like that can only be mined in a block with no other Sapling activity, and under real shielded traffic it risks sitting in the mempool until its 120-block expiry.

  • Batches now target RECOVERY_BATCH_NOTES = 80 notes. With padding that is at most 82 of 300 Sapling components and 86 of 330 overall.
  • Splitting now also applies to proposals that fit a block but exceed the target. Before, only proposals over the block limit were split.
  • If the wallet's value can't pay the extra output padding of the preferred number of batches (near-marginal notes), it falls back to fewer, larger batches, down to the fewest that fit a block. That fallback is the old behaviour, so no wallet that could be swept before is now refused (batching_distributes_value_to_pay_cross_pool_output_padding still exercises this path).
  • A proposal that already fits a block but can't be split (e.g. real change) is kept as one transaction, never refused for lacking headroom (new test unsplittable_proposal_that_fits_a_block_is_kept).
  • Extra cost: ZIP 317 charges per logical action, so the only additional fee is the 2-output padding per extra batch (10,000 zat each).
  • The module doc now says the limits are per block.

Tip timestamp tolerance

validate_tip_evidence refused any tip timestamped more than 5 minutes ahead of the local clock. That rejects legitimate tips from miners whose timestamps run ahead, and any computer whose clock runs a few minutes slow. The future bound is now 30 minutes. Freshness is still enforced by MAX_TIP_AGE. The two failures now have separate messages, and both name the system clock as a possible cause. A test covers a tip 10 minutes ahead being accepted.

Smaller fixes

  • GUI: when a birthday estimate is discarded because the date, network or endpoint changed, the hint now says so. Before, it stayed on "Looking up block height…".
  • docs/qualification/nu7-supported-recovery.md: the 2.0.0 waiver ran into "No release … is authorized here". It is now its own paragraph, and the last sentence reads "Apart from the 2.0.0 waiver above, …".

Not in this PR

The funded NU7 rehearsal is still outstanding. regtest_local_network keeps nu7: None, so no sweep has been mined under NU7 rules, including one at the new batch size.

Tests

  • cargo test -p argos-core --lib --locked: 692 passed, 0 failed.
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: clean.
  • cargo fmt --all: clean.
  • node --test tests/gui/: 189 passed.

🤖 Generated with Claude Code

ZIP 218's shielded limits are per block. Batches of 298 notes filled
a block's whole Sapling budget, so they could only be mined in a block
with no other Sapling activity and risked expiring unmined. Batches now
target 80 notes (about a quarter of the block budget), falling back to
fewer, larger batches only when the wallet cannot pay the extra output
padding. A proposal that already fits a block but cannot be split is
kept as one transaction.

Also:
- Accept tips timestamped up to 30 minutes ahead (miner skew or a slow
  local clock), and say which check failed and that the clock may be
  the cause.
- GUI: say when a stale birthday estimate is discarded instead of
  leaving "Looking up block height..." on screen.
- Qualification doc: separate the 2.0.0 waiver from the sentence that
  no release is authorized.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
zec-wallet-rescue Ready Ready Preview Nov 7, 2026 6:37pm UTC

Request Review

This branch was successfully deployed

1 active deployment
Preview — b4126817 Deployed Nov 7, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant