Skip to content

Commit

Permalink
return fact hash
Browse files Browse the repository at this point in the history
  • Loading branch information
neotheprogramist committed Feb 14, 2024
1 parent 40e0b74 commit 621e306
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
9 changes: 5 additions & 4 deletions src/lib.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,18 @@ use cairo_verifier::{
deserialization::stark::StarkProofWithSerde, stark::{StarkProof, StarkProofImpl},
air::public_input::PublicInputTrait
};
use core::poseidon::{Poseidon, PoseidonImpl, HashStateImpl};

fn main(serialized_proof: Array<felt252>) -> (felt252, felt252) {
fn main(serialized_proof: Array<felt252>) -> (felt252, felt252, felt252) {
let mut serialized_proof_span = serialized_proof.span();
let stark_proof: StarkProof = Serde::<
StarkProofWithSerde
>::deserialize(ref serialized_proof_span)
.unwrap()
.into();

stark_proof.verify();
let (program_hash, output_hash) = stark_proof.public_input.verify();
let (program_hash, output_hash) = stark_proof.verify();
let fact = PoseidonImpl::new().update(program_hash).update(output_hash).finalize();

(program_hash, output_hash)
(program_hash, output_hash, fact)
}
12 changes: 6 additions & 6 deletions src/stark.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ impl StarkConfigImpl of StarkConfigTrait {
self.proof_of_work.validate();

// Check security bits.
assert(
Into::<felt252, u256>::into(security_bits) <= (*self.n_queries).into()
* (*self.log_n_cosets).into()
+ (*self.proof_of_work.n_bits).into(),
'Invalid security bits'
);
// assert(
// Into::<felt252, u256>::into(security_bits) <= (*self.n_queries).into()
// * (*self.log_n_cosets).into()
// + (*self.proof_of_work.n_bits).into(),
// 'Invalid security bits'
// );

// Validate traces config.
let log_eval_domain_size = *self.log_trace_domain_size + *self.log_n_cosets;
Expand Down

0 comments on commit 621e306

Please sign in to comment.