Skip to content

Commit ede4a36

Browse files
jpserratmrcnski
andauthored
remove retry from backers on failed candidate validation (#2182)
Hey guys, as discussed I've changed the name to a more general one `PvfExecKind`, is this good or too general? Creating this as a draft, I still have to fix the tests. Closes #1585 Kusama address: FkB6QEo8VnV3oifugNj5NeVG3Mvq1zFbrUu4P5YwRoe5mQN --------- Co-authored-by: command-bot <> Co-authored-by: Marcin S <[email protected]>
1 parent b35300c commit ede4a36

18 files changed

Lines changed: 271 additions & 243 deletions

File tree

polkadot/node/core/approval-voting/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ use polkadot_node_subsystem_util::{
5454
};
5555
use polkadot_primitives::{
5656
ApprovalVote, BlockNumber, CandidateHash, CandidateIndex, CandidateReceipt, DisputeStatement,
57-
ExecutorParams, GroupIndex, Hash, PvfExecTimeoutKind, SessionIndex, SessionInfo,
57+
ExecutorParams, GroupIndex, Hash, PvfExecKind, SessionIndex, SessionInfo,
5858
ValidDisputeStatementKind, ValidatorId, ValidatorIndex, ValidatorPair, ValidatorSignature,
5959
};
6060
use sc_keystore::LocalKeystore;
@@ -2867,7 +2867,7 @@ async fn launch_approval<Context>(
28672867
candidate_receipt: candidate.clone(),
28682868
pov: available_data.pov,
28692869
executor_params,
2870-
exec_timeout_kind: PvfExecTimeoutKind::Approval,
2870+
exec_kind: PvfExecKind::Approval,
28712871
response_sender: val_tx,
28722872
})
28732873
.await;

polkadot/node/core/approval-voting/src/tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2705,10 +2705,10 @@ async fn handle_double_assignment_import(
27052705
assert_matches!(
27062706
overseer_recv(virtual_overseer).await,
27072707
AllMessages::CandidateValidation(CandidateValidationMessage::ValidateFromExhaustive {
2708-
exec_timeout_kind,
2708+
exec_kind,
27092709
response_sender,
27102710
..
2711-
}) if exec_timeout_kind == PvfExecTimeoutKind::Approval => {
2711+
}) if exec_kind == PvfExecKind::Approval => {
27122712
response_sender.send(Ok(ValidationResult::Valid(Default::default(), Default::default())))
27132713
.unwrap();
27142714
}

polkadot/node/core/backing/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ use polkadot_node_subsystem_util::{
106106
use polkadot_primitives::{
107107
BackedCandidate, CandidateCommitments, CandidateHash, CandidateReceipt,
108108
CommittedCandidateReceipt, CoreIndex, CoreState, ExecutorParams, Hash, Id as ParaId,
109-
PersistedValidationData, PvfExecTimeoutKind, SigningContext, ValidationCode, ValidatorId,
109+
PersistedValidationData, PvfExecKind, SigningContext, ValidationCode, ValidatorId,
110110
ValidatorIndex, ValidatorSignature, ValidityAttestation,
111111
};
112112
use sp_keystore::KeystorePtr;
@@ -566,7 +566,7 @@ async fn request_candidate_validation(
566566
candidate_receipt,
567567
pov,
568568
executor_params,
569-
exec_timeout_kind: PvfExecTimeoutKind::Backing,
569+
exec_kind: PvfExecKind::Backing,
570570
response_sender: tx,
571571
})
572572
.await;

polkadot/node/core/backing/src/tests/mod.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ use polkadot_node_subsystem::{
3333
};
3434
use polkadot_node_subsystem_test_helpers as test_helpers;
3535
use polkadot_primitives::{
36-
CandidateDescriptor, GroupRotationInfo, HeadData, PersistedValidationData, PvfExecTimeoutKind,
36+
CandidateDescriptor, GroupRotationInfo, HeadData, PersistedValidationData, PvfExecKind,
3737
ScheduledCore, SessionIndex, LEGACY_MIN_BACKING_VOTES,
3838
};
3939
use sp_application_crypto::AppCrypto;
@@ -344,14 +344,14 @@ async fn assert_validate_from_exhaustive(
344344
validation_data,
345345
validation_code,
346346
candidate_receipt,
347-
exec_timeout_kind,
347+
exec_kind,
348348
response_sender,
349349
..
350350
},
351351
) if validation_data == *assert_pvd &&
352352
validation_code == *assert_validation_code &&
353353
*pov == *assert_pov && &candidate_receipt.descriptor == assert_candidate.descriptor() &&
354-
exec_timeout_kind == PvfExecTimeoutKind::Backing &&
354+
exec_kind == PvfExecKind::Backing &&
355355
candidate_receipt.commitments_hash == assert_candidate.commitments.hash() =>
356356
{
357357
response_sender.send(Ok(ValidationResult::Valid(
@@ -550,14 +550,14 @@ fn backing_works() {
550550
validation_code,
551551
candidate_receipt,
552552
pov,
553-
exec_timeout_kind,
553+
exec_kind,
554554
response_sender,
555555
..
556556
},
557557
) if validation_data == pvd_ab &&
558558
validation_code == validation_code_ab &&
559559
*pov == pov_ab && &candidate_receipt.descriptor == candidate_a.descriptor() &&
560-
exec_timeout_kind == PvfExecTimeoutKind::Backing &&
560+
exec_kind == PvfExecKind::Backing &&
561561
candidate_receipt.commitments_hash == candidate_a_commitments_hash =>
562562
{
563563
response_sender.send(Ok(
@@ -729,14 +729,14 @@ fn backing_works_while_validation_ongoing() {
729729
validation_code,
730730
candidate_receipt,
731731
pov,
732-
exec_timeout_kind,
732+
exec_kind,
733733
response_sender,
734734
..
735735
},
736736
) if validation_data == pvd_abc &&
737737
validation_code == validation_code_abc &&
738738
*pov == pov_abc && &candidate_receipt.descriptor == candidate_a.descriptor() &&
739-
exec_timeout_kind == PvfExecTimeoutKind::Backing &&
739+
exec_kind == PvfExecKind::Backing &&
740740
candidate_a_commitments_hash == candidate_receipt.commitments_hash =>
741741
{
742742
// we never validate the candidate. our local node
@@ -890,14 +890,14 @@ fn backing_misbehavior_works() {
890890
validation_code,
891891
candidate_receipt,
892892
pov,
893-
exec_timeout_kind,
893+
exec_kind,
894894
response_sender,
895895
..
896896
},
897897
) if validation_data == pvd_a &&
898898
validation_code == validation_code_a &&
899899
*pov == pov_a && &candidate_receipt.descriptor == candidate_a.descriptor() &&
900-
exec_timeout_kind == PvfExecTimeoutKind::Backing &&
900+
exec_kind == PvfExecKind::Backing &&
901901
candidate_a_commitments_hash == candidate_receipt.commitments_hash =>
902902
{
903903
response_sender.send(Ok(
@@ -1057,14 +1057,14 @@ fn backing_dont_second_invalid() {
10571057
validation_code,
10581058
candidate_receipt,
10591059
pov,
1060-
exec_timeout_kind,
1060+
exec_kind,
10611061
response_sender,
10621062
..
10631063
},
10641064
) if validation_data == pvd_a &&
10651065
validation_code == validation_code_a &&
10661066
*pov == pov_block_a && &candidate_receipt.descriptor == candidate_a.descriptor() &&
1067-
exec_timeout_kind == PvfExecTimeoutKind::Backing &&
1067+
exec_kind == PvfExecKind::Backing &&
10681068
candidate_a.commitments.hash() == candidate_receipt.commitments_hash =>
10691069
{
10701070
response_sender.send(Ok(ValidationResult::Invalid(InvalidCandidate::BadReturn))).unwrap();
@@ -1097,14 +1097,14 @@ fn backing_dont_second_invalid() {
10971097
validation_code,
10981098
candidate_receipt,
10991099
pov,
1100-
exec_timeout_kind,
1100+
exec_kind,
11011101
response_sender,
11021102
..
11031103
},
11041104
) if validation_data == pvd_b &&
11051105
validation_code == validation_code_b &&
11061106
*pov == pov_block_b && &candidate_receipt.descriptor == candidate_b.descriptor() &&
1107-
exec_timeout_kind == PvfExecTimeoutKind::Backing &&
1107+
exec_kind == PvfExecKind::Backing &&
11081108
candidate_b.commitments.hash() == candidate_receipt.commitments_hash =>
11091109
{
11101110
response_sender.send(Ok(
@@ -1224,14 +1224,14 @@ fn backing_second_after_first_fails_works() {
12241224
validation_code,
12251225
candidate_receipt,
12261226
pov,
1227-
exec_timeout_kind,
1227+
exec_kind,
12281228
response_sender,
12291229
..
12301230
},
12311231
) if validation_data == pvd_a &&
12321232
validation_code == validation_code_a &&
12331233
*pov == pov_a && &candidate_receipt.descriptor == candidate.descriptor() &&
1234-
exec_timeout_kind == PvfExecTimeoutKind::Backing &&
1234+
exec_kind == PvfExecKind::Backing &&
12351235
candidate.commitments.hash() == candidate_receipt.commitments_hash =>
12361236
{
12371237
response_sender.send(Ok(ValidationResult::Invalid(InvalidCandidate::BadReturn))).unwrap();
@@ -1368,14 +1368,14 @@ fn backing_works_after_failed_validation() {
13681368
validation_code,
13691369
candidate_receipt,
13701370
pov,
1371-
exec_timeout_kind,
1371+
exec_kind,
13721372
response_sender,
13731373
..
13741374
},
13751375
) if validation_data == pvd_a &&
13761376
validation_code == validation_code_a &&
13771377
*pov == pov_a && &candidate_receipt.descriptor == candidate.descriptor() &&
1378-
exec_timeout_kind == PvfExecTimeoutKind::Backing &&
1378+
exec_kind == PvfExecKind::Backing &&
13791379
candidate.commitments.hash() == candidate_receipt.commitments_hash =>
13801380
{
13811381
response_sender.send(Err(ValidationFailed("Internal test error".into()))).unwrap();
@@ -1634,13 +1634,13 @@ fn retry_works() {
16341634
validation_code,
16351635
candidate_receipt,
16361636
pov,
1637-
exec_timeout_kind,
1637+
exec_kind,
16381638
..
16391639
},
16401640
) if validation_data == pvd_a &&
16411641
validation_code == validation_code_a &&
16421642
*pov == pov_a && &candidate_receipt.descriptor == candidate.descriptor() &&
1643-
exec_timeout_kind == PvfExecTimeoutKind::Backing &&
1643+
exec_kind == PvfExecKind::Backing &&
16441644
candidate.commitments.hash() == candidate_receipt.commitments_hash
16451645
);
16461646
virtual_overseer

polkadot/node/core/backing/src/tests/prospective_parachains.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,14 +232,14 @@ async fn assert_validate_seconded_candidate(
232232
validation_code,
233233
candidate_receipt,
234234
pov,
235-
exec_timeout_kind,
235+
exec_kind,
236236
response_sender,
237237
..
238238
}) if &validation_data == assert_pvd &&
239239
&validation_code == assert_validation_code &&
240240
&*pov == assert_pov &&
241241
&candidate_receipt.descriptor == candidate.descriptor() &&
242-
exec_timeout_kind == PvfExecTimeoutKind::Backing &&
242+
exec_kind == PvfExecKind::Backing &&
243243
candidate.commitments.hash() == candidate_receipt.commitments_hash =>
244244
{
245245
response_sender.send(Ok(ValidationResult::Valid(

0 commit comments

Comments
 (0)