Skip to content

Commit 3683347

Browse files
Update to main
1 parent 9adfff3 commit 3683347

File tree

10 files changed

+75
-50
lines changed

10 files changed

+75
-50
lines changed

.github/workflows/check.yml

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: check
33
on:
44
push:
55
branches:
6-
- main
6+
- meidar/update_rev/main/bl_unpacking
77
pull_request:
88

99
jobs:
@@ -12,19 +12,20 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v4
1414
- run: rustup show
15-
- run: rustup toolchain install nightly --profile minimal
16-
- run: rustup component add rustfmt --toolchain nightly
15+
- run: rustup toolchain install nightly-2025-07-14 --profile minimal
16+
- run: rustup component add rustfmt --toolchain nightly-2025-07-14
1717
- uses: Swatinem/rust-cache@v2
18-
- run: cargo +nightly fmt --all -- --check
18+
- run: cargo +nightly-2025-07-14 fmt --all -- --check
1919

2020
clippy:
2121
runs-on: ubuntu-latest
2222
steps:
2323
- uses: actions/checkout@v4
2424
- run: rustup show
25-
- run: rustup component add clippy
25+
- run: rustup toolchain install nightly-2025-07-14 --profile minimal
26+
- run: rustup component add clippy --toolchain nightly-2025-07-14
2627
- uses: Swatinem/rust-cache@v2
27-
- run: cargo clippy --all -- -D warnings
28+
- run: cargo +nightly-2025-07-14 clippy --all -- -D warnings
2829

2930
tests:
3031
runs-on: ubuntu-latest
@@ -33,27 +34,29 @@ jobs:
3334
with:
3435
submodules: "true"
3536
- run: rustup show
37+
- run: rustup toolchain install nightly-2025-07-14 --profile minimal
3638
- uses: Swatinem/rust-cache@v2
3739
- uses: actions/setup-python@v4
3840
with:
39-
python-version: '3.11'
41+
python-version: "3.11"
4042
# - name: "Unit tests"
4143
# run: |
42-
# RUSTFLAGS="-D warnings" cargo test
44+
# RUSTFLAGS="-D warnings" cargo +nightly-2025-07-14 test
4345
- name: "Test examples"
4446
run: |
45-
RUSTFLAGS="-D warnings" cargo run --example run_program
47+
RUSTFLAGS="-D warnings" cargo +nightly-2025-07-14 run --example run_program
4648
- name: "Unit tests in stwo_run_and_prove"
4749
run: |
48-
RUSTFLAGS="-D warnings" cargo test -p stwo_run_and_prove
50+
RUSTFLAGS="-D warnings" cargo +nightly-2025-07-14 test -p stwo_run_and_prove
4951
5052
udeps:
5153
runs-on: ubuntu-latest
5254
steps:
5355
- uses: actions/checkout@v4
56+
- run: rustup show
57+
- run: rustup toolchain install nightly-2025-07-14 --profile minimal
5458
- uses: Swatinem/rust-cache@v2
5559
with:
5660
cache-on-failure: true
5761
- run: cargo install cargo-udeps --locked
58-
# - run: cargo +nightly udeps --all-targets
59-
- run: cargo +nightly-2025-04-06 udeps
62+
- run: cargo +nightly-2025-07-14 udeps

.github/workflows/upload_artifacts_workflow.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ name: Upload-Artifacts
33
on:
44
push:
55
branches:
6-
- main
7-
6+
- meidar/update_rev/main/bl_unpacking
7+
88
jobs:
99
artifacts-push:
1010
runs-on: ubuntu-24.04

Cargo.toml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ resolver = "2"
1111
bincode = { version = "2.0.1", features = [
1212
"serde",
1313
] }
14-
cairo-lang-executable = { git = "https://github.com/starkware-libs/cairo.git", rev = "f6f7c3bf45c9973bf8782d78c84aed6e741c2a2d" }
15-
cairo-lang-runner = { git = "https://github.com/starkware-libs/cairo.git", rev = "f6f7c3bf45c9973bf8782d78c84aed6e741c2a2d" }
16-
cairo-lang-casm = { git = "https://github.com/starkware-libs/cairo.git", rev = "f6f7c3bf45c9973bf8782d78c84aed6e741c2a2d" }
17-
cairo-lang-execute-utils = { git = "https://github.com/starkware-libs/cairo.git", rev = "f6f7c3bf45c9973bf8782d78c84aed6e741c2a2d" }
14+
cairo-lang-executable = { git = "https://github.com/starkware-libs/cairo.git", rev = "86eb25173f9d8700adbd2770406d715fbf1bb9f8" }
15+
cairo-lang-runner = { git = "https://github.com/starkware-libs/cairo.git", rev = "86eb25173f9d8700adbd2770406d715fbf1bb9f8" }
16+
cairo-lang-casm = { git = "https://github.com/starkware-libs/cairo.git", rev = "86eb25173f9d8700adbd2770406d715fbf1bb9f8" }
17+
cairo-lang-execute-utils = { git = "https://github.com/starkware-libs/cairo.git", rev = "86eb25173f9d8700adbd2770406d715fbf1bb9f8" }
1818
cairo-program-runner-lib = { path = "crates/cairo-program-runner-lib" }
19-
cairo-vm = { git = "https://github.com/lambdaclass/cairo-vm", rev = "b1a91f929b5fa29a1a2e9e6990a68a1220c0c673", features = [
19+
cairo-vm = { git = "https://github.com/lambdaclass/cairo-vm", rev = "e2c6c91c73cd0bc351721f302390fcc0965c6224", features = [
2020
"extensive_hints",
2121
"mod_builtin",
2222
"clap",
@@ -26,15 +26,15 @@ log = "0.4.21"
2626
num-bigint = "0.4"
2727
num-traits = "0.2.19"
2828
regex = "1.11.1"
29-
serde = { version = "1.0.202", features = ["derive"] }
30-
serde_json = "1.0.117"
29+
serde = { version = "1.0.219", features = ["derive"] }
30+
serde_json = "1.0.142"
3131
starknet-crypto = "0.6.2"
3232
starknet-types-core = "0.1.2"
33-
stwo_cairo_utils = { git = "https://github.com/starkware-libs/stwo-cairo", rev = "d7b50347905c687a885a3b6818db4e9311683735" }
34-
stwo-cairo-adapter = { git = "https://github.com/starkware-libs/stwo-cairo", rev = "d7b50347905c687a885a3b6818db4e9311683735" }
35-
stwo_cairo_prover = { git = "https://github.com/starkware-libs/stwo-cairo", rev = "d7b50347905c687a885a3b6818db4e9311683735" }
36-
stwo-cairo-serialize = { git = "https://github.com/starkware-libs/stwo-cairo", rev = "d7b50347905c687a885a3b6818db4e9311683735" }
37-
cairo-air = { git = "https://github.com/starkware-libs/stwo-cairo", rev = "d7b50347905c687a885a3b6818db4e9311683735" }
33+
stwo_cairo_utils = { git = "https://github.com/starkware-libs/stwo-cairo", rev = "59bc14aef12bee9fb9519c3da6e90c4a196206b5" }
34+
stwo-cairo-adapter = { git = "https://github.com/starkware-libs/stwo-cairo", rev = "59bc14aef12bee9fb9519c3da6e90c4a196206b5" }
35+
stwo_cairo_prover = { git = "https://github.com/starkware-libs/stwo-cairo", rev = "59bc14aef12bee9fb9519c3da6e90c4a196206b5" }
36+
stwo-cairo-serialize = { git = "https://github.com/starkware-libs/stwo-cairo", rev = "59bc14aef12bee9fb9519c3da6e90c4a196206b5" }
37+
cairo-air = { git = "https://github.com/starkware-libs/stwo-cairo", rev = "59bc14aef12bee9fb9519c3da6e90c4a196206b5" }
3838
tempfile = "3.10.1"
3939
thiserror = "1.0.61"
4040
thiserror-no-std = "2.0.2"

crates/cairo-program-runner-lib/src/hints/fact_topologies.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ pub fn configure_fact_topologies<FT: AsRef<FactTopology>>(
267267
}
268268

269269
fn check_tree_structure(tree_structure: &[usize]) -> Result<(), TreeStructureError> {
270-
if (!tree_structure.len() % 2 == 0) || (tree_structure.len() > 10) {
270+
if (!tree_structure.len()).is_multiple_of(2) || (tree_structure.len() > 10) {
271271
return Err(TreeStructureError::InvalidTreeStructure);
272272
}
273273

crates/cairo-program-runner-lib/src/hints/load_cairo_pie.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use std::collections::BTreeMap;
12
use std::collections::HashMap;
23

34
use cairo_vm::types::builtin_name::BuiltinName;
@@ -77,7 +78,7 @@ impl From<CairoPieLoaderError> for HintError {
7778
/// a pointer in the VM memory, or to an integer in case the segment is uninitialized.
7879
/// Those will be wrapped by the appropriate `MaybeRelocatable` variant.
7980
pub struct RelocationTable {
80-
relocations: HashMap<isize, MaybeRelocatable>,
81+
relocations: BTreeMap<isize, MaybeRelocatable>,
8182
}
8283

8384
impl RelocationTable {
@@ -156,7 +157,7 @@ pub fn extract_segment(maybe_relocatable: MaybeRelocatable) -> Result<isize, Rel
156157
}
157158
}
158159

159-
/// Builds a hashmap of address -> value from the `CairoPieMemory` vector.
160+
/// Builds a HashMap of address -> value from the `CairoPieMemory` vector.
160161
///
161162
/// Makes it more convenient to access values in the Cairo PIE memory.
162163
fn build_cairo_pie_memory_map(memory: &CairoPieMemory) -> HashMap<Relocatable, &MaybeRelocatable> {
@@ -203,7 +204,7 @@ pub fn build_cairo_pie_relocation_table(
203204
offset: 0,
204205
};
205206

206-
// Create a hashmap of the program memory for easier searching.
207+
// Create a HashMap of the program memory for easier searching.
207208
// If this turns out to be too expensive, consider building it directly
208209
// when building the CairoPie object.
209210
let memory_map = build_cairo_pie_memory_map(&cairo_pie.memory);
@@ -231,7 +232,7 @@ pub fn build_cairo_pie_relocation_table(
231232

232233
fn extend_additional_data(
233234
builtin: &mut SignatureBuiltinRunner,
234-
data: &HashMap<Relocatable, (Felt252, Felt252)>,
235+
data: &BTreeMap<Relocatable, (Felt252, Felt252)>,
235236
relocation_table: &RelocationTable,
236237
) -> Result<(), SignatureRelocationError> {
237238
for (addr, signature) in data {

crates/cairo-program-runner-lib/src/hints/types.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,7 @@ impl RunMode {
482482
entrypoint: "main",
483483
trace_enabled: true,
484484
relocate_mem,
485+
relocate_trace: relocate_mem,
485486
layout,
486487
proof_mode: true,
487488
secure_run: None,
@@ -496,6 +497,7 @@ impl RunMode {
496497
entrypoint: "main",
497498
trace_enabled: false,
498499
relocate_mem: false,
500+
relocate_trace: false,
499501
layout,
500502
proof_mode: false,
501503
secure_run: None,

crates/cairo-program-runner-lib/src/tasks.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use std::{
33
str::FromStr,
44
};
55

6+
use cairo_lang_executable::executable::EntryPointKind;
67
use cairo_lang_executable::executable::Executable;
78
use cairo_lang_execute_utils::{program_and_hints_from_executable, user_args_from_flags};
89
use cairo_vm::types::errors::program_errors::ProgramError;
@@ -75,7 +76,19 @@ pub fn create_cairo1_program_task(
7576
.iter()
7677
.map(|n| BigInt::from_str(&n.to_string()).unwrap())
7778
.collect();
78-
let (program, string_to_hint) = program_and_hints_from_executable(&executable, false)
79+
80+
let entrypoint = executable
81+
.entrypoints
82+
.iter()
83+
.find(|e| e.kind == EntryPointKind::Bootloader)
84+
.ok_or_else(|| {
85+
BootloaderTaskError::Cairo1(format!(
86+
"{:?} entrypoint not found",
87+
EntryPointKind::Bootloader
88+
))
89+
})?;
90+
91+
let (program, string_to_hint) = program_and_hints_from_executable(&executable, entrypoint)
7992
.map_err(|e| BootloaderTaskError::Cairo1(format!("Failed to parse executable: {e:?}")))?;
8093
let user_args = user_args_from_flags(user_args_file.as_ref(), &user_args_list)
8194
.map_err(|e| BootloaderTaskError::Cairo1(format!("Failed to parse user args: {e:?}")))?;

crates/stwo_run_and_prove/src/main.rs

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,24 @@ use stwo_cairo_adapter::vm_import::VmImportError;
2020
use stwo_cairo_prover::prover::{
2121
ChannelHash, ProverParameters, default_prod_prover_parameters, prove_cairo,
2222
};
23-
use stwo_cairo_prover::stwo_prover::core::backend::BackendForChannel;
24-
use stwo_cairo_prover::stwo_prover::core::backend::simd::SimdBackend;
25-
use stwo_cairo_prover::stwo_prover::core::channel::MerkleChannel;
26-
use stwo_cairo_prover::stwo_prover::core::pcs::PcsConfig;
27-
use stwo_cairo_prover::stwo_prover::core::prover::ProvingError;
28-
use stwo_cairo_prover::stwo_prover::core::vcs::blake2_merkle::Blake2sMerkleChannel;
29-
use stwo_cairo_prover::stwo_prover::core::vcs::ops::MerkleHasher;
30-
use stwo_cairo_prover::stwo_prover::core::vcs::poseidon252_merkle::Poseidon252MerkleChannel;
23+
24+
use stwo_cairo_prover::stwo::core::channel::MerkleChannel;
25+
use stwo_cairo_prover::stwo::core::pcs::PcsConfig;
26+
use stwo_cairo_prover::stwo::core::vcs::MerkleHasher;
27+
use stwo_cairo_prover::stwo::core::vcs::blake2_merkle::Blake2sMerkleChannel;
28+
use stwo_cairo_prover::stwo::core::vcs::poseidon252_merkle::Poseidon252MerkleChannel;
29+
use stwo_cairo_prover::stwo::prover::ProvingError;
30+
use stwo_cairo_prover::stwo::prover::backend::BackendForChannel;
31+
use stwo_cairo_prover::stwo::prover::backend::simd::SimdBackend;
32+
33+
// use stwo_cairo_prover::stwo_prover::core::backend::BackendForChannel;
34+
// use stwo_cairo_prover::stwo_prover::core::backend::simd::SimdBackend;
35+
// use stwo_cairo_prover::stwo_prover::core::channel::MerkleChannel;
36+
// use stwo_cairo_prover::stwo_prover::core::pcs::PcsConfig;
37+
// use stwo_cairo_prover::stwo_prover::core::prover::ProvingError;
38+
// use stwo_cairo_prover::stwo_prover::core::vcs::blake2_merkle::Blake2sMerkleChannel;
39+
// use stwo_cairo_prover::stwo_prover::core::vcs::ops::MerkleHasher;
40+
// use stwo_cairo_prover::stwo_prover::core::vcs::poseidon252_merkle::Poseidon252MerkleChannel;
3141
use stwo_cairo_serialize::CairoSerialize;
3242
use stwo_cairo_utils::file_utils::{IoErrorWithPath, create_file, read_to_string};
3343
use thiserror::Error;
@@ -183,9 +193,7 @@ fn stwo_run_and_prove(
183193
let program_input = get_program_input(&program_input)?;
184194
info!("Running cairo run program.");
185195
let runner = cairo_run_program(&program, program_input, cairo_run_config)?;
186-
let mut prover_input_info = runner.get_prover_input_info()?;
187-
info!("Adapting prover input.");
188-
let prover_input = adapter(&mut prover_input_info)?;
196+
let prover_input = adapter(&runner);
189197
let output_vec = prove_with_retries(prover_input, prove_config, prover)?;
190198

191199
if let Some(output_path) = program_output {
@@ -229,7 +237,7 @@ fn prove_with_retries(
229237
i + 1,
230238
prove_config.n_proof_attempts
231239
);
232-
let proof_file_path = prove_config.proofs_dir.join(format!("proof_{}", i));
240+
let proof_file_path = prove_config.proofs_dir.join(format!("proof_{i}"));
233241

234242
match prover.choose_channel_and_prove(
235243
&cairo_prover_inputs,
@@ -360,7 +368,7 @@ where
360368
CairoSerialize::serialize(&proof, &mut serialized);
361369
let hex_strings: Vec<String> = serialized
362370
.into_iter()
363-
.map(|felt| format!("0x{:x}", felt))
371+
.map(|felt| format!("0x{felt:x}"))
364372
.collect();
365373
let serialized_hex = sonic_rs::to_string_pretty(&hex_strings)?;
366374
proof_file.write_all(serialized_hex.as_bytes())?;

crates/vm_runner/src/main.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ fn run(args: impl Iterator<Item = String>) -> Result<ProverInput, Error> {
6767
// we don't need to relocate memory in the VM because we later call the adapter that does
6868
// relocation.
6969
relocate_mem: false,
70+
relocate_trace: false,
7071
layout: args.layout,
7172
proof_mode: true,
7273
secure_run: None,
@@ -75,10 +76,7 @@ fn run(args: impl Iterator<Item = String>) -> Result<ProverInput, Error> {
7576
dynamic_layout_params: None,
7677
};
7778
let cairo_runner = cairo_run_program(&program, program_input_contents, cairo_run_config)?;
78-
let mut prover_input_info = cairo_runner
79-
.get_prover_input_info()
80-
.expect("Unable to get prover input info");
81-
let prover_input = adapter(&mut prover_input_info)?;
79+
let prover_input = adapter(&cairo_runner);
8280

8381
let execution_resources = ExecutionResources::from_prover_input(&prover_input);
8482
log::info!("Execution resources: {execution_resources:#?}");

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[toolchain]
2-
channel = "nightly-2025-04-06"
2+
channel = "nightly-2025-07-14"

0 commit comments

Comments
 (0)