Skip to content

Commit

Permalink
Rename Trace::get_info
Browse files Browse the repository at this point in the history
  • Loading branch information
plafer committed Feb 20, 2024
1 parent c31d18c commit a0fdbfc
Show file tree
Hide file tree
Showing 29 changed files with 43 additions and 43 deletions.
2 changes: 1 addition & 1 deletion examples/src/fibonacci/fib2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ where
info_span!("generate_execution_trace", num_cols = TRACE_WIDTH, steps = field::Empty)
.in_scope(|| {
let trace = prover.build_trace(self.sequence_length);
tracing::Span::current().record("steps", trace.get_info().length());
tracing::Span::current().record("steps", trace.info().length());
trace
});

Expand Down
2 changes: 1 addition & 1 deletion examples/src/fibonacci/fib2/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ where
DefaultConstraintEvaluator<'a, Self::Air, E>;

fn get_pub_inputs(&self, trace: &Self::Trace) -> BaseElement {
let last_step = trace.get_info().length() - 1;
let last_step = trace.info().length() - 1;
trace.get(1, last_step)
}

Expand Down
2 changes: 1 addition & 1 deletion examples/src/fibonacci/fib8/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ where
info_span!("generate_execution_trace", num_cols = TRACE_WIDTH, steps = field::Empty)
.in_scope(|| {
let trace = prover.build_trace(self.sequence_length);
tracing::Span::current().record("steps", trace.get_info().length());
tracing::Span::current().record("steps", trace.info().length());
trace
});

Expand Down
2 changes: 1 addition & 1 deletion examples/src/fibonacci/fib8/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ where
DefaultConstraintEvaluator<'a, Self::Air, E>;

fn get_pub_inputs(&self, trace: &Self::Trace) -> BaseElement {
let last_step = trace.get_info().length() - 1;
let last_step = trace.info().length() - 1;
trace.get(1, last_step)
}

Expand Down
2 changes: 1 addition & 1 deletion examples/src/fibonacci/fib_small/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ where
info_span!("generate_execution_trace", num_cols = TRACE_WIDTH, steps = field::Empty)
.in_scope(|| {
let trace = prover.build_trace(self.sequence_length);
tracing::Span::current().record("steps", trace.get_info().length());
tracing::Span::current().record("steps", trace.info().length());
trace
});

Expand Down
2 changes: 1 addition & 1 deletion examples/src/fibonacci/fib_small/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ where
DefaultConstraintEvaluator<'a, Self::Air, E>;

fn get_pub_inputs(&self, trace: &Self::Trace) -> BaseElement {
let last_step = trace.get_info().length() - 1;
let last_step = trace.info().length() - 1;
trace.get(1, last_step)
}

Expand Down
2 changes: 1 addition & 1 deletion examples/src/fibonacci/mulfib2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ where
info_span!("generate_execution_trace", num_cols = TRACE_WIDTH, steps = field::Empty)
.in_scope(|| {
let trace = prover.build_trace(sequence_length);
tracing::Span::current().record("steps", trace.get_info().length());
tracing::Span::current().record("steps", trace.info().length());
trace
});

Expand Down
2 changes: 1 addition & 1 deletion examples/src/fibonacci/mulfib2/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ where
DefaultConstraintEvaluator<'a, Self::Air, E>;

fn get_pub_inputs(&self, trace: &Self::Trace) -> BaseElement {
let last_step = trace.get_info().length() - 1;
let last_step = trace.info().length() - 1;
trace.get(0, last_step)
}

Expand Down
2 changes: 1 addition & 1 deletion examples/src/fibonacci/mulfib8/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ where
info_span!("generate_execution_trace", num_cols = TRACE_WIDTH, steps = field::Empty)
.in_scope(|| {
let trace = prover.build_trace(sequence_length);
tracing::Span::current().record("steps", trace.get_info().length());
tracing::Span::current().record("steps", trace.info().length());
trace
});

Expand Down
2 changes: 1 addition & 1 deletion examples/src/fibonacci/mulfib8/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ where
DefaultConstraintEvaluator<'a, Self::Air, E>;

fn get_pub_inputs(&self, trace: &Self::Trace) -> BaseElement {
let last_step = trace.get_info().length() - 1;
let last_step = trace.info().length() - 1;
trace.get(6, last_step)
}

Expand Down
2 changes: 1 addition & 1 deletion examples/src/lamport/aggregate/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ where
info_span!("generate_execution_trace", num_cols = TRACE_WIDTH, steps = field::Empty)
.in_scope(|| {
let trace = prover.build_trace(&self.messages, &self.signatures);
tracing::Span::current().record("steps", trace.get_info().length());
tracing::Span::current().record("steps", trace.info().length());
trace
});

Expand Down
2 changes: 1 addition & 1 deletion examples/src/lamport/threshold/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ where
info_span!("generate_execution_trace", num_cols = TRACE_WIDTH, steps = field::Empty)
.in_scope(|| {
let trace = prover.build_trace(&self.pub_key, self.message, &self.signatures);
tracing::Span::current().record("steps", trace.get_info().length());
tracing::Span::current().record("steps", trace.info().length());
trace
});

Expand Down
2 changes: 1 addition & 1 deletion examples/src/merkle/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ where
info_span!("generate_execution_trace", num_cols = TRACE_WIDTH, steps = field::Empty)
.in_scope(|| {
let trace = prover.build_trace(self.value, &self.path, self.index);
tracing::Span::current().record("steps", trace.get_info().length());
tracing::Span::current().record("steps", trace.info().length());
trace
});

Expand Down
2 changes: 1 addition & 1 deletion examples/src/merkle/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ where
DefaultConstraintEvaluator<'a, Self::Air, E>;

fn get_pub_inputs(&self, trace: &Self::Trace) -> PublicInputs {
let last_step = trace.get_info().length() - 1;
let last_step = trace.info().length() - 1;
PublicInputs {
tree_root: [trace.get(0, last_step), trace.get(1, last_step)],
}
Expand Down
2 changes: 1 addition & 1 deletion examples/src/rescue/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ where
info_span!("generate_execution_trace", num_cols = TRACE_WIDTH, steps = field::Empty)
.in_scope(|| {
let trace = prover.build_trace(self.seed, self.chain_length);
tracing::Span::current().record("steps", trace.get_info().length());
tracing::Span::current().record("steps", trace.info().length());
trace
});

Expand Down
2 changes: 1 addition & 1 deletion examples/src/rescue/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ where
DefaultConstraintEvaluator<'a, Self::Air, E>;

fn get_pub_inputs(&self, trace: &Self::Trace) -> PublicInputs {
let last_step = trace.get_info().length() - 1;
let last_step = trace.info().length() - 1;
PublicInputs {
seed: [trace.get(0, 0), trace.get(1, 0)],
result: [trace.get(0, last_step), trace.get(1, last_step)],
Expand Down
2 changes: 1 addition & 1 deletion examples/src/rescue_raps/custom_trace_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ impl<B: StarkField> RapTraceTable<B> {
impl<B: StarkField> Trace for RapTraceTable<B> {
type BaseField = B;

fn get_info(&self) -> &TraceInfo {
fn info(&self) -> &TraceInfo {
&self.info
}

Expand Down
2 changes: 1 addition & 1 deletion examples/src/rescue_raps/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ where
info_span!("generate_execution_trace", num_cols = TRACE_WIDTH, steps = field::Empty)
.in_scope(|| {
let trace = prover.build_trace(&self.seeds, &self.permuted_seeds, self.result);
tracing::Span::current().record("steps", trace.get_info().length());
tracing::Span::current().record("steps", trace.info().length());
trace
});

Expand Down
2 changes: 1 addition & 1 deletion examples/src/rescue_raps/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ where
DefaultConstraintEvaluator<'a, Self::Air, E>;

fn get_pub_inputs(&self, trace: &Self::Trace) -> PublicInputs {
let last_step = trace.get_info().length() - 1;
let last_step = trace.info().length() - 1;
PublicInputs {
result: [
[trace.get(0, last_step), trace.get(1, last_step)],
Expand Down
2 changes: 1 addition & 1 deletion examples/src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pub fn print_trace<E: StarkField>(
let trace_width = trace.width();

let mut state = vec![E::ZERO; trace_width];
for i in 0..trace.get_info().length() {
for i in 0..trace.info().length() {
if (i.wrapping_sub(offset)) % multiples_of != 0 {
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion examples/src/vdf/exempt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ where
info_span!("generate_execution_trace", num_cols = TRACE_WIDTH, steps = field::Empty)
.in_scope(|| {
let trace = VdfProver::<H>::build_trace(self.seed, self.num_steps + 1);
tracing::Span::current().record("steps", trace.get_info().length());
tracing::Span::current().record("steps", trace.info().length());
trace
});

Expand Down
2 changes: 1 addition & 1 deletion examples/src/vdf/exempt/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ where
fn get_pub_inputs(&self, trace: &Self::Trace) -> VdfInputs {
// the result is read from the second to last step because the last last step contains
// garbage
let second_to_last_step = trace.get_info().length() - 2;
let second_to_last_step = trace.info().length() - 2;
VdfInputs {
seed: trace.get(0, 0),
result: trace.get(0, second_to_last_step),
Expand Down
2 changes: 1 addition & 1 deletion examples/src/vdf/regular/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ where
info_span!("generate_execution_trace", num_cols = TRACE_WIDTH, steps = field::Empty)
.in_scope(|| {
let trace = VdfProver::<H>::build_trace(self.seed, self.num_steps);
tracing::Span::current().record("steps", trace.get_info().length());
tracing::Span::current().record("steps", trace.info().length());
trace
});

Expand Down
2 changes: 1 addition & 1 deletion examples/src/vdf/regular/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ where
DefaultConstraintEvaluator<'a, Self::Air, E>;

fn get_pub_inputs(&self, trace: &Self::Trace) -> VdfInputs {
let last_step = trace.get_info().length() - 1;
let last_step = trace.info().length() - 1;
VdfInputs {
seed: trace.get(0, 0),
result: trace.get(0, last_step),
Expand Down
8 changes: 4 additions & 4 deletions prover/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ pub trait Prover {
// create an instance of AIR for the provided parameters. this takes a generic description
// of the computation (provided via AIR type), and creates a description of a specific
// execution of the computation for the provided public inputs.
let air = Self::Air::new(trace.get_info().clone(), pub_inputs, self.options().clone());
let air = Self::Air::new(trace.info().clone(), pub_inputs, self.options().clone());

// create a channel which is used to simulate interaction between the prover and the
// verifier; the channel will be used to commit to values and to draw randomness that
Expand All @@ -266,7 +266,7 @@ pub trait Prover {
// extend the main execution trace and build a Merkle tree from the extended trace
let span = info_span!("commit_to_main_trace_segment").entered();
let (trace_lde, trace_polys) =
self.new_trace_lde(trace.get_info(), trace.main_segment(), &domain);
self.new_trace_lde(trace.info(), trace.main_segment(), &domain);

// get the commitment to the main trace segment LDE
let main_trace_root = trace_lde.get_main_trace_commitment();
Expand All @@ -283,8 +283,8 @@ pub trait Prover {
// commitment and trace polynomial table structs
let mut aux_trace_segments = Vec::new();
let mut aux_trace_rand_elements = AuxTraceRandElements::new();
for i in 0..trace.get_info().num_aux_segments() {
let num_columns = trace.get_info().get_aux_segment_width(i);
for i in 0..trace.info().num_aux_segments() {
let num_columns = trace.info().get_aux_segment_width(i);
let (aux_segment, rand_elements) = {
let _ = info_span!("build_aux_trace_segment", num_columns).entered();

Expand Down
20 changes: 10 additions & 10 deletions prover/src/trace/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub trait Trace: Sized {
// REQUIRED METHODS
// --------------------------------------------------------------------------------------------
/// Returns trace info for this trace.
fn get_info(&self) -> &TraceInfo;
fn info(&self) -> &TraceInfo;

/// Returns a reference to a [Matrix] describing the main segment of this trace.
fn main_segment(&self) -> &ColMatrix<Self::BaseField>;
Expand Down Expand Up @@ -81,18 +81,18 @@ pub trait Trace: Sized {
{
// make sure the width align; if they don't something went terribly wrong
assert_eq!(
self.get_info().main_trace_width(),
self.info().main_trace_width(),
air.trace_info().main_trace_width(),
"inconsistent trace width: expected {}, but was {}",
self.get_info().main_trace_width(),
self.info().main_trace_width(),
air.trace_info().main_trace_width(),
);

// --- 1. make sure the assertions are valid ----------------------------------------------

// first, check assertions against the main segment of the execution trace
for assertion in air.get_assertions() {
assertion.apply(self.get_info().length(), |step, value| {
assertion.apply(self.info().length(), |step, value| {
assert!(
value == self.main_segment().get(assertion.column(), step),
"trace does not satisfy assertion main_trace({}, {}) == {}",
Expand All @@ -109,8 +109,8 @@ pub trait Trace: Sized {
// column index in the context of this segment
let mut column_idx = assertion.column();
let mut segment_idx = 0;
for i in 0..self.get_info().num_aux_segments() {
let segment_width = self.get_info().get_aux_segment_width(i);
for i in 0..self.info().num_aux_segments() {
let segment_width = self.info().get_aux_segment_width(i);
if column_idx < segment_width {
segment_idx = i;
break;
Expand All @@ -119,7 +119,7 @@ pub trait Trace: Sized {
}

// get the matrix and verify the assertion against it
assertion.apply(self.get_info().length(), |step, value| {
assertion.apply(self.info().length(), |step, value| {
assert!(
value == aux_segments[segment_idx].get(column_idx, step),
"trace does not satisfy assertion aux_trace({}, {}) == {}",
Expand All @@ -139,9 +139,9 @@ pub trait Trace: Sized {

// initialize buffers to hold evaluation frames and results of constraint evaluations
let mut x = Self::BaseField::ONE;
let mut main_frame = EvaluationFrame::new(self.get_info().main_trace_width());
let mut main_frame = EvaluationFrame::new(self.info().main_trace_width());
let mut aux_frame = if air.trace_info().is_multi_segment() {
Some(EvaluationFrame::<E>::new(self.get_info().aux_trace_width()))
Some(EvaluationFrame::<E>::new(self.info().aux_trace_width()))
} else {
None
};
Expand All @@ -151,7 +151,7 @@ pub trait Trace: Sized {

// we check transition constraints on all steps except the last k steps, where k is the
// number of steps exempt from transition constraints (guaranteed to be at least 1)
for step in 0..self.get_info().length() - air.context().num_transition_exemptions() {
for step in 0..self.info().length() - air.context().num_transition_exemptions() {
// build periodic values
for (p, v) in periodic_values_polys.iter().zip(periodic_values.iter_mut()) {
let num_cycles = air.trace_length() / p.len();
Expand Down
4 changes: 2 additions & 2 deletions prover/src/trace/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ fn new_trace_table() {
let trace_length = 8;
let trace = build_fib_trace(trace_length * 2);

assert_eq!(2, trace.get_info().main_trace_width());
assert_eq!(8, trace.get_info().length());
assert_eq!(2, trace.info().main_trace_width());
assert_eq!(8, trace.info().length());

let expected: Vec<BaseElement> = vec![1u32, 2, 5, 13, 34, 89, 233, 610]
.into_iter()
Expand Down
4 changes: 2 additions & 2 deletions prover/src/trace/trace_lde/default/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fn extend_trace_table() {

// build the trace polynomials, extended trace, and commitment using the default TraceLde impl
let (trace_lde, trace_polys) = DefaultTraceLde::<BaseElement, Blake3>::new(
&trace.get_info(),
&trace.info(),
trace.main_segment(),
&domain,
);
Expand Down Expand Up @@ -76,7 +76,7 @@ fn commit_trace_table() {

// build the trace polynomials, extended trace, and commitment using the default TraceLde impl
let (trace_lde, _) = DefaultTraceLde::<BaseElement, Blake3>::new(
&trace.get_info(),
&trace.info(),
trace.main_segment(),
&domain,
);
Expand Down
2 changes: 1 addition & 1 deletion prover/src/trace/trace_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ impl<B: StarkField> TraceTable<B> {
impl<B: StarkField> Trace for TraceTable<B> {
type BaseField = B;

fn get_info(&self) -> &TraceInfo {
fn info(&self) -> &TraceInfo {
&self.info
}

Expand Down

0 comments on commit a0fdbfc

Please sign in to comment.