Skip to content

Commit

Permalink
Merge branch 'hotstuff_integration' into reject_invalid_qc
Browse files Browse the repository at this point in the history
  • Loading branch information
linh2931 authored Jan 25, 2024
2 parents 530c66f + 9071262 commit 995d075
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
6 changes: 5 additions & 1 deletion libraries/chain/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,11 @@ struct building_block {
EOS_ASSERT( qc->block_height <= block_header::num_from_id(parent_id()), block_validate_exception,
"most recent ancestor QC block number (${a}) cannot be greater than parent's block number (${p})",
("a", qc->block_height)("p", block_header::num_from_id(parent_id())) );
qc_data = qc_data_t{ *qc, qc_info_t{ qc->block_height, qc->qc.is_strong() }};
if( bb.parent.is_needed(*qc) ) {
qc_data = qc_data_t{ *qc, qc_info_t{ qc->block_height, qc->qc.is_strong() }};
} else {
qc_data = qc_data_t{ {}, qc_info_t{ qc->block_height, qc->qc.is_strong() }};
}
break;
}
}
Expand Down
7 changes: 6 additions & 1 deletion libraries/chain/include/eosio/chain/block_header_state.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct building_block_input {
};

struct qc_data_t {
quorum_certificate qc; // Comes from traversing branch from parent and calling get_best_qc()
std::optional<quorum_certificate> qc; // Comes from traversing branch from parent and calling get_best_qc()
// assert(qc->block_num <= num_from_id(previous));
qc_info_t qc_info; // describes the above qc
};
Expand Down Expand Up @@ -79,6 +79,11 @@ struct block_header_state {

block_header_state next(const signed_block_header& h, const protocol_feature_set& pfs, validator_t& validator) const;

// block descending from this need the provided qc in the block extension
bool is_needed(const quorum_certificate& qc) const {
return !core.last_qc_block_num || qc.block_height > *core.last_qc_block_num;
}

flat_set<digest_type> get_activated_protocol_features() const { return activated_protocol_features->protocol_features; }
const vector<digest_type>& get_new_protocol_feature_activations() const;
producer_authority get_scheduled_producer(block_timestamp_type t) const;
Expand Down
2 changes: 1 addition & 1 deletion libraries/chain/webassembly/privileged.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ namespace eosio { namespace chain { namespace webassembly {
.public_key{fc::crypto::blslib::bls_public_key{*pk}}});
}

EOS_ASSERT( finpol.threshold > weight_sum / 2, wasm_execution_error, "Finalizer policy threshold cannot be met by finalizer weights" );
EOS_ASSERT( weight_sum >= finpol.threshold && finpol.threshold > weight_sum / 2, wasm_execution_error, "Finalizer policy threshold (${t}) must be greater than half of the sum of the weights (${w}), and less than or equal to the sum of the weights", ("t", finpol.threshold)("w", weight_sum) );

context.control.set_proposed_finalizers( finpol );
}
Expand Down

0 comments on commit 995d075

Please sign in to comment.