Skip to content

Shielded spends selecting more than 6 notes are always rejected: "State Transition exceeds maximum size of 20480 bytes" #5573

Open

Description

@Claudius-Maginificent

Expected Behavior

A shielded spend (Unshield, and likewise transfer / withdrawal / identity top-up) of an amount covered by the wallet's shielded balance is built and accepted by the network.

Current Behavior

When note selection picks more than 6 notes, the wallet builds the transition (including the Halo 2 proof, 30–60 s) and broadcasts it, and DAPI rejects it every time:

grpc error: code: 'Client specified an invalid argument', message: "State Transition exceeds maximum size of 20480 bytes"

The wallet surfaces this as PlatformWalletError::ShieldedBroadcastFailed. Retrying rebuilds the same transition and fails the same way, so any spend that needs more than 6 notes cannot be made.

Observed in Dash Evo Tool on testnet, Unshield from one shielded account:

Time (UTC) Inputs Fee (credits) State transition Result
16:31:49 13 527,992,800 2a1e8d57… rejected: exceeds 20480 bytes
16:36:06 1 120,222,800 5c767db0… executed, h=643075, 8,214 B
16:37:17 5 231,432,800 bb1d5b25… executed, h=643081, 16,257 B
16:39:27 9 379,712,800 1698b9a2… rejected: exceeds 20480 bytes
16:40:24 2 120,222,800 125cb66a… executed, h=643089, 8,210 B
16:41:14 8 342,642,800 eb5354c9… rejected: exceeds 20480 bytes
16:44:46 7 305,572,800 bc29192f… rejected: exceeds 20480 bytes
16:46:24 3 157,292,800 0cf8aeb0… executed, h=643126, 10,891 B

Serialized Unshield size by input count, measured offline through the same builder path (build_unshield_transition with real Halo 2 proofs, then serialize_to_bytes()). Fees match the logged ones to the credit, and the sizes for 1, 2, 3 and 5 inputs match the on-chain transitions above:

Inputs Orchard actions Size (bytes) vs 20480 limit
1 2 8,210 fits
2 2 8,210 fits
5 5 16,253 fits
6 6 18,934 fits
7 7 21,615 +1,135
8 8 24,296 +3,816
9 9 26,977 +6,497
13 13 37,701 +17,221

Each action adds 2,681 bytes, of which the proof accounts for 2,272. The fixed part is about 2,848 bytes. Encrypted notes are at their minimal 216-byte size, and the change output adds no action, so the transition is not inflated.

Relevant facts:

  • The check is in rs-dapi services/platform_service/broadcast_state_transition.rs. It compares the raw protobuf bytes with max_state_transition_size = 20480 (system_limits/v4.rs, PV14). Drive repeats the check in decode_raw_state_transitions/v1.
  • max_shielded_transition_actions is 16 in the same table. Its comment notes that only 6 actions fit under 20 KiB.
  • rs-platform-wallet note selection (wallet/shielded/note_selection.rs, largest first) and the spend operations in wallet/shielded/operations.rs apply no limit on the number of selected notes or on the transition size. rs-sdk does not check the size before broadcast.

Steps to Reproduce (for bugs)

  1. Hold 7 or more unspent shielded notes in one account (e.g. several shields or received transfers).
  2. Unshield (or transfer or withdraw) an amount that largest-first selection can only cover with 7 or more notes, e.g. close to the full shielded balance.
  3. Wait for the proof to build and the broadcast to return State Transition exceeds maximum size of 20480 bytes.

Context

A wallet that has accumulated many small notes (change outputs, small shields) cannot unshield or send most of its balance. The only way out is to guess smaller amounts that happen to select 6 or fewer notes. The user is not told this. Each failed attempt costs a full proof build.

Your Environment

  • Network: testnet, dapi/drive 5.0.0-rc.8, protocol version 14
  • Client: Dash Evo Tool pinned to platform 9f7ed169. unshield.rs and note_selection.rs are unchanged from there to v5.1-dev (063589bf0a)
  • Operating System: Linux

🤖 Generated with Claude Code

https://claude.ai/code/session_019H9THphMnuQyh9oPY13SoE

Activity

  1. added
    bug
    on Oct 24, 2026
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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions