-
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
set_finalizers host function (#1511) #1561
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
dcb04cb
set_finalizers host function (#1511)
fcecin e27c827
Fixes & get finalizer info to pacemaker
fcecin 5aaad89
Placeholder fix for bls_public_key operators
fcecin ee8eff1
controller::get_finalizer returns finalizer info
fcecin 1cc704b
Remove vector copy
fcecin 83183dd
Small fixes
fcecin c9fec69
Refactor finalizer_authority
fcecin 3b3f55a
Refactor finalizer_authority
fcecin 02841ab
Misc fixes
fcecin dba1f3a
GH-1541 Add thread safety to chain_pacemaker access of chain state
heifner cb8bc49
GH-1541 minor cleanup
heifner a7fc539
GH-1541 minor cleanup
heifner 7f4bcf8
GH-1541 make sure head_block_state is initialized
heifner 7447c15
GH-1541 make sure head_block_state is initialized
heifner 9b6fbdc
Merge pull request #1574 from AntelopeIO/GH-1541-threading-part-2
heifner 255e2b0
Merge remote-tracking branch 'origin/hotstuff_integration' into hotst…
heifner 8735839
Merge remote-tracking branch 'origin/hotstuff_integration' into hotst…
heifner 683750a
chain_pacemaker now created in startup.
heifner 36a60e1
Remove unneeded/unused shared versions
heifner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#pragma once | ||
|
||
#include <eosio/chain/config.hpp> | ||
#include <eosio/chain/types.hpp> | ||
#include <chainbase/chainbase.hpp> | ||
#include <eosio/chain/authority.hpp> | ||
#include <eosio/chain/snapshot.hpp> | ||
|
||
#include <fc/crypto/bls_public_key.hpp> | ||
|
||
namespace eosio::chain { | ||
|
||
struct finalizer_authority { | ||
|
||
std::string description; | ||
uint64_t fweight = 0; // weight that this finalizer's vote has for meeting fthreshold | ||
fc::crypto::blslib::bls_public_key public_key; | ||
|
||
friend bool operator == ( const finalizer_authority& lhs, const finalizer_authority& rhs ) { | ||
return tie( lhs.description, lhs.fweight, lhs.public_key ) == tie( rhs.description, rhs.fweight, rhs.public_key ); | ||
} | ||
friend bool operator != ( const finalizer_authority& lhs, const finalizer_authority& rhs ) { | ||
return !(lhs == rhs); | ||
} | ||
}; | ||
|
||
struct finalizer_set { | ||
finalizer_set() = default; | ||
|
||
finalizer_set( uint32_t version, uint64_t fthreshold, std::initializer_list<finalizer_authority> finalizers ) | ||
:version(version) | ||
,fthreshold(fthreshold) | ||
,finalizers(finalizers) | ||
{} | ||
|
||
uint32_t version = 0; ///< sequentially incrementing version number | ||
uint64_t fthreshold = 0; // vote fweight threshold to finalize blocks | ||
vector<finalizer_authority> finalizers; // Instant Finality voter set | ||
|
||
friend bool operator == ( const finalizer_set& a, const finalizer_set& b ) | ||
{ | ||
if( a.version != b.version ) return false; | ||
if( a.fthreshold != b.fthreshold ) return false; | ||
if ( a.finalizers.size() != b.finalizers.size() ) return false; | ||
for( uint32_t i = 0; i < a.finalizers.size(); ++i ) | ||
if( ! (a.finalizers[i] == b.finalizers[i]) ) return false; | ||
return true; | ||
} | ||
|
||
friend bool operator != ( const finalizer_set& a, const finalizer_set& b ) | ||
{ | ||
return !(a==b); | ||
} | ||
}; | ||
|
||
} /// eosio::chain | ||
|
||
FC_REFLECT( eosio::chain::finalizer_authority, (description)(fweight)(public_key) ) | ||
FC_REFLECT( eosio::chain::finalizer_set, (version)(fthreshold)(finalizers) ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
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.
@arhag ?