Sync status refactoring (#5450)
As I was looking at the coupling between `SyncingEngine`,
`SyncingStrategy` and individual strategies I noticed a few things that
were unused, redundant or awkward.
The awkward change comes from
https://github.com/paritytech/substrate/pull/13700 where
`num_connected_peers` property was added to `SyncStatus` struct just so
it can be rendered in the informer. While convenient, the property
didn't really belong there and was annoyingly set to `0` in some
strategies and to `num_peers` in others. I have replaced that with a
property on `SyncingService` that already stored necessary information
internally.
Also `ExtendedPeerInfo` didn't have a working `Clone` implementation due
to lack of perfect derive in Rust and while I ended up not using it in
the refactoring, I included fixed implementation for it in this PR
anyway.
While these changes are not strictly necessary for
https://github.com/paritytech/polkadot-sdk/issues/5333, they do reduce
coupling of syncing engine with syncing strategy, which I thought is a
good thing.
Reviewing individual commits will be the easiest as usual.
---------
Co-authored-by:
Dmitry Markin <dmitry@markin.tech>
parent
3cbefaf1
Pipeline
#492957
waiting for manual action
with stages
in
1 hour, 49 minutes, and 58 seconds
Stage:
Stage:
Stage:
Stage:
Stage:
Stage:
Stage:
Showing
- prdoc/pr_5450.prdoc 18 additions, 0 deletionsprdoc/pr_5450.prdoc
- substrate/client/informant/src/display.rs 1 addition, 1 deletionsubstrate/client/informant/src/display.rs
- substrate/client/informant/src/lib.rs 7 additions, 7 deletionssubstrate/client/informant/src/lib.rs
- substrate/client/network/sync/src/engine.rs 5 additions, 21 deletionssubstrate/client/network/sync/src/engine.rs
- substrate/client/network/sync/src/service/syncing_service.rs 7 additions, 30 deletionssubstrate/client/network/sync/src/service/syncing_service.rs
- substrate/client/network/sync/src/strategy/chain_sync.rs 0 additions, 1 deletionsubstrate/client/network/sync/src/strategy/chain_sync.rs
- substrate/client/network/sync/src/strategy/state.rs 0 additions, 1 deletionsubstrate/client/network/sync/src/strategy/state.rs
- substrate/client/network/sync/src/strategy/warp.rs 0 additions, 1 deletionsubstrate/client/network/sync/src/strategy/warp.rs
- substrate/client/network/sync/src/types.rs 12 additions, 3 deletionssubstrate/client/network/sync/src/types.rs
- substrate/client/network/test/src/lib.rs 4 additions, 6 deletionssubstrate/client/network/test/src/lib.rs
- substrate/client/network/test/src/sync.rs 1 addition, 1 deletionsubstrate/client/network/test/src/sync.rs
- substrate/client/service/src/lib.rs 1 addition, 1 deletionsubstrate/client/service/src/lib.rs
Please register or sign in to comment