Skip to content

Shielded spend fails with ShieldedMerkleWitnessUnavailable ("invalid frontier data") once the note tree is large — known limitation? #4144

Open

Description

@DashBot-0001

Hi — I've been exercising the shielded-pool transitions on testnet with a local build that has the shielded feature enabled, and hit a consistent failure I wanted to check before assuming it's a bug (it may well be expected while the feature is under development).

Setup: a testnet wallet that has accumulated ~1950 shielded notes (commitment tree size ~1952).

  • Works: ShieldFromAssetLock (funding the pool) succeeds reliably across many iterations.
  • Fails: every spending transition — ShieldedTransfer, Unshield, ShieldedWithdrawal — fails. The user-facing message is the generic "wallet service could not complete", but the underlying error is:
ShieldedMerkleWitnessUnavailable("witness(1896, depth 0): invalid frontier data: witness failed:
  Tree does not contain a root at address Address { level: Level(0), index: 1896 }")

The same note position (1896) is selected and fails on every spend attempt — so it reads as the witness/frontier for that particular spendable note not being available, rather than a general witness failure.

Possibly related sync log just before it (not sure if it's causal — the source comment suggests the rewind is compensated by a checkpoint id, so flagging it only as a correlated observation):

Shielded sync: next_start_index is 0 after scanning 1952 notes — next sync will rescan from the beginning
Multi-subwallet shielded sync finished new_notes_total=0 new_index=1952

Source pointers (rev d18020f):

  • packages/rs-platform-wallet/src/wallet/shielded/operations.rs — the witness_at_depth(position, 0) strict branch raising ShieldedMerkleWitnessUnavailable
  • packages/rs-platform-wallet/src/wallet/shielded/sync.rs — the next_start_index handling

Question: Is this a known limitation of the current witness-frontier maintenance while the feature is under development, or would a reproducer / more logs be useful? The shield (into-pool) side is solid — it's specifically witness availability for spends once the tree is sizeable. Happy to help narrow it down.

Thanks!

Activity

  1. DashBot-0001 commented on Jul 30, 2026

    @DashBot-0001
    Author

    Reporting back with a follow-up, since I filed this one and still have the original reproduction.

    I can no longer reproduce it on the current platform pin.

    Then (2026-07-18, when this was filed): commitment tree ~1952 notes, platform pinned at d18020f. Every note-spending operation (ShieldedTransfer / Unshield / ShieldedWithdrawal) hard-failed with ShieldedMerkleWitnessUnavailable("invalid frontier data: Tree does not contain a root at {level:0, index:1896}"). 100% failure, including slow manual attempts, so it was not a timing or frequency effect.

    Now (2026-07-30): same test wallet, tree grown 2486 → 2761 notes, DET built from v1.0-dev which pins feat/platform-wallet-storage-rehydration. 150 operations adjudicated against on-chain state, zero occurrences — no ShieldedMerkleWitnessUnavailable, no invalid frontier, no Tree does not contain a root anywhere in the logs. That covers 30 rounds of shield → sync → transfer → unshield → withdraw, plus multi-note-merging spends of up to 6 actions, plus concurrency and restart tests.

    The only variable that changed is the platform pin: DET moved off d18020f on 2026-07-24 (#919) and to branch tracking on 2026-07-28 (#940).

    My guess at which change did it, offered tentatively: #4237 ("make shielded re-bind non-destructive so it cannot wipe an in-flight sync pass", ~+1120 lines in coordinator.rs) rewrote exactly the store/sync layer that witness_at_depth reads from — the error string originates in the store, not in operations.rs, which only forwards it. I verified that fix's own claim end-to-end separately: 6/6 rounds of concurrent sync ‖ re-bind with the balance never dropping and no purge_wallet / purge_all_subwallets in the logs. But I want to be clear that this is my inference — nothing in that PR mentions this issue, and a repo-wide search for frontier / witness_at_depth in issues and PRs returns nothing.

    Two things worth flagging before anyone closes this:

    1. The fix is not in any published binary. The latest release, v1.0.0-weekly.20260721, still has rev = "d18020f..." in its Cargo.toml. Anyone running a released DET is still on the affected code.
    2. I never established the threshold. The two data points are tree 1952 (failing, testnet) and tree 283 (working, mainnet, 2026-07-23) on the same pin, with 1669 notes of unexplored range between them. On the new pin I have only "does not reproduce at 2486–2761", which does not by itself prove the tree-size relationship is gone rather than merely pushed further out.

    Happy to run anything specific if it would help decide whether this can be closed.


    Investigation and this comment were produced with AI assistance (Claude); all figures above are from executed runs on testnet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions