Skip to content

Commit

Permalink
major refactor tests fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Okm165 committed Jul 12, 2024
1 parent 6b685a7 commit 9101bd7
Show file tree
Hide file tree
Showing 51 changed files with 3,383 additions and 3,814 deletions.
10 changes: 4 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ members = [
"crates/fri",
"crates/pow",
"crates/stark",
"crates/common",
]
exclude = []

Expand All @@ -25,17 +24,16 @@ version = "0.0.1"

[workspace.dependencies]
serde = { version = "1.0", features = ["derive"] }
starknet-crypto = "0.7.1"
starknet-core = "0.11.1"
thiserror = "1.0.61"
serde_with = "2.3.2"
sha3 = "0.10.8"
starknet-core = "0.11.1"
starknet-crypto = "0.7.1"
starknet-types-core = "0.1.5"
thiserror = "1.0.61"

cairovm_verifier_air = { path = "crates/air" }
cairovm_verifier_transcript = { path = "crates/transcript" }
cairovm_verifier_commitment = { path = "crates/commitment" }
cairovm_verifier_fri = { path = "crates/fri" }
cairovm_verifier_pow = { path = "crates/pow" }
cairovm_verifier_stark = { path = "crates/stark" }
cairovm_verifier_common = { path = "crates/common" }
cairovm_verifier_transcript = { path = "crates/transcript" }
23 changes: 9 additions & 14 deletions crates/air/src/fixtures/commitment.rs
Original file line number Diff line number Diff line change
@@ -1,33 +1,28 @@
use cairovm_verifier_commitment::{
table::types::Commitment as TableCommitment,
vector::{config::Config as VectorCommitmentConfig, types::Commitment as VectorCommitment},
};
use starknet_crypto::Felt;

use crate::trace::Commitment;

use super::{config, interaction_elements, unsent_commitment};
use crate::trace::Commitment;
use cairovm_verifier_commitment::{table, vector};
use starknet_crypto::Felt;

pub fn get() -> Commitment {
let unsent_commitment = unsent_commitment::get();
let traces_config = config::get();

Commitment {
original: TableCommitment {
original: table::types::Commitment {
config: traces_config.original,
vector_commitment: VectorCommitment {
config: VectorCommitmentConfig {
vector_commitment: vector::types::Commitment {
config: vector::config::Config {
height: Felt::from_hex_unchecked("0x14"),
n_verifier_friendly_commitment_layers: Felt::from_hex_unchecked("0x64"),
},
commitment_hash: unsent_commitment.original,
},
},
interaction_elements: interaction_elements::get(),
interaction: TableCommitment {
interaction: table::types::Commitment {
config: traces_config.interaction,
vector_commitment: VectorCommitment {
config: VectorCommitmentConfig {
vector_commitment: vector::types::Commitment {
config: vector::config::Config {
height: Felt::from_hex_unchecked("0x14"),
n_verifier_friendly_commitment_layers: Felt::from_hex_unchecked("0x64"),
},
Expand Down
19 changes: 8 additions & 11 deletions crates/air/src/fixtures/config.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
use cairovm_verifier_commitment::{
table::config::Config as TableConfig, vector::config::Config as VectorConfig,
};
use crate::trace;
use cairovm_verifier_commitment::{table, vector};
use starknet_crypto::Felt;

use crate::trace::config::Config;

pub fn get() -> Config {
Config {
original: TableConfig {
pub fn get() -> trace::config::Config {
trace::config::Config {
original: table::config::Config {
n_columns: Felt::from_hex_unchecked("0x7"),
vector: VectorConfig {
vector: vector::config::Config {
height: Felt::from_hex_unchecked("0x14"),
n_verifier_friendly_commitment_layers: Felt::from_hex_unchecked("0x64"),
},
},
interaction: TableConfig {
interaction: table::config::Config {
n_columns: Felt::from_hex_unchecked("0x3"),
vector: VectorConfig {
vector: vector::config::Config {
height: Felt::from_hex_unchecked("0x14"),
n_verifier_friendly_commitment_layers: Felt::from_hex_unchecked("0x64"),
},
Expand Down
12 changes: 6 additions & 6 deletions crates/air/src/fixtures/decommitment.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use cairovm_verifier_commitment::table::types::Decommitment as TableDecommitment;
use cairovm_verifier_commitment::table;
use starknet_crypto::Felt;

use crate::trace::Decommitment;
use crate::trace;

pub fn get() -> Decommitment {
Decommitment {
original: TableDecommitment {
pub fn get() -> trace::Decommitment {
trace::Decommitment {
original: table::types::Decommitment {
values: vec![
Felt::from_hex_unchecked(
"0x5a81cfa7b8ba1dd722ce2bcaf78476fd0e0b7fda53287ed2632c2c32ab4f42c",
Expand Down Expand Up @@ -219,7 +219,7 @@ pub fn get() -> Decommitment {
),
],
},
interaction: TableDecommitment {
interaction: table::types::Decommitment {
values: vec![
Felt::from_hex_unchecked(
"0x5bf29218811908115445900bc8f367dcf29cf113bfe0e29f3c669b396e12da6",
Expand Down
1 change: 1 addition & 0 deletions crates/air/src/fixtures/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ pub mod commitment;
pub mod config;
pub mod decommitment;
pub mod interaction_elements;
pub mod public_input;
pub mod unsent_commitment;
pub mod witness;
234 changes: 234 additions & 0 deletions crates/air/src/fixtures/public_input.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
use crate::{
public_memory::PublicInput,
types::{AddrValue, Page, SegmentInfo},
};
use starknet_crypto::Felt;

pub fn get() -> PublicInput {
PublicInput {
log_n_steps: Felt::from_hex_unchecked("0xe"),
range_check_min: Felt::from_hex_unchecked("0x7ffa"),
range_check_max: Felt::from_hex_unchecked("0x8001"),
layout: Felt::from_hex_unchecked("0x726563757273697665"),
dynamic_params: vec![],
segments: vec![
SegmentInfo {
begin_addr: Felt::from_hex_unchecked("0x1"),
stop_ptr: Felt::from_hex_unchecked("0x5"),
},
SegmentInfo {
begin_addr: Felt::from_hex_unchecked("0x25"),
stop_ptr: Felt::from_hex_unchecked("0x68"),
},
SegmentInfo {
begin_addr: Felt::from_hex_unchecked("0x68"),
stop_ptr: Felt::from_hex_unchecked("0x6a"),
},
SegmentInfo {
begin_addr: Felt::from_hex_unchecked("0x6a"),
stop_ptr: Felt::from_hex_unchecked("0x6a"),
},
SegmentInfo {
begin_addr: Felt::from_hex_unchecked("0x1ea"),
stop_ptr: Felt::from_hex_unchecked("0x1ea"),
},
SegmentInfo {
begin_addr: Felt::from_hex_unchecked("0x9ea"),
stop_ptr: Felt::from_hex_unchecked("0x9ea"),
},
],
padding_addr: Felt::from_hex_unchecked("0x1"),
padding_value: Felt::from_hex_unchecked("0x40780017fff7fff"),
main_page: Page(vec![
AddrValue {
address: Felt::from_hex_unchecked("0x1"),
value: Felt::from_hex_unchecked("0x40780017fff7fff"),
},
AddrValue {
address: Felt::from_hex_unchecked("0x2"),
value: Felt::from_hex_unchecked("0x4"),
},
AddrValue {
address: Felt::from_hex_unchecked("0x3"),
value: Felt::from_hex_unchecked("0x1104800180018000"),
},
AddrValue {
address: Felt::from_hex_unchecked("0x4"),
value: Felt::from_hex_unchecked("0x4"),
},
AddrValue {
address: Felt::from_hex_unchecked("0x5"),
value: Felt::from_hex_unchecked("0x10780017fff7fff"),
},
AddrValue {
address: Felt::from_hex_unchecked("0x6"),
value: Felt::from_hex_unchecked("0x0"),
},
AddrValue {
address: Felt::from_hex_unchecked("0x7"),
value: Felt::from_hex_unchecked("0x40780017fff7fff"),
},
AddrValue {
address: Felt::from_hex_unchecked("0x8"),
value: Felt::from_hex_unchecked("0x1"),
},
AddrValue {
address: Felt::from_hex_unchecked("0x9"),
value: Felt::from_hex_unchecked("0x400380007ffa8000"),
},
AddrValue {
address: Felt::from_hex_unchecked("0xa"),
value: Felt::from_hex_unchecked("0x480680017fff8000"),
},
AddrValue {
address: Felt::from_hex_unchecked("0xb"),
value: Felt::from_hex_unchecked("0x1"),
},
AddrValue {
address: Felt::from_hex_unchecked("0xc"),
value: Felt::from_hex_unchecked("0x480680017fff8000"),
},
AddrValue {
address: Felt::from_hex_unchecked("0xd"),
value: Felt::from_hex_unchecked("0x1"),
},
AddrValue {
address: Felt::from_hex_unchecked("0xe"),
value: Felt::from_hex_unchecked("0x480a80007fff8000"),
},
AddrValue {
address: Felt::from_hex_unchecked("0xf"),
value: Felt::from_hex_unchecked("0x1104800180018000"),
},
AddrValue {
address: Felt::from_hex_unchecked("0x10"),
value: Felt::from_hex_unchecked("0x9"),
},
AddrValue {
address: Felt::from_hex_unchecked("0x11"),
value: Felt::from_hex_unchecked("0x400280017ffa7fff"),
},
AddrValue {
address: Felt::from_hex_unchecked("0x12"),
value: Felt::from_hex_unchecked("0x482680017ffa8000"),
},
AddrValue {
address: Felt::from_hex_unchecked("0x13"),
value: Felt::from_hex_unchecked("0x2"),
},
AddrValue {
address: Felt::from_hex_unchecked("0x14"),
value: Felt::from_hex_unchecked("0x480a7ffb7fff8000"),
},
AddrValue {
address: Felt::from_hex_unchecked("0x15"),
value: Felt::from_hex_unchecked("0x480a7ffc7fff8000"),
},
AddrValue {
address: Felt::from_hex_unchecked("0x16"),
value: Felt::from_hex_unchecked("0x480a7ffd7fff8000"),
},
AddrValue {
address: Felt::from_hex_unchecked("0x17"),
value: Felt::from_hex_unchecked("0x208b7fff7fff7ffe"),
},
AddrValue {
address: Felt::from_hex_unchecked("0x18"),
value: Felt::from_hex_unchecked("0x20780017fff7ffd"),
},
AddrValue {
address: Felt::from_hex_unchecked("0x19"),
value: Felt::from_hex_unchecked("0x4"),
},
AddrValue {
address: Felt::from_hex_unchecked("0x1a"),
value: Felt::from_hex_unchecked("0x480a7ffc7fff8000"),
},
AddrValue {
address: Felt::from_hex_unchecked("0x1b"),
value: Felt::from_hex_unchecked("0x208b7fff7fff7ffe"),
},
AddrValue {
address: Felt::from_hex_unchecked("0x1c"),
value: Felt::from_hex_unchecked("0x480a7ffc7fff8000"),
},
AddrValue {
address: Felt::from_hex_unchecked("0x1d"),
value: Felt::from_hex_unchecked("0x482a7ffc7ffb8000"),
},
AddrValue {
address: Felt::from_hex_unchecked("0x1e"),
value: Felt::from_hex_unchecked("0x482680017ffd8000"),
},
AddrValue {
address: Felt::from_hex_unchecked("0x1f"),
value: Felt::from_hex_unchecked(
"0x800000000000011000000000000000000000000000000000000000000000000",
),
},
AddrValue {
address: Felt::from_hex_unchecked("0x20"),
value: Felt::from_hex_unchecked("0x1104800180018000"),
},
AddrValue {
address: Felt::from_hex_unchecked("0x21"),
value: Felt::from_hex_unchecked(
"0x800000000000010fffffffffffffffffffffffffffffffffffffffffffffff9",
),
},
AddrValue {
address: Felt::from_hex_unchecked("0x22"),
value: Felt::from_hex_unchecked("0x208b7fff7fff7ffe"),
},
AddrValue {
address: Felt::from_hex_unchecked("0x23"),
value: Felt::from_hex_unchecked("0x25"),
},
AddrValue {
address: Felt::from_hex_unchecked("0x24"),
value: Felt::from_hex_unchecked("0x0"),
},
AddrValue {
address: Felt::from_hex_unchecked("0x25"),
value: Felt::from_hex_unchecked("0x68"),
},
AddrValue {
address: Felt::from_hex_unchecked("0x26"),
value: Felt::from_hex_unchecked("0x6a"),
},
AddrValue {
address: Felt::from_hex_unchecked("0x27"),
value: Felt::from_hex_unchecked("0x1ea"),
},
AddrValue {
address: Felt::from_hex_unchecked("0x28"),
value: Felt::from_hex_unchecked("0x9ea"),
},
AddrValue {
address: Felt::from_hex_unchecked("0x64"),
value: Felt::from_hex_unchecked("0x6a"),
},
AddrValue {
address: Felt::from_hex_unchecked("0x65"),
value: Felt::from_hex_unchecked("0x6a"),
},
AddrValue {
address: Felt::from_hex_unchecked("0x66"),
value: Felt::from_hex_unchecked("0x1ea"),
},
AddrValue {
address: Felt::from_hex_unchecked("0x67"),
value: Felt::from_hex_unchecked("0x9ea"),
},
AddrValue {
address: Felt::from_hex_unchecked("0x68"),
value: Felt::from_hex_unchecked("0xa"),
},
AddrValue {
address: Felt::from_hex_unchecked("0x69"),
value: Felt::from_hex_unchecked("0x90"),
},
]),
continuous_page_headers: vec![],
}
}
6 changes: 3 additions & 3 deletions crates/air/src/fixtures/unsent_commitment.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use starknet_crypto::Felt;

use crate::trace::UnsentCommitment;
use crate::trace;

pub fn get() -> UnsentCommitment {
UnsentCommitment {
pub fn get() -> trace::UnsentCommitment {
trace::UnsentCommitment {
original: Felt::from_hex_unchecked(
"0x2a588e8517b956684162e05e373dc6891146c1853c82d3984fbc707ae937972",
),
Expand Down
Loading

0 comments on commit 9101bd7

Please sign in to comment.