TraceInfo

Struct TraceInfo 

Source
pub struct TraceInfo { /* private fields */ }
Expand description

Information about a specific execution trace.

Trace info consists of the number of columns for all trace segments, trace length, the number of random elements needed to generate the auxiliary segment and optional custom metadata.

Currently, a trace can consist of at most two segments: the main segment and one auxiliary segment. Metadata is just a vector of bytes and can store any values up to 64KB in size.

Implementations§

Source§

impl TraceInfo

Source

pub const MIN_TRACE_LENGTH: usize = 8usize

Smallest allowed execution trace length; currently set at 8.

Source

pub const MAX_TRACE_WIDTH: usize = 255usize

Maximum number of columns in an execution trace (across all segments); currently set at 255.

Source

pub const MAX_META_LENGTH: usize = 65_535usize

Maximum number of bytes in trace metadata; currently set at 65535.

Source

pub const MAX_RAND_SEGMENT_ELEMENTS: usize = 255usize

Maximum number of random elements in the auxiliary trace segment; currently set to 255.

Source

pub fn new(width: usize, length: usize) -> TraceInfo

Creates a new TraceInfo from the specified trace width and length.

An execution trace described by this trace info is limited to a single segment.

§Panics

Panics if:

  • Trace width is zero or greater than 255.
  • Trace length is smaller than 8 or is not a power of two.
Source

pub fn with_meta(width: usize, length: usize, meta: Vec<u8>) -> TraceInfo

Creates a new TraceInfo from the specified trace width, length, and metadata.

An execution trace described by this trace info is limited to a single segment.

§Panics

Panics if:

  • Trace width is zero or greater than 255.
  • Trace length is smaller than 8 or is not a power of two.
  • Length of meta is greater than 65535;
Source

pub fn new_multi_segment( main_segment_width: usize, aux_segment_width: usize, num_aux_segment_rands: usize, trace_length: usize, trace_meta: Vec<u8>, ) -> TraceInfo

Creates a new TraceInfo with main and auxiliary segments.

§Panics

Panics if:

  • The width of the first trace segment is zero.
  • Total width of all trace segments is greater than 255.
  • Trace length is smaller than 8 or is not a power of two.
  • A zero entry in auxiliary segment width array is followed by a non-zero entry.
  • Number of random elements for the auxiliary trace segment of non-zero width is set to zero.
  • Number of random elements for the auxiliary trace segment of zero width is set to non-zero.
  • Number of random elements for any auxiliary trace segment is greater than 255.
Source

pub fn width(&self) -> usize

Returns the total number of columns in an execution trace.

This is guaranteed to be between 1 and 255.

Source

pub fn length(&self) -> usize

Returns execution trace length.

The length is guaranteed to be a power of two.

Source

pub fn meta(&self) -> &[u8]

Returns execution trace metadata.

Source

pub fn is_multi_segment(&self) -> bool

Returns true if an execution trace contains the auxiliary trace segment.

Source

pub fn main_trace_width(&self) -> usize

Returns the number of columns in the main segment of an execution trace.

This is guaranteed to be between 1 and 255.

Source

pub fn aux_segment_width(&self) -> usize

Returns the number of columns in the auxiliary segment of an execution trace.

Source

pub fn num_segments(&self) -> usize

Returns the total number of segments in an execution trace.

Source

pub fn num_aux_segments(&self) -> usize

Returns the number of auxiliary trace segments in an execution trace.

Source

pub fn get_aux_segment_width(&self) -> usize

Returns the number of columns in the auxiliary trace segment.

Source

pub fn get_num_aux_segment_rand_elements(&self) -> usize

Returns the number of random elements needed to build all auxiliary columns.

Trait Implementations§

Source§

impl Clone for TraceInfo

Source§

fn clone(&self) -> TraceInfo

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TraceInfo

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Deserializable for TraceInfo

Source§

fn read_from<R>(source: &mut R) -> Result<TraceInfo, DeserializationError>
where R: ByteReader,

Reads TraceInfo from the specified source and returns the result.

§Errors

Returns an error of a valid TraceInfo struct could not be read from the specified source.

Source§

fn read_from_bytes(bytes: &[u8]) -> Result<Self, DeserializationError>

Attempts to deserialize the provided bytes into Self and returns the result. Read more
Source§

impl PartialEq for TraceInfo

Source§

fn eq(&self, other: &TraceInfo) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serializable for TraceInfo

Source§

fn write_into<W>(&self, target: &mut W)
where W: ByteWriter,

Serializes self and writes the resulting bytes into the target.

Source§

fn to_bytes(&self) -> Vec<u8>

Serializes self into a vector of bytes.
Source§

fn get_size_hint(&self) -> usize

Returns an estimate of how many bytes are needed to represent self. Read more
Source§

impl<E> ToElements<E> for TraceInfo
where E: StarkField,

Source§

fn to_elements(&self) -> Vec<E>

Source§

impl Eq for TraceInfo

Source§

impl StructuralPartialEq for TraceInfo

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.