Skip to content

Implement warp sync strategy #3183

Description

@EclesioMeloJunior

Description

  • Implement the warp sync proof request
  • The mechanism should be a strategy under the sync package, it must implement the Strategy interface
type Strategy interface {
	OnBlockAnnounce(from peer.ID, msg *network.BlockAnnounceMessage) (repChange *Change, err error)
	OnBlockAnnounceHandshake(from peer.ID, msg *network.BlockAnnounceHandshake) error
	NextActions() ([]*syncTask, error)
	IsFinished(results []*syncTaskResult) (done bool, repChanges []Change, blocks []peer.ID, err error)
	ShowMetrics()
}

The Warp Proof Request is issued to a valid peer and the message format is just the hash of the block, since we don't have it documented in the spec, an example can be found here: https://github.com/paritytech/polkadot-sdk/blob/eb0a9e593fb6a0f2bbfdb75602a51f4923995529/substrate/client/network/sync/src/strategy/warp.rs#L516

The Warp Sync Strategy should issue the warp sync proof request until it receives the done flag from the peer indicating that the warp sync is completed then it should issue a state request to bring the most up to data state and import it.

Each warp sync proof contains a set of warp fragments, each fragment contains a block that a authority set happened and the justification proving the finality of the block, these blocks should be validated and imported in the state, the response format is defined in the link in additional informations

The Warp Sync process is full done once the most up to date state is requested and imported, once finished the sync service should change from warp sync to full sync method and keeping syncing!

Additional informations

https://spec.polkadot.network/#sect-sync-warp
WARP Sync slides (2).pdf

Metadata

Metadata

Assignees

Labels

C-complexComplex changes across multiple modules. Possibly will require additional research.P-lowthis is mostly nice to have.S-networkissues related to the dot/network package.T-featthis issue/pr is a new feature or functionality.

Type

No type

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions