Skip to content

Commit

Permalink
small enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
neotheprogramist committed Feb 7, 2024
1 parent 2472d7a commit 76d55d6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions fact_registry/src/lib.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ mod FactRegistry {
#[abi(embed_v0)]
impl FactRegistryImpl of super::IFactRegistry<ContractState> {
fn verify_and_register_fact(ref self: ContractState, stark_proof: StarkProofWithSerde) {
let (program_hash, program_output_hash) = self.cairo_verifier.verify_proof(stark_proof);
let (program_hash, output_hash) = self.cairo_verifier.verify_proof(stark_proof);
let fact = PoseidonImpl::new()
.update(program_hash)
.update(program_output_hash)
.update(output_hash)
.finalize();
self.emit(Event::FactRegistered(FactRegistered { fact }));
self.facts.write(fact, true);
Expand Down
10 changes: 5 additions & 5 deletions fact_registry/tests/test_contract.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ fn test_return_false_before_register() {
let contract_address = deploy_contract('FactRegistry');
let dispatcher = IFactRegistryDispatcher { contract_address };

let program_hash = 0;
let program_output_hash = 0;
let fact = PoseidonImpl::new().update(program_hash).update(program_output_hash).finalize();
let program_hash = 1551631761987449313068479026839604705498481570694519235869911227847882150820;
let output_hash = 2336063802160155556507656746920808233007292323159462153734705441523787563728;
let fact = PoseidonImpl::new().update(program_hash).update(output_hash).finalize();

let result = dispatcher.is_valid(fact);
assert(result == false, 'Fact should not be valid');
Expand All @@ -36,8 +36,8 @@ fn test_valid_proof_registers_fact() {

dispatcher.verify_and_register_fact(stark_proof);

let program_hash = 3079335794724869688242598235275801819928706317639282524427601876274248508975;
let output_hash = 3125953701990409645607292272040066796400233313650038958016652175380834344318;
let program_hash = 1551631761987449313068479026839604705498481570694519235869911227847882150820;
let output_hash = 2336063802160155556507656746920808233007292323159462153734705441523787563728;
let fact = PoseidonImpl::new().update(program_hash).update(output_hash).finalize();

let result = dispatcher.is_valid(fact);
Expand Down

0 comments on commit 76d55d6

Please sign in to comment.