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 <marcin@realemail.net>
This commit is contained in:
jserrat
2023-11-20 11:00:19 +00:00
committed by GitHub
parent b35300c377
commit ede4a36262
18 changed files with 276 additions and 248 deletions
+18 -18
View File
@@ -30,7 +30,7 @@ use polkadot_node_subsystem::{
use polkadot_primitives::{
CandidateCommitments, CandidateDescriptor, CandidateReceipt, PersistedValidationData,
PvfExecTimeoutKind,
PvfExecKind,
};
use futures::channel::oneshot;
@@ -90,10 +90,10 @@ impl FakeCandidateValidation {
}
}
fn should_misbehave(&self, timeout: PvfExecTimeoutKind) -> bool {
fn should_misbehave(&self, timeout: PvfExecKind) -> bool {
match timeout {
PvfExecTimeoutKind::Backing => self.includes_backing(),
PvfExecTimeoutKind::Approval => self.includes_approval(),
PvfExecKind::Backing => self.includes_backing(),
PvfExecKind::Approval => self.includes_approval(),
}
}
}
@@ -279,13 +279,13 @@ where
candidate_receipt,
pov,
executor_params,
exec_timeout_kind,
exec_kind,
response_sender,
..
},
} => {
match self.fake_validation {
x if x.misbehaves_valid() && x.should_misbehave(exec_timeout_kind) => {
x if x.misbehaves_valid() && x.should_misbehave(exec_kind) => {
// Behave normally if the `PoV` is not known to be malicious.
if pov.block_data.0.as_slice() != MALICIOUS_POV {
return Some(FromOrchestra::Communication {
@@ -295,7 +295,7 @@ where
candidate_receipt,
pov,
executor_params,
exec_timeout_kind,
exec_kind,
response_sender,
},
})
@@ -333,14 +333,14 @@ where
candidate_receipt,
pov,
executor_params,
exec_timeout_kind,
exec_kind,
response_sender,
},
})
},
}
},
x if x.misbehaves_invalid() && x.should_misbehave(exec_timeout_kind) => {
x if x.misbehaves_invalid() && x.should_misbehave(exec_kind) => {
// Set the validation result to invalid with probability `p` and trigger a
// dispute
let behave_maliciously = self.distribution.sample(&mut rand::thread_rng());
@@ -373,7 +373,7 @@ where
candidate_receipt,
pov,
executor_params,
exec_timeout_kind,
exec_kind,
response_sender,
},
})
@@ -388,7 +388,7 @@ where
candidate_receipt,
pov,
executor_params,
exec_timeout_kind,
exec_kind,
response_sender,
},
}),
@@ -401,13 +401,13 @@ where
candidate_receipt,
pov,
executor_params,
exec_timeout_kind,
exec_kind,
response_sender,
..
},
} => {
match self.fake_validation {
x if x.misbehaves_valid() && x.should_misbehave(exec_timeout_kind) => {
x if x.misbehaves_valid() && x.should_misbehave(exec_kind) => {
// Behave normally if the `PoV` is not known to be malicious.
if pov.block_data.0.as_slice() != MALICIOUS_POV {
return Some(FromOrchestra::Communication {
@@ -415,7 +415,7 @@ where
candidate_receipt,
pov,
executor_params,
exec_timeout_kind,
exec_kind,
response_sender,
},
})
@@ -445,13 +445,13 @@ where
candidate_receipt,
pov,
executor_params,
exec_timeout_kind,
exec_kind,
response_sender,
},
}),
}
},
x if x.misbehaves_invalid() && x.should_misbehave(exec_timeout_kind) => {
x if x.misbehaves_invalid() && x.should_misbehave(exec_kind) => {
// Maliciously set the validation result to invalid for a valid candidate
// with probability `p`
let behave_maliciously = self.distribution.sample(&mut rand::thread_rng());
@@ -479,7 +479,7 @@ where
candidate_receipt,
pov,
executor_params,
exec_timeout_kind,
exec_kind,
response_sender,
},
})
@@ -491,7 +491,7 @@ where
candidate_receipt,
pov,
executor_params,
exec_timeout_kind,
exec_kind,
response_sender,
},
}),