Skip to content

Commit

Permalink
fixes&refactors
Browse files Browse the repository at this point in the history
  • Loading branch information
Okm165 committed Mar 1, 2024
1 parent 26dffa8 commit 24765d2
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 152 deletions.
2 changes: 1 addition & 1 deletion benches/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fn main() -> anyhow::Result<()> {
let sierra_program =
serde_json::from_str::<VersionedProgram>(&fs::read_to_string(cli.target)?)?.into_v1()?;

BENCH_FUNCTION_LIST.into_iter().for_each(|f_name| {
BENCH_FUNCTION_LIST.iter().for_each(|f_name| {
let result = bench(sierra_program.program.to_owned(), f_name).unwrap();

println!("Function: {f_name}");
Expand Down
14 changes: 6 additions & 8 deletions examples/starknet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
anyhow = "1"
cairo-felt = "0.9"
cairo-proof-parser = { git = "https://github.com/Okm165/cairo-proof-parser" }
itertools = "0.12.0"
num-bigint = "0.4"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
thiserror = "1.0"
anyhow.workspace = true
cairo-args-runner.workspace = true
clap.workspace = true
cairo-proof-parser.workspace = true
serde.workspace = true
serde_json.workspace = true
24 changes: 4 additions & 20 deletions examples/starknet/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,29 +1,13 @@
mod vec252;
use crate::vec252::VecFelt252;
use cairo_args_runner::VecFelt252;
use cairo_proof_parser::parse;
use itertools::{chain, Itertools};
use std::{
io::{stdin, Read},
};
use std::io::{stdin, Read};

fn main() -> anyhow::Result<()> {
let mut input = String::new();
stdin().read_to_string(&mut input)?;
let parsed = parse(input)?;

let config: VecFelt252 = serde_json::from_str(&parsed.config.to_string())?;
let public_input: VecFelt252 = serde_json::from_str(&parsed.public_input.to_string())?;
let unsent_commitment: VecFelt252 =
serde_json::from_str(&parsed.unsent_commitment.to_string())?;
let witness: VecFelt252 = serde_json::from_str(&parsed.witness.to_string())?;

let proof = chain!(
config.to_vec(),
public_input.to_vec(),
unsent_commitment.to_vec(),
witness.to_vec()
)
.collect_vec();
let exprs = parse(input)?.to_string();
let proof: VecFelt252 = serde_json::from_str(&exprs).unwrap();

let proof_string = proof
.iter()
Expand Down
118 changes: 0 additions & 118 deletions examples/starknet/src/vec252.rs

This file was deleted.

7 changes: 2 additions & 5 deletions runner/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
use std::io::{stdin, Read};

use cairo_args_runner::{Arg, Felt252, VecFelt252};
use clap::Parser;

use std::io::{stdin, Read};
use cairo_proof_parser::parse;
use cairo_args_runner::{Arg, Felt252, VecFelt252};

#[derive(Parser)]
#[command(author, version, about, long_about = None)]
Expand All @@ -25,7 +23,6 @@ fn main() -> anyhow::Result<()> {
}

fn run(parsed: String, target: String) -> anyhow::Result<Vec<Felt252>> {
let target = target;
let function = "main";
let args: VecFelt252 = serde_json::from_str(&parsed).unwrap();
Ok(cairo_args_runner::run(
Expand Down

0 comments on commit 24765d2

Please sign in to comment.