-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Extracting the syncing protocol from sc-network
#8686
Comments
Hey, is anyone still working on this? Due to the inactivity this issue has been automatically marked as stale. It will be closed if no further activity occurs. Thank you for your contributions. |
Issue still relevant and important. |
I just briefly discussed this with @tomaka. Sync is rather tightly integrated with the networking currently. This manifests mainly in the sync peer-set being explicitly used by grandpa to keep both in sync. For now this should stay this way, this means we keep a hard coded sync peer-set inside the networking crate. For now, we would only move out the sync related code into its own crate. |
Code can mainly be found here: https://github.com/paritytech/substrate/tree/master/client/network/src/protocol/sync |
Okay, I will try to extract anything related to |
FYI, it is mainly this https://github.com/paritytech/substrate/blob/master/client/network/src/protocol/sync.rs and this https://github.com/paritytech/substrate/tree/master/client/network/src/protocol/sync. And while I see that network-gossip is on the client folder level, sync should go to |
What is complicated is that the code in
If you want to plug the sync code through the public high-level API, you need to refactor this, but I don't really know how. |
Turns out I need this for changing sync mechanics. |
I am learning a lot about the Substrate libp2p integration as I slowly crawl with this PR. I wanted to do too much refactoring at first, but got some intermediate milestone I can reach in a week next to my other ongoing tasks, I guess. |
@wigy-opensource-developer can you please give details on what is planned. |
Of course. As a first step As a second step message handling for As a third step, abstractions common to My estimation is that the first step will get to master next week. |
Hey, any progress here? |
Hey, no there is not yet any real progress. This will also still take quite some time to have something proper. |
Is there something I can do to speed up the process here? I can do some refactoring if I understand what it should look like in the end. |
Can you again say what you need @nazar-pc? |
To replace sync mechanism with a custom one. Let's say node discovers it is significantly behind the tip of the chain and needs to reach out to archival node to get last 1000 blocks. I need that to happen over our distributed storage network instead, archival nodes in traditional sense will not be feasible on our network due to scale. |
Do you have any write up of your syncing algorithm? I mean it is enough to have some rough write up on how it works. |
There is a lot to it, but somewhat abstractly the algorithm would be like this:
This replaces how node requests ranges of blocks of archival history from other nodes, I expect that majority of the remaining logic will remain the same as it is in Substrate though. |
Okay ty. |
I need to expand that syncing Subspace from Subspace DSN using described approach is the first step. We'd like to enable other chains to be able to sync from Subspace DSN in a similar way, so ideally we'd write some kind module that others can import into their project if they so choose. We were discussing about enabling parachains on Rococo to sync this way for instance. |
@nazar-pc if you like you could start working on this. This is just the first iteration and is rather simple. It is really just about moving the code related to syncing to a new crate. sc-network for now will depend on this crate. |
Cool, I'll notify once I start actively working on it |
Part 4 is ready on my side, it makes Will submit as a PR once third PR is merged. |
Sounds good :) |
Hi! @nazar-pc do you plan more PR after the Network sync refactoring (part 4) #11412 is merged? All four PRs are a great work and are a major step towards untangling sync from the network. During our (@timorl and myself) investigation of the network, however, we spotted that there are still some parts of sync in the |
Yes, I do expect more PRs after that, just need feedback and to sync with maintainers before moving forward. I'd like to not only sync to be decoupled, but eventually to have networking interface where Just trying to make small steps without breaking things in the process. UPD: Part 4 covers some of the needs I had, but likely not all of them, so expect more PRs for sure. |
With latest PR still not merged I already started working on more changes. First of all addressing some of review comments from that PR that'll land separately, but also on refactorings around On It'll allow wrapping |
@nazar-pc what is your future plans here? Do you still want to continue pursuing this issue or can I assign it to someone else? |
I was looking into sync algorithm specifically a few times over last few weeks and before that. There are still many bits of sync left in I'm still very much interested in pursuing this, just depends on how much time I'll have. |
Okay :) Yeah, sync is still really deeply backed into |
I don't have anything refactoring-wise pending. |
I have removed rest of the syncing code from Unfortunately, as we want to keep the hardcoded entry in the peerset, I've had to add some workarounds around the Currently the syncing code is installed as a bunch of generic request-response protocols (+ block announcement notification protocol) and the
This was more of a status update. I've started to split the work and I hope to have something reviewable soonish. Let me know what you think about all of the above. I would especially appreciate any feedback on what needs to be done so that the hardcoded entry can be removed from the peerset. |
This should entirely go out of |
At the moment,
sc-network
contains a pretty generic low-level networking stack, on top of which the syncing and transaction protocols are implemented.sc-network
exposes both the API of the low-level networking stack, but also an API for syncing and transaction-related actions.I think it would make sense to move the syncing and transaction out of
sc-network
.I focused on the syncing in the issue title, because transactions are already more or less segregated from the rest.
The text was updated successfully, but these errors were encountered: