Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Enable approval-coalescing by default
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandru Gheorghe <[email protected]>
  • Loading branch information
alexggh committed Aug 22, 2023
1 parent 3264a00 commit d5fc80c
Showing 1 changed file with 30 additions and 28 deletions.
58 changes: 30 additions & 28 deletions node/core/approval-voting/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,7 @@ impl State {
#[overseer::contextbounds(ApprovalVoting, prefix = self::overseer)]
async fn get_approval_voting_params_or_default<Context>(
&mut self,
ctx: &mut Context,
_ctx: &mut Context,
block_hash: Hash,
) -> ApprovalVotingParams {
if let Some(params) = self
Expand All @@ -847,29 +847,30 @@ impl State {
{
*params
} else {
let (s_tx, s_rx) = oneshot::channel();

ctx.send_message(RuntimeApiMessage::Request(
block_hash,
RuntimeApiRequest::ApprovalVotingParams(s_tx),
))
.await;

match s_rx.await {
Ok(Ok(params)) => {
self.approval_voting_params_cache
.as_mut()
.map(|cache| cache.put(block_hash, params));
params
},
_ => {
gum::error!(
target: LOG_TARGET,
"Could not request approval voting params from runtime using defaults"
);
ApprovalVotingParams { max_approval_coalesce_count: 1 }
},
}
// let (s_tx, s_rx) = oneshot::channel();

// ctx.send_message(RuntimeApiMessage::Request(
// block_hash,
// RuntimeApiRequest::ApprovalVotingParams(s_tx),
// ))
// .await;

// match s_rx.await {
// Ok(Ok(params)) => {
// self.approval_voting_params_cache
// .as_mut()
// .map(|cache| cache.put(block_hash, params));
// params
// },
// _ => {
// gum::error!(
// target: LOG_TARGET,
// "Could not request approval voting params from runtime using defaults"
// );
// TODO: Uncomment this after versi test
ApprovalVotingParams { max_approval_coalesce_count: 6 }
// },
// }
}
}
}
Expand Down Expand Up @@ -2681,9 +2682,9 @@ where
metrics.on_no_shows(no_shows);
}
if check == Check::ApprovedOneThird {
// No-shows are not counted when more than one third of validators approve a candidate,
// so count candidates where more than one third of validators had to approve it,
// this is indicative of something breaking.
// No-shows are not counted when more than one third of validators approve a
// candidate, so count candidates where more than one third of validators had to
// approve it, this is indicative of something breaking.
metrics.on_approved_by_one_third()
}

Expand Down Expand Up @@ -3366,7 +3367,8 @@ async fn maybe_create_signature<Context>(
let oldest_candidate_to_sign = match block_entry.longest_waiting_candidate_signature() {
Some(candidate) => candidate,
// No cached candidates, nothing to do here, this just means the timer fired,
// but the signatures were already sent because we gathered more than max_approval_coalesce_count.
// but the signatures were already sent because we gathered more than
// max_approval_coalesce_count.
None => return Ok(None),
};

Expand Down

0 comments on commit d5fc80c

Please sign in to comment.