mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 23:21:06 +00:00
Use cached session index to obtain executor params (#1190)
* Import changes from archieved repo * Revert erroneous changes * Fix more tests * Resolve discussions * Fix MORE tests * approval-voting: launch_approval better interface (#1355) --------- Co-authored-by: Javier Viola <javier@parity.io> Co-authored-by: ordian <noreply@reusable.software> Co-authored-by: ordian <write@reusable.software>
This commit is contained in:
@@ -164,6 +164,7 @@ async fn run<Context>(
|
||||
CandidateValidationMessage::ValidateFromChainState(
|
||||
candidate_receipt,
|
||||
pov,
|
||||
executor_params,
|
||||
timeout,
|
||||
response_sender,
|
||||
) => {
|
||||
@@ -179,6 +180,7 @@ async fn run<Context>(
|
||||
validation_host,
|
||||
candidate_receipt,
|
||||
pov,
|
||||
executor_params,
|
||||
timeout,
|
||||
&metrics,
|
||||
)
|
||||
@@ -196,23 +198,23 @@ async fn run<Context>(
|
||||
validation_code,
|
||||
candidate_receipt,
|
||||
pov,
|
||||
executor_params,
|
||||
timeout,
|
||||
response_sender,
|
||||
) => {
|
||||
let bg = {
|
||||
let mut sender = ctx.sender().clone();
|
||||
let metrics = metrics.clone();
|
||||
let validation_host = validation_host.clone();
|
||||
|
||||
async move {
|
||||
let _timer = metrics.time_validate_from_exhaustive();
|
||||
let res = validate_candidate_exhaustive(
|
||||
&mut sender,
|
||||
validation_host,
|
||||
persisted_validation_data,
|
||||
validation_code,
|
||||
candidate_receipt,
|
||||
pov,
|
||||
executor_params,
|
||||
timeout,
|
||||
&metrics,
|
||||
)
|
||||
@@ -497,6 +499,7 @@ async fn validate_from_chain_state<Sender>(
|
||||
validation_host: ValidationHost,
|
||||
candidate_receipt: CandidateReceipt,
|
||||
pov: Arc<PoV>,
|
||||
executor_params: ExecutorParams,
|
||||
exec_timeout_kind: PvfExecTimeoutKind,
|
||||
metrics: &Metrics,
|
||||
) -> Result<ValidationResult, ValidationFailed>
|
||||
@@ -511,12 +514,12 @@ where
|
||||
};
|
||||
|
||||
let validation_result = validate_candidate_exhaustive(
|
||||
sender,
|
||||
validation_host,
|
||||
validation_data,
|
||||
validation_code,
|
||||
candidate_receipt.clone(),
|
||||
pov,
|
||||
executor_params,
|
||||
exec_timeout_kind,
|
||||
metrics,
|
||||
)
|
||||
@@ -546,19 +549,16 @@ where
|
||||
validation_result
|
||||
}
|
||||
|
||||
async fn validate_candidate_exhaustive<Sender>(
|
||||
sender: &mut Sender,
|
||||
async fn validate_candidate_exhaustive(
|
||||
mut validation_backend: impl ValidationBackend + Send,
|
||||
persisted_validation_data: PersistedValidationData,
|
||||
validation_code: ValidationCode,
|
||||
candidate_receipt: CandidateReceipt,
|
||||
pov: Arc<PoV>,
|
||||
executor_params: ExecutorParams,
|
||||
exec_timeout_kind: PvfExecTimeoutKind,
|
||||
metrics: &Metrics,
|
||||
) -> Result<ValidationResult, ValidationFailed>
|
||||
where
|
||||
Sender: SubsystemSender<RuntimeApiMessage>,
|
||||
{
|
||||
) -> Result<ValidationResult, ValidationFailed> {
|
||||
let _timer = metrics.time_validate_candidate_exhaustive();
|
||||
|
||||
let validation_code_hash = validation_code.hash();
|
||||
@@ -615,27 +615,6 @@ where
|
||||
relay_parent_storage_root: persisted_validation_data.relay_parent_storage_root,
|
||||
};
|
||||
|
||||
let executor_params = if let Ok(executor_params) =
|
||||
executor_params_at_relay_parent(candidate_receipt.descriptor.relay_parent, sender).await
|
||||
{
|
||||
gum::debug!(
|
||||
target: LOG_TARGET,
|
||||
?validation_code_hash,
|
||||
?para_id,
|
||||
"Acquired executor params for the session: {:?}",
|
||||
executor_params,
|
||||
);
|
||||
executor_params
|
||||
} else {
|
||||
gum::warn!(
|
||||
target: LOG_TARGET,
|
||||
?validation_code_hash,
|
||||
?para_id,
|
||||
"Failed to acquire executor params for the session",
|
||||
);
|
||||
return Ok(ValidationResult::Invalid(InvalidCandidate::BadParent))
|
||||
};
|
||||
|
||||
let result = validation_backend
|
||||
.validate_candidate_with_retry(
|
||||
raw_validation_code.to_vec(),
|
||||
|
||||
Reference in New Issue
Block a user