Add hidden cli option to allow validator reports replayed transaction cost metrics (backport #22369) (#22519)

* Add hidden cli option to allow validator reports replayed transaction cost metrics (#22369)

* add hidden cli option to allow validator reports replayed transaction cost detail metrics

* Update validator/src/main.rs

Co-authored-by: Michael Vines <mvines@gmail.com>

* - rebase master, using unbounded instead of channel; dowgrade to datapoint_trace

* removed cli arg, prefer log at trace

Co-authored-by: Michael Vines <mvines@gmail.com>
(cherry picked from commit a724fa2347)

# Conflicts:
#	core/src/tvu.rs

* fix conflict

Co-authored-by: Tao Zhu <82401714+taozhu-chicago@users.noreply.github.com>
Co-authored-by: Tao Zhu <tao@solana.com>
This commit is contained in:
mergify[bot]
2022-01-21 15:05:41 -07:00
committed by GitHub
parent 35ca3182ba
commit 91bc44931f
5 changed files with 147 additions and 0 deletions

View File

@ -32,6 +32,7 @@ use {
snapshot_package::{AccountsPackageSender, SnapshotType},
snapshot_utils::{self, BankFromArchiveTimings},
transaction_batch::TransactionBatch,
transaction_cost_metrics_sender::TransactionCostMetricsSender,
vote_account::VoteAccount,
vote_sender_types::ReplayVoteSender,
},
@ -317,6 +318,7 @@ pub fn process_entries_for_tests(
None,
transaction_status_sender,
replay_vote_sender,
None,
&mut timings,
Arc::new(RwLock::new(BlockCostCapacityMeter::default())),
);
@ -333,6 +335,7 @@ fn process_entries_with_callback(
entry_callback: Option<&ProcessCallback>,
transaction_status_sender: Option<&TransactionStatusSender>,
replay_vote_sender: Option<&ReplayVoteSender>,
transaction_cost_metrics_sender: Option<&TransactionCostMetricsSender>,
timings: &mut ExecuteTimings,
cost_capacity_meter: Arc<RwLock<BlockCostCapacityMeter>>,
) -> Result<()> {
@ -366,6 +369,11 @@ fn process_entries_with_callback(
}
}
EntryType::Transactions(transactions) => {
if let Some(transaction_cost_metrics_sender) = transaction_cost_metrics_sender {
transaction_cost_metrics_sender
.send_cost_details(bank.clone(), transactions.iter());
}
if randomize {
transactions.shuffle(&mut rng);
}
@ -791,6 +799,7 @@ fn confirm_full_slot(
skip_verification,
transaction_status_sender,
replay_vote_sender,
None,
opts.entry_callback.as_ref(),
recyclers,
opts.allow_dead_slots,
@ -858,6 +867,7 @@ pub fn confirm_slot(
skip_verification: bool,
transaction_status_sender: Option<&TransactionStatusSender>,
replay_vote_sender: Option<&ReplayVoteSender>,
transaction_cost_metrics_sender: Option<&TransactionCostMetricsSender>,
entry_callback: Option<&ProcessCallback>,
recyclers: &VerifyRecyclers,
allow_dead_slots: bool,
@ -954,6 +964,7 @@ pub fn confirm_slot(
entry_callback,
transaction_status_sender,
replay_vote_sender,
transaction_cost_metrics_sender,
&mut execute_timings,
cost_capacity_meter,
)