Refactor candidate validation messages (#2219)

This commit is contained in:
s0me0ne-unkn0wn
2023-11-08 15:21:58 +01:00
committed by GitHub
parent 1bc0885829
commit 50390950d8
14 changed files with 384 additions and 354 deletions
+36 -24
View File
@@ -143,14 +143,18 @@ pub enum CandidateValidationMessage {
///
/// If there is no state available which can provide this data or the core for
/// the para is not free at the relay-parent, an error is returned.
ValidateFromChainState(
CandidateReceipt,
Arc<PoV>,
ExecutorParams,
/// Execution timeout
PvfExecTimeoutKind,
oneshot::Sender<Result<ValidationResult, ValidationFailed>>,
),
ValidateFromChainState {
/// The candidate receipt
candidate_receipt: CandidateReceipt,
/// The proof-of-validity
pov: Arc<PoV>,
/// Session's executor parameters
executor_params: ExecutorParams,
/// Execution timeout kind (backing/approvals)
exec_timeout_kind: PvfExecTimeoutKind,
/// The sending side of the response channel
response_sender: oneshot::Sender<Result<ValidationResult, ValidationFailed>>,
},
/// Validate a candidate with provided, exhaustive parameters for validation.
///
/// Explicitly provide the `PersistedValidationData` and `ValidationCode` so this can do full
@@ -160,27 +164,35 @@ pub enum CandidateValidationMessage {
/// cases where the validity of the candidate is established. This is the case for the typical
/// use-case: secondary checkers would use this request relying on the full prior checks
/// performed by the relay-chain.
ValidateFromExhaustive(
PersistedValidationData,
ValidationCode,
CandidateReceipt,
Arc<PoV>,
ExecutorParams,
/// Execution timeout
PvfExecTimeoutKind,
oneshot::Sender<Result<ValidationResult, ValidationFailed>>,
),
ValidateFromExhaustive {
/// Persisted validation data
validation_data: PersistedValidationData,
/// Validation code
validation_code: ValidationCode,
/// The candidate receipt
candidate_receipt: CandidateReceipt,
/// The proof-of-validity
pov: Arc<PoV>,
/// Session's executor parameters
executor_params: ExecutorParams,
/// Execution timeout kind (backing/approvals)
exec_timeout_kind: PvfExecTimeoutKind,
/// The sending side of the response channel
response_sender: oneshot::Sender<Result<ValidationResult, ValidationFailed>>,
},
/// Try to compile the given validation code and send back
/// the outcome.
///
/// The validation code is specified by the hash and will be queried from the runtime API at
/// the given relay-parent.
PreCheck(
// Relay-parent
Hash,
ValidationCodeHash,
oneshot::Sender<PreCheckOutcome>,
),
PreCheck {
/// Relay-parent
relay_parent: Hash,
/// Validation code hash
validation_code_hash: ValidationCodeHash,
/// The sending side of the response channel
response_sender: oneshot::Sender<PreCheckOutcome>,
},
}
/// Messages received by the Collator Protocol subsystem.