Skip to content

platform-wallet: shielded builders read Sdk::version(), which can lag the version the SDK encodes requests at #6062

Open

Description

@QuantumExplorer

What happens

Sdk::version() returns the SDK's stored protocol version. Sdk::query_settings().protocol_version (protocol_gate::version_for_requests) is the version the SDK actually encodes requests at: for an unpinned SDK whose verified answers show the network runs a version this build does not know, it is the newest version the build knows, while the stored version stays where it was (an unknown version is never stored). The gate (ensure_network_serves / ensure_protocol_requirement) decides from the verified answer.

rs-platform-wallet's shielded operations price and build with sdk.version() in about 14 places in wallet/shielded/operations.rs: the shield fee reserve, the identity-shield admission floor and builder, note selection (select_notes_with_fee, select_notes_for_denomination, ensure_allowed_denomination), and the transfer, unshield, withdrawal, top-up, identity create and private document builders.

So when the stored version lags (an SDK seeded below the version the network ran before it moved to a version this build does not know), the wallet prices and builds with an older table than the one the SDK admits and encodes with. Examples from the #6051 review:

  • seeded at 13, network newer than the build: the identity shield is built with the v13 table, whose extra sighash data does not bind the funding identity, while the v14+ verifier expects it; the saved debit would fail verification and block further shields from that identity;
  • a top-up whose fee table differs between the stored and the execution version credits less than requested.

The default seed is 14 on every network and the stored version normally ratchets to the network's, so this needs a seed below the default or a first contact with a network newer than the build. It predates #6051 and applies to every shielded builder.

Possible fixes

  • Take one effective version snapshot (sdk.query_settings().protocol_version) at the start of each wallet operation, after the activation gate, and use it for every fee computation, note selection and builder in that operation.
  • Or make Sdk::version() return the request version, so every caller agrees with the encoding without changes.

Either should come with a regression on the gate tests' signed newer fixture that goes past admission and checks the identity binding and the top-up amount.

Activity

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