Skip to content

rs-sdk: tell a transition refused by the local size check apart from a node's rejection #6284

Backlog

Description

@romchornyi

Problem

checked_broadcast_request (packages/rs-sdk/src/platform/transition/broadcast_request.rs) refuses a transition over max_state_transition_size before anything is sent. It returns the same Error::Protocol(ConsensusError(StateTransitionMaxSizeExceededError)) that Platform returns when a node rejects the transition. A caller cannot tell "stopped locally, never dispatched" from "reached a node and was rejected".

Effect in platform-wallet

AssetLockManager::submit_with_chain_lock_fallback (rs-platform-wallet/src/wallet/asset_lock/orchestration.rs) treats entering the IS→CL fallback as a possible dispatch (maybe_dispatched). A size error satisfies needs_chain_lock_proof when the shorter ChainLock proof would make the transition fit. Suppose the InstantSend attempt was refused only by the local size check and the ChainLock attempt then fails before dispatch (for example, the signer has no key). The wallet then reports StateTransitionResultUnconfirmed (MaybeSent, FFI code 20) with no held lock. The real outcome is a refusal before dispatch, which should keep the signer diagnostic (31) and name the resumable lock.

The wallet keeps the conservative MaybeSent today, because the SDK gives it no evidence either way.

Proposed

Have the SDK carry "refused before dispatch" evidence out of its local preparation checks, e.g. a distinct error variant or wrapper for checked_broadcast_request refusals that keeps the consensus error as its source. The per-attempt record in submit_with_chain_lock_fallback can then set maybe_dispatched only for attempts that may have reached a node.

Raised in review of #5928 (#5928 (comment)).

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