From 341e9e79892b275b84bfffbe3259d5ff68a79bb3 Mon Sep 17 00:00:00 2001 From: Neo Date: Thu, 15 Feb 2024 07:42:56 +0000 Subject: [PATCH] remove unnecessary rust deps & fmt --- Cargo.toml | 4 +--- runner/Cargo.toml | 2 -- runner/src/main.rs | 30 ++++++++++++++++++------------ 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 80b0d5f39..d612f2aa7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" diff --git a/runner/Cargo.toml b/runner/Cargo.toml index b3eab9571..685ecaf52 100644 --- a/runner/Cargo.toml +++ b/runner/Cargo.toml @@ -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 diff --git a/runner/src/main.rs b/runner/src/main.rs index 4b9bca3c0..a33d32f7f 100644 --- a/runner/src/main.rs +++ b/runner/src/main.rs @@ -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)] @@ -20,26 +24,28 @@ fn main() -> anyhow::Result<()> { let target = cli.target; let function = "main"; - let args: Vec = parsed.iter().map(|x| { - match x { + let args: Vec = 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)?;