Skip to content

[pull] main from aptos-labs:main - #740

Merged
pull[bot] merged 2 commits into
mtrackeros:mainfrom
aptos-labs:main
Jul 21, 2026
Merged

[pull] main from aptos-labs:main#740
pull[bot] merged 2 commits into
mtrackeros:mainfrom
aptos-labs:main

Conversation

@pull

@pull pull Bot commented Jul 21, 2026

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

grao1991 and others added 2 commits July 21, 2026 07:08
End-to-end native-position state sync, mirroring main state throughout. A fresh
node fast-syncs native-position state alongside main state as a proper bootstrapper
stage, reusing the same range-proof restore machinery.

Storage layer:
- Reuse the generic StateSnapshotRestore<StateKey, StateValue> via a
  PositionStateValueWriter (hash-keyed, matching StateValueByKeyHashSchema):
  sequential range-proof verify, crash resumption, commit watermark, the
  StateSnapshotReceiver trait. Paged producer get_position_value_chunk_with_proof
  (one SparseMerkleRangeProof per chunk), bounded by both item count
  (max_state_chunk_size) and serialized bytes (max_network_chunk_bytes), matching
  get_state_value_chunk_with_proof_by_size.

DB traits:
- DbReader::get_position_state_value_chunk_with_proof + get_position_state_item_count
- DbWriter::get_position_state_snapshot_receiver (on AptosDB; forwarded by
  FastSyncStorageWrapper / FakeAptosDB).

TransactionInfoV1 anchor:
- TransactionInfo::position_state_root() reads the reserved TransactionInfoV1 slot.
- TransactionInfo::verify_position_state_root(root) validates a chunk root against
  it, returning true when the slot is None (permissive until the executor
  populates it) and enforcing equality once it is set.

Cross-crate state-sync:
- storage-service serves position chunks + count; data-client requests them;
  data-streaming GetAllPositionStates stream + PositionStateStreamEngine
  (count-based; empty tree => stream completes); StorageSynchronizer applies them
  off-thread (save_position_state_values, spawn_position_state_snapshot_receiver);
  metadata persists PositionSnapshotSync progress (crash resumption).
- bootstrapper runs a PositionValueSyncer stage after the main snapshot completes
  (only when a main fast-sync occurred), pinned to the bootstrap target version.
  Each chunk is validated against the anchored TransactionInfo via
  verify_position_state_root; the restore is verified against the anchor when set,
  else the chunk's own self-consistent root. Completion is gated on the persisted
  position progress; an empty position tree is handled (count 0).

Shared with main state (no duplicated copies):
- bootstrapper verify_state_value_chunk_indices(expected_start_index, label, ...)
  serves both the state and position payload processors.
- metadata_storage is parameterized by a private SnapshotKind { MainState,
  Position }; the progress read/write helpers are shared.
- can_service gates position requests on the same advertised range as main state
  via or-patterns.

Note: the executor does not yet populate the TransactionInfoV1 anchor slot
(separate execution change). Until then the slot is None, so chunk-root validation
is permissive and the restore is anchored on the producer-supplied root; once the
executor sets the slot, validation/restore enforce it automatically.

All new DataRequest/DataResponse/DbMetadataKey variants appended for BCS wire
stability. Builds + clippy clean; data-streaming, state-sync-driver (65),
storage-service-types (11), and native_storage (7) tests pass.
@pull pull Bot locked and limited conversation to collaborators Jul 21, 2026
@pull pull Bot added the ⤵️ pull label Jul 21, 2026
@pull
pull Bot merged commit 7f54b89 into mtrackeros:main Jul 21, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants