-
Notifications
You must be signed in to change notification settings - Fork 2.6k
BEEFY - justifications sync protocol #12093
Comments
I'm seeing all current RequestResponse protocols in Substrate network are built around sync and are also kind of hardcoded, not really "pluggable". Should we also "hardcode" BEEFY support (at most wrap it around an Option<>, just like warp sync)? Should we add it to (Protocol as NetworkBehavior)::poll() just like the others, maybe even through the ChainSync trait member? Since this would be a separate sync, we'll end up with mixed state (some block-sync-specific and some BEEFY-sync-specific) in struct ChainSync, struct PeerSync and struct PeerSyncState. Any concerns here? In case we get justifs from other sources is there any way to cancel any pending request? What kind of peer selection strategy should we use? |
If you take a look at Polkadot you see pluggable protocols and this is the way forward. We will not accept anymore hardcoded protocols if there is not any special reason for this.
No please don't do this. It should be its own protocol, living in its own crate. Also just no to the other stuff above 🙈
I don't think there is a way currently. What would be other sources to receive a justification?
I think for now we should be able to just follow the substrate/client/network/common/src/protocol/event.rs Lines 50 to 60 in 40703f4
You can get these by getting an substrate/client/network/src/service.rs Line 1042 in 40703f4
One problem is probably to know what blocks/justification a peer has. Maybe we should have our completely own protocol on top of |
I guess it's fine even without canceling a pending request, we'll just drop the obsolete response.
We could use the votes gossiping to determine which peers have what (mandatory) justifications: any peer voting on block
Ok, got it. Will develop this as its own protocol, living in its own crate, "pluggable" into |
So all validators will have the justifications and only normal nodes will need to request them from validators? While doing major sync we send the BEEFY justification directly alongside the block? (Just trying to understand when we will need to request a justification) |
yup, and the worker/voter gets them through
A validator was offline for a while and when coming back up syncs blocks from a node that also doesn't have (latest) BEEFY justifications => no justifs through block import, no justifs through voting because those rounds ended a while ago. |
Okay, so the validator comes back online. Syncs blocks without justfication. While doing this its already running the BEEFY protocol and listens for votes. Any node that votes on stuff with a higher block number than we are missing the justification for should have all justifications of all blocks before including the one we are searching for? |
Yes, that’s right, any node voting for higher blocks should (if behaving correctly) have all mandatory block justifications leading to block number they’re currently voting on. And we’re only on-demand syncing mandatory ones so this approach should work. |
This issue replaces paritytech/grandpa-bridge-gadget#20 and tracks implementing
#3
below:A node running BEEFY worker/gadget, generates/imports and stores BEEFY justifications as follows:
RequestResponse
protocol - where node can request BEEFY justifications for certain blocks from connected peers, and also answer any requests it gets.#3
above is required when syncing from a peer that might be missing some/all BEEFY justifications.The text was updated successfully, but these errors were encountered: