Repository navigation
rpc: GetEpoch end-of-epoch fields - #28600
Open
nickvikeras wants to merge 1 commit into
Open
nickvikeras wants to merge 1 commit into
nickvikeras wants to merge 1 commit into
Conversation
nickvikeras
force-pushed
the
nickv/epoch-fields
branch
from
November 6, 2026 16:55
d33ac7b to
6721ff3
Compare
nickvikeras
force-pushed
the
nickv/epoch-fields
branch
from
November 6, 2026 17:41
6721ff3 to
98a9bb5
Compare
nickvikeras
force-pushed
the
nickv/object-versions-rpc
branch
2 times, most recently
from
November 6, 2026 21:34
2090827 to
d533742
Compare
nickvikeras
force-pushed
the
nickv/epoch-fields
branch
from
November 6, 2026 22:15
98a9bb5 to
f7375b5
Compare
1 of 8 tasks
nickvikeras
added a commit
that referenced
this pull request
Nov 6, 2026
# Conflicts: # Cargo.lock # Cargo.toml # crates/sui-kv-rpc/src/bigtable_client.rs # crates/sui-rpc-api/src/grpc/v2/ledger_service/mod.rs
nickvikeras
added a commit
that referenced
this pull request
Nov 6, 2026
# Conflicts: # Cargo.lock # Cargo.toml # crates/sui-kv-rpc/src/bigtable_client.rs # crates/sui-rpc-api/src/grpc/v2/ledger_service/mod.rs
nickvikeras
added a commit
that referenced
this pull request
Nov 7, 2026
# Conflicts: # Cargo.lock # Cargo.toml # crates/sui-kv-rpc/src/bigtable_client.rs # crates/sui-rpc-api/src/grpc/v2/ledger_service/mod.rs
nickvikeras
added a commit
that referenced
this pull request
Nov 7, 2026
# Conflicts: # Cargo.lock # Cargo.toml # crates/sui-kv-rpc/src/bigtable_client.rs # crates/sui-rpc-api/src/grpc/v2/ledger_service/mod.rs
nickvikeras
added a commit
that referenced
this pull request
Nov 7, 2026
# Conflicts: # Cargo.lock # Cargo.toml # crates/sui-kv-rpc/src/bigtable_client.rs # crates/sui-rpc-api/src/grpc/v2/ledger_service/mod.rs
nickvikeras
added a commit
that referenced
this pull request
Nov 7, 2026
# Conflicts: # Cargo.lock # Cargo.toml # crates/sui-kv-rpc/src/bigtable_client.rs # crates/sui-rpc-api/src/grpc/v2/ledger_service/mod.rs
nickvikeras
marked this pull request as ready for review
November 11, 2026 00:59
nickvikeras
force-pushed
the
nickv/epoch-fields
branch
3 times, most recently
from
November 13, 2026 11:11
cfa86ca to
bcaa403
Compare
bmwill
approved these changes
Nov 13, 2026
nickvikeras
force-pushed
the
nickv/epoch-fields
branch
from
November 14, 2026 06:25
bcaa403 to
e196b87
Compare
GraphQL's Epoch reads move from Postgres to kv-rpc, so GetEpoch serves the end-of-epoch data GraphQL reads there, from both the fullnode and kv-rpc: transaction_end_exclusive, ended_in_safe_mode, system_epoch_info and epoch_commitments come from the stored epoch rows (rpc-store EpochInfo now carries them) and are set exactly when last_checkpoint is; transaction_start_inclusive comes from the previous epoch's end. kv-rpc reads epochs through the request's limited client. The fullnode's latest epoch is the live system state's, and its end-of-epoch fields appear as soon as the rpc-store row has them. kv-rpc answers as of its served height: an epoch that ends above it has not ended yet. The rpc-store merge no longer lets a mid-epoch restore seed overwrite a known epoch-start state, and the fullnode does not serve a seeded mid-epoch state as a past epoch's system_state. Also bumps sui-rust-sdk to 09f4c23 (MystenLabs/sui-rust-sdk#344) and drops the unused CheckpointData::epoch_info.
nickvikeras
force-pushed
the
nickv/epoch-fields
branch
from
November 15, 2026 02:09
e196b87 to
3c83540
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
GraphQL's
Epochreads move from Postgres to kv-rpc, soLedgerService/GetEpochserves the end-of-epoch data GraphQL reads there, from both the fullnode and kv-rpc.Stacked on #28577. Depends on MystenLabs/sui-apis#53 and MystenLabs/sui-rust-sdk#344, pinned at
09f4c23. Because #344 is based on SDK master, the pin also brings in MystenLabs/sui-rust-sdk#337: the ledger-stream client orders frames byWatermark.cursor_positionand ends a stream withDATA_LOSSon a frame without it. 1.82'ssui-rpc-apidoes not send it. 1.83's sends it on item and scan-frontier frames, and on a terminal frame unless the request resumed from a transaction or event cursor that carries no public position, such as one minted by 1.82 (whose cursors have none). 1.84 and main send it on every frame. The running epoch'ssystem_stateat kv-rpc's served height is split out into #28607, which is stacked on #28663.Mini design doc
Design. The new
Epochfields come from the stored epoch rows on both servers (rpc-store on the fullnode, BigTableepochson kv-rpc):transaction_end_exclusiveended_in_safe_modesystem_epoch_infoepoch_commitmentsThese are set exactly when
last_checkpointis.transaction_start_inclusiveis the previous epoch'stransaction_end_exclusive, or 0 for epoch 0. One shared helper insui-rpc-apifills the fields for both servers. kv-rpc reads epochs through the request's limited BigTable client.Decisions.
GetEpochwithout an epoch answers for the live system state's epoch, as before: the fullnode's plain reads are live (decision 31 of the min-checkpoint design). On kv-rpc it answers for the epoch of its served height H, as every kv-rpc read does. For an epoch after the latest, the fullnode answersNOT_FOUNDand kv-rpc an empty response (kv-rpc: answer NOT_FOUND for an epoch it has not served #28608 makes itNOT_FOUND).last_checkpoint,endand the end fields appear as soon as the rpc-store row has them. On kv-rpc, an epoch that ends above H has nolast_checkpoint,endor end fields yet, even when the indexer has already written them.ended_in_safe_mode = trueand nosystem_epoch_info, because noSystemEpochInfoEventwas emitted.protocol_config,startandreference_gas_pricefrom the live state. Any other epoch takes them from its rpc-store row, not from its stored system-state snapshot.start_checkpoint.system_state.Impact and rollout. Additive fields on both servers, with no flag. The fullnode's latest epoch stays the live one. Right after an epoch change, the epoch that just ended has its end fields on the fullnode only once the rpc indexes have indexed its last checkpoint. On kv-rpc,
system_stateis always the epoch-start snapshot here; #28607 serves the running epoch's state at the served height. Fullnode/kv-rpc parity holds for ended epochs; for the running epoch the fullnode answers from its live state and kv-rpc at H.Test coverage. The unit tests cover kv-rpc against a mock BigTable and the rpc-store merge. The e2e tests run the fullnode, kv-rpc, and both against one chain. Not covered end to end:
Test plan
New tests:
sui-kv-rpc:end_fields_are_served_once_the_epoch_has_ended_at_the_served_height: end fields are hidden above the served height, safe-mode counters are unset, and the first transaction comes from the previous epoch.sui-rpc-store:partial_seed_does_not_clobber_known_start_record.sui-e2e-tests:get_epoch_end_fields, where the fullnode's end fields match the last checkpoint's summary.sui-indexer-alt-e2e-tests:test_get_epoch_matches_between_fullnode_and_kv_rpc: one chain served by both servers. An ended epoch's stored fields, end fields andsystem_statematch. The running epoch is not compared: the fullnode answers for it from its live state.Release notes
GetEpochadds the end-of-epoch fieldstransaction_start_inclusive,transaction_end_exclusive,ended_in_safe_mode,system_epoch_infoandepoch_commitments.