Function check_set_predicates

Source
pub async fn check_set_predicates<SA, SB>(
    pre_state: &SA,
    post_state: &SB,
    solution_set: Arc<SolutionSet>,
    get_predicate: impl GetPredicate,
    get_program: impl 'static + Clone + GetProgram + Send + Sync,
    config: Arc<CheckPredicateConfig>,
) -> Result<Gas, PredicatesError<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 all of a SolutionSet’s Solutions against their associated Predicates.

For each solution, we load the associated predicate and its programs and execute each asynchronously in topological order. The leaf nodes are treated as constraints and if any constraint returns false, the whole solution set is considered to be invalid.

NOTE: This assumes that the given SolutionSet and all Predicates have already 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.

Returns the total gas spent.