Function essential_check::solution::check_predicate

source ·
pub async fn check_predicate<SA, SB>(
    pre_state: &SA,
    post_state: &SB,
    solution: Arc<Solution>,
    predicate: Arc<Predicate>,
    solution_data_index: SolutionDataIndex,
    config: &CheckPredicateConfig,
    transient_data: Arc<TransientData>,
) -> Result<(Utility, Gas), PredicateError<SA::Error>>
where SA: StateRead + Sync, SB: StateRead<Error = SA::Error> + Sync,
Expand description

Checks a solution against a single predicate using the solution data at the given index.

Reads all pre and post state slots into memory, then checks all constraints.

NOTE: This assumes that the given Solution and Predicate have been independently validated using solution::check 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_data_index represents the data within solution.data that claims to solve this predicate.

Returns the utility score of the solution alongside the total gas spent.