pub async fn check_predicates<SA, SB>(
pre_state: &SA,
post_state: &SB,
solution: Arc<Solution>,
get_predicate: impl Fn(&PredicateAddress) -> Arc<Predicate>,
config: Arc<CheckPredicateConfig>,
) -> Result<Gas, PredicatesError<SA::Error>>Expand description
Checks all of a solution’s SolutionData against its associated predicates.
For each of the solution’s data elements, a single task is spawned that
reads the pre and post state slots for the associated predicate with access to
the given pre_state and post_state, then checks all constraints over the
resulting pre and post state slots.
NOTE: This assumes that the given Solution and all Predicates
have already been independently validated using
solution::check and
predicate::check respectively.
§Arguments
pre_statemust provide access to state prior to mutations being applied.post_statemust provide access to state post mutations being applied.get_predicateprovides immediate access to a predicate associated with the given solution. Calls topredicatemust complete immediately. All necessary predicates are assumed to have been read from storage and validated ahead of time.
Returns the total gas spent.