paritytech / polkadot-sdk

The Parity Polkadot Blockchain SDK
https://polkadot.network/
1.8k stars 652 forks source link

Introduce `BlockGap` #5592

Closed liuchengxu closed 3 weeks ago

liuchengxu commented 3 weeks ago

Previously, block gaps could only be created by warp sync, but block gaps will also be generated by fast sync once #5406 is fixed. This PR is part 1 of the detailed implementation plan in https://github.com/paritytech/polkadot-sdk/issues/5406#issuecomment-2325064863: refactor BlockGap.

This refactor converts the existing (NumberFor<Block>, NumberFor<Block>) into a dedicated BlockGap<NumberFor<Block>> struct. This change is purely structural and does not alter existing logic, but lays the groundwork for the follow-up PR.

The compatibility concern caused by the new structure is addressed in the second commit.

cc @dmitry-markin