diff --git a/.github/workflows/proof_verification_tests.yml b/.github/workflows/proof_verification_tests.yml
index 5756a5b6..0ee0e0e1 100644
--- a/.github/workflows/proof_verification_tests.yml
+++ b/.github/workflows/proof_verification_tests.yml
@@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
- cairo_version: ['cairo0', 'cairo1']
+ memory_verification: ['cairo0', 'cairo1']
layout: ['recursive', 'recursive_with_poseidon', 'small', 'dex', 'starknet', 'starknet_with_keccak']
hash_function: ['keccak']
hasher_bit_length: ['160_lsb']
@@ -34,4 +34,4 @@ jobs:
run: scarb build --no-default-features --features monolith,${{ matrix.layout }},${{ matrix.hash_function }}
- name: Run verification
- run: cargo run --release --bin runner -- --program target/dev/integrity.sierra.json --cairo-version ${{ matrix.cairo_version == 'cairo0' && 'strict' || 'cairo1' }} --stone-version ${{ matrix.stone_version }} --hasher-bit-length ${{ matrix.hasher_bit_length }} < examples/proofs/${{ matrix.layout }}/${{ matrix.cairo_version }}_${{ matrix.stone_version }}_${{ matrix.hash_function }}_${{ matrix.hasher_bit_length }}_example_proof.json
+ run: cargo run --release --bin runner -- --program target/dev/integrity.sierra.json --cairo-version ${{ matrix.memory_verification == 'cairo0' && 'strict' || 'cairo1' }} --stone-version ${{ matrix.stone_version }} --hasher-bit-length ${{ matrix.hasher_bit_length }} < examples/proofs/${{ matrix.layout }}/${{ matrix.memory_verification }}_${{ matrix.stone_version }}_${{ matrix.hash_function }}_${{ matrix.hasher_bit_length }}_example_proof.json
diff --git a/README.md b/README.md
index 1f08dac1..21cfa2d5 100644
--- a/README.md
+++ b/README.md
@@ -90,7 +90,7 @@ verifier types: [`monolith`, `split`]
There are also additional settings that can be configured at runtime:
-`cairo_version`: [`cairo0`, `cairo1`]
+`memory_verification`: [`cairo0`, `cairo1`]
TODO CHANGE
`stone_version`: [`stone5`, `stone6`]
hasher bit length: [`160_lsb`, `248_lsb`]
diff --git a/runner/src/lib.rs b/runner/src/lib.rs
index d26a179c..bc42e3dd 100644
--- a/runner/src/lib.rs
+++ b/runner/src/lib.rs
@@ -6,18 +6,18 @@ use clap::ValueEnum;
pub use vec252::VecFelt252;
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum)]
-pub enum CairoVersion {
+pub enum MemoryVerification {
Strict = 0,
Relaxed = 1,
Cairo1 = 2,
}
-impl From for Felt252 {
- fn from(value: CairoVersion) -> Self {
+impl From for Felt252 {
+ fn from(value: MemoryVerification) -> Self {
match value {
- CairoVersion::Strict => Felt252::from(0),
- CairoVersion::Relaxed => Felt252::from(1),
- CairoVersion::Cairo1 => Felt252::from(2),
+ MemoryVerification::Strict => Felt252::from(0),
+ MemoryVerification::Relaxed => Felt252::from(1),
+ MemoryVerification::Cairo1 => Felt252::from(2),
}
}
}
diff --git a/runner/src/main.rs b/runner/src/main.rs
index 6ef86fa0..6111d760 100644
--- a/runner/src/main.rs
+++ b/runner/src/main.rs
@@ -7,7 +7,7 @@ use cairo_lang_sierra::program::VersionedProgram;
use cairo_lang_utils::ordered_hash_map::OrderedHashMap;
use clap::Parser;
use itertools::{chain, Itertools};
-use runner::{CairoVersion, HasherBitLength, StoneVersion};
+use runner::{HasherBitLength, MemoryVerification, StoneVersion};
use std::{
fs,
io::{stdin, Read},
@@ -25,7 +25,7 @@ struct Cli {
program: String,
/// Cairo version - public memory pattern
#[clap(value_enum, short, long)]
- cairo_version: CairoVersion,
+ memory_verification: MemoryVerification,
/// Stone version
#[clap(value_enum, short, long)]
stone_version: StoneVersion,
@@ -71,7 +71,7 @@ fn main() -> anyhow::Result<()> {
let func = runner.find_function(ENTRYPOINT).unwrap();
let args = &[
Arg::Array(proof.into_iter().map(Arg::Value).collect_vec()),
- Arg::Value(cli.cairo_version.into()),
+ Arg::Value(cli.memory_verification.into()),
Arg::Value(cli.hasher_bit_length.into()),
Arg::Value(cli.stone_version.into()),
];
diff --git a/src/air/public_input.cairo b/src/air/public_input.cairo
index 9a089887..9ecd5016 100644
--- a/src/air/public_input.cairo
+++ b/src/air/public_input.cairo
@@ -231,12 +231,12 @@ fn verify_relaxed_public_input(public_input: @PublicInput) -> (felt252, felt252)
mod tests {
use super::get_public_input_hash;
use integrity::tests::stone_proof_fibonacci_keccak::public_input::get;
- use integrity::settings::{VerifierSettings, CairoVersion, HasherBitLength, StoneVersion};
+ use integrity::settings::{VerifierSettings, MemoryVerification, HasherBitLength, StoneVersion};
#[test]
#[available_gas(9999999999)]
fn test_get_public_input_hash() {
let settings = VerifierSettings {
- cairo_version: 2, // cairo1
+ memory_verification: 2, // cairo1
hasher_bit_length: HasherBitLength::Lsb160,
stone_version: StoneVersion::Stone5,
};
diff --git a/src/benches/air/traces/decommit.cairo b/src/benches/air/traces/decommit.cairo
index 351193e3..14da5007 100644
--- a/src/benches/air/traces/decommit.cairo
+++ b/src/benches/air/traces/decommit.cairo
@@ -1,7 +1,7 @@
use integrity::{
channel::channel::ChannelImpl, air::layouts::recursive::{traces::traces_decommit},
tests::stone_proof_fibonacci,
- settings::{VerifierSettings, HasherBitLength, StoneVersion, CairoVersion},
+ settings::{VerifierSettings, HasherBitLength, StoneVersion, MemoryVerification},
};
fn bench_air_traces_decommit() {
@@ -11,7 +11,7 @@ fn bench_air_traces_decommit() {
let witness = stone_proof_fibonacci::traces::witness::get();
let settings = VerifierSettings {
- cairo_version: 0, // strict
+ memory_verification: 0, // strict
hasher_bit_length: HasherBitLength::Lsb160,
stone_version: StoneVersion::Stone5,
};
diff --git a/src/benches/stark/stark_proof_verify.cairo b/src/benches/stark/stark_proof_verify.cairo
index 07bb775e..1a140baa 100644
--- a/src/benches/stark/stark_proof_verify.cairo
+++ b/src/benches/stark/stark_proof_verify.cairo
@@ -15,7 +15,7 @@ fn bench_stark_proof_verify() {
};
let settings = VerifierSettings {
- cairo_version: 0, // strict
+ memory_verification: 0, // strict
hasher_bit_length: HasherBitLength::Lsb160,
stone_version: StoneVersion::Stone5,
};
diff --git a/src/benches/stark/verify.cairo b/src/benches/stark/verify.cairo
index 987c11df..d5e5bb3c 100644
--- a/src/benches/stark/verify.cairo
+++ b/src/benches/stark/verify.cairo
@@ -12,7 +12,7 @@ fn bench_stark_verify() {
let stark_domains = stone_proof_fibonacci_keccak::stark::domains::get();
let settings = VerifierSettings {
- cairo_version: 0, // strict
+ memory_verification: 0, // strict
hasher_bit_length: HasherBitLength::Lsb160,
stone_version: StoneVersion::Stone5,
};
diff --git a/src/contracts/fact_registry.cairo b/src/contracts/fact_registry.cairo
index aa1b2eb2..b730e77e 100644
--- a/src/contracts/fact_registry.cairo
+++ b/src/contracts/fact_registry.cairo
@@ -230,6 +230,7 @@ mod FactRegistry {
}
}
+ #[abi(embed_v0)]
impl FactRegistryImpl of IFactRegistry {
fn get_all_verifications_for_fact_hash(
self: @ContractState, fact_hash: FactHash
@@ -291,7 +292,7 @@ mod FactRegistry {
.update(verifier_config.layout)
.update(verifier_config.hasher)
.update(verifier_config.stone_version)
- .update(verifier_config.cairo_version)
+ .update(verifier_config.memory_verification)
.finalize();
let verification_hash = PoseidonImpl::new()
diff --git a/src/contracts/proxy.cairo b/src/contracts/proxy.cairo
index e058d4ed..369655d7 100644
--- a/src/contracts/proxy.cairo
+++ b/src/contracts/proxy.cairo
@@ -73,7 +73,7 @@ mod Proxy {
},
fact_registry_interface::{IFactRegistryDispatcher, IFactRegistryDispatcherTrait,}
},
- StarkProofWithSerde, StarkProof, CairoVersion,
+ StarkProofWithSerde, StarkProof, MemoryVerification,
fri::fri::{FriLayerWitness, FriVerificationStateConstant, FriVerificationStateVariable},
settings::{JobId, FactHash, VerificationHash},
};
diff --git a/src/contracts/verifier.cairo b/src/contracts/verifier.cairo
index b06850f6..47ac0378 100644
--- a/src/contracts/verifier.cairo
+++ b/src/contracts/verifier.cairo
@@ -1,5 +1,5 @@
use integrity::{
- StarkProof, CairoVersion, StarkProofWithSerde,
+ StarkProof, MemoryVerification, StarkProofWithSerde,
fri::fri::{FriLayerWitness, FriVerificationStateConstant, FriVerificationStateVariable},
settings::{VerifierSettings, FactHash, JobId, SecurityBits},
};
@@ -66,7 +66,7 @@ mod CairoVerifier {
storage::{StoragePointerReadAccess, StoragePointerWriteAccess, StoragePathEntry, Map},
};
use integrity::{
- CairoVersion, PublicInputImpl, StarkProofWithSerde, stark::{StarkProof, StarkProofImpl},
+ MemoryVerification, PublicInputImpl, StarkProofWithSerde, stark::{StarkProof, StarkProofImpl},
fri::fri::{
FriLayerWitness, FriVerificationStateConstant, FriVerificationStateVariable,
hash_constant, hash_variable
@@ -111,12 +111,12 @@ mod CairoVerifier {
stark_proof_serde: StarkProofWithSerde,
) -> ProofVerified {
let stark_proof: StarkProof = stark_proof_serde.into();
- let (program_hash, output_hash) = match settings.cairo_version {
+ let (program_hash, output_hash) = match settings.memory_verification {
0 => stark_proof.public_input.verify_strict(),
1 => stark_proof.public_input.verify_relaxed(),
2 => stark_proof.public_input.verify_cairo1(),
_ => {
- assert(false, 'invalid cairo_version');
+ assert(false, 'invalid memory_verification');
(0, 0)
}
};
@@ -143,12 +143,12 @@ mod CairoVerifier {
assert(self.state_constant.entry(job_id).read().is_none(), 'job_id already exists');
let stark_proof: StarkProof = stark_proof_serde.into();
- let (program_hash, output_hash) = match settings.cairo_version {
+ let (program_hash, output_hash) = match settings.memory_verification {
0 => stark_proof.public_input.verify_strict(),
1 => stark_proof.public_input.verify_relaxed(),
2 => stark_proof.public_input.verify_cairo1(),
_ => {
- assert(false, 'invalid cairo_version');
+ assert(false, 'invalid memory_verification');
(0, 0)
}
};
diff --git a/src/lib.cairo b/src/lib.cairo
index e9ac4308..8e54d469 100644
--- a/src/lib.cairo
+++ b/src/lib.cairo
@@ -42,7 +42,7 @@ use integrity::{
IFactRegistry, IFactRegistryDispatcher, IFactRegistryDispatcherTrait
},
settings::{
- FactHash, VerificationHash, PresetHash, SecurityBits, JobId, CairoVersion, HasherBitLength,
+ FactHash, VerificationHash, PresetHash, SecurityBits, JobId, MemoryVerification, HasherBitLength,
StoneVersion, VerifierSettings, VerifierPreset, VerifierConfiguration, split_settings
},
};
@@ -74,12 +74,12 @@ fn main(mut serialized: Span, settings: @VerifierSettings) -> (felt252,
.verify(ContractAddressZero::zero(), ContractAddressZero::zero(), settings);
assert(security_bits >= SECURITY_BITS, 'Security bits are too low');
- let (program_hash, output_hash) = match (*settings).cairo_version {
+ let (program_hash, output_hash) = match (*settings).memory_verification {
0 => stark_proof.public_input.verify_strict(),
1 => stark_proof.public_input.verify_relaxed(),
2 => stark_proof.public_input.verify_cairo1(),
_ => {
- assert(false, 'invalid cairo_version');
+ assert(false, 'invalid memory_verification');
(0, 0)
}
};
diff --git a/src/settings.cairo b/src/settings.cairo
index 8684af5e..4e1f26b7 100644
--- a/src/settings.cairo
+++ b/src/settings.cairo
@@ -6,7 +6,7 @@ type JobId = felt252;
#[derive(Drop, Copy, PartialEq, Serde, starknet::Store)]
-enum CairoVersion {
+enum MemoryVerification {
Strict,
Relaxed,
Cairo1,
@@ -27,7 +27,7 @@ enum StoneVersion {
// settings accepted by verifier (parameters for verification)
#[derive(Drop, Copy, Serde, starknet::Store)]
struct VerifierSettings {
- cairo_version: felt252, // should be CairoVersion but causes compiler bug
+ memory_verification: felt252, // should be MemoryVerification but causes compiler bug
hasher_bit_length: HasherBitLength,
stone_version: StoneVersion,
}
@@ -45,19 +45,19 @@ 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
+ memory_verification: 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 == 'strict' {
- 0 // CairoVersion::Strict
- } else if verifier_config.cairo_version == 'relaxed' {
- 1 // CairoVersion::Relaxed
+ let memory_verification = if verifier_config.memory_verification == 'strict' {
+ 0 // MemoryVerification::Strict
+ } else if verifier_config.memory_verification == 'relaxed' {
+ 1 // MemoryVerification::Relaxed
} else {
- assert(verifier_config.cairo_version == 'cairo1', 'Unsupported cairo version');
- 2 // CairoVersion::Cairo1
+ assert(verifier_config.memory_verification == 'cairo1', 'Unsupported cairo version');
+ 2 // MemoryVerification::Cairo1
};
let (hasher, hasher_bit_length) = if verifier_config.hasher == 'keccak_160_lsb' {
@@ -79,7 +79,7 @@ fn split_settings(verifier_config: VerifierConfiguration) -> (VerifierSettings,
};
(
- VerifierSettings { cairo_version, hasher_bit_length, stone_version },
+ VerifierSettings { memory_verification, hasher_bit_length, stone_version },
VerifierPreset { layout, hasher }
)
}
diff --git a/src/stark/tests/test_stark_proof_verify.cairo b/src/stark/tests/test_stark_proof_verify.cairo
index c89a5f20..325a0051 100644
--- a/src/stark/tests/test_stark_proof_verify.cairo
+++ b/src/stark/tests/test_stark_proof_verify.cairo
@@ -19,7 +19,7 @@ fn test_stark_proof_fibonacci_verify() {
};
let settings = VerifierSettings {
- cairo_version: 0, // strict
+ memory_verification: 0, // strict
hasher_bit_length: HasherBitLength::Lsb160,
stone_version: StoneVersion::Stone5,
};
@@ -42,7 +42,7 @@ fn test_stark_proof_fibonacci_verify() {
};
let settings = VerifierSettings {
- cairo_version: 0, // strict
+ memory_verification: 0, // strict
hasher_bit_length: HasherBitLength::Lsb160,
stone_version: StoneVersion::Stone5,
};
diff --git a/src/stark/tests/test_stark_verify.cairo b/src/stark/tests/test_stark_verify.cairo
index 57ccc6d2..c47545a1 100644
--- a/src/stark/tests/test_stark_verify.cairo
+++ b/src/stark/tests/test_stark_verify.cairo
@@ -15,7 +15,7 @@ fn test_stark_verify() {
let stark_domains = stone_proof_fibonacci::stark::domains::get();
let settings = VerifierSettings {
- cairo_version: 0, // strict
+ memory_verification: 0, // strict
hasher_bit_length: HasherBitLength::Lsb160,
stone_version: StoneVersion::Stone5,
};
@@ -41,7 +41,7 @@ fn test_stark_verify() {
let stark_domains = stone_proof_fibonacci_keccak::stark::domains::get();
let settings = VerifierSettings {
- cairo_version: 0, // strict
+ memory_verification: 0, // strict
hasher_bit_length: HasherBitLength::Lsb160,
stone_version: StoneVersion::Stone5,
};
diff --git a/src/table_commitment/tests/test_table_commitment_decommit.cairo b/src/table_commitment/tests/test_table_commitment_decommit.cairo
index 0db8146c..129789d1 100644
--- a/src/table_commitment/tests/test_table_commitment_decommit.cairo
+++ b/src/table_commitment/tests/test_table_commitment_decommit.cairo
@@ -20,7 +20,7 @@ fn test_table_commitment_decommit() {
let witness = stone_proof_fibonacci::traces::witness::get().original;
let settings = VerifierSettings {
- cairo_version: 0, // strict
+ memory_verification: 0, // strict
hasher_bit_length: HasherBitLength::Lsb160,
stone_version: StoneVersion::Stone5,
};
@@ -37,7 +37,7 @@ fn test_table_commitment_decommit() {
let witness = stone_proof_fibonacci_keccak::traces::witness::get().original;
let settings = VerifierSettings {
- cairo_version: 0, // strict
+ memory_verification: 0, // strict
hasher_bit_length: HasherBitLength::Lsb160,
stone_version: StoneVersion::Stone5,
};
diff --git a/src/vector_commitment/tests/test_vector_commitment_decommit.cairo b/src/vector_commitment/tests/test_vector_commitment_decommit.cairo
index bbbc333c..6742c83b 100644
--- a/src/vector_commitment/tests/test_vector_commitment_decommit.cairo
+++ b/src/vector_commitment/tests/test_vector_commitment_decommit.cairo
@@ -108,7 +108,7 @@ fn test_vector_commitment_decommit_1() {
};
let settings = VerifierSettings {
- cairo_version: 0, // strict
+ memory_verification: 0, // strict
hasher_bit_length: HasherBitLength::Lsb160,
stone_version: StoneVersion::Stone5,
};
@@ -217,7 +217,7 @@ fn test_vector_commitment_decommit() {
};
let settings = VerifierSettings {
- cairo_version: 0, // strict
+ memory_verification: 0, // strict
hasher_bit_length: HasherBitLength::Lsb160,
stone_version: StoneVersion::Stone5,
};
diff --git a/verify-on-starknet.sh b/verify-on-starknet.sh
index 8fe696e3..d1332ed9 100755
--- a/verify-on-starknet.sh
+++ b/verify-on-starknet.sh
@@ -2,7 +2,7 @@
# Check if the arguments are provided
if [ $# -ne 6 ]; then
- echo "Usage: $0 "
+ echo "Usage: $0 "
exit 1
fi
@@ -22,7 +22,7 @@ calldata_file=$2
layout=$(string_to_hex $3)
hasher=$(string_to_hex $4)
stone_version=$(string_to_hex $5)
-cairo_version=$(string_to_hex $6)
+memory_verification=$(string_to_hex $6)
# Check if the file exists
if [ ! -f "$calldata_file" ]; then
@@ -39,5 +39,5 @@ sncast \
invoke \
--contract-address "$contract_address" \
--function "verify_proof_full_and_register_fact" \
- --calldata $layout $hasher $stone_version $cairo_version $calldata \
+ --calldata $layout $hasher $stone_version $memory_verification $calldata \
--fee-token eth