mirror of
https://github.com/logos-storage/circom-compat.git
synced 2026-01-07 15:33:13 +00:00
chore: lints + remove ethers dep
This commit is contained in:
parent
5a1b78b320
commit
746d2329e9
@ -27,7 +27,6 @@ byteorder = "1.4.3"
|
|||||||
|
|
||||||
# ethereum compat
|
# ethereum compat
|
||||||
ethers-core = { git = "https://github.com/gakonst/ethers-rs", default-features = false, optional = true }
|
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
|
# error handling
|
||||||
thiserror = "1.0.26"
|
thiserror = "1.0.26"
|
||||||
@ -40,6 +39,7 @@ cfg-if = "1.0"
|
|||||||
hex-literal = "0.2.1"
|
hex-literal = "0.2.1"
|
||||||
tokio = { version = "1.7.1", features = ["macros"] }
|
tokio = { version = "1.7.1", features = ["macros"] }
|
||||||
serde_json = "1.0.64"
|
serde_json = "1.0.64"
|
||||||
|
ethers = { git = "https://github.com/gakonst/ethers-rs" }
|
||||||
|
|
||||||
[[bench]]
|
[[bench]]
|
||||||
name = "groth16"
|
name = "groth16"
|
||||||
@ -48,5 +48,5 @@ harness = false
|
|||||||
[features]
|
[features]
|
||||||
bench-complex-all = []
|
bench-complex-all = []
|
||||||
circom-2 = []
|
circom-2 = []
|
||||||
full = ["ethers", "ethers-core"]
|
ethereum = ["ethers-core"]
|
||||||
default = ["full"]
|
default = ["ethereum"]
|
||||||
|
|||||||
@ -39,7 +39,7 @@ fn from_array32(arr: Vec<u32>) -> BigInt {
|
|||||||
|
|
||||||
#[cfg(feature = "circom-2")]
|
#[cfg(feature = "circom-2")]
|
||||||
fn to_array32(s: &BigInt, size: usize) -> Vec<u32> {
|
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 mut rem = s.clone();
|
||||||
let radix = BigInt::from(0x100000000u64);
|
let radix = BigInt::from(0x100000000u64);
|
||||||
let mut c = size;
|
let mut c = size;
|
||||||
@ -232,13 +232,10 @@ impl WitnessCalculator {
|
|||||||
for (i, value) in values.into_iter().enumerate() {
|
for (i, value) in values.into_iter().enumerate() {
|
||||||
let f_arr = to_array32(&value, n32 as usize);
|
let f_arr = to_array32(&value, n32 as usize);
|
||||||
for j in 0..n32 {
|
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
|
self.instance
|
||||||
.set_input_signal(msb as u32, lsb as u32, i as u32)?;
|
.write_shared_rw_memory(j, f_arr[(n32 as usize) - 1 - (j as usize)])?;
|
||||||
|
}
|
||||||
|
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> {
|
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:
|
// 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
|
// https://github.com/iden3/circom_runtime/blob/master/js/witness_calculator.js#L52-L64
|
||||||
println!(
|
println!("runtime error, exiting early: {a} {b} {c} {d} {e} {f}",);
|
||||||
"runtime error, exiting early: {a} {b} {c} {d} {e} {f}",
|
|
||||||
);
|
|
||||||
Err(RuntimeError::user(Box::new(ExitCode(1))))
|
Err(RuntimeError::user(Box::new(ExitCode(1))))
|
||||||
}
|
}
|
||||||
Function::new_native(store, func)
|
Function::new_native(store, func)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user