diff --git a/src/fact_registry.cairo b/src/fact_registry.cairo index e4acb830..bd70a1d6 100644 --- a/src/fact_registry.cairo +++ b/src/fact_registry.cairo @@ -1,104 +1,41 @@ use cairo_verifier::{ StarkProofWithSerde, fri::fri::{FriLayerWitness, FriVerificationStateConstant, FriVerificationStateVariable}, - verifier::InitResult, settings::{VerifierSettings, HasherBitLength, StoneVersion, CairoVersion}, + verifier::InitResult, + settings::{ + VerifierSettings, VerificationHash, HasherBitLength, StoneVersion, CairoVersion, + SecurityBits, FactHash, JobId, VerifierConfiguration, VerifierPreset, + }, }; use starknet::ContractAddress; -// preset that identify the verifier (hardcoded in verifier) -#[derive(Drop, Copy, Serde)] -struct VerifierPreset { - layout: felt252, - hasher: felt252, -} - -// both preset and settings merged together -#[derive(Drop, Copy, Serde)] -struct VerifierConfiguration { - layout: felt252, // string encoded as hex - hasher: felt252, // function and number of bits - stone_version: felt252, // stone5 or stone6 - cairo_version: felt252, // cairo0 or cairo1 -} - -fn verifier_configuration_to_tuple( - verifier_config: VerifierConfiguration -) -> (felt252, felt252, felt252, felt252) { - ( - verifier_config.layout, - verifier_config.hasher, - verifier_config.stone_version, - verifier_config.cairo_version, - ) -} - -fn verifier_configuration_from_tuple( - tuple: (felt252, felt252, felt252, felt252) -) -> VerifierConfiguration { - let (layout, hasher, stone_version, cairo_version) = tuple; - VerifierConfiguration { layout, hasher, stone_version, cairo_version, } -} - -fn split_settings(verifier_config: VerifierConfiguration) -> (VerifierSettings, VerifierPreset) { - let layout = verifier_config.layout; - - let cairo_version = if verifier_config.cairo_version == 'cairo0' { - CairoVersion::Cairo0 - } else { - assert(verifier_config.cairo_version == 'cairo1', 'Unsupported variant'); - CairoVersion::Cairo1 - }; - - let (hasher, hasher_bit_length) = if verifier_config.hasher == 'keccak_160_lsb' { - ('keccak', HasherBitLength::Lsb160) - } else if verifier_config.hasher == 'keccak_248_lsb' { - ('keccak', HasherBitLength::Lsb248) - } else if verifier_config.hasher == 'blake2s_160_lsb' { - ('blake2s', HasherBitLength::Lsb248) - } else { - assert(verifier_config.hasher == 'blake2s_248_lsb', 'Unsupported variant'); - ('blake2s', HasherBitLength::Lsb248) - }; - - let stone_version = if verifier_config.stone_version == 'stone5' { - StoneVersion::Stone5 - } else { - assert(verifier_config.stone_version == 'stone6', 'Unsupported variant'); - StoneVersion::Stone6 - }; - - ( - VerifierSettings { cairo_version, hasher_bit_length, stone_version }, - VerifierPreset { layout, hasher } - ) -} #[derive(Drop, Copy, Serde)] struct VerificationListElement { - verification_hash: felt252, - security_bits: u32, + verification_hash: VerificationHash, + security_bits: SecurityBits, verifier_config: VerifierConfiguration, } -#[derive(Drop, Copy, Serde)] +#[derive(Drop, Copy, Serde, starknet::Store)] struct Verification { - fact_hash: felt252, - security_bits: u32, + fact_hash: FactHash, + security_bits: SecurityBits, verifier_config: VerifierConfiguration, } #[derive(Drop, Copy, Serde, starknet::Event)] struct FactRegistered { #[key] - fact_hash: felt252, + fact_hash: FactHash, #[key] verifier_address: ContractAddress, #[key] - security_bits: u32, + security_bits: SecurityBits, #[key] verifier_config: VerifierConfiguration, #[key] - verification_hash: felt252, + verification_hash: VerificationHash, } #[starknet::interface] @@ -111,14 +48,14 @@ trait IFactRegistry { fn verify_proof_initial( ref self: TContractState, - job_id: felt252, + job_id: JobId, verifier_config: VerifierConfiguration, stark_proof: StarkProofWithSerde, ) -> InitResult; fn verify_proof_step( ref self: TContractState, - job_id: felt252, + job_id: JobId, state_constant: FriVerificationStateConstant, state_variable: FriVerificationStateVariable, witness: FriLayerWitness, @@ -126,16 +63,18 @@ trait IFactRegistry { fn verify_proof_final_and_register_fact( ref self: TContractState, - job_id: felt252, + job_id: JobId, state_constant: FriVerificationStateConstant, state_variable: FriVerificationStateVariable, last_layer_coefficients: Span, ) -> FactRegistered; fn get_all_verifications_for_fact_hash( - self: @TContractState, fact_hash: felt252 + self: @TContractState, fact_hash: FactHash ) -> Array; - fn get_verification(self: @TContractState, verification_hash: felt252) -> Option; + fn get_verification( + self: @TContractState, verification_hash: VerificationHash + ) -> Option; fn get_verifier_address(self: @TContractState, preset: VerifierPreset) -> ContractAddress; fn register_verifier( @@ -150,6 +89,10 @@ mod FactRegistry { StarkProofWithSerde, StarkProof, CairoVersion, verifier::{InitResult, ICairoVerifierDispatcher, ICairoVerifierDispatcherTrait}, fri::fri::{FriLayerWitness, FriVerificationStateConstant, FriVerificationStateVariable}, + settings::{ + VerifierPreset, VerifierConfiguration, split_settings, JobId, FactHash, + VerificationHash, PresetHash, SecurityBits, + }, }; use starknet::{ ContractAddress, get_caller_address, @@ -157,25 +100,23 @@ mod FactRegistry { }; use core::{ poseidon::{Poseidon, PoseidonImpl, HashStateImpl}, keccak::keccak_u256s_be_inputs, - starknet::event::EventEmitter - }; - use super::{ - VerifierPreset, VerificationListElement, Verification, IFactRegistry, FactRegistered, - VerifierConfiguration, split_settings, verifier_configuration_from_tuple, - verifier_configuration_to_tuple + starknet::event::EventEmitter, }; + use super::{VerificationListElement, Verification, IFactRegistry, FactRegistered}; #[storage] struct Storage { owner: ContractAddress, - verifiers: Map, - facts: Map, // fact_hash => number of verifications registered - fact_verifications: Map<(felt252, u32), felt252>, // fact_hash, index => verification_hash + verifiers: Map, + facts: Map, // fact_hash => number of verifications registered + fact_verifications: Map< + (FactHash, u32), VerificationHash + >, // fact_hash, index => verification_hash verification_hashes: Map< - felt252, Option<(felt252, u32, (felt252, felt252, felt252, felt252))> - >, // verification_hash => (fact_hash, security_bits, VerifierConfiguration) + VerificationHash, Option + >, // verification_hash => Verification verifier_configs: Map< - felt252, Option<(felt252, felt252, felt252, felt252)> + JobId, Option >, // job_id => VerifierConfiguration } @@ -227,14 +168,11 @@ mod FactRegistry { fn verify_proof_initial( ref self: ContractState, - job_id: felt252, + job_id: JobId, verifier_config: VerifierConfiguration, stark_proof: StarkProofWithSerde, ) -> InitResult { - self - .verifier_configs - .entry(job_id) - .write(Option::Some(verifier_configuration_to_tuple(verifier_config))); + self.verifier_configs.entry(job_id).write(Option::Some(verifier_config)); let (verifier_settings, verifier_preset) = split_settings(verifier_config); ICairoVerifierDispatcher { contract_address: self.get_verifier_address(verifier_preset) @@ -244,14 +182,16 @@ mod FactRegistry { fn verify_proof_step( ref self: ContractState, - job_id: felt252, + job_id: JobId, state_constant: FriVerificationStateConstant, state_variable: FriVerificationStateVariable, witness: FriLayerWitness, ) -> (FriVerificationStateVariable, u32) { - let verifier_config = verifier_configuration_from_tuple( - self.verifier_configs.entry(job_id).read().expect('Job id not found') - ); + let verifier_config = self + .verifier_configs + .entry(job_id) + .read() + .expect('Job id not found'); let (_, verifier_preset) = split_settings(verifier_config); let verifier_address = self.get_verifier_address(verifier_preset); ICairoVerifierDispatcher { contract_address: verifier_address } @@ -260,14 +200,16 @@ mod FactRegistry { fn verify_proof_final_and_register_fact( ref self: ContractState, - job_id: felt252, + job_id: JobId, state_constant: FriVerificationStateConstant, state_variable: FriVerificationStateVariable, last_layer_coefficients: Span, ) -> FactRegistered { - let verifier_config = verifier_configuration_from_tuple( - self.verifier_configs.entry(job_id).read().expect('Job id not found') - ); + let verifier_config = self + .verifier_configs + .entry(job_id) + .read() + .expect('Job id not found'); let (_, verifier_preset) = split_settings(verifier_config); let verifier_address = self.get_verifier_address(verifier_preset); let result = ICairoVerifierDispatcher { contract_address: verifier_address } @@ -282,7 +224,7 @@ mod FactRegistry { } fn get_all_verifications_for_fact_hash( - self: @ContractState, fact_hash: felt252 + self: @ContractState, fact_hash: FactHash ) -> Array { let n = self.facts.entry(fact_hash).read(); let mut i = 0; @@ -292,16 +234,17 @@ mod FactRegistry { break; } let verification_hash = self.fact_verifications.entry((fact_hash, i)).read(); - let (_, security_bits, verifier_config_tuple) = self + let verification = self .verification_hashes .entry(verification_hash) .read() .unwrap(); - let verifier_config = verifier_configuration_from_tuple(verifier_config_tuple); arr .append( VerificationListElement { - verification_hash, security_bits, verifier_config + verification_hash, + security_bits: verification.security_bits, + verifier_config: verification.verifier_config } ); i += 1; @@ -310,16 +253,9 @@ mod FactRegistry { } fn get_verification( - self: @ContractState, verification_hash: felt252 + self: @ContractState, verification_hash: VerificationHash ) -> Option { - match self.verification_hashes.entry(verification_hash).read() { - Option::Some(x) => { - let (fact_hash, security_bits, verifier_config_tuple) = x; - let verifier_config = verifier_configuration_from_tuple(verifier_config_tuple); - Option::Some(Verification { fact_hash, security_bits, verifier_config }) - }, - Option::None => { Option::None } - } + self.verification_hashes.entry(verification_hash).read() } fn get_verifier_address(self: @ContractState, preset: VerifierPreset) -> ContractAddress { @@ -355,27 +291,24 @@ mod FactRegistry { #[generate_trait] impl InternalFactRegistry of InternalFactRegistryTrait { - fn _hash_configuration(self: @ContractState, config: VerifierConfiguration) -> felt252 { - PoseidonImpl::new() - .update(config.layout) - .update(config.hasher) - .update(config.stone_version) - .update(config.cairo_version) - .finalize() - } - - fn _hash_preset(self: @ContractState, preset: VerifierPreset) -> felt252 { + fn _hash_preset(self: @ContractState, preset: VerifierPreset) -> PresetHash { PoseidonImpl::new().update(preset.layout).update(preset.hasher).finalize() } fn _register_fact( ref self: ContractState, - fact_hash: felt252, + fact_hash: FactHash, verifier_address: ContractAddress, - security_bits: u32, + security_bits: SecurityBits, verifier_config: VerifierConfiguration, ) -> FactRegistered { - let verifier_config_hash = self._hash_configuration(verifier_config); + let verifier_config_hash = PoseidonImpl::new() + .update(verifier_config.layout) + .update(verifier_config.hasher) + .update(verifier_config.stone_version) + .update(verifier_config.cairo_version) + .finalize(); + let verification_hash = PoseidonImpl::new() .update(fact_hash) .update(verifier_config_hash) @@ -387,20 +320,13 @@ mod FactRegistry { }; self.emit(Event::FactRegistered(event)); - if self.verification_hashes.entry(verification_hash).read().is_none() { + let verification_hash_entry = self.verification_hashes.entry(verification_hash); + if verification_hash_entry.read().is_none() { let next_index = self.facts.entry(fact_hash).read(); self.fact_verifications.entry((fact_hash, next_index)).write(verification_hash); - self - .verification_hashes - .entry(verification_hash) + verification_hash_entry .write( - Option::Some( - ( - fact_hash, - security_bits, - verifier_configuration_to_tuple(verifier_config) - ) - ) + Option::Some(Verification { fact_hash, security_bits, verifier_config }) ); self.facts.entry(fact_hash).write(next_index + 1); } diff --git a/src/proxy.cairo b/src/proxy.cairo index 81fd12ce..27b99ad0 100644 --- a/src/proxy.cairo +++ b/src/proxy.cairo @@ -5,6 +5,7 @@ use cairo_verifier::{ fact_registry::{ FactRegistered, VerifierConfiguration, VerificationListElement, Verification, VerifierPreset }, + settings::{JobId, FactHash, VerificationHash}, }; use starknet::{ContractAddress, ClassHash}; @@ -18,14 +19,14 @@ trait IProxy { fn verify_proof_initial( ref self: TContractState, - job_id: felt252, + job_id: JobId, verifier_config: VerifierConfiguration, stark_proof: StarkProofWithSerde, ) -> InitResult; fn verify_proof_step( ref self: TContractState, - job_id: felt252, + job_id: JobId, state_constant: FriVerificationStateConstant, state_variable: FriVerificationStateVariable, witness: FriLayerWitness, @@ -33,16 +34,18 @@ trait IProxy { fn verify_proof_final_and_register_fact( ref self: TContractState, - job_id: felt252, + job_id: JobId, state_constant: FriVerificationStateConstant, state_variable: FriVerificationStateVariable, last_layer_coefficients: Span, ) -> FactRegistered; fn get_all_verifications_for_fact_hash( - self: @TContractState, fact_hash: felt252 + self: @TContractState, fact_hash: FactHash ) -> Array; - fn get_verification(self: @TContractState, verification_hash: felt252) -> Option; + fn get_verification( + self: @TContractState, verification_hash: VerificationHash + ) -> Option; fn get_verifier_address(self: @TContractState, preset: VerifierPreset) -> ContractAddress; fn register_verifier( @@ -66,6 +69,7 @@ mod Proxy { StarkProofWithSerde, StarkProof, CairoVersion, verifier::{InitResult, ICairoVerifierDispatcher, ICairoVerifierDispatcherTrait}, fri::fri::{FriLayerWitness, FriVerificationStateConstant, FriVerificationStateVariable}, + settings::{JobId, FactHash, VerificationHash}, }; use starknet::{ContractAddress, ClassHash, get_caller_address, syscalls}; use core::{ @@ -109,7 +113,7 @@ mod Proxy { fn verify_proof_initial( ref self: ContractState, - job_id: felt252, + job_id: JobId, verifier_config: VerifierConfiguration, stark_proof: StarkProofWithSerde, ) -> InitResult { @@ -119,7 +123,7 @@ mod Proxy { fn verify_proof_step( ref self: ContractState, - job_id: felt252, + job_id: JobId, state_constant: FriVerificationStateConstant, state_variable: FriVerificationStateVariable, witness: FriLayerWitness, @@ -130,7 +134,7 @@ mod Proxy { fn verify_proof_final_and_register_fact( ref self: ContractState, - job_id: felt252, + job_id: JobId, state_constant: FriVerificationStateConstant, state_variable: FriVerificationStateVariable, last_layer_coefficients: Span, @@ -145,14 +149,14 @@ mod Proxy { } fn get_all_verifications_for_fact_hash( - self: @ContractState, fact_hash: felt252 + self: @ContractState, fact_hash: FactHash ) -> Array { IFactRegistryDispatcher { contract_address: self.fact_registry.read() } .get_all_verifications_for_fact_hash(fact_hash) } fn get_verification( - self: @ContractState, verification_hash: felt252 + self: @ContractState, verification_hash: VerificationHash ) -> Option { IFactRegistryDispatcher { contract_address: self.fact_registry.read() } .get_verification(verification_hash) diff --git a/src/settings.cairo b/src/settings.cairo index 860d3a33..6cdcf522 100644 --- a/src/settings.cairo +++ b/src/settings.cairo @@ -1,70 +1,81 @@ -#[derive(Drop, Copy, PartialEq, Serde)] +type FactHash = felt252; +type VerificationHash = felt252; +type PresetHash = felt252; +type SecurityBits = u32; +type JobId = felt252; + +#[derive(Drop, Copy, PartialEq, Serde, starknet::Store)] enum CairoVersion { Cairo0, Cairo1, } -#[derive(Drop, Copy, PartialEq, Serde)] +#[derive(Drop, Copy, PartialEq, Serde, starknet::Store)] enum HasherBitLength { Lsb160, Lsb248, } -#[derive(Drop, Copy, PartialEq, Serde)] +#[derive(Drop, Copy, PartialEq, Serde, starknet::Store)] enum StoneVersion { Stone5, Stone6, } // settings accepted by verifier (parameters for verification) -#[derive(Drop, Copy, Serde)] +#[derive(Drop, Copy, Serde, starknet::Store)] struct VerifierSettings { cairo_version: CairoVersion, hasher_bit_length: HasherBitLength, stone_version: StoneVersion, } -fn verifier_settings_to_tuple(settings: VerifierSettings) -> (felt252, felt252, felt252) { - let cairo_version = match settings.cairo_version { - CairoVersion::Cairo0 => 0, - CairoVersion::Cairo1 => 1, - }; - let hasher_bit_length = match settings.hasher_bit_length { - HasherBitLength::Lsb160 => 0, - HasherBitLength::Lsb248 => 1, - }; - let stone_version = match settings.stone_version { - StoneVersion::Stone5 => 0, - StoneVersion::Stone6 => 1, - }; - (cairo_version, hasher_bit_length, stone_version) +// preset that identify the verifier (hardcoded in verifier) +#[derive(Drop, Copy, Serde)] +struct VerifierPreset { + layout: felt252, + hasher: felt252, } -fn tuple_to_verifier_settings(tuple: (felt252, felt252, felt252)) -> VerifierSettings { - let (cairo_verifier, hasher_bit_length, stone_version) = tuple; - let cairo_version = match cairo_verifier { - 0 => CairoVersion::Cairo0, - 1 => CairoVersion::Cairo1, - _ => { - assert(false, 'invalid cairo_version'); - CairoVersion::Cairo0 - }, +// both preset and settings merged together +#[derive(Drop, Copy, Serde, starknet::Store)] +struct VerifierConfiguration { + layout: felt252, // string encoded as hex + hasher: felt252, // function and number of bits + stone_version: felt252, // stone5 or stone6 + cairo_version: felt252, // cairo0 or cairo1 +} + +fn split_settings(verifier_config: VerifierConfiguration) -> (VerifierSettings, VerifierPreset) { + let layout = verifier_config.layout; + + let cairo_version = if verifier_config.cairo_version == 'cairo0' { + CairoVersion::Cairo0 + } else { + assert(verifier_config.cairo_version == 'cairo1', 'Unsupported cairo version'); + CairoVersion::Cairo1 }; - let hasher_bit_length = match hasher_bit_length { - 0 => HasherBitLength::Lsb160, - 1 => HasherBitLength::Lsb248, - _ => { - assert(false, 'invalid hasher_bit_length'); - HasherBitLength::Lsb160 - } + + let (hasher, hasher_bit_length) = if verifier_config.hasher == 'keccak_160_lsb' { + ('keccak', HasherBitLength::Lsb160) + } else if verifier_config.hasher == 'keccak_248_lsb' { + ('keccak', HasherBitLength::Lsb248) + } else if verifier_config.hasher == 'blake2s_160_lsb' { + ('blake2s', HasherBitLength::Lsb248) + } else { + assert(verifier_config.hasher == 'blake2s_248_lsb', 'Unsupported hasher variant'); + ('blake2s', HasherBitLength::Lsb248) }; - let stone_version = match stone_version { - 0 => StoneVersion::Stone5, - 1 => StoneVersion::Stone6, - _ => { - assert(false, 'invalid stone_version'); - StoneVersion::Stone5 - } + + let stone_version = if verifier_config.stone_version == 'stone5' { + StoneVersion::Stone5 + } else { + assert(verifier_config.stone_version == 'stone6', 'Unsupported stone version'); + StoneVersion::Stone6 }; - VerifierSettings { cairo_version, hasher_bit_length, stone_version, } + + ( + VerifierSettings { cairo_version, hasher_bit_length, stone_version }, + VerifierPreset { layout, hasher } + ) } diff --git a/src/verifier.cairo b/src/verifier.cairo index 626e8aca..2d78e661 100644 --- a/src/verifier.cairo +++ b/src/verifier.cairo @@ -1,14 +1,14 @@ use cairo_verifier::{ StarkProof, CairoVersion, StarkProofWithSerde, fri::fri::{FriLayerWitness, FriVerificationStateConstant, FriVerificationStateVariable}, - settings::VerifierSettings, + settings::{VerifierSettings, FactHash, JobId, SecurityBits}, }; #[derive(Drop, Serde)] struct InitResult { program_hash: felt252, output_hash: felt252, - fact: felt252, + fact: FactHash, last_layer_coefficients: Span, state_constant: FriVerificationStateConstant, state_variable: FriVerificationStateVariable, @@ -18,11 +18,11 @@ struct InitResult { #[derive(Drop, Copy, Serde, starknet::Event)] struct ProofVerified { #[key] - job_id: felt252, + job_id: JobId, #[key] - fact: felt252, + fact: FactHash, #[key] - security_bits: u32, + security_bits: SecurityBits, #[key] settings: VerifierSettings, } @@ -37,14 +37,14 @@ trait ICairoVerifier { fn verify_proof_initial( ref self: TContractState, - job_id: felt252, + job_id: JobId, settings: VerifierSettings, stark_proof_serde: StarkProofWithSerde, ) -> InitResult; fn verify_proof_step( ref self: TContractState, - job_id: felt252, + job_id: JobId, state_constant: FriVerificationStateConstant, state_variable: FriVerificationStateVariable, witness: FriLayerWitness, @@ -52,7 +52,7 @@ trait ICairoVerifier { fn verify_proof_final( ref self: TContractState, - job_id: felt252, + job_id: JobId, state_constant: FriVerificationStateConstant, state_variable: FriVerificationStateVariable, last_layer_coefficients: Span, @@ -71,7 +71,7 @@ mod CairoVerifier { FriLayerWitness, FriVerificationStateConstant, FriVerificationStateVariable, hash_constant, hash_variable }, - settings::{VerifierSettings, verifier_settings_to_tuple, tuple_to_verifier_settings}, + settings::{VerifierSettings, JobId, FactHash, SecurityBits}, }; use core::poseidon::{Poseidon, PoseidonImpl, HashStateImpl}; use super::{ProofVerified, InitResult, ICairoVerifier}; @@ -80,13 +80,11 @@ mod CairoVerifier { struct Storage { composition_contract_address: ContractAddress, oods_contract_address: ContractAddress, - state_constant: Map>, // job_id => hash(constant state) - state_variable: Map>, // job_id => hash(variable state) - state_fact: Map>, // job_id => fact_hash - state_security_bits: Map>, // job_id => security_bits - state_settings: Map< - felt252, Option<(felt252, felt252, felt252)> - >, // job_id => verifier_settings + state_constant: Map>, // job_id => hash(constant state) + state_variable: Map>, // job_id => hash(variable state) + state_fact: Map>, // job_id => fact_hash + state_security_bits: Map>, // job_id => security_bits + state_settings: Map>, // job_id => verifier_settings } #[constructor] @@ -133,7 +131,7 @@ mod CairoVerifier { fn verify_proof_initial( ref self: ContractState, - job_id: felt252, + job_id: JobId, settings: VerifierSettings, stark_proof_serde: StarkProofWithSerde, ) -> InitResult { @@ -157,7 +155,7 @@ mod CairoVerifier { self.state_variable.entry(job_id).write(Option::Some(hash_variable(@var))); self.state_fact.entry(job_id).write(Option::Some(fact)); self.state_security_bits.entry(job_id).write(Option::Some(security_bits)); - self.state_settings.write(job_id, Option::Some(verifier_settings_to_tuple(settings))); + self.state_settings.write(job_id, Option::Some(settings)); let layers_left = con.n_layers - var.iter; @@ -174,7 +172,7 @@ mod CairoVerifier { fn verify_proof_step( ref self: ContractState, - job_id: felt252, + job_id: JobId, state_constant: FriVerificationStateConstant, state_variable: FriVerificationStateVariable, witness: FriLayerWitness, @@ -195,9 +193,7 @@ mod CairoVerifier { .expect('No state (variable) saved'), 'Invalid state (variable)' ); - let settings = tuple_to_verifier_settings( - self.state_settings.entry(job_id).read().expect('No settings saved') - ); + let settings = self.state_settings.entry(job_id).read().expect('No settings saved'); let (con, var) = StarkProofImpl::verify_step( state_constant, state_variable, witness, settings @@ -211,7 +207,7 @@ mod CairoVerifier { fn verify_proof_final( ref self: ContractState, - job_id: felt252, + job_id: JobId, state_constant: FriVerificationStateConstant, state_variable: FriVerificationStateVariable, last_layer_coefficients: Span, @@ -236,9 +232,7 @@ mod CairoVerifier { ); assert(new_var.iter.into() == new_con.n_layers + 1, 'Verification not finalized'); - let settings = tuple_to_verifier_settings( - self.state_settings.entry(job_id).read().expect('No settings saved') - ); + let settings = self.state_settings.entry(job_id).read().expect('No settings saved'); self.state_variable.entry(job_id).write(Option::None); self.state_constant.entry(job_id).write(Option::None);