Skip to content

Commit af5cf79

Browse files
fmkraOkm165
andauthored
Optimizations (#136)
* Use divrem in rotr functions * Sigma calculation optimization * Use felts where possible * Inline rotr functions * Fmt * Fix comment break * Revert to scarb 2.6.3 * Fmt * Fmt * public input hash test * cairo0_example_proof_blake2s * Fix public input test * Fmt * ducking formatting * I gonna loose my mind --------- Co-authored-by: Bartosz Nowak <[email protected]>
1 parent 1c8fb28 commit af5cf79

16 files changed

+407
-132
lines changed

src/air/layouts/dex/public_input.cairo

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl DexPublicInputImpl of PublicInputTrait {
9797
ref memory_index
9898
);
9999

100-
// 3. Output segment
100+
// 3. Output segment
101101
let output_len = output_stop - output_start;
102102
let output = memory
103103
.extract_range(

src/air/layouts/recursive/public_input.cairo

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl RecursivePublicInputImpl of PublicInputTrait {
9797
ref memory_index
9898
);
9999

100-
// 3. Output segment
100+
// 3. Output segment
101101
let output_len = output_stop - output_start;
102102
let output = memory
103103
.extract_range(

src/air/layouts/recursive_with_poseidon/public_input.cairo

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ impl RecursiveWithPoseidonPublicInputImpl of PublicInputTrait {
9898
ref memory_index
9999
);
100100

101-
// 3. Output segment
101+
// 3. Output segment
102102
let output_len = output_stop - output_start;
103103
let output = memory
104104
.extract_range(

src/air/layouts/small/public_input.cairo

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl SmallPublicInputImpl of PublicInputTrait {
9797
ref memory_index
9898
);
9999

100-
// 3. Output segment
100+
// 3. Output segment
101101
let output_len = output_stop - output_start;
102102
let output = memory
103103
.extract_range(

src/air/layouts/starknet/public_input.cairo

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ impl StarknetPublicInputImpl of PublicInputTrait {
9898
ref memory_index
9999
);
100100

101-
// 3. Output segment
101+
// 3. Output segment
102102
let output_len = output_stop - output_start;
103103
let output = memory
104104
.extract_range(

src/air/layouts/starknet_with_keccak/public_input.cairo

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ impl StarknetWithKeccakPublicInputImpl of PublicInputTrait {
9898
ref memory_index
9999
);
100100

101-
// 3. Output segment
101+
// 3. Output segment
102102
let output_len = output_stop - output_start;
103103
let output = memory
104104
.extract_range(

src/air/public_input.cairo

+5-2
Original file line numberDiff line numberDiff line change
@@ -177,17 +177,17 @@ fn verify_cairo1_public_input(public_input: @PublicInput) -> (felt252, felt252)
177177
let program = memory.extract_range_unchecked(0, memory.len() - output_len);
178178
let program_hash = poseidon_hash_span(program);
179179

180-
// 2. Output segment
180+
// 2. Output segment
181181
let output = memory.extract_range_unchecked(memory.len() - output_len, output_len);
182182
let output_hash = poseidon_hash_span(output);
183183
(program_hash, output_hash)
184184
}
185185

186+
// === RECURSIVE BEGIN ===
186187
#[cfg(test)]
187188
mod tests {
188189
use super::get_public_input_hash;
189190
use cairo_verifier::tests::stone_proof_fibonacci_keccak::public_input::get;
190-
// test data from cairo0-verifier run on stone-prover generated proof
191191
#[test]
192192
#[available_gas(9999999999)]
193193
fn test_get_public_input_hash() {
@@ -199,3 +199,6 @@ mod tests {
199199
)
200200
}
201201
}
202+
// === RECURSIVE END ===
203+
204+

src/air/public_memory.cairo

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ impl PageImpl of PageTrait {
5656

5757
let current = *self.at(offset);
5858

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

0 commit comments

Comments
 (0)