[pull] main from aptos-labs:main - #740
Merged
Merged
Conversation
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.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
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 : )