polkadot-sdk icon indicating copy to clipboard operation
polkadot-sdk copied to clipboard

Added Validator to WarpSyncProvider

Open Klapeyron opened this issue 1 month ago • 1 comments

Description

It looks like WarpSyncProvider in sc-network-sync has direct dependency to sp-consensus-gradnpa types, specially SetId and AuthorityList:

/// Warp sync backend. Handles retrieving and verifying warp sync proofs.
pub trait WarpSyncProvider<Block: BlockT>: Send + Sync {
	/// Generate proof starting at given block hash. The proof is accumulated until maximum proof
	/// size is reached.
	fn generate(
		&self,
		start: Block::Hash,
	) -> Result<EncodedProof, Box<dyn std::error::Error + Send + Sync>>;
	/// Verify warp proof against current set of authorities.
	fn verify(
		&self,
		proof: &EncodedProof,
		set_id: SetId,
		authorities: AuthorityList,
	) -> Result<VerificationResult<Block>, Box<dyn std::error::Error + Send + Sync>>;
	/// Get current list of authorities. This is supposed to be genesis authorities when starting
	/// sync.
	fn current_authorities(&self) -> AuthorityList;
}

This PR is removing this dependency and replaces it with Validator, which can be used to validate proofs.

Klapeyron avatar Nov 06 '25 11:11 Klapeyron

Thank you @bkchr! It simplified this code significantly, I will appreciate if you will allocate some time to make a second round of review, meanwhile I will prepare some prdoc.

Klapeyron avatar Dec 04 '25 18:12 Klapeyron

Please also merge master, there are some fixes for some of the flaky CI jobs.

bkchr avatar Dec 12 '25 08:12 bkchr

Thank you. @bkchr if you could also take a look on this one: https://github.com/paritytech/polkadot-sdk/pull/10223#discussion_r2592404755, looks like there is some missing test for warp with rotating committee, due at the moment when this comment was created, validator was not persisting new authority set and CI was green. Maybe it can be addressed in some follow-up issue

Klapeyron avatar Dec 12 '25 09:12 Klapeyron