Skip to content

[core] plumb table ID to flush #708

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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
5 changes: 4 additions & 1 deletion crates/core/src/constraint_system/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ use binius_math::MultilinearPoly;
use itertools::izip;

use super::error::{Error, VerificationError};
use crate::{oracle::OracleId, witness::MultilinearExtensionIndex};
use crate::{constraint_system::TableId, oracle::OracleId, witness::MultilinearExtensionIndex};

pub type ChannelId = usize;

Expand All @@ -68,6 +68,7 @@ pub enum OracleOrConst<F: Field> {
}
#[derive(Debug, Clone, SerializeBytes, DeserializeBytes)]
pub struct Flush<F: TowerField> {
pub table_id: TableId,
pub oracles: Vec<OracleOrConst<F>>,
pub channel_id: ChannelId,
pub direction: FlushDirection,
Expand Down Expand Up @@ -125,7 +126,9 @@ where
direction,
ref selectors,
multiplicity,
table_id,
} = flush;
let _ = table_id;

if channel_id > max_channel_id {
return Err(Error::ChannelIdOutOfRange {
Expand Down
1 change: 1 addition & 0 deletions crates/core/src/constraint_system/prove.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ where
let mixing_challenge = transcript.sample();
let permutation_challenges = transcript.sample_vec(channel_count);

flushes.retain(|flush| table_sizes[flush.table_id] > 0);
flushes.sort_by_key(|flush| flush.channel_id);
let flush_oracle_ids =
make_flush_oracles(&mut oracles, &flushes, mixing_challenge, &permutation_challenges)?;
Expand Down
1 change: 1 addition & 0 deletions crates/core/src/constraint_system/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ fn test_make_masked_flush_witnesses_handles_small_n_vars() {
.unwrap();

let flush = Flush {
table_id: 0,
oracles: vec![OracleOrConst::<F>::Oracle(poly_id)],
channel_id: 0,
direction: FlushDirection::Push,
Expand Down
1 change: 1 addition & 0 deletions crates/core/src/constraint_system/verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ where
// TODO(cryptographers): Find a way to sample less randomness
let permutation_challenges = transcript.sample_vec(channel_count);

flushes.retain(|flush| table_sizes[flush.table_id] > 0);
flushes.sort_by_key(|flush| flush.channel_id);
let flush_oracle_ids =
make_flush_oracles(&mut oracles, &flushes, mixing_challenge, &permutation_challenges)?;
Expand Down
1 change: 1 addition & 0 deletions crates/m3/src/builder/constraint_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ impl<F: TowerField> ConstraintSystem<F> {
.collect::<Vec<_>>();

compiled_flushes.push(CompiledFlush {
table_id: table.id(),
oracles: flush_oracles,
channel_id: *channel_id,
direction: *direction,
Expand Down
Loading