mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 23:21:02 +00:00
Histogram support in runtime metrics (#6935)
* Histogram support in runtime metrics Add support for histograms to the runtime metrics. Additionally add `polkadot_parachain_verify_dispute_signature` histogram which tracks the time needed from the runtime to verify a single validator signature of a dispute statement. * Add noops * u64 instead of f64 * Update buckets * Wrap `get_current_time()` in runtime metrics * Change the dimension of the Histogram from usec to sec * Fix a compilation error * Update buckets * Fix `on_signature_check_complete` calculation * Update buckets * Update buckets * formatting * Another weights update * Adjust buckets again * Final buckets adjustment * Revert "Fix a compilation error" This reverts commit 06290b40a39eeb78de2602d8916a39edf7a8b714. * Update primitives/src/v4/metrics.rs Co-authored-by: Andrei Sandu <54316454+sandreim@users.noreply.github.com> * Use `saturating_sub` for time difference calculation * Pass nanoseconds to client instead of seconds (using f64 in runtime is dangerous) --------- Co-authored-by: Andrei Sandu <54316454+sandreim@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
4903859544
commit
22f404f092
@@ -16,11 +16,14 @@
|
||||
|
||||
//! Runtime component for handling disputes of parachain candidates.
|
||||
|
||||
use crate::{configuration, initializer::SessionChangeNotification, session_info};
|
||||
use crate::{
|
||||
configuration, initializer::SessionChangeNotification, metrics::METRICS, session_info,
|
||||
};
|
||||
use bitvec::{bitvec, order::Lsb0 as BitOrderLsb0};
|
||||
use frame_support::{ensure, weights::Weight};
|
||||
use frame_system::pallet_prelude::*;
|
||||
use parity_scale_codec::{Decode, Encode};
|
||||
use polkadot_runtime_metrics::get_current_time;
|
||||
use primitives::{
|
||||
byzantine_threshold, supermajority_threshold, ApprovalVote, CandidateHash,
|
||||
CheckedDisputeStatementSet, CheckedMultiDisputeStatementSet, CompactStatement, ConsensusLog,
|
||||
@@ -1336,9 +1339,14 @@ fn check_signature(
|
||||
ExplicitDisputeStatement { valid: false, candidate_hash, session }.signing_payload(),
|
||||
};
|
||||
|
||||
if validator_signature.verify(&payload[..], &validator_public) {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(())
|
||||
}
|
||||
let start = get_current_time();
|
||||
|
||||
let res =
|
||||
if validator_signature.verify(&payload[..], &validator_public) { Ok(()) } else { Err(()) };
|
||||
|
||||
let end = get_current_time();
|
||||
|
||||
METRICS.on_signature_check_complete(end.saturating_sub(start)); // ns
|
||||
|
||||
res
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user