Make candidate validation timeouts configurable (#4001)

* pvf: make execution timeout configurable

* guide: add timeouts to candidate validation params

* add timeouts to candidate validation messages

* fmt

* port backing to use the backing pvf timeout

* port approval-voting to use the execution timeout

* port dispute participation to use the correct timeout

* fmt

* address grumbles & test failure
This commit is contained in:
Robert Habermeier
2021-10-04 16:53:36 +02:00
committed by GitHub
parent 114e757988
commit 6002865874
19 changed files with 192 additions and 62 deletions
+19 -9
View File
@@ -317,9 +317,10 @@ fn backing_second_works() {
CandidateValidationMessage::ValidateFromChainState(
c,
pov,
timeout,
tx,
)
) if pov == pov && &c == candidate.descriptor() => {
) if pov == pov && &c == candidate.descriptor() && timeout == BACKING_EXECUTION_TIMEOUT => {
tx.send(Ok(
ValidationResult::Valid(CandidateCommitments {
head_data: expected_head_data.clone(),
@@ -476,9 +477,10 @@ fn backing_works() {
CandidateValidationMessage::ValidateFromChainState(
c,
pov,
timeout,
tx,
)
) if pov == pov && &c == candidate_a.descriptor() => {
) if pov == pov && &c == candidate_a.descriptor() && timeout == BACKING_EXECUTION_TIMEOUT => {
tx.send(Ok(
ValidationResult::Valid(CandidateCommitments {
head_data: expected_head_data.clone(),
@@ -669,9 +671,10 @@ fn backing_works_while_validation_ongoing() {
CandidateValidationMessage::ValidateFromChainState(
c,
pov,
timeout,
tx,
)
) if pov == pov && &c == candidate_a.descriptor() => {
) if pov == pov && &c == candidate_a.descriptor() && timeout == BACKING_EXECUTION_TIMEOUT => {
// we never validate the candidate. our local node
// shouldn't issue any statements.
std::mem::forget(tx);
@@ -834,9 +837,10 @@ fn backing_misbehavior_works() {
CandidateValidationMessage::ValidateFromChainState(
c,
pov,
timeout,
tx,
)
) if pov == pov && &c == candidate_a.descriptor() => {
) if pov == pov && &c == candidate_a.descriptor() && timeout == BACKING_EXECUTION_TIMEOUT => {
tx.send(Ok(
ValidationResult::Valid(CandidateCommitments {
head_data: expected_head_data.clone(),
@@ -980,9 +984,10 @@ fn backing_dont_second_invalid() {
CandidateValidationMessage::ValidateFromChainState(
c,
pov,
timeout,
tx,
)
) if pov == pov && &c == candidate_a.descriptor() => {
) if pov == pov && &c == candidate_a.descriptor() && timeout == BACKING_EXECUTION_TIMEOUT => {
tx.send(Ok(ValidationResult::Invalid(InvalidCandidate::BadReturn))).unwrap();
}
);
@@ -1008,9 +1013,10 @@ fn backing_dont_second_invalid() {
CandidateValidationMessage::ValidateFromChainState(
c,
pov,
timeout,
tx,
)
) if pov == pov && &c == candidate_b.descriptor() => {
) if pov == pov && &c == candidate_b.descriptor() && timeout == BACKING_EXECUTION_TIMEOUT => {
tx.send(Ok(
ValidationResult::Valid(CandidateCommitments {
head_data: expected_head_data.clone(),
@@ -1138,9 +1144,10 @@ fn backing_second_after_first_fails_works() {
CandidateValidationMessage::ValidateFromChainState(
c,
pov,
timeout,
tx,
)
) if pov == pov && &c == candidate.descriptor() => {
) if pov == pov && &c == candidate.descriptor() && timeout == BACKING_EXECUTION_TIMEOUT => {
tx.send(Ok(ValidationResult::Invalid(InvalidCandidate::BadReturn))).unwrap();
}
);
@@ -1186,6 +1193,7 @@ fn backing_second_after_first_fails_works() {
_,
pov,
_,
_,
)
) => {
assert_eq!(&*pov, &pov_to_second);
@@ -1270,9 +1278,10 @@ fn backing_works_after_failed_validation() {
CandidateValidationMessage::ValidateFromChainState(
c,
pov,
timeout,
tx,
)
) if pov == pov && &c == candidate.descriptor() => {
) if pov == pov && &c == candidate.descriptor() && timeout == BACKING_EXECUTION_TIMEOUT => {
tx.send(Err(ValidationFailed("Internal test error".into()))).unwrap();
}
);
@@ -1646,9 +1655,10 @@ fn retry_works() {
CandidateValidationMessage::ValidateFromChainState(
c,
pov,
timeout,
_tx,
)
) if pov == pov && &c == candidate.descriptor()
) if pov == pov && &c == candidate.descriptor() && timeout == BACKING_EXECUTION_TIMEOUT
);
virtual_overseer
});