Skip to content

Commit

Permalink
feat(blockifier_test_utils): move cairo_compile from blockifier::test…
Browse files Browse the repository at this point in the history
…_utils and update dependencies
  • Loading branch information
rotem-starkware committed Feb 9, 2025
1 parent 3cb7dc1 commit acee391
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 13 deletions.
1 change: 1 addition & 0 deletions .github/workflows/blockifier_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ on:
- 'Cargo.lock'
- 'Cargo.toml'
- 'crates/blockifier/**'
- 'crates/blockifier_test_utils/**'
- 'crates/native_blockifier/**'
- 'crates/starknet_sierra_multicompile/build.rs'
- 'scripts/build_native_blockifier.sh'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/blockifier_compiled_cairo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ on:
- 'Cargo.toml'
- '.github/workflows/blockifier_compiled_cairo.yml'
- 'crates/blockifier/feature_contracts/**'
- 'crates/blockifier/src/test_utils/cairo_compile.rs'
- 'crates/blockifier/tests/feature_contracts_compatibility_test.rs'
- 'crates/blockifier/tests/requirements.txt'
- 'crates/blockifier_test_utils/cairo_compile.rs'
- 'scripts/dependencies.sh'

env:
Expand Down
7 changes: 5 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions crates/blockifier/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,8 @@ starknet_infra_utils.workspace = true
starknet_sierra_multicompile.workspace = true
strum.workspace = true
strum_macros.workspace = true
tempfile.workspace = true
thiserror.workspace = true
tokio = { workspace = true, optional = true, features = ["macros", "rt-multi-thread"] }
toml.workspace = true
tracing = { workspace = true, optional = true }
tracing-test = { workspace = true, optional = true }

Expand Down
1 change: 0 additions & 1 deletion crates/blockifier/src/test_utils.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
pub mod cairo_compile;
pub mod contracts;
pub mod dict_state_reader;
pub mod initial_test_state;
Expand Down
2 changes: 1 addition & 1 deletion crates/blockifier/src/test_utils/contracts.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::collections::HashMap;

use blockifier_test_utils::cairo_compile::{cairo0_compile, cairo1_compile, CompilationArtifacts};
use cairo_lang_starknet_classes::casm_contract_class::CasmContractClass;
use cairo_lang_starknet_classes::contract_class::ContractClass as CairoLangContractClass;
use itertools::Itertools;
Expand All @@ -21,7 +22,6 @@ use crate::execution::contract_class::RunnableCompiledClass;
use crate::execution::entry_point::EntryPointTypeAndSelector;
#[cfg(feature = "cairo_native")]
use crate::execution::native::contract_class::NativeCompiledClassV1;
use crate::test_utils::cairo_compile::{cairo0_compile, cairo1_compile, CompilationArtifacts};
use crate::test_utils::struct_impls::LoadContractFromFile;
use crate::test_utils::{get_raw_contract_class, CairoVersion, RunnableCairo1};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
use std::fs;

use blockifier::test_utils::cairo_compile::{
prepare_group_tag_compiler_deps,
CompilationArtifacts,
};
use blockifier::test_utils::contracts::{
FeatureContract,
CAIRO1_FEATURE_CONTRACTS_DIR,
SIERRA_CONTRACTS_SUBDIR,
};
use blockifier::test_utils::{CairoVersion, RunnableCairo1};
use blockifier_test_utils::cairo_compile::{prepare_group_tag_compiler_deps, CompilationArtifacts};
use pretty_assertions::assert_eq;
use rstest::rstest;
use tracing::info;
Expand Down
5 changes: 5 additions & 0 deletions crates/blockifier_test_utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@ license-file.workspace = true
description = "Test utilities for the blockifier."

[dependencies]
cached.workspace = true
serde = { workspace = true, features = ["derive"] }
starknet-types-core.workspace = true
starknet_api = { workspace = true, features = ["testing"] }
starknet_infra_utils.workspace = true
tempfile.workspace = true
toml.workspace = true

[lints]
workspace = true
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use serde::{Deserialize, Serialize};
use starknet_infra_utils::compile_time_cargo_manifest_dir;
use tempfile::NamedTempFile;

use crate::test_utils::contracts::TagAndToolchain;
use crate::contracts::TagAndToolchain;

const CAIRO0_PIP_REQUIREMENTS_FILE: &str = "tests/requirements.txt";
const CAIRO1_REPO_RELATIVE_PATH_OVERRIDE_ENV_VAR: &str = "CAIRO1_REPO_RELATIVE_PATH";
Expand Down Expand Up @@ -62,7 +62,7 @@ pub enum CompilationArtifacts {
/// Returns the version of the Cairo1 compiler defined in the root Cargo.toml (by checking the
/// package version of one of the crates from the compiler in the dependencies).
pub fn cairo1_compiler_version() -> String {
let cargo_toml: CargoToml = toml::from_str(include_str!("../../../../Cargo.toml")).unwrap();
let cargo_toml: CargoToml = toml::from_str(include_str!("../../../Cargo.toml")).unwrap();
match cargo_toml.workspace.dependencies.cairo_lang_casm {
DependencyValue::String(version) | DependencyValue::Object { version } => version.clone(),
}
Expand Down
1 change: 1 addition & 0 deletions crates/blockifier_test_utils/src/contracts.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub type TagAndToolchain = (Option<String>, Option<String>);
2 changes: 2 additions & 0 deletions crates/blockifier_test_utils/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
pub mod cairo_compile;
pub mod calldata;
pub mod contracts;
pub mod types;

0 comments on commit acee391

Please sign in to comment.