-
Notifications
You must be signed in to change notification settings - Fork 696
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to disable gap creation during block import #5343
Allow to disable gap creation during block import #5343
Conversation
14465c9
to
714f587
Compare
Let me know if |
@@ -1707,7 +1708,8 @@ impl<Block: BlockT> Backend<Block> { | |||
&(start, end).encode(), | |||
); | |||
} | |||
} else if number > best_num + One::one() && | |||
} else if operation.create_gap && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc #4984
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not exactly sure how it is related necessarily, it still had to pass through consensus successfully before ending up here IIUC.
I do see those "block has an unknown parent" in some cases though and subscribed to linked issue a while ago.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean this is a hack and I'm fine for now to live with this to make your life easier. My question would be, could we maybe just disable it "globally". So, that you can create the backend and tell it to never create a gap. Would that work for you?
I think it'll work equally well for my use case. I though about it initially and couldn't decide whether there is a use case where there might be a scenarios in such gaps should be created in some cases, but not others in runtime, so I decided to make that possibility open. In the scenario I'm thinking about one block is inserted as already finalized and I want to disable gap creation for that specific block. There are no other cases where gap would be created, so beyond that it makes no difference to me whether it is global or local decision. |
Which block authoring engine are you using? Currently, during warp sync, importing a block within a gap causes Babe to skip certain checks that would otherwise cause the import to fail. Block verification: polkadot-sdk/substrate/client/consensus/babe/src/lib.rs Lines 1149 to 1158 in 0cd577b
Block import: polkadot-sdk/substrate/client/consensus/babe/src/lib.rs Lines 1420 to 1431 in 0cd577b
|
We use Dilithium (Subspace v2.3) PoAS consensus and as described in #5333 we already have two custom sync mechanisms that are not part of Substrate either. What BABE consensus does is 100% irrelevant for us. Our consensus is not only ready for the changes in this PR, we already use changes that provide similar effect in production (testnet with ~8000 nodes) during last few months. We already carry patches to Substrate downstream that allow us to do what we need to do, this is just one of the steps to introduce new capabilities in Substrate that would allow us to drop downstream hacks and workarounds. As of right now stock Substrate is not flexible enough for our purposes and assumptions like existence of Warp sync are causing issues for us downstream, which I aim to correct over time. |
5d4c724
to
72787ef
Compare
I understand. It’s worth noting that |
Looks like semver check started using wrong Rust version, so it fails to compile now, merging fresh |
Anything else I can do in this PR to move it forward? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
How can I interest more folks in reviewing this? PR is quite simple and was open for about a month now, missing September release cut. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. I'm not very familiar with backend/db, why this is better than disabling gap sync?
Also, there is #5592 that just touched the same code.
Gap sync is the consequence, the database will still have gap recorded, sync status will be misreported by informer, etc. For our chain gap sync is of no interest right now, hence we don't want gap to be created in the first place. At the same time we might want to have it in other cases in the future, which is all still possible with this PR. |
030cb4a
This feature is helpful for us with custom sync protocol that is similar to Warp sync except we do not ever sync the gap and don't want it to exist in the first place (see paritytech#5333 and its references for motivation). Otherwise we had to resort to this: d537512 --------- Co-authored-by: Davide Galassi <[email protected]> (cherry picked from commit 030cb4a)
This feature is helpful for us with custom sync protocol that is similar to Warp sync except we do not ever sync the gap and don't want it to exist in the first place (see #5333 and its references for motivation).
Otherwise we had to resort to this: autonomys@d537512