Skip to content

Commit

Permalink
GH-2125 Add additional logging
Browse files Browse the repository at this point in the history
  • Loading branch information
heifner committed Mar 8, 2024
1 parent e2b7c3c commit febdebb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions libraries/chain/block_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ block_state::block_state(const block_header_state& bhs, deque<transaction_metada
block->transactions = std::move(trx_receipts);

if( qc ) {
ilog("integrate qc ${qcbn} strong=${s} into block ${bn}", ("qcbn", qc->block_num)("s", qc->qc.is_strong())("bn", block_num()));
emplace_extension(block->block_extensions, quorum_certificate_extension::extension_id(), fc::raw::pack( *qc ));
}

Expand Down
7 changes: 7 additions & 0 deletions libraries/chain/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -698,8 +698,10 @@ struct building_block {
("a", qc->block_num)("p", block_header::num_from_id(parent_id())) );
auto qc_claim = qc_claim_t { qc->block_num, qc->qc.is_strong() };
if( bb.parent.is_needed(*qc) ) {
ilog("integrate qc and qc claim ${qc} into block ${bn}", ("qc", qc_claim)("bn", block_header::num_from_id(parent_id())+1));
qc_data = qc_data_t{ *qc, qc_claim };
} else {
ilog("integrate only qc claim ${qc} into block ${bn}", ("qc", qc_claim)("bn", block_header::num_from_id(parent_id())+1));
qc_data = qc_data_t{ {}, qc_claim };
}
break;
Expand Down Expand Up @@ -3456,15 +3458,20 @@ struct controller_impl {

const auto claimed = fetch_bsp_on_branch_by_num( bsp_in->previous(), qc_ext.qc.block_num );
if( !claimed ) {
ilog("qc not found in forkdb, qc: ${qbn}, strong=${s}", ("qbn", qc_ext.qc.block_num)("s", received_qc.is_strong()));
return;
}

// Don't save the QC from block extension if the claimed block has a better valid_qc.
if (claimed->valid_qc && (claimed->valid_qc->is_strong() || received_qc.is_weak())) {
ilog("qc not better, claimed->valid: ${qbn}, strong=${s}, received: ${rbn}, strong=${rs}",
("qbn", claimed->block_num())("s", claimed->valid_qc->is_strong())
("rbn", qc_ext.qc.block_num)("rs", received_qc.is_strong()));
return;
}

// Save the QC. This is safe as the function is called by push_block & accept_block from application thread.
ilog("setting valid qc: ${rbn}, strong=${rs}", ("rbn", qc_ext.qc.block_num)("rs", received_qc.is_strong()));
claimed->valid_qc = received_qc;

// advance LIB if QC is strong
Expand Down
3 changes: 2 additions & 1 deletion libraries/chain/hotstuff/finalizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ finalizer::vote_result finalizer::decide_vote(const finality_core& core, const b
res.liveness_check = core.latest_qc_block_timestamp() > fsi.lock.timestamp;

if (!res.liveness_check) {
ilog("liveness check failed for ${bn}: ${c} <= ${l}", ("bn", core.current_block_num())("c", core.latest_qc_block_timestamp())("l", fsi.lock.timestamp));
ilog("liveness check failed for ${bn}: ${c} <= ${l}, latest_qc_claim: ${qc}",
("bn", core.current_block_num())("c", core.latest_qc_block_timestamp())("l", fsi.lock.timestamp)("qc", core.latest_qc_claim()));
// Safety check : check if this proposal extends the proposal we're locked on
res.safety_check = core.extends(fsi.lock.block_id);
if (!res.safety_check) {
Expand Down

0 comments on commit febdebb

Please sign in to comment.