Struct sp1_core::runtime::ExecutionRecord
source · pub struct ExecutionRecord {Show 29 fields
pub program: Arc<Program>,
pub cpu_events: Vec<CpuEvent>,
pub add_events: Vec<AluEvent>,
pub mul_events: Vec<AluEvent>,
pub sub_events: Vec<AluEvent>,
pub bitwise_events: Vec<AluEvent>,
pub shift_left_events: Vec<AluEvent>,
pub shift_right_events: Vec<AluEvent>,
pub divrem_events: Vec<AluEvent>,
pub lt_events: Vec<AluEvent>,
pub byte_lookups: HashMap<u32, HashMap<ByteLookupEvent, usize>>,
pub sha_extend_events: Vec<ShaExtendEvent>,
pub sha_compress_events: Vec<ShaCompressEvent>,
pub keccak_permute_events: Vec<KeccakPermuteEvent>,
pub ed_add_events: Vec<ECAddEvent>,
pub ed_decompress_events: Vec<EdDecompressEvent>,
pub secp256k1_add_events: Vec<ECAddEvent>,
pub secp256k1_double_events: Vec<ECDoubleEvent>,
pub bn254_add_events: Vec<ECAddEvent>,
pub bn254_double_events: Vec<ECDoubleEvent>,
pub k256_decompress_events: Vec<ECDecompressEvent>,
pub bls12381_add_events: Vec<ECAddEvent>,
pub bls12381_double_events: Vec<ECDoubleEvent>,
pub uint256_mul_events: Vec<Uint256MulEvent>,
pub memory_initialize_events: Vec<MemoryInitializeFinalizeEvent>,
pub memory_finalize_events: Vec<MemoryInitializeFinalizeEvent>,
pub bls12381_decompress_events: Vec<ECDecompressEvent>,
pub public_values: PublicValues<u32, u32>,
pub nonce_lookup: HashMap<u128, u32>,
}Expand description
A record of the execution of a program.
The trace of the execution is represented as a list of “events” that occur every cycle.
Fields§
§program: Arc<Program>The program.
cpu_events: Vec<CpuEvent>A trace of the CPU events which get emitted during execution.
add_events: Vec<AluEvent>A trace of the ADD, and ADDI events.
mul_events: Vec<AluEvent>A trace of the MUL events.
sub_events: Vec<AluEvent>A trace of the SUB events.
bitwise_events: Vec<AluEvent>A trace of the XOR, XORI, OR, ORI, AND, and ANDI events.
shift_left_events: Vec<AluEvent>A trace of the SLL and SLLI events.
shift_right_events: Vec<AluEvent>A trace of the SRL, SRLI, SRA, and SRAI events.
divrem_events: Vec<AluEvent>A trace of the DIV, DIVU, REM, and REMU events.
lt_events: Vec<AluEvent>A trace of the SLT, SLTI, SLTU, and SLTIU events.
byte_lookups: HashMap<u32, HashMap<ByteLookupEvent, usize>>All byte lookups that are needed.
The layout is shard -> (event -> count). Byte lookups are sharded to prevent the multiplicities from overflowing.
sha_extend_events: Vec<ShaExtendEvent>§sha_compress_events: Vec<ShaCompressEvent>§keccak_permute_events: Vec<KeccakPermuteEvent>§ed_add_events: Vec<ECAddEvent>§ed_decompress_events: Vec<EdDecompressEvent>§secp256k1_add_events: Vec<ECAddEvent>§secp256k1_double_events: Vec<ECDoubleEvent>§bn254_add_events: Vec<ECAddEvent>§bn254_double_events: Vec<ECDoubleEvent>§k256_decompress_events: Vec<ECDecompressEvent>§bls12381_add_events: Vec<ECAddEvent>§bls12381_double_events: Vec<ECDoubleEvent>§uint256_mul_events: Vec<Uint256MulEvent>§memory_initialize_events: Vec<MemoryInitializeFinalizeEvent>§memory_finalize_events: Vec<MemoryInitializeFinalizeEvent>§bls12381_decompress_events: Vec<ECDecompressEvent>§public_values: PublicValues<u32, u32>The public values.
nonce_lookup: HashMap<u128, u32>Implementations§
source§impl ExecutionRecord
impl ExecutionRecord
pub fn new(program: Arc<Program>) -> Self
pub fn add_mul_event(&mut self, mul_event: AluEvent)
pub fn add_lt_event(&mut self, lt_event: AluEvent)
pub fn add_alu_events(&mut self, alu_events: HashMap<Opcode, Vec<AluEvent>>)
sourcepub fn defer(&mut self) -> ExecutionRecord
pub fn defer(&mut self) -> ExecutionRecord
Take out events from the ExecutionRecord that should be deferred to a separate shard.
Note: we usually defer events that would increase the recursion cost significantly if included in every shard.
sourcepub fn split(&mut self, last: bool, opts: SplitOpts) -> Vec<ExecutionRecord>
pub fn split(&mut self, last: bool, opts: SplitOpts) -> Vec<ExecutionRecord>
Splits the deferred ExecutionRecord into multiple ExecutionRecords, each which contain a “reasonable” number of deferred events.
Trait Implementations§
source§impl ByteRecord for ExecutionRecord
impl ByteRecord for ExecutionRecord
source§fn add_byte_lookup_event(&mut self, blu_event: ByteLookupEvent)
fn add_byte_lookup_event(&mut self, blu_event: ByteLookupEvent)
ByteLookupEvent to the record.fn add_sharded_byte_lookup_events( &mut self, new_events: Vec<&HashMap<u32, HashMap<ByteLookupEvent, usize>>>, )
source§fn add_byte_lookup_events(&mut self, blu_events: Vec<ByteLookupEvent>)
fn add_byte_lookup_events(&mut self, blu_events: Vec<ByteLookupEvent>)
ByteLookupEvents to the record.source§fn add_u8_range_check(&mut self, shard: u32, channel: u32, a: u8, b: u8)
fn add_u8_range_check(&mut self, shard: u32, channel: u32, a: u8, b: u8)
ByteLookupEvent to verify a and `b are indeed bytes to the shard.source§fn add_u16_range_check(&mut self, shard: u32, channel: u32, a: u32)
fn add_u16_range_check(&mut self, shard: u32, channel: u32, a: u32)
ByteLookupEvent to verify a is indeed u16.source§fn add_u8_range_checks(&mut self, shard: u32, channel: u32, bytes: &[u8])
fn add_u8_range_checks(&mut self, shard: u32, channel: u32, bytes: &[u8])
ByteLookupEvents to verify that all the bytes in the input slice are indeed bytes.source§fn add_u8_range_checks_field<F: PrimeField32>(
&mut self,
shard: u32,
channel: u32,
field_values: &[F],
)
fn add_u8_range_checks_field<F: PrimeField32>( &mut self, shard: u32, channel: u32, field_values: &[F], )
ByteLookupEvents to verify that all the field elements in the input slice are indeed
bytes.source§impl Clone for ExecutionRecord
impl Clone for ExecutionRecord
source§fn clone(&self) -> ExecutionRecord
fn clone(&self) -> ExecutionRecord
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for ExecutionRecord
impl Debug for ExecutionRecord
source§impl Default for ExecutionRecord
impl Default for ExecutionRecord
source§fn default() -> ExecutionRecord
fn default() -> ExecutionRecord
source§impl<'de> Deserialize<'de> for ExecutionRecord
impl<'de> Deserialize<'de> for ExecutionRecord
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl MachineRecord for ExecutionRecord
impl MachineRecord for ExecutionRecord
source§fn public_values<F: AbstractField>(&self) -> Vec<F>
fn public_values<F: AbstractField>(&self) -> Vec<F>
Retrieves the public values. This method is needed for the MachineRecord trait, since
type Config = SP1CoreOpts
fn stats(&self) -> HashMap<String, usize>
fn append(&mut self, other: &mut ExecutionRecord)
fn register_nonces(&mut self, _opts: &Self::Config)
Auto Trait Implementations§
impl Freeze for ExecutionRecord
impl RefUnwindSafe for ExecutionRecord
impl Send for ExecutionRecord
impl Sync for ExecutionRecord
impl Unpin for ExecutionRecord
impl UnwindSafe for ExecutionRecord
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more