You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
rs-sdk: broadcast may raise the SDK protocol version after a caller's pre-dispatch check #5916
StateTransition::broadcast first runs the SDK's protocol gate (Sdk::ensure_network_serves), which may send one proved probe and raise an unpinned SDK's protocol version, and only then sends the transition. A caller that checks "the protocol version this transition was built and priced under still holds" before calling broadcast therefore cannot rule out a version change between its check and the actual send.
This matters for transitions whose fee is fixed when they are built, such as the shielded spends planned with an exact fee in #5865: track_delivery_checked runs its context check immediately before every dispatch, but the dispatch itself can await the gate's probe before the request goes out. A transition built and priced under version N can then reach a network the SDK has just learned runs N+1, and consensus applies N+1's fee schedule (a refusal as an overpayment, or a slightly different net amount for an unshield). No funds are lost; the planned exact fee is not guaranteed in that window.
Recovery dispatches of a saved spend go through the same path.
Fix direction
Either of:
a broadcast entry point that takes the protocol context the transition was built under and checks it atomically with building the request (no await between the check and the send), refusing with a typed error when it no longer holds; or
run the gate before the caller's check (so the broadcast's own gate decides without a probe) and document that the gate inside broadcast must not probe after it.
A window where the network itself upgrades between the send and execution remains either way; this issue is only about the SDK changing its version between the caller's check and the send.
Found in the review of #5865 (thread linked there).
Activity