Skip to main content

Crate sp1_core_executor

Crate sp1_core_executor 

Source
Expand description

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

Modules§

bls
BLS12-381 field operation hooks.
build
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§

ALUTypeRecord
Memory record where only the first two operands are known to be registers, but the third isn’t.
CompressedMemory
A structure that stores a single bit for each address.
CoreAirIdConvertError
An error type used for converting from RiscvAirId to CoreAirId.
CoreAirIdIter
An iterator over the variants of CoreAirId
CoreVM
A RISC-V VM that uses a MinimalTrace to oracle memory access.
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.
ForkState
Holds data to track changes made to the runtime since a fork point.
GasEstimatingVM
A RISC-V VM that uses a MinimalTrace to create a ExecutionReport.
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.
ITypeRecord
Memory record where the first two operands are registers.
Instruction
RISC-V 64IM Instruction.
IoOptions
The IO options for the [SP1Executor].
JTypeRecord
Memory record where only one operand is a register.
MaximalShapes
Defines a set of maximal shapes for generating core proofs.
MemoryAccessRecord
A memory access record.
MinimalExecutor
A minimal trace executor.
MinimalTranspiler
A transpiler building JIT function from RISC-V instructions. For now, the struct seems useless as all methods on it are pure functions. Later when we implement mprotect, the struct will then become a necessary component.
Program
A program that can be executed by the SP1 zkVM.
RTypeRecord
Memory record where all three operands are registers.
RiscvAirIdIter
An iterator over the variants of RiscvAirId
SP1Context
Context to run a program inside SP1.
SP1ContextBuilder
A builder for SP1Context.
SP1CoreOpts
Options for the core prover.
SP1RecursionProof
An intermediate proof which proves the execution of a Hypercube verifier.
ShardingThreshold
The threshold that determines when to split the shard.
SplicedMinimalTrace
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 MinimalTrace to create multiple SplicedMinimalTraces.
SplitOpts
Options for splitting deferred events.
StatusCode
The status code of the execution.
SyscallCodeIter
An iterator over the variants of SyscallCode
TracingVM
A RISC-V VM that uses a MinimalTrace to create a ExecutionRecord.
UnsafeMemory
An unsafe memory view
UntrustedProgramInstructionRecord
Memory record for an untrusted program instruction fetch.

Enums§

ByteOpcode
Byte Opcode.
CoreAirId
RV64IM AIR Identifiers.
CycleResult
The result of a cycle.
ExecutionError
Errors that the executor can throw.
InstructionType
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.
RetainedEventsPreset
Allowed presets for collections of events that may be retained instead of deferred.
RiscvAirId
RV64IM AIR Identifiers.
SyscallCode
System Calls.
TraceChunkRaw

Constants§

BYTE_NUM_ROWS
The number of rows in the ByteChip.
CLK_INC
The default increment for the timestamp.
DEFAULT_MEMORY_LIMIT
Default memory limit for SP1 programs, note this value has different semantics on different implementation. For native executor, it is the limit on total process memory(resident set size, or RSS) of thie entire child process. For portable executor, it is merely the limit on created memory entries. This means the actual memory usage for portable executor will exceed this limit.
DEFAULT_TRACE_CHUNK_SLOTS
The default number trace chunk slots
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 Write types 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 a HashMap<u32, V>.
get_complexity_mapping
Returns a mapping of RiscvAirId to 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 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_64bit_operation
Returns true if the given opcode is a 64bit operation.
is_signed_64bit_operation
Returns true if the given opcode is a signed 64bit operation.
is_signed_word_operation
Returns true if the given opcode is a signed word operation.
is_unsigned_64bit_operation
Returns true if the given opcode is a unsigned 64bit operation.
is_unsigned_word_operation
Returns true if the given opcode is a unsigned word operation.
is_word_operation
Returns true if the given opcode is 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 a Vec<(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§

BoxedHook
A runtime hook, wrapped in a smart pointer.