Skip to content

Commit

Permalink
columns dependent on layout internally in stark_verify function
Browse files Browse the repository at this point in the history
  • Loading branch information
Okm165 committed Aug 28, 2024
1 parent ea33821 commit cc964d1
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 53 deletions.
16 changes: 2 additions & 14 deletions src/benches/stark/verify.cairo
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
use cairo_verifier::{
stark::stark_verify::stark_verify,
air::layouts::recursive::constants::{NUM_COLUMNS_FIRST, NUM_COLUMNS_SECOND},
tests::stone_proof_fibonacci_keccak,
};
use cairo_verifier::{stark::stark_verify::stark_verify, tests::stone_proof_fibonacci_keccak,};

fn bench_stark_verify() {
let public_input = stone_proof_fibonacci_keccak::public_input::get();
Expand All @@ -11,13 +7,5 @@ fn bench_stark_verify() {
let witness = stone_proof_fibonacci_keccak::stark::witness::get();
let stark_domains = stone_proof_fibonacci_keccak::stark::domains::get();

stark_verify(
NUM_COLUMNS_FIRST,
NUM_COLUMNS_SECOND,
@public_input,
queries,
commitment,
witness,
stark_domains,
)
stark_verify(@public_input, queries, commitment, witness, stark_domains,)
}
45 changes: 36 additions & 9 deletions src/oods.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -4,49 +4,49 @@ use cairo_verifier::{
// air::layouts::dex::{
// AIRComposition, AIROods, DexAIRCompositionImpl, DexAIROodsImpl,
// global_values::InteractionElements, public_input::PublicInput, traces::TracesDecommitment,
// constants::{CONSTRAINT_DEGREE, DynamicParams},
// constants::{CONSTRAINT_DEGREE, NUM_COLUMNS_FIRST, NUM_COLUMNS_SECOND, DynamicParams},
// },
// === DEX END ===
// === RECURSIVE BEGIN ===
air::layouts::recursive::{
AIRComposition, AIROods, RecursiveAIRCompositionImpl, RecursiveAIROodsImpl,
global_values::InteractionElements, public_input::PublicInput, traces::TracesDecommitment,
constants::{CONSTRAINT_DEGREE, DynamicParams},
constants::{CONSTRAINT_DEGREE, NUM_COLUMNS_FIRST, NUM_COLUMNS_SECOND, DynamicParams},
},
// === RECURSIVE END ===
// === RECURSIVE_WITH_POSEIDON BEGIN ===
// air::layouts::recursive_with_poseidon::{
// AIRComposition, AIROods, RecursiveWithPoseidonAIRCompositionImpl,
// RecursiveWithPoseidonAIROodsImpl, global_values::InteractionElements,
// public_input::PublicInput, traces::TracesDecommitment, constants::{CONSTRAINT_DEGREE, DynamicParams},
// public_input::PublicInput, traces::TracesDecommitment, constants::{CONSTRAINT_DEGREE, NUM_COLUMNS_FIRST, NUM_COLUMNS_SECOND, DynamicParams},
// },
// === RECURSIVE_WITH_POSEIDON END ===
// === SMALL BEGIN ===
// air::layouts::small::{
// AIRComposition, AIROods, SmallAIRCompositionImpl, SmallAIROodsImpl,
// global_values::InteractionElements, public_input::PublicInput, traces::TracesDecommitment,
// constants::{CONSTRAINT_DEGREE, DynamicParams},
// constants::{CONSTRAINT_DEGREE, NUM_COLUMNS_FIRST, NUM_COLUMNS_SECOND, DynamicParams},
// },
// === SMALL END ===
// === STARKNET BEGIN ===
// air::layouts::starknet::{
// AIRComposition, AIROods, StarknetAIRCompositionImpl, StarknetAIROodsImpl,
// global_values::InteractionElements, public_input::PublicInput, traces::TracesDecommitment,
// constants::{CONSTRAINT_DEGREE, DynamicParams},
// constants::{CONSTRAINT_DEGREE, NUM_COLUMNS_FIRST, NUM_COLUMNS_SECOND, DynamicParams},
// },
// === STARKNET END ===
// === STARKNET_WITH_KECCAK BEGIN ===
// air::layouts::starknet_with_keccak::{
// AIRComposition, AIROods, StarknetWithKeccakAIRCompositionImpl,
// StarknetWithKeccakAIROodsImpl, global_values::InteractionElements,
// public_input::PublicInput, traces::TracesDecommitment, constants::{CONSTRAINT_DEGREE, DynamicParams},
// public_input::PublicInput, traces::TracesDecommitment, constants::{CONSTRAINT_DEGREE, NUM_COLUMNS_FIRST, NUM_COLUMNS_SECOND, DynamicParams},
// },
// === STARKNET_WITH_KECCAK END ===
// === DYNAMIC BEGIN ===
// air::layouts::dynamic::{
// AIRComposition, AIROods, StarknetWithKeccakAIRCompositionImpl,
// StarknetWithKeccakAIROodsImpl, global_values::InteractionElements,
// public_input::PublicInput, traces::TracesDecommitment, constants::{CONSTRAINT_DEGREE, DynamicParams},
// public_input::PublicInput, traces::TracesDecommitment, constants::{CONSTRAINT_DEGREE, NUM_COLUMNS_FIRST, NUM_COLUMNS_SECOND, DynamicParams},
// },
// === DYNAMIC END ===
table_commitment::table_commitment::TableDecommitment
Expand Down Expand Up @@ -88,8 +88,6 @@ fn verify_oods(
}

fn eval_oods_boundary_poly_at_points(
n_original_columns: u32,
n_interaction_columns: u32,
public_input: @PublicInput,
eval_info: OodsEvaluationInfo,
points: Span<felt252>,
Expand All @@ -99,6 +97,35 @@ fn eval_oods_boundary_poly_at_points(
let mut dynamic_params_span = public_input.dynamic_params.span();
let dynamic_params = Serde::<DynamicParams>::deserialize(ref dynamic_params_span).unwrap();

// === DEX BEGIN ===
// let n_original_columns: u32 = NUM_COLUMNS_FIRST;
// let n_interaction_columns: u32 = NUM_COLUMNS_SECOND;
// === DEX END ===
// === RECURSIVE BEGIN ===
let n_original_columns: u32 = NUM_COLUMNS_FIRST;
let n_interaction_columns: u32 = NUM_COLUMNS_SECOND;
// === RECURSIVE END ===
// === RECURSIVE_WITH_POSEIDON BEGIN ===
// let n_original_columns: u32 = NUM_COLUMNS_FIRST;
// let n_interaction_columns: u32 = NUM_COLUMNS_SECOND;
// === RECURSIVE_WITH_POSEIDON END ===
// === SMALL BEGIN ===
// let n_original_columns: u32 = NUM_COLUMNS_FIRST;
// let n_interaction_columns: u32 = NUM_COLUMNS_SECOND;
// === SMALL END ===
// === STARKNET BEGIN ===
// let n_original_columns: u32 = NUM_COLUMNS_FIRST;
// let n_interaction_columns: u32 = NUM_COLUMNS_SECOND;
// === STARKNET END ===
// === STARKNET_WITH_KECCAK BEGIN ===
// let n_original_columns: u32 = NUM_COLUMNS_FIRST;
// let n_interaction_columns: u32 = NUM_COLUMNS_SECOND;
// === STARKNET_WITH_KECCAK END ===
// === DYNAMIC BEGIN ===
// let n_original_columns: u32 = dynamic_params.num_columns_first;
// let n_interaction_columns: u32 = dynamic_params.num_columns_second;
// === DYNAMIC END ===

assert(
decommitment.original.values.len() == points.len() * n_original_columns, 'Invalid value'
);
Expand Down
15 changes: 1 addition & 14 deletions src/stark.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -11,52 +11,45 @@ use cairo_verifier::{
// layouts::dex::{
// traces::{TracesConfig, TracesConfigTrait}, public_input::DexPublicInputImpl,
// traces::{TracesUnsentCommitment, TracesCommitment, TracesDecommitment, TracesWitness},
// constants::{NUM_COLUMNS_FIRST, NUM_COLUMNS_SECOND}
// },
// === DEX END ===
// === RECURSIVE BEGIN ===
layouts::recursive::{
traces::{TracesConfig, TracesConfigTrait}, public_input::RecursivePublicInputImpl,
traces::{TracesUnsentCommitment, TracesCommitment, TracesDecommitment, TracesWitness},
constants::{NUM_COLUMNS_FIRST, NUM_COLUMNS_SECOND},
},
// === RECURSIVE END ===
// === RECURSIVE_WITH_POSEIDON BEGIN ===
// layouts::recursive_with_poseidon::{
// traces::{TracesConfig, TracesConfigTrait},
// public_input::RecursiveWithPoseidonPublicInputImpl,
// traces::{TracesUnsentCommitment, TracesCommitment, TracesDecommitment, TracesWitness},
// constants::{NUM_COLUMNS_FIRST, NUM_COLUMNS_SECOND}
// },
// === RECURSIVE_WITH_POSEIDON END ===
// === SMALL BEGIN ===
// layouts::small::{
// traces::{TracesConfig, TracesConfigTrait}, public_input::SmallPublicInputImpl,
// traces::{TracesUnsentCommitment, TracesCommitment, TracesDecommitment, TracesWitness},
// constants::{NUM_COLUMNS_FIRST, NUM_COLUMNS_SECOND}
// },
// === SMALL END ===
// === STARKNET BEGIN ===
// layouts::starknet::{
// traces::{TracesConfig, TracesConfigTrait}, public_input::StarknetPublicInputImpl,
// traces::{TracesUnsentCommitment, TracesCommitment, TracesDecommitment, TracesWitness},
// constants::{NUM_COLUMNS_FIRST, NUM_COLUMNS_SECOND}
// },
// === STARKNET END ===
// === STARKNET_WITH_KECCAK BEGIN ===
// layouts::starknet_with_keccak::{
// traces::{TracesConfig, TracesConfigTrait},
// public_input::StarknetWithKeccakPublicInputImpl,
// traces::{TracesUnsentCommitment, TracesCommitment, TracesDecommitment, TracesWitness},
// constants::{NUM_COLUMNS_FIRST, NUM_COLUMNS_SECOND}
// },
// === STARKNET_WITH_KECCAK END ===
// === DYNAMIC BEGIN ===
// layouts::dynamic::{
// traces::{TracesConfig, TracesConfigTrait},
// public_input::StarknetWithKeccakPublicInputImpl,
// traces::{TracesUnsentCommitment, TracesCommitment, TracesDecommitment, TracesWitness},
// constants::{NUM_COLUMNS_FIRST, NUM_COLUMNS_SECOND}
// },
// === DYNAMIC END ===
},
Expand Down Expand Up @@ -115,13 +108,7 @@ impl StarkProofImpl of StarkProofTrait {

// STARK verify phase.
stark_verify::stark_verify(
NUM_COLUMNS_FIRST,
NUM_COLUMNS_SECOND,
self.public_input,
queries.span(),
stark_commitment,
*self.witness,
stark_domains
self.public_input, queries.span(), stark_commitment, *self.witness, stark_domains
)
}
}
Expand Down
4 changes: 0 additions & 4 deletions src/stark/stark_verify.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ use cairo_verifier::{

// STARK verify phase.
fn stark_verify(
n_original_columns: u32,
n_interaction_columns: u32,
public_input: @PublicInput,
queries: Span<felt252>,
commitment: StarkCommitment,
Expand Down Expand Up @@ -59,8 +57,6 @@ fn stark_verify(
constraint_coefficients: commitment.interaction_after_oods,
};
let oods_poly_evals = eval_oods_boundary_poly_at_points(
n_original_columns,
n_interaction_columns,
public_input,
eval_info,
points.span(),
Expand Down
14 changes: 2 additions & 12 deletions src/stark/tests/test_stark_verify.cairo
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use cairo_verifier::{
stark::stark_verify::stark_verify,
air::layouts::recursive::constants::{NUM_COLUMNS_FIRST, NUM_COLUMNS_SECOND},
tests::{stone_proof_fibonacci, stone_proof_fibonacci_keccak}
stark::stark_verify::stark_verify, tests::{stone_proof_fibonacci, stone_proof_fibonacci_keccak}
};

// === BLAKE2S BEGIN ===
Expand Down Expand Up @@ -29,15 +27,7 @@ fn test_stark_verify() {
let witness = stone_proof_fibonacci_keccak::stark::witness::get();
let stark_domains = stone_proof_fibonacci_keccak::stark::domains::get();

stark_verify(
NUM_COLUMNS_FIRST,
NUM_COLUMNS_SECOND,
@public_input,
queries,
commitment,
witness,
stark_domains,
)
stark_verify(@public_input, queries, commitment, witness, stark_domains,)
}
// === KECCAK END ===

Expand Down

0 comments on commit cc964d1

Please sign in to comment.