From 5d81bdd167f79b9f2338fb9bf84170e1e1d67e0e Mon Sep 17 00:00:00 2001 From: Kevin Heifner Date: Fri, 25 Aug 2023 07:35:42 -0500 Subject: [PATCH 1/5] GH-1519 Rm unused file --- .../eosio/producer_plugin/qc_chain.hpp.bkp | 70 ------------------- 1 file changed, 70 deletions(-) delete mode 100644 plugins/producer_plugin/include/eosio/producer_plugin/qc_chain.hpp.bkp diff --git a/plugins/producer_plugin/include/eosio/producer_plugin/qc_chain.hpp.bkp b/plugins/producer_plugin/include/eosio/producer_plugin/qc_chain.hpp.bkp deleted file mode 100644 index 8b177295cf..0000000000 --- a/plugins/producer_plugin/include/eosio/producer_plugin/qc_chain.hpp.bkp +++ /dev/null @@ -1,70 +0,0 @@ -#pragma once -#include -#include -#include - -namespace eosio { namespace chain { - - const uint32_t INTERUPT_TIMEOUT = 6; //sufficient timeout for new leader to be selected - - class qc_chain { - public: - - qc_chain( ){}; - ~qc_chain(){}; - - name get_proposer(); - name get_leader(); - name get_incoming_leader(); - - bool is_quorum_met(eosio::chain::quorum_certificate qc, extended_schedule schedule, hs_proposal_message proposal); - - std::vector get_finalizers(); - - hs_proposal_message new_proposal_candidate(block_id_type block_id, uint8_t phase_counter); - hs_new_block_message new_block_candidate(block_id_type block_id); - - void init(chain_plugin& chain_plug, std::set my_producers); - - block_header_state_ptr get_block_header( const block_id_type& id ); - - bool am_i_proposer(); - bool am_i_leader(); - bool am_i_finalizer(); - - void process_proposal(hs_proposal_message msg); - void process_vote(hs_vote_message msg); - void process_new_view(hs_new_view_message msg); - void process_new_block(hs_new_block_message msg); - - void broadcast_hs_proposal(hs_proposal_message msg); - void broadcast_hs_vote(hs_vote_message msg); - void broadcast_hs_new_view(hs_new_view_message msg); - void broadcast_hs_new_block(hs_new_block_message msg); - - bool extends(fc::sha256 descendant, fc::sha256 ancestor); - - void on_beat(block_state& hbs); - - void update_high_qc(eosio::chain::quorum_certificate high_qc); - - void on_leader_rotate(); - - bool is_node_safe(hs_proposal_message proposal); - - std::vector get_qc_chain(fc::sha256 proposal_id); - - void on_hs_vote_msg(hs_vote_message msg); //confirmation msg event handler - void on_hs_proposal_msg(hs_proposal_message msg); //consensus msg event handler - void on_hs_new_view_msg(hs_new_view_message msg); //new view msg event handler - void on_hs_new_block_msg(hs_new_block_message msg); //new block msg event handler - - void update(hs_proposal_message proposal); - void commit(hs_proposal_message proposal); - - void clear_old_data(uint64_t cutoff); - - std::mutex _hotstuff_state_mutex; - - }; -}} /// eosio::qc_chain \ No newline at end of file From 32e9243c7647a900284cb0a5a3192f8c96a820b8 Mon Sep 17 00:00:00 2001 From: Kevin Heifner Date: Fri, 25 Aug 2023 09:24:37 -0500 Subject: [PATCH 2/5] GH-1519 Remove hotstuff emit messages in controller. Simplify and optimize hotstuff message sending in net_plugin. --- libraries/chain/controller.cpp | 32 ---- .../chain/include/eosio/chain/controller.hpp | 29 ---- libraries/hotstuff/chain_pacemaker.cpp | 33 +++- .../eosio/hotstuff/chain_pacemaker.hpp | 10 ++ plugins/chain_plugin/chain_plugin.cpp | 25 ++- .../eosio/chain_plugin/chain_plugin.hpp | 8 +- .../include/eosio/net_plugin/net_plugin.hpp | 3 +- plugins/net_plugin/net_plugin.cpp | 153 +++++++----------- 8 files changed, 125 insertions(+), 168 deletions(-) diff --git a/libraries/chain/controller.cpp b/libraries/chain/controller.cpp index 037dc6de50..bad536b07a 100644 --- a/libraries/chain/controller.cpp +++ b/libraries/chain/controller.cpp @@ -1974,22 +1974,6 @@ struct controller_impl { pending->push(); } - void commit_hs_proposal_msg(hs_proposal_message_ptr msg){ - emit( self.new_hs_proposal_message, msg ); - } - - void commit_hs_vote_msg(hs_vote_message_ptr msg){ - emit( self.new_hs_vote_message, msg ); - } - - void commit_hs_new_view_msg(hs_new_view_message_ptr msg){ - emit( self.new_hs_new_view_message, msg ); - } - - void commit_hs_new_block_msg(hs_new_block_message_ptr msg){ - emit( self.new_hs_new_block_message, msg ); - } - /** * This method is called from other threads. The controller_impl should outlive those threads. * However, to avoid race conditions, it means that the behavior of this function should not change @@ -2983,22 +2967,6 @@ void controller::commit_block() { my->commit_block(block_status::incomplete); } -void controller::commit_hs_proposal_msg(hs_proposal_message_ptr msg) { - my->commit_hs_proposal_msg(msg); -} - -void controller::commit_hs_vote_msg(hs_vote_message_ptr msg) { - my->commit_hs_vote_msg(msg); -} - -void controller::commit_hs_new_view_msg(hs_new_view_message_ptr msg) { - my->commit_hs_new_view_msg(msg); -} - -void controller::commit_hs_new_block_msg(hs_new_block_message_ptr msg) { - my->commit_hs_new_block_msg(msg); -} - deque controller::abort_block() { return my->abort_block(); } diff --git a/libraries/chain/include/eosio/chain/controller.hpp b/libraries/chain/include/eosio/chain/controller.hpp index 934ed25dac..5f0da59768 100644 --- a/libraries/chain/include/eosio/chain/controller.hpp +++ b/libraries/chain/include/eosio/chain/controller.hpp @@ -21,15 +21,6 @@ namespace eosio { namespace vm { class wasm_allocator; }} namespace eosio { namespace chain { - struct hs_proposal_message; - struct hs_vote_message; - struct hs_new_view_message; - struct hs_new_block_message; - using hs_proposal_message_ptr = std::shared_ptr; - using hs_vote_message_ptr = std::shared_ptr; - using hs_new_view_message_ptr = std::shared_ptr; - using hs_new_block_message_ptr = std::shared_ptr; - class authorization_manager; namespace resource_limits { @@ -176,12 +167,6 @@ namespace eosio { namespace chain { void sign_block( const signer_callback_type& signer_callback ); void commit_block(); - void commit_hs_proposal_msg(hs_proposal_message_ptr msg); - void commit_hs_vote_msg(hs_vote_message_ptr msg); - - void commit_hs_new_view_msg(hs_new_view_message_ptr msg); - void commit_hs_new_block_msg(hs_new_block_message_ptr msg); - // thread-safe std::future create_block_state_future( const block_id_type& id, const signed_block_ptr& b ); // thread-safe @@ -352,20 +337,6 @@ namespace eosio { namespace chain { signal accepted_transaction; signal)> applied_transaction; signal bad_alloc; - signal new_hs_proposal_message; - signal new_hs_vote_message; - signal new_hs_new_view_message; - signal new_hs_new_block_message; - - /* - signal pre_apply_block; - signal post_apply_block; - signal abort_apply_block; - signal pre_apply_transaction; - signal post_apply_transaction; - signal pre_apply_action; - signal post_apply_action; - */ const apply_handler* find_apply_handler( account_name contract, scope_name scope, action_name act )const; wasm_interface_collection& get_wasm_interface(); diff --git a/libraries/hotstuff/chain_pacemaker.cpp b/libraries/hotstuff/chain_pacemaker.cpp index f5763150e9..e4d4c238e4 100644 --- a/libraries/hotstuff/chain_pacemaker.cpp +++ b/libraries/hotstuff/chain_pacemaker.cpp @@ -107,6 +107,23 @@ namespace eosio { namespace hotstuff { { } + void chain_pacemaker::register_bcast_functions( + std::function on_proposal_message, + std::function on_vote_message, + std::function on_new_block_message, + std::function on_new_view_message + ) { + FC_ASSERT(on_proposal_message, "on_proposal_message must be provided"); + FC_ASSERT(on_vote_message, "on_proposal_message must be provided"); + FC_ASSERT(on_new_block_message, "on_proposal_message must be provided"); + FC_ASSERT(on_new_view_message, "on_proposal_message must be provided"); + std::lock_guard g( _hotstuff_global_mutex ); // not actually needed but doesn't hurt + bcast_proposal_message = std::move(on_proposal_message); + bcast_vote_message = std::move(on_vote_message); + bcast_new_block_message = std::move(on_new_block_message); + bcast_new_view_message = std::move(on_new_view_message); + } + // Called internally by the chain_pacemaker to decide whether it should do something or not, based on feature activation. // Only methods called by the outside need to call this; methods called by qc_chain only don't need to check for enable(). bool chain_pacemaker::enabled() const { @@ -265,25 +282,22 @@ namespace eosio { namespace hotstuff { } void chain_pacemaker::send_hs_proposal_msg(const hs_proposal_message& msg, name id) { - hs_proposal_message_ptr msg_ptr = std::make_shared(msg); - _chain->commit_hs_proposal_msg(msg_ptr); + bcast_proposal_message(msg); } void chain_pacemaker::send_hs_vote_msg(const hs_vote_message& msg, name id) { - hs_vote_message_ptr msg_ptr = std::make_shared(msg); - _chain->commit_hs_vote_msg(msg_ptr); + bcast_vote_message(msg); } void chain_pacemaker::send_hs_new_block_msg(const hs_new_block_message& msg, name id) { - hs_new_block_message_ptr msg_ptr = std::make_shared(msg); - _chain->commit_hs_new_block_msg(msg_ptr); + bcast_new_block_message(msg); } void chain_pacemaker::send_hs_new_view_msg(const hs_new_view_message& msg, name id) { - hs_new_view_message_ptr msg_ptr = std::make_shared(msg); - _chain->commit_hs_new_view_msg(msg_ptr); + bcast_new_view_message(msg); } + // called from net threads void chain_pacemaker::on_hs_proposal_msg(const hs_proposal_message& msg) { if (! enabled()) return; @@ -295,6 +309,7 @@ namespace eosio { namespace hotstuff { prof.core_out(); } + // called from net threads void chain_pacemaker::on_hs_vote_msg(const hs_vote_message& msg) { if (! enabled()) return; @@ -306,6 +321,7 @@ namespace eosio { namespace hotstuff { prof.core_out(); } + // called from net threads void chain_pacemaker::on_hs_new_block_msg(const hs_new_block_message& msg) { if (! enabled()) return; @@ -317,6 +333,7 @@ namespace eosio { namespace hotstuff { prof.core_out(); } + // called from net threads void chain_pacemaker::on_hs_new_view_msg(const hs_new_view_message& msg) { if (! enabled()) return; diff --git a/libraries/hotstuff/include/eosio/hotstuff/chain_pacemaker.hpp b/libraries/hotstuff/include/eosio/hotstuff/chain_pacemaker.hpp index b61015d0a6..8730a1b206 100644 --- a/libraries/hotstuff/include/eosio/hotstuff/chain_pacemaker.hpp +++ b/libraries/hotstuff/include/eosio/hotstuff/chain_pacemaker.hpp @@ -17,6 +17,12 @@ namespace eosio::hotstuff { //class-specific functions chain_pacemaker(controller* chain, std::set my_producers, fc::logger& logger); + void register_bcast_functions( + std::function on_proposal_message, + std::function on_vote_message, + std::function on_new_block_message, + std::function on_new_view_message + ); void beat(); @@ -67,6 +73,10 @@ namespace eosio::hotstuff { chain::controller* _chain = nullptr; qc_chain _qc_chain; + std::function bcast_proposal_message; + std::function bcast_vote_message; + std::function bcast_new_block_message; + std::function bcast_new_view_message; uint32_t _quorum_threshold = 15; //FIXME/TODO: calculate from schedule fc::logger& _logger; diff --git a/plugins/chain_plugin/chain_plugin.cpp b/plugins/chain_plugin/chain_plugin.cpp index 404803ea8b..010408dd84 100644 --- a/plugins/chain_plugin/chain_plugin.cpp +++ b/plugins/chain_plugin/chain_plugin.cpp @@ -1119,6 +1119,20 @@ void chain_plugin::create_pacemaker(std::set my_producers) my->_chain_pacemaker.emplace(&chain(), std::move(my_producers), hotstuff_logger); } +void chain_plugin::register_pacemaker_bcast_functions( + std::function on_proposal_message, + std::function on_vote_message, + std::function on_new_block_message, + std::function on_new_view_message) { + EOS_ASSERT( my->_chain_pacemaker, plugin_config_exception, "chain_pacemaker not created" ); + my->_chain_pacemaker->register_bcast_functions( + std::move(on_proposal_message), + std::move(on_vote_message), + std::move(on_new_block_message), + std::move(on_new_view_message)); +} + + void chain_plugin::plugin_initialize(const variables_map& options) { handle_sighup(); // Sets loggers my->plugin_initialize(options); @@ -2651,7 +2665,7 @@ read_only::get_finalizer_state_results read_only::get_finalizer_state(const get_finalizer_state_params&, const fc::time_point& deadline ) const { get_finalizer_state_results results; - if ( chain_pacemaker ) { // producer_plug is null when called from chain_plugin_tests.cpp and get_table_tests.cpp + if ( chain_pacemaker ) { // is null when called from chain_plugin_tests.cpp and get_table_tests.cpp finalizer_state fs; chain_pacemaker->get_state( fs ); results.chained_mode = fs.chained_mode; @@ -2665,8 +2679,9 @@ read_only::get_finalizer_state(const get_finalizer_state_params&, const fc::time results.high_qc = fs.high_qc; results.current_qc = fs.current_qc; results.schedule = fs.schedule; - for (auto proposal: fs.proposals) { - chain::hs_proposal_message & p = proposal.second; + results.proposals.reserve( fs.proposals.size() ); + for (const auto& proposal : fs.proposals) { + const chain::hs_proposal_message& p = proposal.second; results.proposals.push_back( hs_complete_proposal_message( p ) ); } } @@ -2675,18 +2690,22 @@ read_only::get_finalizer_state(const get_finalizer_state_params&, const fc::time } // namespace chain_apis +// called from net threads void chain_plugin::notify_hs_vote_message( const hs_vote_message& msg ) { my->_chain_pacemaker->on_hs_vote_msg(msg); }; +// called from net threads void chain_plugin::notify_hs_proposal_message( const hs_proposal_message& msg ) { my->_chain_pacemaker->on_hs_proposal_msg(msg); }; +// called from net threads void chain_plugin::notify_hs_new_view_message( const hs_new_view_message& msg ) { my->_chain_pacemaker->on_hs_new_view_msg(msg); }; +// called from net threads void chain_plugin::notify_hs_new_block_message( const hs_new_block_message& msg ) { my->_chain_pacemaker->on_hs_new_block_msg(msg); }; diff --git a/plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp b/plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp index c9a9feb6dd..1e3bffb831 100644 --- a/plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp +++ b/plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp @@ -843,7 +843,7 @@ class read_only : public api_base { uint8_t phase_counter = 0; uint32_t block_height = 0; uint64_t view_number = 0; - explicit hs_complete_proposal_message( const chain::hs_proposal_message & p ) { + explicit hs_complete_proposal_message( const chain::hs_proposal_message& p ) { proposal_id = p.proposal_id; block_id = p.block_id; parent_id = p.parent_id; @@ -1032,6 +1032,12 @@ class chain_plugin : public plugin { const controller& chain() const; void create_pacemaker(std::set my_producers); + void register_pacemaker_bcast_functions( + std::function on_proposal_message, + std::function on_vote_message, + std::function on_new_block_message, + std::function on_new_view_message + ); void notify_hs_vote_message( const chain::hs_vote_message& msg ); void notify_hs_proposal_message( const chain::hs_proposal_message& msg ); void notify_hs_new_view_message( const chain::hs_new_view_message& msg ); diff --git a/plugins/net_plugin/include/eosio/net_plugin/net_plugin.hpp b/plugins/net_plugin/include/eosio/net_plugin/net_plugin.hpp index d0c482e5b1..c18fb4e12c 100644 --- a/plugins/net_plugin/include/eosio/net_plugin/net_plugin.hpp +++ b/plugins/net_plugin/include/eosio/net_plugin/net_plugin.hpp @@ -3,6 +3,7 @@ #include #include #include +#include namespace eosio { using namespace appbase; @@ -26,7 +27,7 @@ namespace eosio { net_plugin(); virtual ~net_plugin(); - APPBASE_PLUGIN_REQUIRES((chain_plugin)) + APPBASE_PLUGIN_REQUIRES((chain_plugin)(producer_plugin)) virtual void set_program_options(options_description& cli, options_description& cfg) override; void handle_sighup() override; diff --git a/plugins/net_plugin/net_plugin.cpp b/plugins/net_plugin/net_plugin.cpp index 42167d89a9..68621f32e2 100644 --- a/plugins/net_plugin/net_plugin.cpp +++ b/plugins/net_plugin/net_plugin.cpp @@ -78,6 +78,7 @@ namespace eosio { using connection_ptr = std::shared_ptr; using connection_wptr = std::weak_ptr; + using send_buffer_type = std::shared_ptr>; static constexpr int64_t block_interval_ns = std::chrono::duration_cast(std::chrono::milliseconds(config::block_interval_ms)).count(); @@ -300,10 +301,7 @@ namespace eosio { bool have_txn( const transaction_id_type& tid ) const; void expire_txns(); - void bcast_hs_proposal_msg(const hs_proposal_message_ptr& msg); - void bcast_hs_vote_msg(const hs_vote_message_ptr& msg); - void bcast_hs_new_view_msg(const hs_new_view_message_ptr& msg); - void bcast_hs_new_block_msg(const hs_new_block_message_ptr& msg); + void bcast_msg( send_buffer_type msg ); void add_unlinkable_block( signed_block_ptr b, const block_id_type& id ) { std::optional rm_blk_id = unlinkable_block_cache.add_unlinkable_block(std::move(b), id); @@ -497,10 +495,10 @@ namespace eosio { void transaction_ack(const std::pair&); void on_irreversible_block( const block_state_ptr& block ); - void on_hs_proposal_message( const hs_proposal_message_ptr& msg ); - void on_hs_vote_message( const hs_vote_message_ptr& msg ); - void on_hs_new_view_message( const hs_new_view_message_ptr& msg ); - void on_hs_new_block_message( const hs_new_block_message_ptr& msg ); + void on_hs_proposal_message( const hs_proposal_message& msg ); + void on_hs_vote_message( const hs_vote_message& msg ); + void on_hs_new_view_message( const hs_new_view_message& msg ); + void on_hs_new_block_message( const hs_new_block_message& msg ); void start_conn_timer(boost::asio::steady_timer::duration du, std::weak_ptr from_connection); void start_expire_timer(); @@ -1715,8 +1713,6 @@ namespace eosio { //------------------------------------------------------------------------ - using send_buffer_type = std::shared_ptr>; - struct buffer_factory { /// caches result for subsequent calls, only provide same net_message instance for each invocation @@ -1817,7 +1813,7 @@ namespace eosio { } buffer_factory buff_factory; - auto send_buffer = buff_factory.get_send_buffer( m ); + const auto& send_buffer = buff_factory.get_send_buffer( m ); enqueue_buffer( send_buffer, close_after_send ); } @@ -1827,7 +1823,7 @@ namespace eosio { verify_strand_in_this_thread( strand, __func__, __LINE__ ); block_buffer_factory buff_factory; - auto sb = buff_factory.get_send_buffer( b ); + const auto& sb = buff_factory.get_send_buffer( b ); latest_blk_time = std::chrono::system_clock::now(); enqueue_buffer( sb, no_reason, to_sync_queue); } @@ -2560,53 +2556,12 @@ namespace eosio { } ); } - void dispatch_manager::bcast_hs_proposal_msg(const hs_proposal_message_ptr& msg) { - if( my_impl->sync_master->syncing_from_peer() ) return; - hs_proposal_message& msg_val = *(msg.get()); - my_impl->connections.for_each_block_connection( [&msg_val]( auto& cp ) { - if( !cp->current() ) return true; - cp->strand.post( [cp, msg_val]() { - if (cp->protocol_version >= proto_instant_finality) - cp->enqueue( msg_val ); - }); - return true; - } ); - } - - void dispatch_manager::bcast_hs_vote_msg(const hs_vote_message_ptr& msg) { - if( my_impl->sync_master->syncing_from_peer() ) return; - hs_vote_message& msg_val = *(msg.get()); - my_impl->connections.for_each_block_connection( [&msg_val]( auto& cp ) { - if( !cp->current() ) return true; - cp->strand.post( [cp, msg_val]() { - if (cp->protocol_version >= proto_instant_finality) - cp->enqueue( msg_val ); - }); - return true; - } ); - } - - void dispatch_manager::bcast_hs_new_block_msg(const hs_new_block_message_ptr& msg) { - if( my_impl->sync_master->syncing_from_peer() ) return; - hs_new_block_message& msg_val = *(msg.get()); - my_impl->connections.for_each_block_connection( [&msg_val]( auto& cp ) { - if( !cp->current() ) return true; - cp->strand.post( [cp, msg_val]() { - if (cp->protocol_version >= proto_instant_finality) - cp->enqueue( msg_val ); - }); - return true; - } ); - } - - void dispatch_manager::bcast_hs_new_view_msg(const hs_new_view_message_ptr& msg) { - if( my_impl->sync_master->syncing_from_peer() ) return; - hs_new_view_message& msg_val = *(msg.get()); - my_impl->connections.for_each_block_connection( [&msg_val]( auto& cp ) { + void dispatch_manager::bcast_msg( send_buffer_type msg ) { + my_impl->connections.for_each_block_connection( [msg{std::move(msg)}]( auto& cp ) { if( !cp->current() ) return true; - cp->strand.post( [cp, msg_val]() { + cp->strand.post( [cp, msg]() { if (cp->protocol_version >= proto_instant_finality) - cp->enqueue( msg_val ); + cp->enqueue_buffer( msg, no_reason ); }); return true; } ); @@ -3632,18 +3587,22 @@ namespace eosio { } void connection::handle_message( const hs_vote_message& msg ) { + peer_dlog(this, "received vote: ${msg}", ("msg", msg)); my_impl->chain_plug->notify_hs_vote_message(msg); } void connection::handle_message( const hs_proposal_message& msg ) { + peer_dlog(this, "received proposal: ${msg}", ("msg", msg)); my_impl->chain_plug->notify_hs_proposal_message(msg); } void connection::handle_message( const hs_new_view_message& msg ) { + peer_dlog(this, "received new view: ${msg}", ("msg", msg)); my_impl->chain_plug->notify_hs_new_view_message(msg); } void connection::handle_message( const hs_new_block_message& msg ) { + peer_dlog(this, "received new block msg: ${msg}", ("msg", msg)); my_impl->chain_plug->notify_hs_new_block_message(msg); } @@ -3898,44 +3857,48 @@ namespace eosio { on_active_schedule(chain_plug->chain().active_producers()); } - // called from application thread - void net_plugin_impl::on_hs_proposal_message( const hs_proposal_message_ptr& msg ){ - //ilog("network plugin received consensus message from application"); + void net_plugin_impl::on_hs_proposal_message( const hs_proposal_message& msg ) { + fc_dlog(logger, "sending proposal msg: ${msg}", ("msg", msg)); - dispatcher->strand.post( [this, msg]() { - dispatcher->bcast_hs_proposal_msg( msg ); - }); + buffer_factory buff_factory; + auto send_buffer = buff_factory.get_send_buffer( msg ); + dispatcher->strand.post( [this, msg{std::move(send_buffer)}]() mutable { + dispatcher->bcast_msg( std::move(msg) ); + }); } - // called from application thread - void net_plugin_impl::on_hs_vote_message( const hs_vote_message_ptr& msg ){ - //ilog("network plugin received confirmation message from application"); + void net_plugin_impl::on_hs_vote_message( const hs_vote_message& msg ) { + fc_dlog(logger, "sending vote msg: ${msg}", ("msg", msg)); - dispatcher->strand.post( [this, msg]() { - dispatcher->bcast_hs_vote_msg( msg ); - }); + buffer_factory buff_factory; + auto send_buffer = buff_factory.get_send_buffer( msg ); + dispatcher->strand.post( [this, msg{std::move(send_buffer)}]() mutable { + dispatcher->bcast_msg( std::move(msg) ); + }); } - // called from application thread - void net_plugin_impl::on_hs_new_view_message( const hs_new_view_message_ptr& msg ){ - //ilog("network plugin received new_view message from application"); + void net_plugin_impl::on_hs_new_view_message( const hs_new_view_message& msg ) { + fc_dlog(logger, "sending new_view msg: ${msg}", ("msg", msg)); - dispatcher->strand.post( [this, msg]() { - dispatcher->bcast_hs_new_view_msg( msg ); - }); + buffer_factory buff_factory; + auto send_buffer = buff_factory.get_send_buffer( msg ); + dispatcher->strand.post( [this, msg{std::move(send_buffer)}]() mutable { + dispatcher->bcast_msg( std::move(msg) ); + }); } - // called from application thread - void net_plugin_impl::on_hs_new_block_message( const hs_new_block_message_ptr& msg ){ - //ilog("network plugin received new_block message from application"); + void net_plugin_impl::on_hs_new_block_message( const hs_new_block_message& msg ) { + fc_dlog(logger, "sending new_block msg: ${msg}", ("msg", msg)); - dispatcher->strand.post( [this, msg]() { - dispatcher->bcast_hs_new_block_msg( msg ); - }); + buffer_factory buff_factory; + auto send_buffer = buff_factory.get_send_buffer( msg ); + dispatcher->strand.post( [this, msg{std::move(send_buffer)}]() mutable { + dispatcher->bcast_msg( std::move(msg) ); + }); } // called from application thread @@ -4262,6 +4225,21 @@ namespace eosio { chain_plug->enable_accept_transactions(); } + chain_plug->register_pacemaker_bcast_functions( + [my = shared_from_this()](const hs_proposal_message& s) { + my->on_hs_proposal_message(s); + }, + [my = shared_from_this()](const hs_vote_message& s) { + my->on_hs_vote_message(s); + }, + [my = shared_from_this()](const hs_new_block_message& s) { + my->on_hs_new_block_message(s); + }, + [my = shared_from_this()](const hs_new_view_message& s) { + my->on_hs_new_view_message(s); + } ); + + } FC_LOG_AND_RETHROW() } @@ -4322,19 +4300,6 @@ namespace eosio { my->on_irreversible_block( s ); } ); - cc.new_hs_proposal_message.connect( [my = shared_from_this()]( const hs_proposal_message_ptr& s ) { - my->on_hs_proposal_message( s ); - } ); - cc.new_hs_vote_message.connect( [my = shared_from_this()]( const hs_vote_message_ptr& s ) { - my->on_hs_vote_message( s ); - } ); - cc.new_hs_new_view_message.connect( [my = shared_from_this()]( const hs_new_view_message_ptr& s ) { - my->on_hs_new_view_message( s ); - } ); - cc.new_hs_new_block_message.connect( [my = shared_from_this()]( const hs_new_block_message_ptr& s ) { - my->on_hs_new_block_message( s ); - } ); - } { From 6af3110504745e4fec95e1c286a5ae8cbb056ac2 Mon Sep 17 00:00:00 2001 From: Kevin Heifner Date: Mon, 28 Aug 2023 11:55:50 -0500 Subject: [PATCH 3/5] GH-1519 Use a std::variant for hotstuff messages --- .../chain/include/eosio/chain/hotstuff.hpp | 2 + libraries/hotstuff/chain_pacemaker.cpp | 34 +++--- .../eosio/hotstuff/chain_pacemaker.hpp | 22 ++-- plugins/chain_plugin/chain_plugin.cpp | 31 +----- .../eosio/chain_plugin/chain_plugin.hpp | 12 +- .../include/eosio/net_plugin/protocol.hpp | 5 +- plugins/net_plugin/net_plugin.cpp | 105 ++---------------- 7 files changed, 44 insertions(+), 167 deletions(-) diff --git a/libraries/chain/include/eosio/chain/hotstuff.hpp b/libraries/chain/include/eosio/chain/hotstuff.hpp index e51d6968fb..962b6e06a5 100644 --- a/libraries/chain/include/eosio/chain/hotstuff.hpp +++ b/libraries/chain/include/eosio/chain/hotstuff.hpp @@ -54,6 +54,8 @@ namespace eosio::chain { quorum_certificate high_qc; //justification }; + using hs_message = std::variant; + struct finalizer_state { bool chained_mode = false; diff --git a/libraries/hotstuff/chain_pacemaker.cpp b/libraries/hotstuff/chain_pacemaker.cpp index e4d4c238e4..54a665e1a1 100644 --- a/libraries/hotstuff/chain_pacemaker.cpp +++ b/libraries/hotstuff/chain_pacemaker.cpp @@ -107,21 +107,10 @@ namespace eosio { namespace hotstuff { { } - void chain_pacemaker::register_bcast_functions( - std::function on_proposal_message, - std::function on_vote_message, - std::function on_new_block_message, - std::function on_new_view_message - ) { - FC_ASSERT(on_proposal_message, "on_proposal_message must be provided"); - FC_ASSERT(on_vote_message, "on_proposal_message must be provided"); - FC_ASSERT(on_new_block_message, "on_proposal_message must be provided"); - FC_ASSERT(on_new_view_message, "on_proposal_message must be provided"); + void chain_pacemaker::register_bcast_function(std::function on_hs_message) { + FC_ASSERT(on_hs_message, "on_hs_message must be provided"); std::lock_guard g( _hotstuff_global_mutex ); // not actually needed but doesn't hurt - bcast_proposal_message = std::move(on_proposal_message); - bcast_vote_message = std::move(on_vote_message); - bcast_new_block_message = std::move(on_new_block_message); - bcast_new_view_message = std::move(on_new_view_message); + bcast_hs_message = std::move(on_hs_message); } // Called internally by the chain_pacemaker to decide whether it should do something or not, based on feature activation. @@ -282,19 +271,28 @@ namespace eosio { namespace hotstuff { } void chain_pacemaker::send_hs_proposal_msg(const hs_proposal_message& msg, name id) { - bcast_proposal_message(msg); + bcast_hs_message(msg); } void chain_pacemaker::send_hs_vote_msg(const hs_vote_message& msg, name id) { - bcast_vote_message(msg); + bcast_hs_message(msg); } void chain_pacemaker::send_hs_new_block_msg(const hs_new_block_message& msg, name id) { - bcast_new_block_message(msg); + bcast_hs_message(msg); } void chain_pacemaker::send_hs_new_view_msg(const hs_new_view_message& msg, name id) { - bcast_new_view_message(msg); + bcast_hs_message(msg); + } + + void chain_pacemaker::on_hs_msg(const eosio::chain::hs_message &msg) { + std::visit(overloaded{ + [this](const hs_vote_message& m) { on_hs_vote_msg(m); }, + [this](const hs_proposal_message& m) { on_hs_proposal_msg(m); }, + [this](const hs_new_block_message& m) { on_hs_new_block_msg(m); }, + [this](const hs_new_view_message& m) { on_hs_new_view_msg(m); }, + }, msg); } // called from net threads diff --git a/libraries/hotstuff/include/eosio/hotstuff/chain_pacemaker.hpp b/libraries/hotstuff/include/eosio/hotstuff/chain_pacemaker.hpp index 8730a1b206..b0791ecedc 100644 --- a/libraries/hotstuff/include/eosio/hotstuff/chain_pacemaker.hpp +++ b/libraries/hotstuff/include/eosio/hotstuff/chain_pacemaker.hpp @@ -17,19 +17,11 @@ namespace eosio::hotstuff { //class-specific functions chain_pacemaker(controller* chain, std::set my_producers, fc::logger& logger); - void register_bcast_functions( - std::function on_proposal_message, - std::function on_vote_message, - std::function on_new_block_message, - std::function on_new_view_message - ); + void register_bcast_function(std::function on_hs_message); void beat(); - void on_hs_proposal_msg(const hs_proposal_message& msg); //consensus msg event handler - void on_hs_vote_msg(const hs_vote_message& msg); //confirmation msg event handler - void on_hs_new_view_msg(const hs_new_view_message& msg); //new view msg event handler - void on_hs_new_block_msg(const hs_new_block_message& msg); //new block msg event handler + void on_hs_msg(const hs_message& msg); void get_state(finalizer_state& fs) const; @@ -57,6 +49,11 @@ namespace eosio::hotstuff { // Check if consensus upgrade feature is activated bool enabled() const; + void on_hs_proposal_msg(const hs_proposal_message& msg); //consensus msg event handler + void on_hs_vote_msg(const hs_vote_message& msg); //confirmation msg event handler + void on_hs_new_view_msg(const hs_new_view_message& msg); //new view msg event handler + void on_hs_new_block_msg(const hs_new_block_message& msg); //new block msg event handler + // This serializes all messages (high-level requests) to the qc_chain core. // For maximum safety, the qc_chain core will only process one request at a time. // These requests can come directly from the net threads, or indirectly from a @@ -73,10 +70,7 @@ namespace eosio::hotstuff { chain::controller* _chain = nullptr; qc_chain _qc_chain; - std::function bcast_proposal_message; - std::function bcast_vote_message; - std::function bcast_new_block_message; - std::function bcast_new_view_message; + std::function bcast_hs_message; uint32_t _quorum_threshold = 15; //FIXME/TODO: calculate from schedule fc::logger& _logger; diff --git a/plugins/chain_plugin/chain_plugin.cpp b/plugins/chain_plugin/chain_plugin.cpp index 010408dd84..517d4fb67c 100644 --- a/plugins/chain_plugin/chain_plugin.cpp +++ b/plugins/chain_plugin/chain_plugin.cpp @@ -1119,17 +1119,9 @@ void chain_plugin::create_pacemaker(std::set my_producers) my->_chain_pacemaker.emplace(&chain(), std::move(my_producers), hotstuff_logger); } -void chain_plugin::register_pacemaker_bcast_functions( - std::function on_proposal_message, - std::function on_vote_message, - std::function on_new_block_message, - std::function on_new_view_message) { +void chain_plugin::register_pacemaker_bcast_function(std::function on_hs_message) { EOS_ASSERT( my->_chain_pacemaker, plugin_config_exception, "chain_pacemaker not created" ); - my->_chain_pacemaker->register_bcast_functions( - std::move(on_proposal_message), - std::move(on_vote_message), - std::move(on_new_block_message), - std::move(on_new_view_message)); + my->_chain_pacemaker->register_bcast_function(std::move(on_hs_message)); } @@ -2691,23 +2683,8 @@ read_only::get_finalizer_state(const get_finalizer_state_params&, const fc::time } // namespace chain_apis // called from net threads -void chain_plugin::notify_hs_vote_message( const hs_vote_message& msg ) { - my->_chain_pacemaker->on_hs_vote_msg(msg); -}; - -// called from net threads -void chain_plugin::notify_hs_proposal_message( const hs_proposal_message& msg ) { - my->_chain_pacemaker->on_hs_proposal_msg(msg); -}; - -// called from net threads -void chain_plugin::notify_hs_new_view_message( const hs_new_view_message& msg ) { - my->_chain_pacemaker->on_hs_new_view_msg(msg); -}; - -// called from net threads -void chain_plugin::notify_hs_new_block_message( const hs_new_block_message& msg ) { - my->_chain_pacemaker->on_hs_new_block_msg(msg); +void chain_plugin::notify_hs_message( const hs_message& msg ) { + my->_chain_pacemaker->on_hs_msg(msg); }; void chain_plugin::notify_hs_block_produced() { diff --git a/plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp b/plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp index 1e3bffb831..bcdb27fc0b 100644 --- a/plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp +++ b/plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp @@ -1032,16 +1032,8 @@ class chain_plugin : public plugin { const controller& chain() const; void create_pacemaker(std::set my_producers); - void register_pacemaker_bcast_functions( - std::function on_proposal_message, - std::function on_vote_message, - std::function on_new_block_message, - std::function on_new_view_message - ); - void notify_hs_vote_message( const chain::hs_vote_message& msg ); - void notify_hs_proposal_message( const chain::hs_proposal_message& msg ); - void notify_hs_new_view_message( const chain::hs_new_view_message& msg ); - void notify_hs_new_block_message( const chain::hs_new_block_message& msg ); + void register_pacemaker_bcast_function(std::function on_hs_message); + void notify_hs_message( const chain::hs_message& msg ); void notify_hs_block_produced(); chain::chain_id_type get_chain_id() const; diff --git a/plugins/net_plugin/include/eosio/net_plugin/protocol.hpp b/plugins/net_plugin/include/eosio/net_plugin/protocol.hpp index f291596bac..811885768a 100644 --- a/plugins/net_plugin/include/eosio/net_plugin/protocol.hpp +++ b/plugins/net_plugin/include/eosio/net_plugin/protocol.hpp @@ -142,10 +142,7 @@ namespace eosio { sync_request_message, signed_block, packed_transaction, - hs_vote_message, - hs_proposal_message, - hs_new_view_message, - hs_new_block_message>; + hs_message>; } // namespace eosio diff --git a/plugins/net_plugin/net_plugin.cpp b/plugins/net_plugin/net_plugin.cpp index 68621f32e2..2fe5e275c8 100644 --- a/plugins/net_plugin/net_plugin.cpp +++ b/plugins/net_plugin/net_plugin.cpp @@ -495,10 +495,7 @@ namespace eosio { void transaction_ack(const std::pair&); void on_irreversible_block( const block_state_ptr& block ); - void on_hs_proposal_message( const hs_proposal_message& msg ); - void on_hs_vote_message( const hs_vote_message& msg ); - void on_hs_new_view_message( const hs_new_view_message& msg ); - void on_hs_new_block_message( const hs_new_block_message& msg ); + void on_hs_message( const hs_message& msg ); void start_conn_timer(boost::asio::steady_timer::duration du, std::weak_ptr from_connection); void start_expire_timer(); @@ -1038,15 +1035,11 @@ namespace eosio { void handle_message( const block_id_type& id, signed_block_ptr ptr ); void handle_message( const packed_transaction& msg ) = delete; // packed_transaction_ptr overload used instead void handle_message( packed_transaction_ptr trx ); + void handle_message( const hs_message& msg ); // returns calculated number of blocks combined latency uint32_t calc_block_latency(); - void handle_message( const hs_vote_message& msg ); - void handle_message( const hs_proposal_message& msg ); - void handle_message( const hs_new_view_message& msg ); - void handle_message( const hs_new_block_message& msg ); - void process_signed_block( const block_id_type& id, signed_block_ptr block, block_state_ptr bsp ); fc::variant_object get_logger_variant() const { @@ -1124,30 +1117,12 @@ namespace eosio { c->handle_message( msg ); } - void operator()( const hs_vote_message& msg ) const { + void operator()( const hs_message& msg ) const { // continue call to handle_message on connection strand peer_dlog( c, "handle hs_vote_message" ); c->handle_message( msg ); } - void operator()( const hs_proposal_message& msg ) const { - // continue call to handle_message on connection strand - peer_dlog( c, "handle hs_proposal_message" ); - c->handle_message( msg ); - } - void operator()( const hs_new_view_message& msg ) const { - // continue call to handle_message on connection strand - peer_dlog( c, "handle hs_new_view_message" ); - c->handle_message( msg ); - } - void operator()( const hs_new_block_message& msg ) const { - // continue call to handle_message on connection strand - peer_dlog( c, "handle hs_new_block_message" ); - c->handle_message( msg ); - } - - }; - std::tuple split_host_port_type(const std::string& peer_add) { @@ -3586,24 +3561,9 @@ namespace eosio { } } - void connection::handle_message( const hs_vote_message& msg ) { - peer_dlog(this, "received vote: ${msg}", ("msg", msg)); - my_impl->chain_plug->notify_hs_vote_message(msg); - } - - void connection::handle_message( const hs_proposal_message& msg ) { - peer_dlog(this, "received proposal: ${msg}", ("msg", msg)); - my_impl->chain_plug->notify_hs_proposal_message(msg); - } - - void connection::handle_message( const hs_new_view_message& msg ) { - peer_dlog(this, "received new view: ${msg}", ("msg", msg)); - my_impl->chain_plug->notify_hs_new_view_message(msg); - } - - void connection::handle_message( const hs_new_block_message& msg ) { - peer_dlog(this, "received new block msg: ${msg}", ("msg", msg)); - my_impl->chain_plug->notify_hs_new_block_message(msg); + void connection::handle_message( const hs_message& msg ) { + peer_dlog(this, "received hs: ${msg}", ("msg", msg)); + my_impl->chain_plug->notify_hs_message(msg); } size_t calc_trx_size( const packed_transaction_ptr& trx ) { @@ -3857,41 +3817,8 @@ namespace eosio { on_active_schedule(chain_plug->chain().active_producers()); } - void net_plugin_impl::on_hs_proposal_message( const hs_proposal_message& msg ) { - fc_dlog(logger, "sending proposal msg: ${msg}", ("msg", msg)); - - buffer_factory buff_factory; - auto send_buffer = buff_factory.get_send_buffer( msg ); - - dispatcher->strand.post( [this, msg{std::move(send_buffer)}]() mutable { - dispatcher->bcast_msg( std::move(msg) ); - }); - } - - void net_plugin_impl::on_hs_vote_message( const hs_vote_message& msg ) { - fc_dlog(logger, "sending vote msg: ${msg}", ("msg", msg)); - - buffer_factory buff_factory; - auto send_buffer = buff_factory.get_send_buffer( msg ); - - dispatcher->strand.post( [this, msg{std::move(send_buffer)}]() mutable { - dispatcher->bcast_msg( std::move(msg) ); - }); - } - - void net_plugin_impl::on_hs_new_view_message( const hs_new_view_message& msg ) { - fc_dlog(logger, "sending new_view msg: ${msg}", ("msg", msg)); - - buffer_factory buff_factory; - auto send_buffer = buff_factory.get_send_buffer( msg ); - - dispatcher->strand.post( [this, msg{std::move(send_buffer)}]() mutable { - dispatcher->bcast_msg( std::move(msg) ); - }); - } - - void net_plugin_impl::on_hs_new_block_message( const hs_new_block_message& msg ) { - fc_dlog(logger, "sending new_block msg: ${msg}", ("msg", msg)); + void net_plugin_impl::on_hs_message( const hs_message& msg ) { + fc_dlog(logger, "sending hs msg: ${msg}", ("msg", msg)); buffer_factory buff_factory; auto send_buffer = buff_factory.get_send_buffer( msg ); @@ -4225,21 +4152,11 @@ namespace eosio { chain_plug->enable_accept_transactions(); } - chain_plug->register_pacemaker_bcast_functions( - [my = shared_from_this()](const hs_proposal_message& s) { - my->on_hs_proposal_message(s); - }, - [my = shared_from_this()](const hs_vote_message& s) { - my->on_hs_vote_message(s); - }, - [my = shared_from_this()](const hs_new_block_message& s) { - my->on_hs_new_block_message(s); - }, - [my = shared_from_this()](const hs_new_view_message& s) { - my->on_hs_new_view_message(s); + chain_plug->register_pacemaker_bcast_function( + [my = shared_from_this()](const hs_message& s) { + my->on_hs_message(s); } ); - } FC_LOG_AND_RETHROW() } From 55936b13b59b357ccb349fe68af17c8322d6d830 Mon Sep 17 00:00:00 2001 From: Kevin Heifner Date: Mon, 28 Aug 2023 13:51:24 -0500 Subject: [PATCH 4/5] GH-1519 Rename method to be more clear --- plugins/net_plugin/net_plugin.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/net_plugin/net_plugin.cpp b/plugins/net_plugin/net_plugin.cpp index 2fe5e275c8..07cd52f3a3 100644 --- a/plugins/net_plugin/net_plugin.cpp +++ b/plugins/net_plugin/net_plugin.cpp @@ -495,7 +495,7 @@ namespace eosio { void transaction_ack(const std::pair&); void on_irreversible_block( const block_state_ptr& block ); - void on_hs_message( const hs_message& msg ); + void bcast_hs_message( const hs_message& msg ); void start_conn_timer(boost::asio::steady_timer::duration du, std::weak_ptr from_connection); void start_expire_timer(); @@ -1119,7 +1119,7 @@ namespace eosio { void operator()( const hs_message& msg ) const { // continue call to handle_message on connection strand - peer_dlog( c, "handle hs_vote_message" ); + peer_dlog( c, "handle hs_message" ); c->handle_message( msg ); } }; @@ -3817,7 +3817,7 @@ namespace eosio { on_active_schedule(chain_plug->chain().active_producers()); } - void net_plugin_impl::on_hs_message( const hs_message& msg ) { + void net_plugin_impl::bcast_hs_message( const hs_message& msg ) { fc_dlog(logger, "sending hs msg: ${msg}", ("msg", msg)); buffer_factory buff_factory; @@ -4154,7 +4154,7 @@ namespace eosio { chain_plug->register_pacemaker_bcast_function( [my = shared_from_this()](const hs_message& s) { - my->on_hs_message(s); + my->bcast_hs_message(s); } ); } FC_LOG_AND_RETHROW() From 79bdc0433f02f64a1c3eda6a12a64236816daf34 Mon Sep 17 00:00:00 2001 From: Kevin Heifner Date: Mon, 28 Aug 2023 14:06:42 -0500 Subject: [PATCH 5/5] GH-1519 Rename method to be more clear --- libraries/hotstuff/chain_pacemaker.cpp | 6 +++--- .../hotstuff/include/eosio/hotstuff/chain_pacemaker.hpp | 2 +- plugins/chain_plugin/chain_plugin.cpp | 4 ++-- .../include/eosio/chain_plugin/chain_plugin.hpp | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libraries/hotstuff/chain_pacemaker.cpp b/libraries/hotstuff/chain_pacemaker.cpp index 54a665e1a1..1b3f62801c 100644 --- a/libraries/hotstuff/chain_pacemaker.cpp +++ b/libraries/hotstuff/chain_pacemaker.cpp @@ -107,10 +107,10 @@ namespace eosio { namespace hotstuff { { } - void chain_pacemaker::register_bcast_function(std::function on_hs_message) { - FC_ASSERT(on_hs_message, "on_hs_message must be provided"); + void chain_pacemaker::register_bcast_function(std::function broadcast_hs_message) { + FC_ASSERT(broadcast_hs_message, "on_hs_message must be provided"); std::lock_guard g( _hotstuff_global_mutex ); // not actually needed but doesn't hurt - bcast_hs_message = std::move(on_hs_message); + bcast_hs_message = std::move(broadcast_hs_message); } // Called internally by the chain_pacemaker to decide whether it should do something or not, based on feature activation. diff --git a/libraries/hotstuff/include/eosio/hotstuff/chain_pacemaker.hpp b/libraries/hotstuff/include/eosio/hotstuff/chain_pacemaker.hpp index b0791ecedc..aa8e1f0c4c 100644 --- a/libraries/hotstuff/include/eosio/hotstuff/chain_pacemaker.hpp +++ b/libraries/hotstuff/include/eosio/hotstuff/chain_pacemaker.hpp @@ -17,7 +17,7 @@ namespace eosio::hotstuff { //class-specific functions chain_pacemaker(controller* chain, std::set my_producers, fc::logger& logger); - void register_bcast_function(std::function on_hs_message); + void register_bcast_function(std::function broadcast_hs_message); void beat(); diff --git a/plugins/chain_plugin/chain_plugin.cpp b/plugins/chain_plugin/chain_plugin.cpp index 517d4fb67c..ae2512371e 100644 --- a/plugins/chain_plugin/chain_plugin.cpp +++ b/plugins/chain_plugin/chain_plugin.cpp @@ -1119,9 +1119,9 @@ void chain_plugin::create_pacemaker(std::set my_producers) my->_chain_pacemaker.emplace(&chain(), std::move(my_producers), hotstuff_logger); } -void chain_plugin::register_pacemaker_bcast_function(std::function on_hs_message) { +void chain_plugin::register_pacemaker_bcast_function(std::function bcast_hs_message) { EOS_ASSERT( my->_chain_pacemaker, plugin_config_exception, "chain_pacemaker not created" ); - my->_chain_pacemaker->register_bcast_function(std::move(on_hs_message)); + my->_chain_pacemaker->register_bcast_function(std::move(bcast_hs_message)); } diff --git a/plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp b/plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp index bcdb27fc0b..150f1ea855 100644 --- a/plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp +++ b/plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp @@ -1032,7 +1032,7 @@ class chain_plugin : public plugin { const controller& chain() const; void create_pacemaker(std::set my_producers); - void register_pacemaker_bcast_function(std::function on_hs_message); + void register_pacemaker_bcast_function(std::function bcast_hs_message); void notify_hs_message( const chain::hs_message& msg ); void notify_hs_block_produced();