Skip to content
This repository was archived by the owner on Aug 21, 2024. It is now read-only.

Commit 103ae1b

Browse files
chore: add text file with current compiler version for CI use
Signed-off-by: Dori Medini <dori@starkware.co>
1 parent c1cbb6e commit 103ae1b

5 files changed

Lines changed: 20 additions & 3 deletions

File tree

crates/blockifier/src/test_utils/cairo_compile.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ pub fn cairo1_compiler_version() -> String {
5656
}
5757
}
5858

59+
pub fn cairo1_compiler_tag() -> String {
60+
format!("v{}", cairo1_compiler_version())
61+
}
62+
5963
/// Returns the path to the local Cairo1 compiler repository.
6064
fn local_cairo1_compiler_repo_path() -> PathBuf {
6165
// Location of blockifier's Cargo.toml.
@@ -149,7 +153,7 @@ fn verify_cairo0_compiler_deps() {
149153

150154
fn verify_cairo1_compiler_deps(git_tag_override: Option<String>) {
151155
let cairo_repo_path = local_cairo1_compiler_repo_path();
152-
let tag = git_tag_override.unwrap_or(format!("v{}", cairo1_compiler_version()));
156+
let tag = git_tag_override.unwrap_or(cairo1_compiler_tag());
153157

154158
// Check if the path is a directory.
155159
assert!(

crates/blockifier/src/test_utils/contracts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const ERC20_CONTRACT_PATH: &str =
5858
const ERC20_CONTRACT_SOURCE_PATH: &str = "./ERC20_without_some_syscalls/ERC20/ERC20.cairo";
5959

6060
// Legacy contract is compiled with a fixed version of the compiler.
61-
const LEGACY_CONTRACT_COMPILER_TAG: &str = "v2.1.0";
61+
pub const LEGACY_CONTRACT_COMPILER_TAG: &str = "v2.1.0";
6262

6363
/// Enum representing all feature contracts.
6464
/// The contracts that are implemented in both Cairo versions include a version field.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v2.6.0

crates/blockifier/tests/feature_contracts_compatibility_test.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use std::fs;
22

3-
use blockifier::test_utils::contracts::FeatureContract;
3+
use blockifier::test_utils::cairo_compile::cairo1_compiler_tag;
4+
use blockifier::test_utils::contracts::{FeatureContract, LEGACY_CONTRACT_COMPILER_TAG};
45
use blockifier::test_utils::CairoVersion;
56
use pretty_assertions::assert_eq;
67
use rstest::rstest;
@@ -109,6 +110,16 @@ fn verify_and_get_files(cairo_version: CairoVersion) -> Vec<(String, String, Str
109110
paths
110111
}
111112

113+
#[test]
114+
fn test_cairo1_compiler_version_ci_files() {
115+
// For all except the legacy contract.
116+
let on_file = include_str!("cairo1_compiler_tag.txt").trim().to_string();
117+
assert_eq!(on_file, cairo1_compiler_tag());
118+
// Legacy contract
119+
let on_file = include_str!("legacy_cairo1_compiler_tag.txt").trim().to_string();
120+
assert_eq!(on_file, LEGACY_CONTRACT_COMPILER_TAG);
121+
}
122+
112123
#[test]
113124
fn verify_feature_contracts_match_enum() {
114125
let mut compiled_paths_from_enum: Vec<String> = FeatureContract::all_feature_contracts()
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v2.1.0

0 commit comments

Comments
 (0)