Crate sp1_core_executor

Source
Expand description

An implementation of an exucutor for the SP1 RISC-V zkVM.

Modules§

estimator
Data that may be collected during execution and used to estimate trace area.
events
Type definitions for the events emitted by the crate::Executor during execution.
subproof
Types and methods for subproof verification inside the crate::Executor.
syscalls
Syscall definitions & implementations for the crate::Executor.

Structs§

CoreAirIdConvertError
An error type used for converting from RiscvAirId to CoreAirId.
CoreAirIdIter
An iterator over the variants of CoreAirId
ExecutionRecord
A record of the execution of a program.
ExecutionReport
An execution report.
ExecutionState
Holds data describing the current state of a program’s execution.
Executor
An executor for the SP1 RISC-V zkVM.
ForkState
Holds data to track changes made to the runtime since a fork point.
HookEnv
Environment that a hook may read from.
HookRegistry
A registry of hooks to call, indexed by the file descriptors through which they are accessed.
Instruction
RISC-V 32IM Instruction.
IoOptions
The IO options for the [SP1Executor].
LocalCounts
Information about event counts which are relevant for shape fixing.
MaximalShapes
Defines a set of maximal shapes for generating core proofs.
MemoryAccessRecord
A memory access record.
Program
A program that can be executed by the SP1 zkVM.
RiscvAirIdIter
An iterator over the variants of RiscvAirId
SP1Context
Context to run a program inside SP1.
SP1ContextBuilder
A builder for SP1Context.
SP1ReduceProof
An intermediate proof which proves the execution.

Enums§

ByteOpcode
Byte Opcode.
CoreAirId
RV32IM AIR Identifiers.
DeferredProofVerification
Whether to verify deferred proofs during execution.
ExecutionError
Errors that the Executor can throw.
ExecutorMode
The different modes the executor can run in.
Opcode
An opcode (short for “operation code”) specifies the operation to be performed by the processor.
Register
A register stores a 32-bit value used by operations.
RiscvAirId
RV32IM AIR Identifiers.

Constants§

DEFAULT_PC_INC
The default increment for the program counter. Is used for all instructions except for branches and jumps.
FD_BLS12_381_INVERSE
The file descriptor through which to access hook_bls12_381_inverse.
FD_BLS12_381_SQRT
The file descriptor through which to access hook_bls12_381_sqrt.
FD_ECRECOVER_HOOK
The file descriptor through which to access hook_ecrecover.
FD_EDDECOMPRESS
The file descriptor through which to access hook_ed_decompress.
FD_FP_INV
The file descriptor through which to access hook_fp_inverse.
FD_FP_SQRT
The file descriptor through which to access hook_fp_sqrt.
FD_HINT
The file descriptor for hints.
FD_PUBLIC_VALUES
The file descriptor for public values.
FD_RSA_MUL_MOD
The file descriptor through which to access hook_rsa_mul_mod.
LOWEST_ALLOWED_FD
The minimum file descriptor.
MAX_PROGRAM_SIZE
The maximum number of instructions in a program.
UNUSED_PC
This is used in the InstrEvent to indicate that the instruction is not from the CPU. A valid pc should be divisible by 4, so we use 1 to indicate that the pc is not used.

Traits§

Hook
A runtime hook. May be called during execution by writing to a specified file descriptor, accepting and returning arbitrary data.
IoWriter
A trait for Write types to be used in the executor.

Functions§

align
Aligns an address to the nearest word below or equal to it.
deserialize_hashmap_as_vec
Deserialize a Vec<(u32, V)> as a HashMap<u32, V>.
estimate_riscv_lde_size
Estimates the LDE area.
get_msb
Calculate the most significant bit of the given 32-bit integer a, and returns it as a u8.
get_quotient_and_remainder
Calculate the correct quotient and remainder for the given b and c per RISC-V spec.
hook_ecrecover
The hook for the ecrecover patches.
hook_ed_decompress
Checks if a compressed Edwards point can be decompressed.
hook_rsa_mul_mod
Given the product of some 256-byte numbers and a modulus, this function does a modular reduction and hints back the values to the vm in order to constrain it.
hookify
Wrap a function in a smart pointer so it may be placed in a HookRegistry.
is_signed_operation
Returns true if the given opcode is a signed operation.
pad_rv32im_event_counts
Pads the event counts to account for the worst case jump in events across N cycles.
rv32im_costs
Load the cost of each air from the predefined JSON.
serialize_hashmap_as_vec
Serialize a HashMap<u32, V> as a Vec<(u32, V)>.

Type Aliases§

BoxedHook
A runtime hook, wrapped in a smart pointer.