-
Notifications
You must be signed in to change notification settings - Fork 68
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
IF: Update fork database fork-choice rule #2273
Conversation
… instead. Move current_core to block_state.
…ate, use values for fork_database by_best_branch rule.
…Only update LIB on block qc not on votes.
Nice to see the improvements. |
uint16_t if_ext_id = instant_finality_extension::extension_id(); | ||
assert(bsp->header_exts.count(if_ext_id) > 0); // in all instant_finality block headers | ||
const auto& if_ext = std::get<instant_finality_extension>(bsp->header_exts.lower_bound(if_ext_id)->second); | ||
if (if_ext.qc_claim.is_strong_qc) { |
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.
Add a comment here saying the claim has already been verified before.
libraries/chain/fork_database.cpp
Outdated
return my->search_on_head_branch_impl(block_num); | ||
} | ||
|
||
template<class BSP> | ||
BSP fork_database_impl<BSP>::search_on_head_branch_impl( uint32_t block_num ) const { | ||
for (auto i = index.find(head->id()); i != index.end(); i = index.find((*i)->previous())) { | ||
if ((*i)->block_num() == block_num) | ||
return *i; |
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.
return my->search_on_head_branch_impl(block_num); | |
} | |
template<class BSP> | |
BSP fork_database_impl<BSP>::search_on_head_branch_impl( uint32_t block_num ) const { | |
for (auto i = index.find(head->id()); i != index.end(); i = index.find((*i)->previous())) { | |
if ((*i)->block_num() == block_num) | |
return *i; | |
return my->search_on_branch_impl(head->id(), block_num); |
Note:start |
After this PR, we no longer update LIB via votes. LIB is only updated according to qc claims in block extensions.
Update
fork_database
fork-choice rule.Computed fields for index (in order):
Potentially switches forks before starting to produce a block. Does not interrupt producing blocks once block production has started.
Includes some misc performance improvements to
fork_database
.Currently does not include voting on non-validated blocks. Would like to add the voting change in #2159 or as a separate PR.
Resolves #2125