paritytech / polkadot-sdk

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

Support block gap created by fast sync #5703

Open liuchengxu opened 2 weeks ago

liuchengxu commented 2 weeks ago

This is part 2 of https://github.com/paritytech/polkadot-sdk/issues/5406#issuecomment-2325064863, properly handling the block gap generated during fast sync.

Although #5406 remains unresolved due to the known issues in #5663, I decided to open up this PR earlier than later to speed up the overall progress. I've tested the fast sync locally with this PR, and it appears to be functioning well. (I was doing a fast sync from a discontinued archive node locally, thus the issue highlighted in https://github.com/paritytech/polkadot-sdk/pull/5663#discussion_r1752124039 was bypassed exactly.)

Once the edge cases in #5663 are addressed, we can move forward by removing the body attribute from the LightState block request and complete the work on #5406. The changes in this PR are incremental, so reviewing commit by commit should provide the best clarity.

cc @dmitry-markin

liuchengxu commented 1 week ago

I don't believe supporting this conversion is necessary unless we encounter a specific use case that justifies it. Currently, the conceptual model is straightforward: gaps are caused either by warp sync or fast sync, but not both simultaneously. From my point of view, warp sync is typically the preferred method, with fast sync used only when warp sync is unsupported by the chain. Users are generally expected to choose one sync strategy, rather than a mix of the two. Adding support for converting gaps between the two could introduce unnecessary complexity without clear benefits.

liuchengxu commented 1 day ago

Ping @bkchr In addition, some insights in terms of the edge case in https://github.com/paritytech/polkadot-sdk/pull/5663#discussion_r1752124039 would also be appreciated.