Skip to content

Commit

Permalink
GH-1523 Use alias for bls_key_map_t
Browse files Browse the repository at this point in the history
  • Loading branch information
heifner committed Sep 6, 2023
1 parent ef2f378 commit 01f462d
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions libraries/chain/include/eosio/chain/hotstuff.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
namespace eosio::chain {

using hs_bitset = boost::dynamic_bitset<uint32_t>;
using bls_key_map_t = std::map<fc::crypto::blslib::bls_public_key, fc::crypto::blslib::bls_private_key>;

inline uint64_t compute_height(uint32_t block_height, uint32_t phase_counter) {
return (uint64_t{block_height} << 32) | phase_counter;
Expand Down
2 changes: 1 addition & 1 deletion libraries/hotstuff/chain_pacemaker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ namespace eosio { namespace hotstuff {

chain_pacemaker::chain_pacemaker(controller* chain,
std::set<account_name> my_producers,
std::map<fc::crypto::blslib::bls_public_key, fc::crypto::blslib::bls_private_key> finalizer_keys,
bls_key_map_t finalizer_keys,
fc::logger& logger)
: _chain(chain),
_qc_chain("default"_n, this, std::move(my_producers), std::move(finalizer_keys), logger),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace eosio::hotstuff {

chain_pacemaker(controller* chain,
std::set<account_name> my_producers,
std::map<fc::crypto::blslib::bls_public_key, fc::crypto::blslib::bls_private_key> finalizer_keys,
chain::bls_key_map_t finalizer_keys,
fc::logger& logger);
void register_bcast_function(std::function<void(const chain::hs_message&)> broadcast_hs_message);

Expand Down
4 changes: 2 additions & 2 deletions libraries/hotstuff/include/eosio/hotstuff/qc_chain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ namespace eosio::hotstuff {

qc_chain(name id, base_pacemaker* pacemaker,
std::set<name> my_producers,
std::map<fc::crypto::blslib::bls_public_key, fc::crypto::blslib::bls_private_key> finalizer_keys,
chain::bls_key_map_t finalizer_keys,
fc::logger& logger);

uint64_t get_state_version() const { return _state_version; } // calling this w/ thread sync is optional
Expand Down Expand Up @@ -198,7 +198,7 @@ namespace eosio::hotstuff {
eosio::chain::extended_schedule _schedule;
base_pacemaker* _pacemaker = nullptr;
std::set<name> _my_producers;
std::map<fc::crypto::blslib::bls_public_key, fc::crypto::blslib::bls_private_key> _my_finalizer_keys;
chain::bls_key_map_t _my_finalizer_keys;
name _id;

mutable std::atomic<uint64_t> _state_version = 1;
Expand Down
2 changes: 1 addition & 1 deletion libraries/hotstuff/qc_chain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ namespace eosio::hotstuff {

qc_chain::qc_chain(name id, base_pacemaker* pacemaker,
std::set<name> my_producers,
std::map<fc::crypto::blslib::bls_public_key, fc::crypto::blslib::bls_private_key> finalizer_keys,
bls_key_map_t finalizer_keys,
fc::logger& logger)
: _pacemaker(pacemaker),
_my_producers(std::move(my_producers)),
Expand Down
2 changes: 1 addition & 1 deletion plugins/chain_plugin/chain_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1117,7 +1117,7 @@ void chain_plugin_impl::plugin_initialize(const variables_map& options) {
} FC_LOG_AND_RETHROW()
}

void chain_plugin::create_pacemaker(std::set<chain::account_name> my_producers, std::map<fc::crypto::blslib::bls_public_key, fc::crypto::blslib::bls_private_key> finalizer_keys) {
void chain_plugin::create_pacemaker(std::set<chain::account_name> my_producers, chain::bls_key_map_t finalizer_keys) {
EOS_ASSERT( !my->_chain_pacemaker, plugin_config_exception, "duplicate chain_pacemaker initialization" );
my->_chain_pacemaker.emplace(&chain(), std::move(my_producers), std::move(finalizer_keys), hotstuff_logger);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1031,7 +1031,7 @@ class chain_plugin : public plugin<chain_plugin> {
// Only call this after plugin_initialize()!
const controller& chain() const;

void create_pacemaker(std::set<chain::account_name> my_producers, std::map<fc::crypto::blslib::bls_public_key, fc::crypto::blslib::bls_private_key> finalizer_keys);
void create_pacemaker(std::set<chain::account_name> my_producers, chain::bls_key_map_t finalizer_keys);
void register_pacemaker_bcast_function(std::function<void(const chain::hs_message&)> bcast_hs_message);
void notify_hs_message( const chain::hs_message& msg );
void notify_hs_block_produced();
Expand Down
2 changes: 1 addition & 1 deletion plugins/producer_plugin/producer_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ class producer_plugin_impl : public std::enable_shared_from_this<producer_plugin

using signature_provider_type = signature_provider_plugin::signature_provider_type;
std::map<chain::public_key_type, signature_provider_type> _signature_providers;
std::map<fc::crypto::blslib::bls_public_key, fc::crypto::blslib::bls_private_key> _finalizer_keys;
bls_key_map_t _finalizer_keys;
std::set<chain::account_name> _producers;
boost::asio::deadline_timer _timer;
block_timing_util::producer_watermarks _producer_watermarks;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void signature_provider_plugin::set_program_options(options_description&, option
const char* const signature_provider_plugin::signature_provider_help_text() const {
return "Key=Value pairs in the form <public-key>=<provider-spec>\n"
"Where:\n"
" <public-key> \tis a string form of a vaild Antelope public key, including BLS finalizer key\n"
" <public-key> \tis a string form of a valid Antelope public key, including BLS finalizer key\n"
" <provider-spec> \tis a string in the form <provider-type>:<data>\n"
" <provider-type> \tis KEY, KEOSD, or SE\n"
" KEY:<data> \tis a string form of a valid Antelope private key which maps to the provided public key\n"
Expand Down

0 comments on commit 01f462d

Please sign in to comment.