-
Notifications
You must be signed in to change notification settings - Fork 69
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: Add hs_irreversible_blocknum to block_header_state #1612
Conversation
Closing. Going to explore not storing in block_header_state. |
@@ -88,6 +88,9 @@ namespace eosio { namespace chain { | |||
|
|||
void mark_valid( const block_state_ptr& h ); | |||
|
|||
// Called by hotstuff to mark a fork branch irreversible | |||
void mark_irreversible( const block_id_type& id ); |
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.
Should this be named as `hs_mark_irreversible"?
"block state ${id} not in fork database; cannot mark as irreversible", ("id", id)); | ||
const bool at_root = (id == root->id); | ||
by_id_idx.modify(itr, [&id, lib](block_state_ptr& bsp) { | ||
bsp->hs_irreversible_blocknum.store(lib); |
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.
This method only updates s_irreversible_blocknum
. Should it be named as hs_mark_irreversible_impl?
@@ -329,6 +331,25 @@ namespace eosio { namespace chain { | |||
root = new_root; | |||
} | |||
|
|||
void fork_database_impl::mark_irreversible_impl( block_id_type id ) { |
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.
You can pass the parameter as const block_id_type&
const bool at_root = (id == root->id); | ||
by_id_idx.modify(itr, [&id, lib](block_state_ptr& bsp) { | ||
bsp->hs_irreversible_blocknum.store(lib); | ||
id = bsp->header.previous; |
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.
Don't reuse (reset) input parameter.
hs_irreversible_blocknum
toblock_header_state
to track hotstuff irreversible block number.fork_database
to use eitherhs_irreversible_blocknum
ordpos_irreversible_blocknum
for LIB.mark_irreversible
tofork_database
to be used bychain_pacemaker
to advance LIB which will then be used bycontroller
log_irreversible
to advance LIB.copyable_atomic
type for use byblock_header_state
hs_irreversible_blocknum
since it will be modified after theblock_state
is signaled and potentially accessed from other threads.fc::atomic_shared_ptr
andcopyable_atomic_shared_ptr
these may not actually be needed. But could be used if we wish to store activefinalizer_set
inblock_state
.Need to add tests for the
fork_database::mark_irreversible
but getting this PR up so it can be used by #1586