mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-21 14:25:41 +00:00
some more metrics for approval voting (#2612)
* some more metrics for approval voting * fix tests Co-authored-by: Andronik Ordian <write@reusable.software>
This commit is contained in:
committed by
GitHub
parent
b105d9acc0
commit
bd2f5b27dd
@@ -59,17 +59,40 @@ pub enum RequiredTranches {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The result of a check.
|
||||||
|
#[derive(Debug, Clone, Copy)]
|
||||||
|
pub enum Check {
|
||||||
|
/// The candidate is unapproved.
|
||||||
|
Unapproved,
|
||||||
|
/// The candidate is approved, with the given amount of no-shows.
|
||||||
|
Approved(usize),
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Check {
|
||||||
|
/// Whether the candidate is approved.
|
||||||
|
pub fn is_approved(&self) -> bool {
|
||||||
|
match *self {
|
||||||
|
Check::Unapproved => false,
|
||||||
|
Check::Approved(_) => true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Check the approval of a candidate.
|
/// Check the approval of a candidate.
|
||||||
pub fn check_approval(
|
pub fn check_approval(
|
||||||
candidate: &CandidateEntry,
|
candidate: &CandidateEntry,
|
||||||
approval: &ApprovalEntry,
|
approval: &ApprovalEntry,
|
||||||
required: RequiredTranches,
|
required: RequiredTranches,
|
||||||
) -> bool {
|
) -> Check {
|
||||||
match required {
|
match required {
|
||||||
RequiredTranches::Pending { .. } => false,
|
RequiredTranches::Pending { .. } => Check::Unapproved,
|
||||||
RequiredTranches::All => {
|
RequiredTranches::All => {
|
||||||
let approvals = candidate.approvals();
|
let approvals = candidate.approvals();
|
||||||
3 * approvals.count_ones() > 2 * approvals.len()
|
if 3 * approvals.count_ones() > 2 * approvals.len() {
|
||||||
|
Check::Approved(0)
|
||||||
|
} else {
|
||||||
|
Check::Unapproved
|
||||||
|
}
|
||||||
}
|
}
|
||||||
RequiredTranches::Exact { needed, tolerated_missing, .. } => {
|
RequiredTranches::Exact { needed, tolerated_missing, .. } => {
|
||||||
// whether all assigned validators up to `needed` less no_shows have approved.
|
// whether all assigned validators up to `needed` less no_shows have approved.
|
||||||
@@ -93,7 +116,11 @@ pub fn check_approval(
|
|||||||
// note: the process of computing `required` only chooses `exact` if
|
// note: the process of computing `required` only chooses `exact` if
|
||||||
// that will surpass a minimum amount of checks.
|
// that will surpass a minimum amount of checks.
|
||||||
// shouldn't typically go above, since all no-shows are supposed to be covered.
|
// shouldn't typically go above, since all no-shows are supposed to be covered.
|
||||||
n_approved + tolerated_missing >= n_assigned
|
if n_approved + tolerated_missing >= n_assigned {
|
||||||
|
Check::Approved(tolerated_missing)
|
||||||
|
} else {
|
||||||
|
Check::Unapproved
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -380,7 +407,7 @@ mod tests {
|
|||||||
maximum_broadcast: 0,
|
maximum_broadcast: 0,
|
||||||
clock_drift: 0,
|
clock_drift: 0,
|
||||||
},
|
},
|
||||||
));
|
).is_approved());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -404,10 +431,10 @@ mod tests {
|
|||||||
approved: false,
|
approved: false,
|
||||||
}.into();
|
}.into();
|
||||||
|
|
||||||
assert!(!check_approval(&candidate, &approval_entry, RequiredTranches::All));
|
assert!(!check_approval(&candidate, &approval_entry, RequiredTranches::All).is_approved());
|
||||||
|
|
||||||
candidate.mark_approval(ValidatorIndex(6));
|
candidate.mark_approval(ValidatorIndex(6));
|
||||||
assert!(check_approval(&candidate, &approval_entry, RequiredTranches::All));
|
assert!(check_approval(&candidate, &approval_entry, RequiredTranches::All).is_approved());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -452,7 +479,7 @@ mod tests {
|
|||||||
tolerated_missing: 0,
|
tolerated_missing: 0,
|
||||||
next_no_show: None,
|
next_no_show: None,
|
||||||
},
|
},
|
||||||
));
|
).is_approved());
|
||||||
assert!(!check_approval(
|
assert!(!check_approval(
|
||||||
&candidate,
|
&candidate,
|
||||||
&approval_entry,
|
&approval_entry,
|
||||||
@@ -461,7 +488,7 @@ mod tests {
|
|||||||
tolerated_missing: 0,
|
tolerated_missing: 0,
|
||||||
next_no_show: None,
|
next_no_show: None,
|
||||||
},
|
},
|
||||||
));
|
).is_approved());
|
||||||
assert!(check_approval(
|
assert!(check_approval(
|
||||||
&candidate,
|
&candidate,
|
||||||
&approval_entry,
|
&approval_entry,
|
||||||
@@ -470,7 +497,7 @@ mod tests {
|
|||||||
tolerated_missing: 4,
|
tolerated_missing: 4,
|
||||||
next_no_show: None,
|
next_no_show: None,
|
||||||
},
|
},
|
||||||
));
|
).is_approved());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -105,6 +105,10 @@ struct MetricsInner {
|
|||||||
imported_candidates_total: prometheus::Counter<prometheus::U64>,
|
imported_candidates_total: prometheus::Counter<prometheus::U64>,
|
||||||
assignments_produced_total: prometheus::Counter<prometheus::U64>,
|
assignments_produced_total: prometheus::Counter<prometheus::U64>,
|
||||||
approvals_produced_total: prometheus::Counter<prometheus::U64>,
|
approvals_produced_total: prometheus::Counter<prometheus::U64>,
|
||||||
|
no_shows_total: prometheus::Counter<prometheus::U64>,
|
||||||
|
wakeups_triggered_total: prometheus::Counter<prometheus::U64>,
|
||||||
|
candidate_approval_time_ticks: prometheus::Histogram,
|
||||||
|
block_approval_time_ticks: prometheus::Histogram,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Aproval Voting metrics.
|
/// Aproval Voting metrics.
|
||||||
@@ -129,6 +133,30 @@ impl Metrics {
|
|||||||
metrics.approvals_produced_total.inc();
|
metrics.approvals_produced_total.inc();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn on_no_shows(&self, n: usize) {
|
||||||
|
if let Some(metrics) = &self.0 {
|
||||||
|
metrics.no_shows_total.inc_by(n as u64);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn on_wakeup(&self) {
|
||||||
|
if let Some(metrics) = &self.0 {
|
||||||
|
metrics.wakeups_triggered_total.inc();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn on_candidate_approved(&self, ticks: Tick) {
|
||||||
|
if let Some(metrics) = &self.0 {
|
||||||
|
metrics.candidate_approval_time_ticks.observe(ticks as f64);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn on_block_approved(&self, ticks: Tick) {
|
||||||
|
if let Some(metrics) = &self.0 {
|
||||||
|
metrics.block_approval_time_ticks.observe(ticks as f64);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl metrics::Metrics for Metrics {
|
impl metrics::Metrics for Metrics {
|
||||||
@@ -157,7 +185,40 @@ impl metrics::Metrics for Metrics {
|
|||||||
)?,
|
)?,
|
||||||
registry,
|
registry,
|
||||||
)?,
|
)?,
|
||||||
|
no_shows_total: prometheus::register(
|
||||||
|
prometheus::Counter::new(
|
||||||
|
"parachain_approvals_no_shows_total",
|
||||||
|
"Number of assignments which became no-shows in the approval voting subsystem",
|
||||||
|
)?,
|
||||||
|
registry,
|
||||||
|
)?,
|
||||||
|
wakeups_triggered_total: prometheus::register(
|
||||||
|
prometheus::Counter::new(
|
||||||
|
"parachain_approvals_wakeups_total",
|
||||||
|
"Number of times we woke up to process a candidate in the approval voting subsystem",
|
||||||
|
)?,
|
||||||
|
registry,
|
||||||
|
)?,
|
||||||
|
candidate_approval_time_ticks: prometheus::register(
|
||||||
|
prometheus::Histogram::with_opts(
|
||||||
|
prometheus::HistogramOpts::new(
|
||||||
|
"parachain_approvals_candidate_approval_time_ticks",
|
||||||
|
"Number of ticks (500ms) to approve candidates.",
|
||||||
|
).buckets(vec![6.0, 12.0, 18.0, 24.0, 30.0, 36.0, 72.0, 100.0, 144.0]),
|
||||||
|
)?,
|
||||||
|
registry,
|
||||||
|
)?,
|
||||||
|
block_approval_time_ticks: prometheus::register(
|
||||||
|
prometheus::Histogram::with_opts(
|
||||||
|
prometheus::HistogramOpts::new(
|
||||||
|
"parachain_approvals_blockapproval_time_ticks",
|
||||||
|
"Number of ticks (500ms) to approve blocks.",
|
||||||
|
).buckets(vec![6.0, 12.0, 18.0, 24.0, 30.0, 36.0, 72.0, 100.0, 144.0]),
|
||||||
|
)?,
|
||||||
|
registry,
|
||||||
|
)?,
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(Metrics(Some(metrics)))
|
Ok(Metrics(Some(metrics)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -400,6 +461,7 @@ async fn run<C>(
|
|||||||
loop {
|
loop {
|
||||||
let actions = futures::select! {
|
let actions = futures::select! {
|
||||||
(tick, woken_block, woken_candidate) = wakeups.next(&*state.clock).fuse() => {
|
(tick, woken_block, woken_candidate) = wakeups.next(&*state.clock).fuse() => {
|
||||||
|
subsystem.metrics.on_wakeup();
|
||||||
process_wakeup(
|
process_wakeup(
|
||||||
&mut state,
|
&mut state,
|
||||||
woken_block,
|
woken_block,
|
||||||
@@ -589,12 +651,13 @@ async fn handle_from_overseer(
|
|||||||
}
|
}
|
||||||
FromOverseer::Communication { msg } => match msg {
|
FromOverseer::Communication { msg } => match msg {
|
||||||
ApprovalVotingMessage::CheckAndImportAssignment(a, claimed_core, res) => {
|
ApprovalVotingMessage::CheckAndImportAssignment(a, claimed_core, res) => {
|
||||||
let (check_outcome, actions) = check_and_import_assignment(state, a, claimed_core)?;
|
let (check_outcome, actions)
|
||||||
|
= check_and_import_assignment(state, metrics, a, claimed_core)?;
|
||||||
let _ = res.send(check_outcome);
|
let _ = res.send(check_outcome);
|
||||||
actions
|
actions
|
||||||
}
|
}
|
||||||
ApprovalVotingMessage::CheckAndImportApproval(a, res) => {
|
ApprovalVotingMessage::CheckAndImportApproval(a, res) => {
|
||||||
check_and_import_approval(state, a, |r| { let _ = res.send(r); })?.0
|
check_and_import_approval(state, metrics, a, |r| { let _ = res.send(r); })?.0
|
||||||
}
|
}
|
||||||
ApprovalVotingMessage::ApprovedAncestor(target, lower_bound, res ) => {
|
ApprovalVotingMessage::ApprovedAncestor(target, lower_bound, res ) => {
|
||||||
match handle_approved_ancestor(ctx, &state.db, target, lower_bound).await {
|
match handle_approved_ancestor(ctx, &state.db, target, lower_bound).await {
|
||||||
@@ -858,6 +921,7 @@ fn schedule_wakeup_action(
|
|||||||
|
|
||||||
fn check_and_import_assignment(
|
fn check_and_import_assignment(
|
||||||
state: &State<impl DBReader>,
|
state: &State<impl DBReader>,
|
||||||
|
metrics: &Metrics,
|
||||||
assignment: IndirectAssignmentCert,
|
assignment: IndirectAssignmentCert,
|
||||||
candidate_index: CandidateIndex,
|
candidate_index: CandidateIndex,
|
||||||
) -> SubsystemResult<(AssignmentCheckResult, Vec<Action>)> {
|
) -> SubsystemResult<(AssignmentCheckResult, Vec<Action>)> {
|
||||||
@@ -963,6 +1027,7 @@ fn check_and_import_assignment(
|
|||||||
// It also produces actions to schedule wakeups for the candidate.
|
// It also produces actions to schedule wakeups for the candidate.
|
||||||
let actions = check_and_apply_full_approval(
|
let actions = check_and_apply_full_approval(
|
||||||
state,
|
state,
|
||||||
|
&metrics,
|
||||||
Some((assignment.block_hash, block_entry)),
|
Some((assignment.block_hash, block_entry)),
|
||||||
assigned_candidate_hash,
|
assigned_candidate_hash,
|
||||||
candidate_entry,
|
candidate_entry,
|
||||||
@@ -974,6 +1039,7 @@ fn check_and_import_assignment(
|
|||||||
|
|
||||||
fn check_and_import_approval<T>(
|
fn check_and_import_approval<T>(
|
||||||
state: &State<impl DBReader>,
|
state: &State<impl DBReader>,
|
||||||
|
metrics: &Metrics,
|
||||||
approval: IndirectSignedApprovalVote,
|
approval: IndirectSignedApprovalVote,
|
||||||
with_response: impl FnOnce(ApprovalCheckResult) -> T,
|
with_response: impl FnOnce(ApprovalCheckResult) -> T,
|
||||||
) -> SubsystemResult<(Vec<Action>, T)> {
|
) -> SubsystemResult<(Vec<Action>, T)> {
|
||||||
@@ -1050,6 +1116,7 @@ fn check_and_import_approval<T>(
|
|||||||
|
|
||||||
let actions = import_checked_approval(
|
let actions = import_checked_approval(
|
||||||
state,
|
state,
|
||||||
|
&metrics,
|
||||||
Some((approval.block_hash, block_entry)),
|
Some((approval.block_hash, block_entry)),
|
||||||
approved_candidate_hash,
|
approved_candidate_hash,
|
||||||
candidate_entry,
|
candidate_entry,
|
||||||
@@ -1061,6 +1128,7 @@ fn check_and_import_approval<T>(
|
|||||||
|
|
||||||
fn import_checked_approval(
|
fn import_checked_approval(
|
||||||
state: &State<impl DBReader>,
|
state: &State<impl DBReader>,
|
||||||
|
metrics: &Metrics,
|
||||||
already_loaded: Option<(Hash, BlockEntry)>,
|
already_loaded: Option<(Hash, BlockEntry)>,
|
||||||
candidate_hash: CandidateHash,
|
candidate_hash: CandidateHash,
|
||||||
mut candidate_entry: CandidateEntry,
|
mut candidate_entry: CandidateEntry,
|
||||||
@@ -1076,6 +1144,7 @@ fn import_checked_approval(
|
|||||||
// This may include blocks beyond the already loaded block.
|
// This may include blocks beyond the already loaded block.
|
||||||
let actions = check_and_apply_full_approval(
|
let actions = check_and_apply_full_approval(
|
||||||
state,
|
state,
|
||||||
|
metrics,
|
||||||
already_loaded,
|
already_loaded,
|
||||||
candidate_hash,
|
candidate_hash,
|
||||||
candidate_entry,
|
candidate_entry,
|
||||||
@@ -1092,6 +1161,7 @@ fn import_checked_approval(
|
|||||||
// the candidate under any blocks filtered.
|
// the candidate under any blocks filtered.
|
||||||
fn check_and_apply_full_approval(
|
fn check_and_apply_full_approval(
|
||||||
state: &State<impl DBReader>,
|
state: &State<impl DBReader>,
|
||||||
|
metrics: &Metrics,
|
||||||
mut already_loaded: Option<(Hash, BlockEntry)>,
|
mut already_loaded: Option<(Hash, BlockEntry)>,
|
||||||
candidate_hash: CandidateHash,
|
candidate_hash: CandidateHash,
|
||||||
mut candidate_entry: CandidateEntry,
|
mut candidate_entry: CandidateEntry,
|
||||||
@@ -1150,13 +1220,13 @@ fn check_and_apply_full_approval(
|
|||||||
session_info.needed_approvals as _
|
session_info.needed_approvals as _
|
||||||
);
|
);
|
||||||
|
|
||||||
let now_approved = approval_checking::check_approval(
|
let check = approval_checking::check_approval(
|
||||||
&candidate_entry,
|
&candidate_entry,
|
||||||
approval_entry,
|
approval_entry,
|
||||||
required_tranches.clone(),
|
required_tranches.clone(),
|
||||||
);
|
);
|
||||||
|
|
||||||
if now_approved {
|
if let approval_checking::Check::Approved(no_shows) = check {
|
||||||
tracing::trace!(
|
tracing::trace!(
|
||||||
target: LOG_TARGET,
|
target: LOG_TARGET,
|
||||||
"Candidate approved {} under block {}",
|
"Candidate approved {} under block {}",
|
||||||
@@ -1164,8 +1234,21 @@ fn check_and_apply_full_approval(
|
|||||||
block_hash,
|
block_hash,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let was_approved = block_entry.is_fully_approved();
|
||||||
|
|
||||||
newly_approved.push(*block_hash);
|
newly_approved.push(*block_hash);
|
||||||
block_entry.mark_approved_by_hash(&candidate_hash);
|
block_entry.mark_approved_by_hash(&candidate_hash);
|
||||||
|
let is_approved = block_entry.is_fully_approved();
|
||||||
|
|
||||||
|
if no_shows != 0 {
|
||||||
|
metrics.on_no_shows(no_shows);
|
||||||
|
}
|
||||||
|
|
||||||
|
metrics.on_candidate_approved(tranche_now as _);
|
||||||
|
|
||||||
|
if is_approved && !was_approved {
|
||||||
|
metrics.on_block_approved(tranche_now as _)
|
||||||
|
}
|
||||||
|
|
||||||
actions.push(Action::WriteBlockEntry(block_entry));
|
actions.push(Action::WriteBlockEntry(block_entry));
|
||||||
}
|
}
|
||||||
@@ -1204,7 +1287,7 @@ fn should_trigger_assignment(
|
|||||||
&candidate_entry,
|
&candidate_entry,
|
||||||
&approval_entry,
|
&approval_entry,
|
||||||
RequiredTranches::All,
|
RequiredTranches::All,
|
||||||
),
|
).is_approved(),
|
||||||
RequiredTranches::Pending {
|
RequiredTranches::Pending {
|
||||||
maximum_broadcast,
|
maximum_broadcast,
|
||||||
clock_drift,
|
clock_drift,
|
||||||
@@ -1620,6 +1703,7 @@ async fn issue_approval(
|
|||||||
|
|
||||||
let actions = import_checked_approval(
|
let actions = import_checked_approval(
|
||||||
state,
|
state,
|
||||||
|
metrics,
|
||||||
Some((block_hash, block_entry)),
|
Some((block_hash, block_entry)),
|
||||||
candidate_hash,
|
candidate_hash,
|
||||||
candidate_entry,
|
candidate_entry,
|
||||||
|
|||||||
@@ -376,6 +376,7 @@ fn rejects_bad_assignment() {
|
|||||||
|
|
||||||
let res = check_and_import_assignment(
|
let res = check_and_import_assignment(
|
||||||
&mut state,
|
&mut state,
|
||||||
|
&Metrics(None),
|
||||||
assignment_good.clone(),
|
assignment_good.clone(),
|
||||||
candidate_index,
|
candidate_index,
|
||||||
).unwrap();
|
).unwrap();
|
||||||
@@ -396,6 +397,7 @@ fn rejects_bad_assignment() {
|
|||||||
|
|
||||||
let res = check_and_import_assignment(
|
let res = check_and_import_assignment(
|
||||||
&mut state,
|
&mut state,
|
||||||
|
&Metrics(None),
|
||||||
assignment,
|
assignment,
|
||||||
candidate_index,
|
candidate_index,
|
||||||
).unwrap();
|
).unwrap();
|
||||||
@@ -411,6 +413,7 @@ fn rejects_bad_assignment() {
|
|||||||
// same assignment, but this time rejected
|
// same assignment, but this time rejected
|
||||||
let res = check_and_import_assignment(
|
let res = check_and_import_assignment(
|
||||||
&mut state,
|
&mut state,
|
||||||
|
&Metrics(None),
|
||||||
assignment_good,
|
assignment_good,
|
||||||
candidate_index,
|
candidate_index,
|
||||||
).unwrap();
|
).unwrap();
|
||||||
@@ -441,6 +444,7 @@ fn rejects_assignment_in_future() {
|
|||||||
|
|
||||||
let res = check_and_import_assignment(
|
let res = check_and_import_assignment(
|
||||||
&mut state,
|
&mut state,
|
||||||
|
&Metrics(None),
|
||||||
assignment.clone(),
|
assignment.clone(),
|
||||||
candidate_index,
|
candidate_index,
|
||||||
).unwrap();
|
).unwrap();
|
||||||
@@ -455,6 +459,7 @@ fn rejects_assignment_in_future() {
|
|||||||
|
|
||||||
let res = check_and_import_assignment(
|
let res = check_and_import_assignment(
|
||||||
&mut state,
|
&mut state,
|
||||||
|
&Metrics(None),
|
||||||
assignment.clone(),
|
assignment.clone(),
|
||||||
candidate_index,
|
candidate_index,
|
||||||
).unwrap();
|
).unwrap();
|
||||||
@@ -479,6 +484,7 @@ fn rejects_assignment_with_unknown_candidate() {
|
|||||||
|
|
||||||
let res = check_and_import_assignment(
|
let res = check_and_import_assignment(
|
||||||
&mut state,
|
&mut state,
|
||||||
|
&Metrics(None),
|
||||||
assignment.clone(),
|
assignment.clone(),
|
||||||
candidate_index,
|
candidate_index,
|
||||||
).unwrap();
|
).unwrap();
|
||||||
@@ -510,6 +516,7 @@ fn assignment_import_updates_candidate_entry_and_schedules_wakeup() {
|
|||||||
|
|
||||||
let (res, actions) = check_and_import_assignment(
|
let (res, actions) = check_and_import_assignment(
|
||||||
&mut state,
|
&mut state,
|
||||||
|
&Metrics(None),
|
||||||
assignment.clone(),
|
assignment.clone(),
|
||||||
candidate_index,
|
candidate_index,
|
||||||
).unwrap();
|
).unwrap();
|
||||||
@@ -560,6 +567,7 @@ fn rejects_approval_before_assignment() {
|
|||||||
|
|
||||||
let (actions, res) = check_and_import_approval(
|
let (actions, res) = check_and_import_approval(
|
||||||
&state,
|
&state,
|
||||||
|
&Metrics(None),
|
||||||
vote,
|
vote,
|
||||||
|r| r
|
|r| r
|
||||||
).unwrap();
|
).unwrap();
|
||||||
@@ -591,6 +599,7 @@ fn rejects_approval_if_no_candidate_entry() {
|
|||||||
|
|
||||||
let (actions, res) = check_and_import_approval(
|
let (actions, res) = check_and_import_approval(
|
||||||
&state,
|
&state,
|
||||||
|
&Metrics(None),
|
||||||
vote,
|
vote,
|
||||||
|r| r
|
|r| r
|
||||||
).unwrap();
|
).unwrap();
|
||||||
@@ -628,6 +637,7 @@ fn rejects_approval_if_no_block_entry() {
|
|||||||
|
|
||||||
let (actions, res) = check_and_import_approval(
|
let (actions, res) = check_and_import_approval(
|
||||||
&state,
|
&state,
|
||||||
|
&Metrics(None),
|
||||||
vote,
|
vote,
|
||||||
|r| r
|
|r| r
|
||||||
).unwrap();
|
).unwrap();
|
||||||
@@ -669,6 +679,7 @@ fn accepts_and_imports_approval_after_assignment() {
|
|||||||
|
|
||||||
let (actions, res) = check_and_import_approval(
|
let (actions, res) = check_and_import_approval(
|
||||||
&state,
|
&state,
|
||||||
|
&Metrics(None),
|
||||||
vote,
|
vote,
|
||||||
|r| r
|
|r| r
|
||||||
).unwrap();
|
).unwrap();
|
||||||
@@ -722,6 +733,7 @@ fn second_approval_import_is_no_op() {
|
|||||||
|
|
||||||
let (actions, res) = check_and_import_approval(
|
let (actions, res) = check_and_import_approval(
|
||||||
&state,
|
&state,
|
||||||
|
&Metrics(None),
|
||||||
vote,
|
vote,
|
||||||
|r| r
|
|r| r
|
||||||
).unwrap();
|
).unwrap();
|
||||||
@@ -767,6 +779,7 @@ fn check_and_apply_full_approval_sets_flag_and_bit() {
|
|||||||
|
|
||||||
let actions = check_and_apply_full_approval(
|
let actions = check_and_apply_full_approval(
|
||||||
&state,
|
&state,
|
||||||
|
&Metrics(None),
|
||||||
None,
|
None,
|
||||||
candidate_hash,
|
candidate_hash,
|
||||||
state.db.candidate_entries.get(&candidate_hash).unwrap().clone(),
|
state.db.candidate_entries.get(&candidate_hash).unwrap().clone(),
|
||||||
@@ -830,6 +843,7 @@ fn check_and_apply_full_approval_does_not_load_cached_block_from_db() {
|
|||||||
|
|
||||||
let actions = check_and_apply_full_approval(
|
let actions = check_and_apply_full_approval(
|
||||||
&state,
|
&state,
|
||||||
|
&Metrics(None),
|
||||||
Some((block_hash, block_entry)),
|
Some((block_hash, block_entry)),
|
||||||
candidate_hash,
|
candidate_hash,
|
||||||
state.db.candidate_entries.get(&candidate_hash).unwrap().clone(),
|
state.db.candidate_entries.get(&candidate_hash).unwrap().clone(),
|
||||||
@@ -1329,6 +1343,7 @@ fn block_not_approved_until_all_candidates_approved() {
|
|||||||
|
|
||||||
let actions = check_and_apply_full_approval(
|
let actions = check_and_apply_full_approval(
|
||||||
&state,
|
&state,
|
||||||
|
&Metrics(None),
|
||||||
None,
|
None,
|
||||||
candidate_hash_2,
|
candidate_hash_2,
|
||||||
state.db.candidate_entries.get(&candidate_hash_2).unwrap().clone(),
|
state.db.candidate_entries.get(&candidate_hash_2).unwrap().clone(),
|
||||||
@@ -1423,6 +1438,7 @@ fn candidate_approval_applied_to_all_blocks() {
|
|||||||
|
|
||||||
let actions = check_and_apply_full_approval(
|
let actions = check_and_apply_full_approval(
|
||||||
&state,
|
&state,
|
||||||
|
&Metrics(None),
|
||||||
None,
|
None,
|
||||||
candidate_hash,
|
candidate_hash,
|
||||||
state.db.candidate_entries.get(&candidate_hash).unwrap().clone(),
|
state.db.candidate_entries.get(&candidate_hash).unwrap().clone(),
|
||||||
|
|||||||
Reference in New Issue
Block a user