Crate essential_constraint_vm

source ·
Expand description

The essential constraint checking implementation.

§Checking Predicates

The primary entrypoint for this crate is the check_predicate function which allows for checking a contract of constraints associated with a single predicate against some provided solution data and state slot mutations in parallel.

§Checking Individual Constraints

Functions are also exposed for checking constraints individually.

  • The exec_bytecode, exec_bytecode_iter and exec_ops functions allow for executing the constraint and returning the resulting Stack.
  • The eval_bytecode, eval_bytecode_iter and eval_ops functions are similar to their exec_* counterparts, but expect the top of the Stack to contain a single boolean value indicating whether the constraint was satisfied (0 for false, 1 for true) and returns this value.

§Performing a Single Operation

The step_op function (and related step_op_* functions) are exposed to allow for applying a single operation to the given stack. This can be useful in the case of integrating constraint operations in a downstream VM (e.g. the essential state read VM).

§Understanding the Assembly

The essential-constraint-asm crate is re-exported as the asm module. See this module’s documentation for information about the expected behaviour of individual operations.

Re-exports§

Modules§

  • Assembly for checking constraints.
  • The types of errors that might occur throughout constraint checking.

Structs§

  • All necessary solution data and state access required to check an individual predicate.
  • A memory efficient representation of a sequence of operations parsed from bytecode.
  • A type wrapper around BytecodeMapped that lazily constructs the map from the given bytecode as operations are accessed.
  • A slice into a BytecodeMapped instance.
  • Memory for temporary storage of words.
  • A stack of repeat counters.
  • All necessary solution data access required to check an individual predicate.
  • The VM’s Stack, i.e. a Vec of Words updated during each step of execution.
  • The pre and post mutation state slot values for the predicate being solved.

Enums§

Traits§

  • Types that provide access to operations.

Functions§

  • Check whether the constraints of a single predicate are met for the given solution data and state slot mutations. All constraints are checked in parallel.
  • Evaluate the operations of a single constraint and return its boolean result.
  • Evaluate the bytecode of a single constraint and return its boolean result.
  • Evaluate the bytecode of a single constraint and return its boolean result.
  • Evaluate the operations of a single constraint and return its boolean result.
  • Execute the operations of a constraint and return the resulting stack.
  • Execute the bytecode of a constraint and return the resulting stack.
  • Execute the bytecode of a constraint and return the resulting stack.
  • Execute the operations of a constraint and return the resulting stack.
  • A helper for collecting all mutable keys that are proposed for mutation for the predicate at the given index.
  • Get the contract of mutable keys for this predicate.
  • Get the mutable keys as slices
  • Step forward constraint checking by the given temporary operation.
  • Step forward constraint checking by the given total control flow operation.
  • Step forward constraint checking by the given operation.
  • Step forward constraint checking by the given access operation.
  • Step forward constraint checking by the given ALU operation.
  • Step forward constraint checking by the given crypto operation.
  • Step forward constraint checking by the given predicate operation.
  • Step forward constraint checking by the given stack operation.
  • Create a transient data map from the solution.

Type Aliases§

  • Shorthand for a Result where the error type is a CheckError.
  • Shorthand for a Result where the error type is a ConstraintError.
  • Shorthand for a Result where the error type is an OpError.
  • Shorthand for a Result where the error type is a StackError.
  • The state slots declared within the predicate.
  • Transient data map.