Skip to content

rpc: vendor sui.rpc.v2beta checkpoint parts protos - #356

Draft
nickvikeras wants to merge 3 commits into
masterfrom
nickv/checkpoint-parts-beta
Draft

nickvikeras wants to merge 3 commits into
masterfrom
nickv/checkpoint-parts-beta

Conversation

@nickvikeras

@nickvikeras nickvikeras commented Dec 4, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Vendors the protos from MystenLabs/sui-apis#67 so SDK users can call the streaming checkpoint parts API. That API reads a checkpoint as a stream of bounded-size CheckpointParts, so it works for checkpoints larger than the server's response message limit. The PR adds:

  • the unstable sui.rpc.v2beta package: CheckpointPart, CheckpointContentsPart, LedgerService.GetCheckpointParts / ListCheckpointParts, and SubscriptionService.SubscribeCheckpointParts;
  • the additive sui.rpc.v2.ErrorReason.RESPONSE_TOO_LARGE, which single-message RPCs (the checkpoint RPCs GetCheckpoint, ListCheckpoints and SubscribeCheckpoints, and transaction and batch RPCs) return with RESOURCE_EXHAUSTED when one rendered response exceeds the server's message size limit. Its metadata is maxMessageBytes (always present), with optional checkpoint and transaction.

These are MystenLabs/sui-apis#67's unmerged protos. Re-vendor from sui-apis main (make -C crates/sui-rpc update-protos) and regenerate once MystenLabs/sui-apis#67 merges, before this PR merges. The vendored v2/signature*.proto files also pick up the reserved zklogin_v2 tags from MystenLabs/sui-apis#66, which is already on main. They change only the descriptor bytes.

Feature gating: proto::sui::rpc::v2beta and the new Client::beta_ledger_client / Client::beta_subscription_client accessors are behind the unstable feature, like v2alpha and Client::proof_client. The unstable feature covers APIs outside the crate's semver guarantees, and v2beta is allowed to break before it graduates into v2. ErrorReason::ResponseTooLarge is in stable v2, so it is not gated.

Retry behavior: ledger streams retry every RESOURCE_EXHAUSTED, but an item's size never changes, so RESPONSE_TOO_LARGE fails the same way on every attempt. stream_* (LedgerStreamConfig defaults max_consecutive_retries to None) would retry it forever, and list_* would use up its retries before failing. Ledger streams now treat it as terminal and return it to the caller.

Test plan

  • New unit tests in client::ledger_streams::retry: response_too_large_is_terminal_in_both_phases and resource_exhausted_without_response_too_large_is_transient.
  • proto::sui::rpc::v2beta::descriptor::tests::file_descriptor_set_is_valid decodes the new package's descriptor set.
  • Re-running cargo run -p proto-build leaves the generated files unchanged.

Vendor the unmerged protos from MystenLabs/sui-apis#67: the unstable
sui.rpc.v2beta package (CheckpointPart, CheckpointContentsPart,
LedgerService.GetCheckpointParts/ListCheckpointParts and
SubscriptionService.SubscribeCheckpointParts) and
ErrorReason.CHECKPOINT_TOO_LARGE. The vendored v2 signature protos also
pick up the reserved zklogin_v2 tags already on sui-apis main.

Expose the generated v2beta module and Client::beta_ledger_client /
Client::beta_subscription_client behind the `unstable` feature, like
v2alpha. Ledger streams treat RESOURCE_EXHAUSTED with
CHECKPOINT_TOO_LARGE as terminal instead of retrying it forever.
Re-vendor MystenLabs/sui-apis#67 at 9da63b2, which generalizes
ErrorReason.CHECKPOINT_TOO_LARGE (11) to RESPONSE_TOO_LARGE for any
single-message RPC whose rendered response exceeds the server's message
limit, with `checkpoint` and `transaction` metadata replacing
`sequenceNumber`. Ledger streams treat RESPONSE_TOO_LARGE as terminal.
Re-vendor MystenLabs/sui-apis#67 at b39732d, which clarifies in the
CheckpointPart comment that parts pack consecutive complete transactions.
Comment-only; no wire changes.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant