Skip to content

Commit

Permalink
Refactor candidate validation messages (#2219)
Browse files Browse the repository at this point in the history
  • Loading branch information
s0me0ne-unkn0wn authored Nov 8, 2023
1 parent 1bc0885 commit 5039095
Show file tree
Hide file tree
Showing 14 changed files with 384 additions and 354 deletions.
14 changes: 7 additions & 7 deletions polkadot/node/core/approval-voting/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2861,15 +2861,15 @@ async fn launch_approval<Context>(

let (val_tx, val_rx) = oneshot::channel();
sender
.send_message(CandidateValidationMessage::ValidateFromExhaustive(
available_data.validation_data,
.send_message(CandidateValidationMessage::ValidateFromExhaustive {
validation_data: available_data.validation_data,
validation_code,
candidate.clone(),
available_data.pov,
candidate_receipt: candidate.clone(),
pov: available_data.pov,
executor_params,
PvfExecTimeoutKind::Approval,
val_tx,
))
exec_timeout_kind: PvfExecTimeoutKind::Approval,
response_sender: val_tx,
})
.await;

match val_rx.await {
Expand Down
8 changes: 6 additions & 2 deletions polkadot/node/core/approval-voting/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2704,8 +2704,12 @@ async fn handle_double_assignment_import(

assert_matches!(
overseer_recv(virtual_overseer).await,
AllMessages::CandidateValidation(CandidateValidationMessage::ValidateFromExhaustive(_, _, _, _, _, timeout, tx)) if timeout == PvfExecTimeoutKind::Approval => {
tx.send(Ok(ValidationResult::Valid(Default::default(), Default::default())))
AllMessages::CandidateValidation(CandidateValidationMessage::ValidateFromExhaustive {
exec_timeout_kind,
response_sender,
..
}) if exec_timeout_kind == PvfExecTimeoutKind::Approval => {
response_sender.send(Ok(ValidationResult::Valid(Default::default(), Default::default())))
.unwrap();
}
);
Expand Down
16 changes: 8 additions & 8 deletions polkadot/node/core/backing/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -551,24 +551,24 @@ async fn request_pov(

async fn request_candidate_validation(
sender: &mut impl overseer::CandidateBackingSenderTrait,
pvd: PersistedValidationData,
code: ValidationCode,
validation_data: PersistedValidationData,
validation_code: ValidationCode,
candidate_receipt: CandidateReceipt,
pov: Arc<PoV>,
executor_params: ExecutorParams,
) -> Result<ValidationResult, Error> {
let (tx, rx) = oneshot::channel();

sender
.send_message(CandidateValidationMessage::ValidateFromExhaustive(
pvd,
code,
.send_message(CandidateValidationMessage::ValidateFromExhaustive {
validation_data,
validation_code,
candidate_receipt,
pov,
executor_params,
PvfExecTimeoutKind::Backing,
tx,
))
exec_timeout_kind: PvfExecTimeoutKind::Backing,
response_sender: tx,
})
.await;

match rx.await {
Expand Down
Loading

0 comments on commit 5039095

Please sign in to comment.