Skip to content

Commit

Permalink
Fix issues
Browse files Browse the repository at this point in the history
  • Loading branch information
fmkra committed Jan 11, 2024
1 parent 890fe1a commit c11db06
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 20 deletions.
15 changes: 9 additions & 6 deletions src/air/traces.cairo
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use cairo_verifier::channel::channel::ChannelTrait;
use cairo_verifier::table_commitment::table_commitment::{
TableUnsentCommitment, TableCommitment, TableDecommitment, TableCommitmentWitness, table_commit,
table_decommit,
TableCommitment, TableDecommitment, TableCommitmentWitness, table_commit, table_decommit,
};
use cairo_verifier::air::{public_input::PublicInput, traces_config::TracesConfig};
use cairo_verifier::channel::channel::Channel;
Expand All @@ -18,8 +17,8 @@ use cairo_verifier::channel::channel::Channel;
// values from the channel.
#[derive(Drop, Copy)]
struct TracesUnsentCommitment {
original: TableUnsentCommitment,
interaction: TableUnsentCommitment,
original: felt252,
interaction: felt252,
}

// Commitment for the Traces component.
Expand Down Expand Up @@ -62,11 +61,15 @@ fn traces_commit(
config: TracesConfig
) -> TracesCommitment {
// Read original commitment.
let original_commitment = table_commit(unsent_commitment.original, config.original);
let original_commitment = table_commit(
ref channel, unsent_commitment.original, config.original
);
// Generate interaction elements for the first interaction.
let interaction_elements = channel.random_felts_to_prover(n_interaction_elements);
// Read interaction commitment.
let interaction_commitment = table_commit(unsent_commitment.interaction, config.interaction);
let interaction_commitment = table_commit(
ref channel, unsent_commitment.interaction, config.interaction
);

TracesCommitment {
public_input: public_input,
Expand Down
8 changes: 3 additions & 5 deletions src/deserialization/fri.cairo
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use cairo_verifier::{
fri::{fri_config::FriConfig, fri::{FriUnsentCommitment, FriWitness, FriLayerWitness}},
table_commitment::table_commitment::{
TableCommitmentConfig, TableCommitmentWitness, TableUnsentCommitment
},
table_commitment::table_commitment::{TableCommitmentConfig, TableCommitmentWitness},
vector_commitment::vector_commitment::{VectorCommitmentConfig, VectorCommitmentWitness},
};

Expand Down Expand Up @@ -58,13 +56,13 @@ struct FriUnsentCommitmentWithSerde {
}
impl IntoFriUnsentCommitment of Into<FriUnsentCommitmentWithSerde, FriUnsentCommitment> {
fn into(self: FriUnsentCommitmentWithSerde) -> FriUnsentCommitment {
let mut inner_layers = ArrayTrait::<TableUnsentCommitment>::new();
let mut inner_layers = ArrayTrait::<felt252>::new();
let mut i = 0;
loop {
if i == self.inner_layers.len() {
break;
}
inner_layers.append(TableUnsentCommitment { vector: *self.inner_layers[i] });
inner_layers.append(*self.inner_layers[i]);
i += 1;
};
FriUnsentCommitment {
Expand Down
7 changes: 2 additions & 5 deletions src/deserialization/traces.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use cairo_verifier::{
}
},
table_commitment::table_commitment::{
TableCommitmentConfig, TableCommitmentWitness, TableDecommitment, TableUnsentCommitment
TableCommitmentConfig, TableCommitmentWitness, TableDecommitment
},
};

Expand Down Expand Up @@ -54,10 +54,7 @@ struct TracesUnsentCommitmentWithSerde {
}
impl IntoTracesUnsentCommitment of Into<TracesUnsentCommitmentWithSerde, TracesUnsentCommitment> {
fn into(self: TracesUnsentCommitmentWithSerde) -> TracesUnsentCommitment {
TracesUnsentCommitment {
original: TableUnsentCommitment { vector: self.original },
interaction: TableUnsentCommitment { vector: self.original },
}
TracesUnsentCommitment { original: self.original, interaction: self.original, }
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/fri/fri.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use cairo_verifier::{
},
table_commitment::table_commitment::{
TableCommitmentWitness, TableDecommitment, TableCommitment, TableCommitmentConfig,
TableUnsentCommitment, table_commit, table_decommit
table_commit, table_decommit
}
};

Expand All @@ -17,7 +17,7 @@ use cairo_verifier::{
#[derive(Drop, Copy)]
struct FriUnsentCommitment {
// Array of size n_layers - 1 containing unsent table commitments for each inner layer.
inner_layers: Span<TableUnsentCommitment>,
inner_layers: Span<felt252>,
// Array of size 2**log_last_layer_degree_bound containing coefficients for the last layer
// polynomial.
last_layer_coefficients: Span<felt252>,
Expand Down Expand Up @@ -86,7 +86,7 @@ fn fri_commit_rounds(
ref channel: Channel,
n_layers: felt252,
configs: Span<TableCommitmentConfig>,
unsent_commitments: Span<TableUnsentCommitment>,
unsent_commitments: Span<felt252>,
step_sizes: Span<felt252>,
) -> (Array<TableCommitment>, Array<felt252>) {
let mut commitments = ArrayTrait::<TableCommitment>::new();
Expand All @@ -99,7 +99,7 @@ fn fri_commit_rounds(
break;
}
// Read commitments.
commitments.append(table_commit(*unsent_commitments.at(i), *configs.at(i)));
commitments.append(table_commit(ref channel, *unsent_commitments.at(i), *configs.at(i)));
// Send the next eval_points.
eval_points.append(channel.random_felt_to_prover());

Expand Down

0 comments on commit c11db06

Please sign in to comment.