Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,334 changes: 1,143 additions & 191 deletions Cargo.lock

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,12 @@ api = { path = "src/crates/api" }
axum = { version = "0.8", features = ["tracing"] }
bincode = "2.0.1"
bitvec = "1.0.1"
bytemuck = { version = "1.20", features = ["derive"] }
cairo_runner = { path = "src/crates/cairo-runner" }
cairo_type_derive = { path = "crates/cairo_type_derive" }
cairo-lang-casm = "2.12.3"
cairo-lang-starknet-classes = "2.12.3"
cairo-type-derive = { git = "https://github.com/keep-starknet-strange/snos.git", rev = "2dc07a4298e2954c774f4d419a8f9db007da494c" }
cairo-vm = { git = "https://github.com/lambdaclass/cairo-vm", rev = "b1a91f929b5fa29a1a2e9e6990a68a1220c0c673", features = ["extensive_hints", "clap", "cairo-1-hints", "mod_builtin"] }
cairo-vm = { git = "https://github.com/lambdaclass/cairo-vm", rev = "e2c6c91c73cd0bc351721f302390fcc0965c6224", features = ["extensive_hints", "clap", "cairo-1-hints", "mod_builtin"] }
chrono = { version = "0.4", features = ["serde"] }
clap = { version = "4.5", features = ["derive"] }
dotenvy = "0.15"
Expand Down Expand Up @@ -74,7 +73,7 @@ starknet-crypto = { version = "0.7.4", default-features = false }
starknet-types-core = { version = "0.1.7", default-features = false }
state_server = { path = "crates/state_server" }
strum_macros = "0.27"
stwo_cairo_adapter = { git = "https://github.com/starkware-libs/stwo-cairo", rev = "62c3c4a", package = "stwo-cairo-adapter" }
stwo_cairo_adapter = { git = "https://github.com/HerodotusDev/stwo-cairo", rev = "df67e40effad69107a431d158af56866a1cbb09b", package = "stwo-cairo-adapter" }
syscall_handler = { path = "crates/syscall_handler" }
thiserror = "2.0"
tiny-keccak = { version = "2.0.2", features = ["keccak"] }
Expand Down
8 changes: 1 addition & 7 deletions crates/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use clap::{Parser, Subcommand};
use dry_hint_processor::syscall_handler::{evm, injected_state, starknet};
use dry_run::{LayoutName, Program, DRY_RUN_COMPILED_JSON};
use fetcher::{parse_syscall_handler, Fetcher};
use sound_run::{prove::prover_input_from_runner, HDP_COMPILED_JSON};
use sound_run::HDP_COMPILED_JSON;
use syscall_handler::SyscallHandler;
use types::{
error::Error, param::Param, ChainProofs, HDPDryRunInput, HDPInput, InjectedState, ProofsData, ETHEREUM_MAINNET_CHAIN_ID,
Expand Down Expand Up @@ -203,12 +203,6 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
pie.write_zip_file(file_name, true)?;
}

if let Some(ref file_name) = args.stwo_prover_input {
let stwo_prover_input = prover_input_from_runner(&cairo_runner);
std::fs::write(file_name, serde_json::to_string(&stwo_prover_input)?)?;
println!("Prover Input saved to: {:?}", file_name);
}

println!("Sound run completed successfully.");
Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion crates/hints/src/patricia/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ where
/// # Errors
/// Returns `PatriciaHintError::UnexpectedLeaf` if a leaf is passed, or
/// `PatriciaHintError::InvalidTupleNode` for an invalid branch with no children.
pub fn decode_node<LF>(node: &TreeUpdate<LF>) -> Result<DecodedNode<LF>, PatriciaHintError>
pub fn decode_node<LF>(node: &TreeUpdate<LF>) -> Result<DecodedNode<'_, LF>, PatriciaHintError>
where
LF: Clone,
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ impl CallHandler for HeaderCallHandler {
let fields = vm
.get_integer_range(ptr, field_len + 1)?
.into_iter()
.map(|f| (*f.as_ref()))
.map(|f| *f.as_ref())
.collect::<Vec<Felt252>>();

Ok(StarknetBlock::from_memorizer(fields).handle(function_id))
Expand Down
1 change: 0 additions & 1 deletion crates/sound_run/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ edition = "2021"
path = "src/lib.rs"

[dependencies]
bytemuck.workspace = true
cairo-vm.workspace = true
clap.workspace = true
dotenvy.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/sound_run/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ use clap::Parser;
use dotenvy as _;
use serde_json as _;
use sound_hint_processor::CustomHintProcessor;
use stwo_cairo_adapter as _;
use tokio as _;
use tracing::info;
use tracing_subscriber as _;
use types::{error::Error, HDPInput, HDPOutput};
pub mod prove;

pub const HDP_COMPILED_JSON: &str = env!("HDP_COMPILED_JSON");

Expand Down
28 changes: 20 additions & 8 deletions crates/sound_run/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
#![warn(unused_crate_dependencies)]
#![forbid(unsafe_code)]

use std::path::PathBuf;
use std::path::{Path, PathBuf};

use bytemuck as _;
use cairo_vm::{self as _, cairo_run::CairoRunConfig, types::layout_name::LayoutName};
use clap::Parser;
use sound_hint_processor as _;
use sound_run::{prove::prover_input_from_runner, Args, HDP_COMPILED_JSON};
use stwo_cairo_adapter as _;
use sound_run::{Args, HDP_COMPILED_JSON};
use stwo_cairo_adapter::adapter::adapter_shards;
use tracing::{self as _, info};
use tracing_subscriber::EnvFilter;
use types::{error::Error, param::Param, CasmContractClass, HDPInput, InjectedState, ProofsData};
Expand Down Expand Up @@ -66,10 +65,23 @@ async fn main() -> Result<(), Error> {
pie.write_zip_file(file_name, true)?;
}

if let Some(ref file_name) = args.stwo_prover_input {
let stwo_prover_input = prover_input_from_runner(&cairo_runner);
std::fs::write(file_name, serde_json::to_string(&stwo_prover_input)?)?;
info!("Prover Input saved to: {:?}", file_name);
if let Some(ref file_name_str) = args.stwo_prover_input {
let file_path = Path::new(file_name_str);

let stem = file_path.file_stem().map(|s| s.to_string_lossy().into_owned()).unwrap_or_default();

let extension = file_path
.extension()
.map(|s| format!(".{}", s.to_string_lossy()))
.unwrap_or_default();

let stwo_prover_inputs = adapter_shards(&cairo_runner, 4000000);

for (idx, input) in stwo_prover_inputs.into_iter().enumerate() {
let new_file_name = format!("{}-{}{}", stem, idx, extension);
std::fs::write(&new_file_name, serde_json::to_string(&input)?)?;
info!("Prover Input saved to: {}", new_file_name);
}
}

Ok(())
Expand Down
60 changes: 0 additions & 60 deletions crates/sound_run/src/prove.rs

This file was deleted.

12 changes: 6 additions & 6 deletions crates/state_server/src/mpt/trie/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ impl Trie {
///
/// A new Trie instance.
#[allow(dead_code)]
pub fn load(
pub fn load<'a>(
root_idx: TrieStorageIndex,
conn: &PooledConnection<SqliteConnectionManager>,
) -> (TrieDB, MerkleTree<TruncatedKeccakHash, 251>) {
conn: &'a PooledConnection<SqliteConnectionManager>,
) -> (TrieDB<'a>, MerkleTree<TruncatedKeccakHash, 251>) {
let storage = TrieDB::new(conn);
let trie = MerkleTree::<TruncatedKeccakHash, 251>::new(root_idx);

Expand Down Expand Up @@ -65,9 +65,9 @@ impl Trie {
/// # Returns
///
/// A new empty Trie instance with storage, trie, and root index.
pub fn create_empty(
conn: &PooledConnection<SqliteConnectionManager>,
) -> Result<(TrieDB, MerkleTree<TruncatedKeccakHash, 251>, TrieStorageIndex), Error> {
pub fn create_empty<'a>(
conn: &'a PooledConnection<SqliteConnectionManager>,
) -> Result<(TrieDB<'a>, MerkleTree<TruncatedKeccakHash, 251>, TrieStorageIndex), Error> {
let storage = TrieDB::new(conn);
let trie = MerkleTree::<TruncatedKeccakHash, 251>::empty();
let root_idx = TrieStorageIndex::from(0);
Expand Down
4 changes: 2 additions & 2 deletions crates/syscall_handler/src/call_contract/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl traits::SyscallHandler for DebugCallContractHandler {
let fields = vm
.get_integer_range(request.calldata_start, field_len)?
.into_iter()
.map(|f| (*f.as_ref()))
.map(|f| *f.as_ref())
.collect::<Vec<Felt252>>();

let str = decode_byte_array_felts(fields);
Expand All @@ -47,7 +47,7 @@ impl traits::SyscallHandler for DebugCallContractHandler {
let fields = vm
.get_integer_range(request.calldata_start, field_len)?
.into_iter()
.map(|f| (*f.as_ref()))
.map(|f| *f.as_ref())
.collect::<Vec<Felt252>>();

println!("{:?}", fields);
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "nightly-2025-04-06"
channel = "nightly-2025-07-14"
profile = "default"
Loading