Skip to content

[sui-kv-rpc][sui-rpc-api] Unify Range resolution - #27738

Closed
wlmyng wants to merge 7 commits into
wlmyng/ledger-history-cursor-applicationfrom
wlmyng/ledger-history-symbolic-unify
Closed

[sui-kv-rpc][sui-rpc-api] Unify Range resolution#27738
wlmyng wants to merge 7 commits into
wlmyng/ledger-history-cursor-applicationfrom
wlmyng/ledger-history-symbolic-unify

Conversation

@wlmyng

@wlmyng wlmyng commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Description

Third PR of the ledger-history convergence stack (#27724#27736 → this): the scalar (transactions/checkpoints) and intra-tx (events) scan lanes finish converging onto one resolved record and one cursor-application body.

ResolvedRange/ResolvedIntraTxRange are replaced outright by ResolvedScan<P> over ScanBounds<P>; the scalar endpoint resolvers drop with_range and their per-endpoint empty branches and use the same one-call resolve as events; scalar cursor tests that became structural twins of the intra-tx family are pruned (the lane-divergent ones — successor canonicalization, raw-echo divergence, u64::MAX saturation — are kept). A final commit settles the construction vocabulary: resolve takes the scan window in position space and applies cursor bounds itself, and the one remaining per-lane seam is ScanCursor<P> on CursorToken (coordinate + resume_lo) — how cursors read being the only thing the lanes actually disagree about.

Wire change (first commit; terminal no-item frames only, data frames unchanged): terminal cursors now echo the raw request cursor instead of a derived coordinate —

  • descending stop-side terminals echo the cursor's own position rather than its successor (after-Item@n previously echoed n+1, now n; the scan interval still starts at n+1);
  • an ascending after-Item cursor that empties the interval retains Item kind (previously normalized to Boundary).

All echoed tokens are resume-equivalent to their predecessors — resuming from either the old or new echo scans the same interval. (One wire-invisible ride-along in the consolidate commit: scalar descending-empty records normalize entry = terminal instead of the end - 1 formula; empty terminal frames never read entry.)

Follow-up (deliberately not here): raw echo enables scalar resume going fully symbolic (uniform resume_lo, +1 confined to the store edge) and anchoring the record on Position-variant payloads for verbatim cursor echo. Tracked separately.

Test plan

Per-arm cursor unit tests in both lanes (tighten / entry-fold / empty / crossed / exact-edge, both cursor kinds), canonical empty-window records, and the u64::MAX cases in query_options. The resume-equivalence claim is pinned directly by raw_after_item_echo_resumes_like_successor_boundary (after-Item@n and Boundary@n+1 admit the identical interval), with the descending pair asserted inside tx_after_cursor_pins_descending_terminal. Endpoint behavior is covered by the existing list_ledger_history e2e suite.

Release notes

Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.

For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.

  • Protocol:
  • Nodes (Validators and Full nodes):
  • gRPC: In the v2 ledger-history ListTransactions/ListEvents/ListCheckpoints endpoints, terminal watermark frames now echo the client's raw cursor position and kind instead of a derived successor coordinate. Echoed cursors remain valid resume points; no client action needed.
  • JSON-RPC:
  • GraphQL:
  • CLI:
  • Rust SDK:
  • Indexing Framework:

@wlmyng
wlmyng deployed to sui-typescript-aws-kms-test-env August 18, 2026 01:41 — with GitHub Actions Active
@vercel

vercel Bot commented Aug 18, 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 18, 2026 11:20pm
sui-kiosk Building Building Preview Aug 18, 2026 11:20pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
multisig-toolkit Ignored Ignored Preview Aug 18, 2026 11:20pm

Request Review

@wlmyng
wlmyng changed the base branch from main to wlmyng/ledger-history-cursor-application August 18, 2026 01:41
@wlmyng
wlmyng deployed to sui-typescript-aws-kms-test-env August 18, 2026 01:51 — with GitHub Actions Active
@wlmyng
wlmyng deployed to sui-typescript-aws-kms-test-env August 18, 2026 01:53 — with GitHub Actions Active
@wlmyng
wlmyng force-pushed the wlmyng/ledger-history-symbolic-unify branch from 2e695d5 to 4c77c6b Compare August 18, 2026 18:35
@wlmyng
wlmyng deployed to sui-typescript-aws-kms-test-env August 18, 2026 18:36 — with GitHub Actions Active
The scan interval still tightens eagerly (after-Item at n scans from n+1),
but claims and terminal records now carry the cursor's raw coordinate and
kind, mirroring the intra-tx lane: descending stop-side terminals echo the
cursor position instead of its successor, and an ascending after-Item that
empties the interval retains Item kind. Wire change on terminal no-item
frames (cursor bytes and exhaustion kinds); flip enumeration in the PR.
wlmyng added 6 commits August 18, 2026 16:10
One record and one cursor-application body for both lanes: ResolvedScan<P>
with a three-function ScanPosition seam (from_tx, cursor_position,
resume_lo). resume_lo canonicalizes the dense u64 lane's Item cursor to its
inclusive successor, which keeps the generic emptiness lattice exact and
confines the +1/u64::MAX arithmetic to ScanBounds<u64>::to_range at the
store edge. Scalar callers read the store range via .range().
All four scalar endpoint resolvers use the same one-line resolve +
apply_cursor_bounds shape as events; with_range and the per-endpoint empty
branches are deleted (empties ride the total path — apply is identity on
them). Ride-along: scalar descending-empty records get the normalized
entry = terminal instead of the end-1 formula, matching the intra-tx lane;
wire-invisible since empty terminal frames never read entry.
Post-unify both lanes run the one ResolvedScan cursor-application body, so
scalar tests that only re-exercise it through the u64 seam duplicate their
intra-tx twins. Deleted the structural twins (before-arm tighten/fold/empty,
rejected no-ops, entry folds, crossed attribution, empty passthrough); kept
the lane-divergent scalar tests: resume_lo successor canonicalization,
raw-echo vs scan-start terminals, u64::MAX saturation, and the after/before
Item-offset asymmetry. The one twin-missing scenario (before-claim overriding
an eagerly written after terminal) is ported into
crossed_cursors_descending_attribution.
resolve() takes the scan window in position space and applies cursor bounds
itself; callers interpret their own row windows (the event lane via
IntraTxCoordinate::tx_window). The row-embedding hook (from_tx), tx_span, and
the unused ResolvedScan::empty_at are deleted. The remaining lane seam is
ScanCursor<P> on CursorToken — coordinate and resume_lo — since how cursors
read is the one thing the lanes actually disagree about.
The symbolic-resume commit's terminal frames echo the raw after-Item
coordinate instead of its Boundary successor. Witness that the two token
forms admit the same interval on resubmission, so the echo change cannot
skip or re-serve an item.
@wlmyng
wlmyng force-pushed the wlmyng/ledger-history-symbolic-unify branch from 0f03022 to ea3e1a5 Compare August 18, 2026 23:18
@wlmyng
wlmyng deployed to sui-typescript-aws-kms-test-env August 18, 2026 23:18 — with GitHub Actions Active
@wlmyng

wlmyng commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by a re-cut of this stack with cleaner PR boundaries (renames → behavior-preserving consolidation with characterization pins → wire-semantics alignment → unification → symbolic resume): #27751#27752#27753#27754#27755. Content is carried over commit-for-commit; the old branch stays as reference.

@wlmyng wlmyng closed this Aug 19, 2026
@wlmyng
wlmyng deleted the wlmyng/ledger-history-symbolic-unify branch August 19, 2026 07:15
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