Skip to content

Commit

Permalink
test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Okm165 committed Aug 29, 2024
1 parent da8bf65 commit 909a4b9
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 50 deletions.
5 changes: 3 additions & 2 deletions src/air/public_input.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ fn verify_cairo1_public_input(public_input: @PublicInput) -> (felt252, felt252)

#[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
Expand All @@ -213,9 +214,9 @@ mod tests {
fn test_get_public_input_hash() {
let public_input = get();
let hash = get_public_input_hash(@public_input, 20);

assert(
hash == 0xaf91f2c71f4a594b1575d258ce82464475c82d8fb244142d0db450491c1b52, 'Hash invalid'
hash == 0x113b1d4f79ee0dac11d2677f9f6dc8ffacb6ea129f3ae1e45e1158ad500791f,
'Hash invalid'
)
}
}
4 changes: 2 additions & 2 deletions src/common/hasher.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ fn hash_n_bytes(mut data: Array<u64>, n: u8, hash_len: bool) -> u256 {
}
}
fn hash_truncated(mut data: Array<u64>) -> felt252 {
(keccak::cairo_keccak(ref data, 0, 0)
.flip_endianness() & 0x00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
(keccak::cairo_keccak(ref data, 0, 0).flip_endianness()
& 0x00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
.try_into()
.unwrap()
}
Expand Down
6 changes: 2 additions & 4 deletions src/common/tests/test_blake2s_u8.cairo
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
use cairo_verifier::common::{
array_append::ArrayAppendTrait, blake2s_u8::{blake2s, load32}
};
use cairo_verifier::common::{array_append::ArrayAppendTrait, blake2s_u8::{blake2s, load32}};

fn get_arr_v1(n: u32) -> Array<u8> {
let mut arr = ArrayTrait::new();
Expand Down Expand Up @@ -88,4 +86,4 @@ fn test_blake2s_v2() {
) == 0x5229f5d506302edae36f9cac3f5d176cd9b6aa8420da6d74d7956789099faf70,
'invalid hash (2)'
);
}
}
4 changes: 3 additions & 1 deletion src/stark.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ impl StarkProofImpl of StarkProofTrait {
self.public_input.validate(@stark_domains);

// Compute the initial hash seed for the Fiat-Shamir channel.
let digest = get_public_input_hash(self.public_input, *self.config.n_verifier_friendly_commitment_layers);
let digest = get_public_input_hash(
self.public_input, *self.config.n_verifier_friendly_commitment_layers
);
// Construct the channel.
let mut channel = ChannelImpl::new(digest);

Expand Down
1 change: 0 additions & 1 deletion src/stark/tests.cairo
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// === RECURSIVE BEGIN ===
mod test_stark_commit;
mod test_stark_proof_verify;
mod test_stark_verify;
// === RECURSIVE END ===

Expand Down
40 changes: 0 additions & 40 deletions src/stark/tests/test_stark_proof_verify.cairo

This file was deleted.

0 comments on commit 909a4b9

Please sign in to comment.