diff --git a/libraries/chain/controller.cpp b/libraries/chain/controller.cpp index 95fc5241d4..9093d19931 100644 --- a/libraries/chain/controller.cpp +++ b/libraries/chain/controller.cpp @@ -3324,7 +3324,7 @@ int64_t controller::set_proposed_producers( vector producers return version; } -void controller::create_pacemaker(std::set my_producers, std::map finalizer_keys, fc::logger& hotstuff_logger) { +void controller::create_pacemaker(std::set my_producers, hotstuff::bls_pub_priv_key_map_t finalizer_keys, fc::logger& hotstuff_logger) { EOS_ASSERT( !my->pacemaker, misc_exception, "duplicate chain_pacemaker initialization" ); my->pacemaker.emplace(this, std::move(my_producers), std::move(finalizer_keys), hotstuff_logger); } diff --git a/libraries/chain/include/eosio/chain/controller.hpp b/libraries/chain/include/eosio/chain/controller.hpp index e17c82b6d4..451b5ec3af 100644 --- a/libraries/chain/include/eosio/chain/controller.hpp +++ b/libraries/chain/include/eosio/chain/controller.hpp @@ -25,6 +25,7 @@ namespace eosio::hotstuff { struct hs_message; struct finalizer_state; enum class hs_message_warning; + using bls_pub_priv_key_map_t = std::map; } namespace eosio { namespace chain { @@ -302,7 +303,7 @@ namespace eosio { namespace chain { int64_t set_proposed_producers( vector producers ); - void create_pacemaker(std::set my_producers, std::map finalizer_keys, fc::logger& hotstuff_logger); + void create_pacemaker(std::set my_producers, hotstuff::bls_pub_priv_key_map_t finalizer_keys, fc::logger& hotstuff_logger); void register_pacemaker_bcast_function(std::function&, const hotstuff::hs_message&)> bcast_hs_message); void register_pacemaker_warn_function(std::function warn_hs_message); // called by host function set_finalizers diff --git a/libraries/hotstuff/chain_pacemaker.cpp b/libraries/hotstuff/chain_pacemaker.cpp index ad638808aa..1002a22718 100644 --- a/libraries/hotstuff/chain_pacemaker.cpp +++ b/libraries/hotstuff/chain_pacemaker.cpp @@ -104,7 +104,7 @@ namespace eosio { namespace hotstuff { #warning TODO get a data directory str passed into the chain_pacemaker ctor and use it to compose the absolute filepathname that is passed to qc_chain ctor chain_pacemaker::chain_pacemaker(controller* chain, std::set my_producers, - std::map finalizer_keys, + bls_pub_priv_key_map_t finalizer_keys, fc::logger& logger) : _chain(chain), _qc_chain("default", this, std::move(my_producers), std::move(finalizer_keys), logger, eosio::chain::config::safetydb_filename), diff --git a/libraries/hotstuff/include/eosio/hotstuff/chain_pacemaker.hpp b/libraries/hotstuff/include/eosio/hotstuff/chain_pacemaker.hpp index 18fbf003be..d1b82a27ac 100644 --- a/libraries/hotstuff/include/eosio/hotstuff/chain_pacemaker.hpp +++ b/libraries/hotstuff/include/eosio/hotstuff/chain_pacemaker.hpp @@ -20,7 +20,7 @@ namespace eosio::hotstuff { chain_pacemaker(controller* chain, std::set my_producers, - std::map finalizer_keys, + bls_pub_priv_key_map_t finalizer_keys, fc::logger& logger); void register_bcast_function(std::function&, const hs_message&)> broadcast_hs_message); void register_warn_function(std::function warning_hs_message); diff --git a/libraries/hotstuff/include/eosio/hotstuff/qc_chain.hpp b/libraries/hotstuff/include/eosio/hotstuff/qc_chain.hpp index 04afcd2ea8..473ba86575 100644 --- a/libraries/hotstuff/include/eosio/hotstuff/qc_chain.hpp +++ b/libraries/hotstuff/include/eosio/hotstuff/qc_chain.hpp @@ -144,6 +144,8 @@ namespace eosio::hotstuff { std::set finalizers; // finalizers that have voted on the proposal }; + using bls_pub_priv_key_map_t = std::map; + // Concurrency note: qc_chain is a single-threaded and lock-free decision engine. // All thread synchronization, if any, is external. class qc_chain { @@ -153,7 +155,7 @@ namespace eosio::hotstuff { qc_chain(std::string id, base_pacemaker* pacemaker, std::set my_producers, - std::map finalizer_keys, + bls_pub_priv_key_map_t finalizer_keys, fc::logger& logger, std::string safety_state_file); diff --git a/libraries/hotstuff/qc_chain.cpp b/libraries/hotstuff/qc_chain.cpp index 937c28310c..00bac1f853 100644 --- a/libraries/hotstuff/qc_chain.cpp +++ b/libraries/hotstuff/qc_chain.cpp @@ -165,7 +165,7 @@ namespace eosio::hotstuff { qc_chain::qc_chain(std::string id, base_pacemaker* pacemaker, std::set my_producers, - std::map finalizer_keys, + bls_pub_priv_key_map_t finalizer_keys, fc::logger& logger, std::string safety_state_file) : _pacemaker(pacemaker), diff --git a/libraries/hotstuff/test/test_hotstuff.cpp b/libraries/hotstuff/test/test_hotstuff.cpp index a6c2964cae..c66da253af 100644 --- a/libraries/hotstuff/test/test_hotstuff.cpp +++ b/libraries/hotstuff/test/test_hotstuff.cpp @@ -75,7 +75,7 @@ class hotstuff_test_handler { for (size_t i = 0 ; i < replicas.size() ; i++){ fc::crypto::blslib::bls_private_key sk = fc::crypto::blslib::bls_private_key(replica_keys[i]); - std::map keys{{sk.get_public_key().to_string(), sk.to_string()}}; + eosio::hotstuff::bls_pub_priv_key_map_t keys{{sk.get_public_key().to_string(), sk.to_string()}}; qc_chain *qcc_ptr = new qc_chain(replica_keys[i].to_string(), &tpm, {replicas[i]}, keys, hotstuff_logger, std::string()); std::shared_ptr qcc_shared_ptr(qcc_ptr); _qc_chains.push_back( std::make_pair(replicas[i], qcc_shared_ptr) ); diff --git a/plugins/producer_plugin/producer_plugin.cpp b/plugins/producer_plugin/producer_plugin.cpp index d52634c925..2927db7357 100644 --- a/plugins/producer_plugin/producer_plugin.cpp +++ b/plugins/producer_plugin/producer_plugin.cpp @@ -492,9 +492,9 @@ class producer_plugin_impl : public std::enable_shared_from_this _signature_providers; - std::map _finalizer_keys; // public, private - std::set _producers; - boost::asio::deadline_timer _timer; + hotstuff::bls_pub_priv_key_map_t _finalizer_keys; // public, private + std::set _producers; + boost::asio::deadline_timer _timer; block_timing_util::producer_watermarks _producer_watermarks; pending_block_mode _pending_block_mode = pending_block_mode::speculating; unapplied_transaction_queue _unapplied_transactions;