refactor: rename circom_wasm to witness
This commit is contained in:
parent
b64f038283
commit
8ff7f3cd1b
|
@ -2,12 +2,11 @@ use color_eyre::Result;
|
|||
use wasmer::{Function, Instance, Value};
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct CircomInstance(Instance);
|
||||
pub struct Wasm(Instance);
|
||||
|
||||
// binds to the circom functions
|
||||
impl CircomInstance {
|
||||
impl Wasm {
|
||||
pub fn new(instance: Instance) -> Self {
|
||||
CircomInstance(instance)
|
||||
Self(instance)
|
||||
}
|
||||
|
||||
pub fn init(&self, sanity_check: bool) -> Result<()> {
|
|
@ -1,17 +1,15 @@
|
|||
mod wasm;
|
||||
pub use wasm::WitnessCalculator;
|
||||
mod witness_calculator;
|
||||
pub use witness_calculator::WitnessCalculator;
|
||||
|
||||
mod memory;
|
||||
pub use memory::SafeMemory;
|
||||
pub(super) use memory::SafeMemory;
|
||||
|
||||
mod circom;
|
||||
pub use circom::CircomInstance;
|
||||
pub(super) use circom::Wasm;
|
||||
|
||||
use fnv::FnvHasher;
|
||||
use std::hash::Hasher;
|
||||
|
||||
pub use num_bigint::BigInt;
|
||||
|
||||
pub(crate) fn fnv(inp: &str) -> (u32, u32) {
|
||||
let mut hasher = FnvHasher::default();
|
||||
hasher.write(inp.as_bytes());
|
|
@ -4,11 +4,11 @@ use num_traits::Zero;
|
|||
use std::cell::Cell;
|
||||
use wasmer::{imports, Function, Instance, Memory, MemoryType, Module, Store};
|
||||
|
||||
use super::{fnv, CircomInstance, SafeMemory};
|
||||
use super::{fnv, SafeMemory, Wasm};
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct WitnessCalculator {
|
||||
pub instance: CircomInstance,
|
||||
pub instance: Wasm,
|
||||
pub memory: SafeMemory,
|
||||
pub n64: i32,
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ impl WitnessCalculator {
|
|||
"log" => runtime::log_component(&store),
|
||||
}
|
||||
};
|
||||
let instance = CircomInstance::new(Instance::new(&module, &import_object)?);
|
||||
let instance = Wasm::new(Instance::new(&module, &import_object)?);
|
||||
|
||||
let n32 = (instance.get_fr_len()? >> 2) - 2;
|
||||
|
Loading…
Reference in New Issue