Browse Source

chore: lints + remove ethers dep

pull/3/head
Georgios Konstantopoulos 1 year ago
parent
commit
746d2329e9
2 changed files with 8 additions and 13 deletions
  1. +3
    -3
      Cargo.toml
  2. +5
    -10
      src/witness/witness_calculator.rs

+ 3
- 3
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 @@ cfg-if = "1.0"
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 @@ harness = false
[features]
bench-complex-all = []
circom-2 = []
full = ["ethers", "ethers-core"]
default = ["full"]
ethereum = ["ethers-core"]
default = ["ethereum"]

+ 5
- 10
src/witness/witness_calculator.rs

@ -39,7 +39,7 @@ fn from_array32(arr: Vec) -> BigInt {
#[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 @@ impl WitnessCalculator {
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 @@ mod runtime {
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)

Loading…
Cancel
Save