From 37520df55b513d544c8313d647446aa39a114d82 Mon Sep 17 00:00:00 2001 From: Odysseas Gabrielides Date: Mon, 8 Jul 2024 16:08:01 +0300 Subject: [PATCH] chore: better logging for devnet upgrade protocol test (#1925) Co-authored-by: Ivan Shumkov --- .../src/abci/handler/prepare_proposal.rs | 5 +++++ .../src/abci/handler/process_proposal.rs | 5 +++++ .../v0/mod.rs | 11 +++++++++++ .../check_for_desired_protocol_upgrade/v0/mod.rs | 16 +++++++++++----- .../upgrade_protocol_version/v0/mod.rs | 5 +++++ 5 files changed, 37 insertions(+), 5 deletions(-) diff --git a/packages/rs-drive-abci/src/abci/handler/prepare_proposal.rs b/packages/rs-drive-abci/src/abci/handler/prepare_proposal.rs index ce4c6b8e10c..29930663f94 100644 --- a/packages/rs-drive-abci/src/abci/handler/prepare_proposal.rs +++ b/packages/rs-drive-abci/src/abci/handler/prepare_proposal.rs @@ -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(); @@ -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 { diff --git a/packages/rs-drive-abci/src/abci/handler/process_proposal.rs b/packages/rs-drive-abci/src/abci/handler/process_proposal.rs index 3f4daaca7b5..b6fff756443 100644 --- a/packages/rs-drive-abci/src/abci/handler/process_proposal.rs +++ b/packages/rs-drive-abci/src/abci/handler/process_proposal.rs @@ -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 { @@ -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, diff --git a/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/add_epoch_pool_to_proposers_payout_operations/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/add_epoch_pool_to_proposers_payout_operations/v0/mod.rs index 670f7dc1fe9..8f42fca8954 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/add_epoch_pool_to_proposers_payout_operations/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/add_epoch_pool_to_proposers_payout_operations/v0/mod.rs @@ -65,6 +65,17 @@ impl Platform { 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; diff --git a/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/check_for_desired_protocol_upgrade/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/check_for_desired_protocol_upgrade/v0/mod.rs index 107a55bb878..a2612fedc80 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/check_for_desired_protocol_upgrade/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/check_for_desired_protocol_upgrade/v0/mod.rs @@ -30,9 +30,9 @@ impl Platform { // 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( @@ -42,13 +42,19 @@ impl Platform { )); } + 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) diff --git a/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/upgrade_protocol_version/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/upgrade_protocol_version/v0/mod.rs index 46b793e4fff..daedf4781a0 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/upgrade_protocol_version/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/upgrade_protocol_version/v0/mod.rs @@ -66,6 +66,11 @@ impl Platform { 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); }