Skip to content

Commit e2d42bf

Browse files
avi-starkwareclaude
andcommitted
apollo_infra_utils,apollo_compile_to_native: add compiler version text files
Create plain text files containing compiler binary versions as the single source of truth. Rust constants now use include_str!().trim_ascii_end() to read from these files. Shell scripts and Dockerfiles will read them with cat in a follow-up. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 2345a62 commit e2d42bf

5 files changed

Lines changed: 13 additions & 7 deletions

File tree

crates/apollo_compile_to_native/src/constants.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44

55
pub(crate) const CAIRO_NATIVE_BINARY_NAME: &str = "starknet-native-compile";
66

7-
pub const REQUIRED_CAIRO_NATIVE_VERSION: &str = "0.9.0-rc.6";
7+
pub const REQUIRED_CAIRO_NATIVE_VERSION: &str =
8+
include_str!("native_compiler_version.txt").trim_ascii_end();
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.9.0-rc.6

crates/apollo_infra_utils/src/cairo_compiler_version.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
#[path = "cairo_compiler_version_test.rs"]
33
mod cairo_compiler_version_test;
44

5-
pub const CAIRO1_COMPILER_VERSION: &str = "2.17.0-rc.4";
5+
pub const CAIRO1_COMPILER_VERSION: &str =
6+
include_str!("cairo_compiler_version.txt").trim_ascii_end();
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.17.0-rc.4

crates/apollo_infra_utils/src/cairo_compiler_version_test.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ use serde::{Deserialize, Serialize};
22

33
use crate::cairo_compiler_version::CAIRO1_COMPILER_VERSION;
44

5-
/// Objects for simple deserialization of `Cargo.toml`, to fetch the Cairo1 compiler version.
6-
/// The compiler itself isn't actually a dependency, so we compile by using the version of the
7-
/// `cairo-lang-casm` crate.
8-
/// The choice of this crate is arbitrary, as all compiler crate dependencies should have the
9-
/// same version.
5+
/// Cross-checks that `CAIRO1_COMPILER_VERSION` (loaded from `cairo_compiler_version.txt`,
6+
/// which the install scripts also read) matches the `cairo-lang-casm` version pinned in
7+
/// `Cargo.toml`. The two are managed independently: the `.txt` file drives the external
8+
/// compiler binary install, the Cargo dep drives the in-process Sierra crates. They must
9+
/// stay in sync; this test fires on drift.
10+
/// The choice of `cairo-lang-casm` is arbitrary, as all compiler crate dependencies should
11+
/// have the same version.
1012
/// Deserializes:
1113
/// """
1214
/// ...

0 commit comments

Comments
 (0)