Skip to content

Commit

Permalink
Merge branch 'main' into Cairo_v0.13.2a0_fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Okm165 committed Aug 29, 2024
2 parents 89c38e6 + af5cf79 commit df4da74
Show file tree
Hide file tree
Showing 15 changed files with 406 additions and 132 deletions.
2 changes: 1 addition & 1 deletion src/air/layouts/dex/public_input.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ impl DexPublicInputImpl of PublicInputTrait {
ref memory_index
);

// 3. Output segment
// 3. Output segment
let output_len = output_stop - output_start;
let output = memory
.extract_range(
Expand Down
2 changes: 1 addition & 1 deletion src/air/layouts/recursive/public_input.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ impl RecursivePublicInputImpl of PublicInputTrait {
ref memory_index
);

// 3. Output segment
// 3. Output segment
let output_len = output_stop - output_start;
let output = memory
.extract_range(
Expand Down
2 changes: 1 addition & 1 deletion src/air/layouts/recursive_with_poseidon/public_input.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ impl RecursiveWithPoseidonPublicInputImpl of PublicInputTrait {
ref memory_index
);

// 3. Output segment
// 3. Output segment
let output_len = output_stop - output_start;
let output = memory
.extract_range(
Expand Down
2 changes: 1 addition & 1 deletion src/air/layouts/small/public_input.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ impl SmallPublicInputImpl of PublicInputTrait {
ref memory_index
);

// 3. Output segment
// 3. Output segment
let output_len = output_stop - output_start;
let output = memory
.extract_range(
Expand Down
2 changes: 1 addition & 1 deletion src/air/layouts/starknet/public_input.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ impl StarknetPublicInputImpl of PublicInputTrait {
ref memory_index
);

// 3. Output segment
// 3. Output segment
let output_len = output_stop - output_start;
let output = memory
.extract_range(
Expand Down
2 changes: 1 addition & 1 deletion src/air/layouts/starknet_with_keccak/public_input.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ impl StarknetWithKeccakPublicInputImpl of PublicInputTrait {
ref memory_index
);

// 3. Output segment
// 3. Output segment
let output_len = output_stop - output_start;
let output = memory
.extract_range(
Expand Down
10 changes: 6 additions & 4 deletions src/air/public_input.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -193,22 +193,21 @@ fn verify_cairo1_public_input(public_input: @PublicInput) -> (felt252, felt252)

// 1. Program segment
assert(initial_pc == INITIAL_PC, 'Invalid initial_pc');
let program = memory
.extract_range_unchecked(initial_pc.try_into().unwrap(), memory.len() - output_len);
let program = memory.extract_range_unchecked(0, memory.len() - output_len);
let program_hash = poseidon_hash_span(program);

// 2. Output segment
// 2. Output segment
let output = memory.extract_range_unchecked(memory.len() - output_len, output_len);
let output_hash = poseidon_hash_span(output);
(program_hash, output_hash)
}

// === RECURSIVE BEGIN ===
#[cfg(test)]
mod tests {
use core::debug::PrintTrait;
use super::get_public_input_hash;
use cairo_verifier::tests::stone_proof_fibonacci_keccak::public_input::get;
// test data from cairo0-verifier run on stone-prover generated proof
#[test]
#[available_gas(9999999999)]
fn test_get_public_input_hash() {
Expand All @@ -220,3 +219,6 @@ mod tests {
)
}
}
// === RECURSIVE END ===


2 changes: 1 addition & 1 deletion src/air/public_memory.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl PageImpl of PageTrait {

let current = *self.at(offset);

// TODO is this needed? If not we can just use slice directly
// TODO is this needed? If not we can just use slice directly
assert(current.address == (addr + i).into(), 'Invalid address');
arr.append(current.value);
i += 1;
Expand Down
Loading

0 comments on commit df4da74

Please sign in to comment.