Function check_predicate

Source
pub async fn check_predicate<SA, SB>(
    pre_state: &SA,
    post_state: &SB,
    solution_set: Arc<SolutionSet>,
    predicate: Arc<Predicate>,
    get_program: &impl GetProgram,
    solution_index: SolutionIndex,
    config: &CheckPredicateConfig,
) -> Result<Gas, PredicateError<SA::Error>>
where SA: Clone + StateRead + Send + Sync + 'static, SB: Clone + StateRead<Error = SA::Error> + Send + Sync + 'static, SA::Future: Send, SB::Future: Send, SA::Error: Send,
Expand description

Checks the predicate of the solution within the given set at the given solution_index.

Spawns a task for each of the predicate’s nodes to execute asynchronously. Oneshot channels are used to provide the execution results from parent to child.

NOTE: This assumes that the given SolutionSet and Predicate have been independently validated using solution::check_set and predicate::check respectively.

§Arguments

  • pre_state must provide access to state prior to mutations being applied.
  • post_state must provide access to state post mutations being applied.
  • solution_index represents the solution within solution_set.solutions that claims to solve this predicate.

Returns the total gas spent.