Expand description
An implementation of an exucutor for the SP1 RISC-V zkVM.
Modules§
- bls
- BLS12-381 field operation hooks.
- events
- Type definitions for the events emitted by the [
crate::Executor] during execution. - fp_ops
- Field operation hooks for computing inverses and square roots.
- subproof
- Types and methods for subproof verification inside the [
crate::Executor].
Structs§
- ALUType
Record - Memory record where only the first two operands are known to be registers, but the third isn’t.
- Compressed
Memory - A structure that stores a single bit for each address.
- Core
AirId Convert Error - An error type used for converting from
RiscvAirIdtoCoreAirId. - Core
AirId Iter - An iterator over the variants of CoreAirId
- CoreVM
- A RISC-V VM that uses a
MinimalTraceto oracle memory access. - Execution
Record - A record of the execution of a program.
- Execution
Report - An execution report.
- Execution
State - Holds data describing the current state of a program’s execution.
- Fork
State - Holds data to track changes made to the runtime since a fork point.
- GasEstimatingVM
- A RISC-V VM that uses a
MinimalTraceto create aExecutionReport. - HookEnv
- Environment that a hook may read from.
- Hook
Registry - A registry of hooks to call, indexed by the file descriptors through which they are accessed.
- IType
Record - Memory record where the first two operands are registers.
- Instruction
- RISC-V 64IM Instruction.
- IoOptions
- The IO options for the [
SP1Executor]. - JType
Record - Memory record where only one operand is a register.
- Maximal
Shapes - Defines a set of maximal shapes for generating core proofs.
- Memory
Access Record - A memory access record.
- Minimal
Executor - A minimal trace executor.
- Program
- A program that can be executed by the SP1 zkVM.
- RType
Record - Memory record where all three operands are registers.
- Riscv
AirId Iter - An iterator over the variants of RiscvAirId
- SP1Context
- Context to run a program inside SP1.
- SP1Context
Builder - A builder for
SP1Context. - SP1Core
Opts - Options for the core prover.
- SP1Recursion
Proof - An intermediate proof which proves the execution of a Hypercube verifier.
- Sharding
Threshold - The threshold that determines when to split the shard.
- Spliced
Minimal Trace - A minimal trace implentation that starts at a different point in the trace, but reuses the same memory reads and hint lens.
- SplicingVM
- A RISC-V VM that uses a
MinimalTraceto create multipleSplicedMinimalTraces. - Split
Opts - Options for splitting deferred events.
- Status
Code - The status code of the execution.
- Syscall
Code Iter - An iterator over the variants of SyscallCode
- Trace
Chunk Raw - TracingVM
- A RISC-V VM that uses a
MinimalTraceto create aExecutionRecord. - Unsafe
Memory - An unsafe memory view
- Untrusted
Program Instruction Record - Memory record for an untrusted program instruction fetch.
Enums§
- Byte
Opcode - Byte Opcode.
- Core
AirId - RV64IM AIR Identifiers.
- Cycle
Result - The result of a cycle.
- Execution
Error - Errors that the executor can throw.
- Instruction
Type - RV64 instruction types.
- 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.
- Retained
Events Preset - Allowed presets for collections of events that may be retained instead of deferred.
- Riscv
AirId - RV64IM AIR Identifiers.
- Syscall
Code - System Calls.
Constants§
- BYTE_
NUM_ ROWS - The number of rows in the
ByteChip. - CLK_INC
- The default increment for the timestamp.
- ELEMENT_
THRESHOLD - The trace area threshold for a shard.
- 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. - HALT_PC
- The executor uses this PC to determine if the program has halted.
As a PC, it is invalid since it is not a multiple of
PC_INC. - HEIGHT_
THRESHOLD - The height threshold for a shard.
- LOWEST_
ALLOWED_ FD - The minimum file descriptor.
- MAXIMUM_
CYCLE_ AREA - The maximum trace area from a single cycle.
The correctness of this value is checked in the test
test_maximum_cycle. - MAXIMUM_
PADDING_ AREA - The maximum trace area from padding with next multiple of 32.
The correctness of this value is checked in the test
test_maximum_padding. - MAX_
PROGRAM_ SIZE - The maximum number of instructions in a program.
- MINIMAL_
TRACE_ CHUNK_ THRESHOLD - The maximum size of a minimal trace chunk in terms of memory entries.
- NUM_
REGISTERS - The number of registers.
- PC_INC
- The default increment for the program counter. Is used for all instructions except for branches and jumps.
- RANGE_
NUM_ ROWS - The number of rows in the
RangeChip.
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
Writetypes to be used in the executor.
Functions§
- add_
halt - Add a halt syscall to the end of the instructions vec.
- chunked_
memory_ init_ events - Given some contiguous memory, create a series of initialize and finalize events.
- cost_
and_ height_ per_ syscall - The maximum trace area and maximum height increment for a single event of a syscall.
- deserialize_
hashmap_ as_ vec - Deserialize a
Vec<(u32, V)>as aHashMap<u32, V>. - get_
complexity_ mapping - Returns a mapping of
RiscvAirIdto their associated complexity codes. This provides the complexity cost for each AIR component in the system. - get_msb
- Calculate the most significant bit of the given 64-bit integer
a, and returns it as a u8. - get_
quotient_ and_ remainder - Calculate the correct
quotientandremainderfor the givenbandcper RISC-V spec. - hook_
ecrecover - The hook for the
ecrecoverpatches. - 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_
64bit_ operation - Returns
trueif the givenopcodeis a 64bit operation. - is_
signed_ 64bit_ operation - Returns
trueif the givenopcodeis a signed 64bit operation. - is_
signed_ word_ operation - Returns
trueif the givenopcodeis a signed word operation. - is_
unsigned_ 64bit_ operation - Returns
trueif the givenopcodeis a unsigned 64bit operation. - is_
unsigned_ word_ operation - Returns
trueif the givenopcodeis a unsigned word operation. - is_
word_ operation - Returns
trueif the givenopcodeis a word operation. - rv64im_
costs - Load the cost of each air from the predefined JSON.
- serialize_
hashmap_ as_ vec - Serialize a
HashMap<u32, V>as aVec<(u32, V)>. - trunc_
32 - Calculate the largest multiple of 32 less than of equal to a given integer
n. - validate_
sign_ extension - Validates that a u64 is properly sign-extended for a given bit width.
Type Aliases§
- Boxed
Hook - A runtime hook, wrapped in a smart pointer.