arnaucube
arnaucube/circom-compatPublic Self-hosted repository
chore: lints + remove ethers dep
Georgios Konstantopoulos me@gakonst.com
Fri, 10 Feb 2023 18:32:42 -0800
commit

746d2329e94e493560a53c41938c329d735d54ed

parent

5a1b78b320ce3896c1eff3a5f19fde4cb17c3279

2 files changed, 8 insertions(+), 13 deletions(-)

jump to
M Cargo.toml → Cargo.toml

@@ -27,7 +27,6 @@ byteorder = "1.4.3"

# ethereum compat ethers-core = { git = "https://github.com/gakonst/ethers-rs", default-features = false, optional = true } -ethers = { git = "https://github.com/gakonst/ethers-rs", features = ["abigen"], optional = true } # error handling thiserror = "1.0.26"

@@ -40,6 +39,7 @@ [dev-dependencies]

hex-literal = "0.2.1" tokio = { version = "1.7.1", features = ["macros"] } serde_json = "1.0.64" +ethers = { git = "https://github.com/gakonst/ethers-rs" } [[bench]] name = "groth16"

@@ -48,5 +48,5 @@

[features] bench-complex-all = [] circom-2 = [] -full = ["ethers", "ethers-core"] -default = ["full"] +ethereum = ["ethers-core"] +default = ["ethereum"]
M src/witness/witness_calculator.rs → src/witness/witness_calculator.rs

@@ -39,7 +39,7 @@ }

#[cfg(feature = "circom-2")] fn to_array32(s: &BigInt, size: usize) -> Vec<u32> { - let mut res = vec![0; size as usize]; + let mut res = vec![0; size]; let mut rem = s.clone(); let radix = BigInt::from(0x100000000u64); let mut c = size;

@@ -232,13 +232,10 @@

for (i, value) in values.into_iter().enumerate() { let f_arr = to_array32(&value, n32 as usize); for j in 0..n32 { - self.instance.write_shared_rw_memory( - j as u32, - f_arr[(n32 as usize) - 1 - (j as usize)], - )?; + self.instance + .write_shared_rw_memory(j, f_arr[(n32 as usize) - 1 - (j as usize)])?; } - self.instance - .set_input_signal(msb as u32, lsb as u32, i as u32)?; + self.instance.set_input_signal(msb, lsb, i as u32)?; } }

@@ -312,9 +309,7 @@ #[allow(clippy::many_single_char_names)]

fn func(a: i32, b: i32, c: i32, d: i32, e: i32, f: i32) -> Result<(), RuntimeError> { // NOTE: We can also get more information why it is failing, see p2str etc here: // https://github.com/iden3/circom_runtime/blob/master/js/witness_calculator.js#L52-L64 - println!( - "runtime error, exiting early: {a} {b} {c} {d} {e} {f}", - ); + println!("runtime error, exiting early: {a} {b} {c} {d} {e} {f}",); Err(RuntimeError::user(Box::new(ExitCode(1)))) } Function::new_native(store, func)