Skip to content

Commit

Permalink
chore: better logging for devnet upgrade protocol test (#1925)
Browse files Browse the repository at this point in the history
Co-authored-by: Ivan Shumkov <ivan@shumkov.ru>
  • Loading branch information
ogabrielides and shumkov authored Jul 8, 2024
1 parent 9194f31 commit 37520df
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 5 deletions.
5 changes: 5 additions & 0 deletions packages/rs-drive-abci/src/abci/handler/prepare_proposal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ where
let invalid_paid_tx_count = state_transitions_result.invalid_paid_count();
let invalid_unpaid_tx_count = state_transitions_result.invalid_unpaid_count();

let storage_fees = state_transitions_result.aggregated_fees().storage_fee;
let processing_fees = state_transitions_result.aggregated_fees().processing_fee;

let mut tx_results = Vec::new();
let mut tx_records = Vec::new();

Expand Down Expand Up @@ -207,6 +210,8 @@ where
valid_tx_count,
delayed_tx_count,
failed_tx_count,
storage_fees,
processing_fees,
"Prepared proposal with {} transition{} for height: {}, round: {} in {} ms",
valid_tx_count + invalid_paid_tx_count,
if valid_tx_count + invalid_paid_tx_count > 0 {
Expand Down
5 changes: 5 additions & 0 deletions packages/rs-drive-abci/src/abci/handler/process_proposal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,9 @@ where
let invalid_unpaid_tx_count = state_transition_results.invalid_unpaid_count();
let unexpected_execution_results = failed_tx_count + invalid_unpaid_tx_count;

let storage_fees = state_transition_results.aggregated_fees().storage_fee;
let processing_fees = state_transition_results.aggregated_fees().processing_fee;

// Reject block if proposal contains failed or unpaid state transitions
if unexpected_execution_results > 0 {
let response = proto::ResponseProcessProposal {
Expand Down Expand Up @@ -275,6 +278,8 @@ where
invalid_tx_count,
valid_tx_count,
elapsed_time_ms,
storage_fees,
processing_fees,
"Processed proposal with {} transactions for height: {}, round: {} in {} ms",
valid_tx_count + invalid_tx_count,
request.height,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,17 @@ impl<C> Platform<C> {

let proposers_len = proposers.len() as u16;

tracing::trace!(
unpaid_block_count = unpaid_epoch_block_count,
unpaid_epoch_index = unpaid_epoch.epoch_index(),
fees = storage_and_processing_fees,
core_block_rewards,
total_payouts,
"Pay {total_payouts} credits to {proposers_len} proposers for {} proposed blocks in epoch {}",
unpaid_epoch_block_count,
unpaid_epoch.epoch_index(),
);

for (i, (proposer_tx_hash, proposed_block_count)) in proposers.into_iter().enumerate() {
let i = i as u16;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ impl<C> Platform<C> {
// if we are at an epoch change, check to see if over 75% of blocks of previous epoch
// were on the future version
let protocol_versions_counter = self.drive.cache.protocol_versions_counter.read();

let mut versions_passing_threshold =
protocol_versions_counter.versions_passing_threshold(required_upgraded_hpmns);
drop(protocol_versions_counter);

if versions_passing_threshold.len() > 1 {
return Err(Error::Execution(
Expand All @@ -42,13 +42,19 @@ impl<C> Platform<C> {
));
}

tracing::trace!(
total_hpmns,
required_upgraded_hpmns,
all_votes = ?protocol_versions_counter.global_cache,
versions_passing_threshold = versions_passing_threshold.len(),
"Protocol version voting is finished. {} versions passing the threshold: {:?}",
versions_passing_threshold.len(),
versions_passing_threshold
);

if !versions_passing_threshold.is_empty() {
// same as equals 1
let next_version = versions_passing_threshold.remove(0);

// TODO: We stored next version here previously.
// It was never used so we can temporary remove it from here and move it to Epoch trees in upcoming PR

Ok(Some(next_version))
} else {
Ok(None)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ impl<C> Platform<C> {
self.check_for_desired_protocol_upgrade(hpmn_list_len, platform_version)?;

if let Some(protocol_version) = next_epoch_protocol_version {
tracing::trace!(
current_epoch_index = epoch_info.current_epoch_index(),
"Next protocol version set to {}",
protocol_version
);
block_platform_state.set_next_epoch_protocol_version(protocol_version);
}

Expand Down

0 comments on commit 37520df

Please sign in to comment.