Skip to content

Commit

Permalink
remove unnecessary rust deps & fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
neotheprogramist committed Feb 15, 2024
1 parent afcfe27 commit 341e9e7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 17 deletions.
4 changes: 1 addition & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ version = "0.1.0"
[workspace.dependencies]
anyhow = "1.0.79"
cairo-args-runner = "1.0.1"
cairo-proof-parser ={ git = "https://github.com/cartridge-gg/cairo-proof-parser", tag = "v0.1.1"}
cairo-proof-parser = { git = "https://github.com/cartridge-gg/cairo-proof-parser", tag = "v0.1.1" }
clap = { version = "4.5.0", features = ["derive"] }
num-bigint = "0.4.4"
serde = { version = "1.0.196", features = ["derive"] }
serde_json = "1.0.113"
2 changes: 0 additions & 2 deletions runner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,3 @@ cairo-args-runner.workspace = true
cairo-proof-parser.workspace = true
clap.workspace = true
num-bigint.workspace = true
serde.workspace = true
serde_json.workspace = true
30 changes: 18 additions & 12 deletions runner/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
use std::{io::{stdin, Read}, str::FromStr};
use std::{
io::{stdin, Read},
str::FromStr,
};

use cairo_args_runner::{run, Arg, Felt252};
use cairo_proof_parser::{parse, Expr};
use clap::Parser;
use num_bigint::BigUint;

#[derive(Parser)]
#[command(author, version, about, long_about = None)]
Expand All @@ -20,26 +24,28 @@ fn main() -> anyhow::Result<()> {
let target = cli.target;
let function = "main";

let args: Vec<Arg> = parsed.iter().map(|x| {
match x {
let args: Vec<Arg> = parsed
.iter()
.map(|x| match x {
Expr::Value(v) => {
let v = num_bigint::BigUint::from_str(v).unwrap();
let v = BigUint::from_str(v).unwrap();
Arg::Value(Felt252::from_bytes_be(&v.to_bytes_be()))
}
Expr::Array(v) => {
let v = v.into_iter().map(|x| {
match x {
let v = v
.into_iter()
.map(|x| match x {
Expr::Value(v) => {
let v = num_bigint::BigUint::from_str(v).unwrap();
let v = BigUint::from_str(v).unwrap();
Felt252::from_bytes_be(&v.to_bytes_be())
}
_ => panic!("Invalid array element")
}
}).collect();
_ => panic!("Invalid array element"),
})
.collect();
Arg::Array(v)
}
}
}).collect();
})
.collect();

let result = run(&target, function, &args)?;

Expand Down

0 comments on commit 341e9e7

Please sign in to comment.