-
Notifications
You must be signed in to change notification settings - Fork 3
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
chainHead: Clarify reported order of pruned blocks #143
Comments
Probably because since those blocks are the root nodes of the pruned branches, then it's trivial to get all the other ones that are pruned... no? I mean, from those ones you just need to traverse their descendants to find the other pruned blocks, correct? If you want, we could change the spec so that only the roots of the pruned branches are reported... I don't care, really.
I mean, yes and no. Basically, in polkadot-api we are currently relying on the In other words, the
IMO the order is completely irrelevant when dealing with pruned blocks. |
I fail to understand anything about the example cases and schemas. To me, delaying the moment when the finalization is reported is acceptable. Delaying when pruned blocks are reported is not acceptable. |
Just to note that in Subxt the We don't care about the order of blocks mentioned in the pruned blocks list though. |
After the latest changes from substrate pruning logic paritytech/polkadot-sdk#3962, the substrate implementation is now returning all pruned blocks in one go. Previously, the pruning logic for this small fork would result in: b1 -> b2 -> b3
-> b2' (f) -> b3' (f) Before: pruning logic was reporting blocks on height N-1, where N is the height of the finalized block. This led to us reporting no pruned blocks B2' was finalized. |
Substrate chains report pruned blocks from level N (height) when the level N + 1 is finalized.
Case 1
In this case the block 6 (height 3) is finalized. Substrate will try to prune blocks on height 2, and will not report any blocks (because block 2 is not the leaf of fork).
However, we know conceptually that [block 2, block 3] and [block 2, block 4, block 5] are blocks on forks that will never get finalized.
Case 2
In this case the block 7 (height 5) is finalized. Substrate will try to prune blocks on height 3, in this case block 3 (height 3) is a leaf of a fork. Block 2 and block 3 are reported as pruned with the finalized event.
However, [block 2, block 4, block 5] are not reported yet.
Case 3
In this case the block 8 (height 6) is finalized. Substrate will try to prune blocks on height 4, in this case block 5 (height 4) is a leaf of a fork. Block 2, block 4 and block 5 are on a fork. However, only block 4 and block 5 should be reported.
This is because we reported block 2 in the previous step.
Questions
Do you see a problem with delaying the announcement of the branch as pruned? (for example, case 1 and case 2).
Should we enforce the order of the pruned blocks? Meaning, for case 1, should we declare at this step block 2, block 3, block 4 and block 5 as pruned?
What would the lightclient do in those scenarios? (cc @tomaka) 🙏
Thanks @josepot for raising this in #142.
cc Substrate fix to report unique branches as pruned: paritytech/polkadot-sdk#3667
cc @paritytech/subxt-team
The text was updated successfully, but these errors were encountered: