pub struct PrecompileTranscript { /* private fields */ }Expand description
Precompile transcript implemented with an RPO256 sponge.
§Structure
Standard RPO256 sponge: 12 elements = capacity (4 elements) + rate (8 elements)
§Operation
- Record: Each precompile commitment is recorded by absorbing it into the rate, updating the capacity
- State: The evolving capacity tracks all absorbed commitments in order
- Finalization: Squeeze with zero rate to extract a transcript digest (the sequential commitment)
§Implementation Note
We store only the 4-element capacity portion between absorptions since since the rate is always overwritten when absorbing blocks that are a multiple of the rate width.
Implementations§
Source§impl PrecompileTranscript
impl PrecompileTranscript
Sourcepub fn from_state(state: PrecompileTranscriptState) -> Self
pub fn from_state(state: PrecompileTranscriptState) -> Self
Creates a transcript from an existing state (for VM operations like log_precompile).
Sourcepub fn state(&self) -> PrecompileTranscriptState
pub fn state(&self) -> PrecompileTranscriptState
Returns the current transcript state (capacity word).
Sourcepub fn record(&mut self, commitment: PrecompileCommitment)
pub fn record(&mut self, commitment: PrecompileCommitment)
Records a precompile commitment into the transcript, updating the state.
Sourcepub fn finalize(self) -> PrecompileTranscriptDigest
pub fn finalize(self) -> PrecompileTranscriptDigest
Finalizes the transcript to a digest (sequential commitment to all recorded requests).
§Details
The output is equivalent to the sequential hash of all PrecompileCommitments, followed
by two empty words. This is because
- Each commitment is represented as two words, a multiple of the rate.
- The initial capacity is set to the zero word since we absord full double words when
calling
recordorfinalize.
Trait Implementations§
Source§impl Clone for PrecompileTranscript
impl Clone for PrecompileTranscript
Source§fn clone(&self) -> PrecompileTranscript
fn clone(&self) -> PrecompileTranscript
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PrecompileTranscript
impl Debug for PrecompileTranscript
Source§impl Default for PrecompileTranscript
impl Default for PrecompileTranscript
Source§fn default() -> PrecompileTranscript
fn default() -> PrecompileTranscript
Returns the “default value” for a type. Read more
Source§impl PartialEq for PrecompileTranscript
impl PartialEq for PrecompileTranscript
impl Copy for PrecompileTranscript
impl Eq for PrecompileTranscript
impl StructuralPartialEq for PrecompileTranscript
Auto Trait Implementations§
impl Freeze for PrecompileTranscript
impl RefUnwindSafe for PrecompileTranscript
impl Send for PrecompileTranscript
impl Sync for PrecompileTranscript
impl Unpin for PrecompileTranscript
impl UnwindSafe for PrecompileTranscript
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
Mutably borrows from an owned value. Read more