Added Validator to WarpSyncProvider
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.
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.
Please also merge master, there are some fixes for some of the flaky CI jobs.
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