Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
feat: discard non-finalizable blocks #7746
feat: discard non-finalizable blocks #7746
Changes from 1 commit
49d3f5a
81efd7d
83244a5
86433c6
18cfb73
e0d1d98
cbb4916
5d7b0ef
155d406
661bf0f
cd251df
fe6ec26
696d06e
11032ae
9d3f0c8
686be05
67b84a1
40921e8
46bdf8d
61b535a
02c836b
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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'm not sure about the need for this constant. This actually assumes that in the chain, we would never have a fork with 20 blocks. While this rarely happens, adding this assumption doesn't help much with the implementation in this function, so I don't think it should be added. the check that compares the block height with the final head height should be enough.
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 don't see where we need this assumption. If there is a fork with >20 blocks, it means that we just can't apply our optimization and discard it here. Having constant 20 helps us to discard more useless blocks (see below).
I think the current check is helpful for scenarios as follows:
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 see. I still don't understand why we need to only check the last 20 blocks. What do you think about just changing the for loop to loop?
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'm concerned about very long forks for which it can take a while to iterate over parents. Maybe there is some reason not to worry about it, but I don't see it.
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.
If I put the check to
preprocess_block
, then these tests are failing:They create some tree of blocks on chain, and the tests fail because some of blocks are being discarded.
Moved it to
Client::start_process_block
, because it looks like optimization on Client side, and I wouldn't make Chain tests assuming this optimization as well. Even after this, two other tests had to be changed.