Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions verifier/src/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,16 @@ where

/// Returns execution trace commitments sent by the prover.
///
/// For computations requiring multiple trace segment, the returned slice will contain a
/// commitment for each trace segment.
pub fn read_trace_commitments(&self) -> &[H::Digest] {
&self.trace_commitments
/// Returns a tuple containing the main trace commitment and an optional auxiliary trace
/// commitment (present only for multi-segment traces).
pub fn read_trace_commitments(&self) -> (H::Digest, Option<H::Digest>) {
let main = self.trace_commitments[0];
let aux = if self.trace_commitments.len() > 1 {
Some(self.trace_commitments[1])
} else {
None
};
(main, aux)
}

/// Returns constraint evaluation commitment sent by the prover.
Expand Down
8 changes: 3 additions & 5 deletions verifier/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,20 +167,18 @@ where
// used to draw random elements needed to construct the next trace segment. The last trace
// commitment is used to draw a set of random coefficients which the prover uses to compute
// constraint composition polynomial.
const MAIN_TRACE_IDX: usize = 0;
const AUX_TRACE_IDX: usize = 1;
let trace_commitments = channel.read_trace_commitments();
let (main_trace_commitment, aux_trace_commitment) = channel.read_trace_commitments();

// reseed the coin with the commitment to the main trace segment
public_coin.reseed(trace_commitments[MAIN_TRACE_IDX]);
public_coin.reseed(main_trace_commitment);

// process auxiliary trace segments (if any), to build a set of random elements for each segment
let aux_trace_rand_elements = if air.trace_info().is_multi_segment() {
let aux_rand_elements = air
.get_aux_rand_elements(&mut public_coin)
.expect("failed to generate the random elements needed to build the auxiliary trace");

public_coin.reseed(trace_commitments[AUX_TRACE_IDX]);
public_coin.reseed(aux_trace_commitment.expect("missing auxiliary trace commitment"));

Some(aux_rand_elements)
} else {
Expand Down