Skip to content

refactor: consolidate ledger-history window resolution and cursor application 2/5 - #27752

Merged
wlmyng merged 6 commits into
mainfrom
wlmyng/resolved-range-consolidation
Aug 20, 2026
Merged

refactor: consolidate ledger-history window resolution and cursor application 2/5#27752
wlmyng merged 6 commits into
mainfrom
wlmyng/resolved-range-consolidation

Conversation

@wlmyng

@wlmyng wlmyng commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Description

Second of the stack (on top of the rename PR). Behavior-preserving consolidation of ledger-history window resolution and cursor application:

  • checkpoint_to_tx_range becomes empty-safe on kv, so empty windows ride the same projection path as non-empty ones instead of a special-cased boundary lookup.
  • CheckpointRange::from_request + .resolve(options) fuse into one ResolvedCheckpointRange::from_request call; the intermediate struct dissolves. Both backends keep their existing error precedence via a standalone validate_checkpoint_bounds called before read-mask/options parsing, exactly where the old validation sat — the fullnode handlers' private ledger_read copy of the same check is deleted in favor of the shared helper.
  • Cursor application moves off QueryOptions onto the records, and both lanes' apply_cursor_bounds are restructured into per-arm apply_after_cursor/apply_before_cursor with the same shape.

Test plan

  • window past indexed tip = LedgerTip
  • zero-width window is CheckpointBound
  • cursors don't change already-empty Resolved*Range
  • resolve orients entry/terminal checkpoints by ordering

Tests on ResolvedRange and ResolvedIntraTxRange around cursor tightening, after/before + ascending/descending.

Which cursor owns the terminal frame when both are present and applied, when one is rejected, when before overrides after.

Every commit compiles and passes the scoped suites individually.

Release notes

  • Protocol
  • Nodes (Validators and Full nodes)
  • gRPC
  • JSON-RPC
  • GraphQL
  • CLI
  • Rust SDK

@wlmyng
wlmyng temporarily deployed to sui-typescript-aws-kms-test-env August 19, 2026 01:53 — with GitHub Actions Inactive
@vercel

vercel Bot commented Aug 19, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
sui-docs Ready Ready Preview Aug 20, 2026 11:05pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
multisig-toolkit Ignored Ignored Preview Aug 20, 2026 11:05pm
sui-kiosk Ignored Ignored Preview Aug 20, 2026 11:05pm

Request Review

@wlmyng
wlmyng force-pushed the wlmyng/resolved-range-consolidation branch from 1c21f01 to 888e2ee Compare August 19, 2026 05:38
@wlmyng
wlmyng temporarily deployed to sui-typescript-aws-kms-test-env August 19, 2026 05:38 — with GitHub Actions Inactive
@wlmyng
wlmyng force-pushed the wlmyng/resolved-range-consolidation branch from 888e2ee to b33651d Compare August 19, 2026 05:46
@wlmyng
wlmyng temporarily deployed to sui-typescript-aws-kms-test-env August 19, 2026 05:46 — with GitHub Actions Inactive
@wlmyng
wlmyng force-pushed the wlmyng/resolved-range-consolidation branch from b33651d to 8e9bdc8 Compare August 19, 2026 06:24
@wlmyng
wlmyng temporarily deployed to sui-typescript-aws-kms-test-env August 19, 2026 06:24 — with GitHub Actions Inactive
@wlmyng wlmyng changed the title refactor: consolidate ledger-history window resolution and cursor application refactor: consolidate ledger-history window resolution and cursor application 2/5 Aug 19, 2026
@wlmyng
wlmyng marked this pull request as ready for review August 19, 2026 06:31
@wlmyng
wlmyng temporarily deployed to sui-typescript-aws-kms-test-env August 19, 2026 06:31 — with GitHub Actions Inactive
Base automatically changed from wlmyng/resolved-range-renames to main August 20, 2026 23:01
wlmyng added 6 commits August 20, 2026 16:01
Same behavior on sui-kv-rpc and sui-rpc-api to unconditionally project
cp to tx range before is_empty() check, since we always do a lookup for
the terminal cursor. This will help eliminate the special case empty_at
for ResolvedXRange, as empty windows instead ride the same projection
path.
CheckpointRange::from_request + .resolve(options) was a two-step every
handler sequenced across two places. ResolvedCheckpointRange::from_request
fuses them into one call — the intermediate struct dissolves, its fields
becoming locals of the fused body; validation, tip clamp, cursor clamps,
and exhaustion attribution are preserved branch for branch.

Both backends keep their existing error precedence: the window-bounds
check stands alone as validate_checkpoint_bounds, called before read-mask
and options parsing as before (the fused resolution re-runs it
harmlessly). The fullnode handlers' private ledger_read copy is deleted
in favor of the shared helper.
…onto the records

ResolvedIntraTxRange gains a one-call resolve from the checkpoint window,
and both records take over cursor application from QueryOptions:
options.apply_{intra_tx_,}cursor_bounds(record) becomes
record.apply_cursor_bounds(&options). Squash of three mechanical moves;
behavior unchanged.
…fore_cursor

Extracts each cursor arm from ResolvedIntraTxRange::apply_cursor_bounds
into its own method and reshapes both onto &mut self. Squash of three
extraction steps; behavior preserved, pinned by the per-arm test family
this adds.
…tra-tx rewrite

Same per-arm extraction for ResolvedRange, ending with the two lanes'
apply_after/before_cursor pairs structurally parallel — their remaining
semantic differences now sit side by side for the alignment PR. Behavior
preserved: the after-Item-at-u64::MAX admission keeps its legacy
short-circuit (terminal at the cursor's own coordinate, before-arm
skipped), expressed as the arm's ControlFlow::Break.
@wlmyng
wlmyng force-pushed the wlmyng/resolved-range-consolidation branch from 8e9bdc8 to aada168 Compare August 20, 2026 23:01
@wlmyng
wlmyng temporarily deployed to sui-typescript-aws-kms-test-env August 20, 2026 23:01 — with GitHub Actions Inactive
@wlmyng
wlmyng merged commit a9d5fd7 into main Aug 20, 2026
61 of 63 checks passed
@wlmyng
wlmyng deleted the wlmyng/resolved-range-consolidation branch August 20, 2026 23:44
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.

2 participants