-
Notifications
You must be signed in to change notification settings - Fork 71
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
Hotstuff integration #1536
Hotstuff integration #1536
Conversation
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.
First quick pass complete. Detailed review next.
fc::variant("bc726a24928ea2d71ba294b70c5c9efc515c1542139bcf9e42f8bc174f2e72ff").as<digest_type>(), | ||
// SHA256 hash of the raw message below within the comment delimiters (do not modify message below). | ||
/* | ||
Builtin protocol feature: INSTANT_FINALITY |
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 some explanation about instant_finality like other protocol features do.
libraries/hotstuff/CMakeLists.txt
Outdated
|
||
add_library( hotstuff | ||
chain_pacemaker.cpp | ||
qc_chain.cpp |
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 am a little puzzled by chain
being a part of those two file names, and one having chain
in the front and the other in the end: chain_pacemake.cpp
and qc_chain.cpp
. Can the names be changed?
#include <iostream> | ||
|
||
// comment this out to remove the core profiler | ||
#define HS_CORE_PROFILER |
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.
Move HS_CORE_PROFILER
to CmakeList.txt to let cmake to control whether to profile or not.
if (! enabled()) | ||
return; | ||
|
||
csc prof("beat"); |
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.
For all those profiling statements, maybe each of them should be enclosed with ifdef
. Even though csc
is a dummy struct when HS_CORE_PROFILER is false, compiler will still generate some code. When read first, it appears profiling is always on. The downside of ifdef
s is the cluttering.
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.
Created #1542
|
||
namespace fc { namespace crypto { namespace blslib { | ||
|
||
/* struct recovery_visitor : fc::visitor<bls_public_key::storage_type> { |
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 be removed?
namespace fc { namespace crypto { namespace blslib { | ||
|
||
struct hash_visitor : public fc::visitor<size_t> { | ||
/* template<typename SigType> |
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.
remove?
results.current_qc = fs.current_qc; | ||
results.schedule = fs.schedule; | ||
for (auto proposal: fs.proposals) { | ||
chain::hs_proposal_message & p = proposal.second; |
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.
remove the space before &
.
@@ -147,6 +147,9 @@ enum return_codes { | |||
|
|||
int main(int argc, char** argv) | |||
{ | |||
|
|||
ilog("nodeos started"); |
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.
why this log? if we do, probably should be "nodeos starting".
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.
Can be safely removed
@@ -200,6 +203,7 @@ int main(int argc, char** argv) | |||
} catch( const node_management_success& e ) { | |||
return NODE_MANAGEMENT_SUCCESS; | |||
} catch( const fc::exception& e ) { | |||
|
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.
why new empty line?
|
||
struct extended_schedule { | ||
producer_authority_schedule producer_schedule; | ||
std::map<name, fc::crypto::blslib::bls_public_key> bls_pub_keys; |
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 the bls_pub_keys
be added in the producer_authority_schedule
instead of on the side like here?
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.
Extended schedule was a placeholder until we reached a decision on the final format of the finalizers set structure. I think we agreed to only keep the bls public key, as well as the threshold for finalizers (as far as the hotstuff algorithm is concerned). The name would be present in the structure as well, but serves only to identify the finalizer on-chain, and is not required by Hotstuff.
block_id_type block_id = NULL_BLOCK_ID; | ||
fc::sha256 parent_id = NULL_PROPOSAL_ID; //new proposal | ||
fc::sha256 final_on_qc = NULL_PROPOSAL_ID; | ||
quorum_certificate justify; //justification |
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.
All these = NULL_PROPOSAL_ID
are unneeded since the default construction of sha256 already initializes to all zeroes.
// | ||
mutable std::mutex _state_mutex; | ||
|
||
#ifdef QC_CHAIN_SIMPLE_PROPOSAL_STORE |
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.
Have we decided on a proposal store? Right now QC_CHAIN_SIMPLE_PROPOSAL_STORE
is not defined.
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.
uint32_t _v_height = 0; | ||
eosio::chain::extended_schedule _schedule; | ||
base_pacemaker* _pacemaker = nullptr; | ||
std::set<name> _my_producers; |
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.
Why is this a std::set
and not a std::vector
. As far as I can tell we never use any of the std::set
capabilities.
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.
Agree; there's no reason to sort or uniquify producer account names.
Note:start |
Note:start |
…d block_state_variant_t.
…finality_info_support
…ting temporary savanna block
…. Improve switch logging.
…ion_block IF: SHiP -- Provide finality_data for Transition blocks
… to terminate at a block don't put any blocks above that in the fork database.
IF: switch variant index of new `get_blocks_request_v1`
This reverts commit 914f218.
…gs all processed blocks
…-vote-processing
Increment `finalizer_policy`'s `generation` when `set_finalizers` is executed.
IF: Populated fork db ASAP; Vote processing off the main thread
Merge of hotstuff consensus integration branch to
main
.Suggested process for this PR:
hotstuff_integration
) branch.hotstuff_integration
branch; create PRs tohotstuff_integration
branch.main
to complete IF Prototype Stage 1A Implementation in Leap #1508.Resolves #1508