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
andexec_ops
functions allow for executing the constraint and returning the resultingStack
. - The
eval_bytecode
,eval_bytecode_iter
andeval_ops
functions are similar to theirexec_*
counterparts, but expect the top of theStack
to contain a single boolean value indicating whether the constraint was satisfied (0
forfalse
,1
fortrue
) 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§
pub use essential_types as types;
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. aVec
ofWord
s updated during each step of execution. - The pre and post mutation state slot values for the predicate being solved.
Enums§
- Update the program to a new position or halt it.
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 aCheckError
. - Shorthand for a
Result
where the error type is aConstraintError
. - Shorthand for a
Result
where the error type is anOpError
. - Shorthand for a
Result
where the error type is aStackError
. - The state slots declared within the predicate.
- Transient data map.