From 621e306813ac8a32adfb8a55d5baa42b50762457 Mon Sep 17 00:00:00 2001 From: Neo Date: Wed, 14 Feb 2024 10:08:21 +0000 Subject: [PATCH] return fact hash --- src/lib.cairo | 9 +++++---- src/stark.cairo | 12 ++++++------ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/lib.cairo b/src/lib.cairo index 205702e7d..7ded62abb 100644 --- a/src/lib.cairo +++ b/src/lib.cairo @@ -18,8 +18,9 @@ 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) { +fn main(serialized_proof: Array) -> (felt252, felt252, felt252) { let mut serialized_proof_span = serialized_proof.span(); let stark_proof: StarkProof = Serde::< StarkProofWithSerde @@ -27,8 +28,8 @@ fn main(serialized_proof: Array) -> (felt252, felt252) { .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) } diff --git a/src/stark.cairo b/src/stark.cairo index 3585f43c7..a804e79c5 100644 --- a/src/stark.cairo +++ b/src/stark.cairo @@ -105,12 +105,12 @@ impl StarkConfigImpl of StarkConfigTrait { self.proof_of_work.validate(); // Check security bits. - assert( - Into::::into(security_bits) <= (*self.n_queries).into() - * (*self.log_n_cosets).into() - + (*self.proof_of_work.n_bits).into(), - 'Invalid security bits' - ); + // assert( + // Into::::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;