Skip to content

Commit

Permalink
Merge pull request #1928 from AntelopeIO/IF_force_chained
Browse files Browse the repository at this point in the history
IF: remove event-driven mode
  • Loading branch information
fcecin authored Nov 27, 2023
2 parents 51323b2 + a744360 commit be8ff28
Show file tree
Hide file tree
Showing 6 changed files with 260 additions and 290 deletions.
3 changes: 1 addition & 2 deletions libraries/hotstuff/include/eosio/hotstuff/hotstuff.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ namespace eosio::hotstuff {
};

struct finalizer_state {
bool chained_mode = false;
fc::sha256 b_leaf;
fc::sha256 b_lock;
fc::sha256 b_exec;
Expand Down Expand Up @@ -119,5 +118,5 @@ FC_REFLECT(eosio::hotstuff::extended_schedule, (producer_schedule)(bls_pub_keys)
FC_REFLECT(eosio::hotstuff::hs_vote_message, (proposal_id)(finalizer_key)(sig));
FC_REFLECT(eosio::hotstuff::hs_proposal_message, (proposal_id)(block_id)(parent_id)(final_on_qc)(justify)(phase_counter));
FC_REFLECT(eosio::hotstuff::hs_new_view_message, (high_qc));
FC_REFLECT(eosio::hotstuff::finalizer_state, (chained_mode)(b_leaf)(b_lock)(b_exec)(b_finality_violation)(block_exec)(pending_proposal_block)(v_height)(high_qc)(current_qc)(schedule)(proposals));
FC_REFLECT(eosio::hotstuff::finalizer_state, (b_leaf)(b_lock)(b_exec)(b_finality_violation)(block_exec)(pending_proposal_block)(v_height)(high_qc)(current_qc)(schedule)(proposals));
FC_REFLECT(eosio::hotstuff::hs_message, (msg));
2 changes: 0 additions & 2 deletions libraries/hotstuff/include/eosio/hotstuff/qc_chain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,6 @@ namespace eosio::hotstuff {

void gc_proposals(uint64_t cutoff);

bool _chained_mode = false;

block_id_type _block_exec;
block_id_type _pending_proposal_block;
safety_state _safety_state;
Expand Down
25 changes: 0 additions & 25 deletions libraries/hotstuff/qc_chain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ namespace eosio::hotstuff {
}

void qc_chain::get_state(finalizer_state& fs) const {
fs.chained_mode = _chained_mode;
fs.b_leaf = _b_leaf;
fs.b_lock = _safety_state.get_b_lock();
fs.b_exec = _b_exec;
Expand Down Expand Up @@ -431,30 +430,6 @@ namespace eosio::hotstuff {

//check for leader change
leader_rotation_check();

//if we're operating in event-driven mode and the proposal hasn't reached the decide phase yet
if (_chained_mode == false && p->phase_counter < 3) {
fc_tlog(_logger, " === ${id} phase increment on proposal ${proposal_id}", ("proposal_id", vote.proposal_id)("id", _id));
hs_proposal_message proposal_candidate;

if (_pending_proposal_block.empty())
proposal_candidate = new_proposal_candidate( p->block_id, p->phase_counter + 1 );
else
proposal_candidate = new_proposal_candidate( _pending_proposal_block, 0 );

reset_qc(proposal_candidate.proposal_id);
fc_tlog(_logger, " === ${id} setting _pending_proposal_block to null (process_vote)", ("id", _id));

_pending_proposal_block = {};
_b_leaf = proposal_candidate.proposal_id;

//todo : asynchronous?
//write_state(_liveness_state_file , _liveness_state);

send_hs_proposal_msg( std::nullopt, proposal_candidate );

fc_tlog(_logger, " === ${id} _b_leaf updated (process_vote): ${proposal_id}", ("proposal_id", proposal_candidate.proposal_id)("id", _id));
}
}
}

Expand Down
Loading

0 comments on commit be8ff28

Please sign in to comment.