Skip to content

Commit

Permalink
feat(keccak): remove todo to return error on witness version
Browse files Browse the repository at this point in the history
  • Loading branch information
tchataigner committed Jan 15, 2024
1 parent cd69157 commit 0fda740
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub enum ReaderError {
source: Box<dyn std::error::Error + Sync + Send>,
},
/// Error thrown when we try to read a witness file with a non-supported version.
#[error("Witness version not supported. Version supported are 1 or 2, found {0}")]
#[error("Witness version not supported. Version supported is 2.*, found {0}")]
WitnessVersionNotSupported(String),
/// Error thrown when we try to read a r1cs file with a non-supported version.
#[error("R1CS version not supported. Version supported is 1, found {0}")]
Expand Down
5 changes: 3 additions & 2 deletions src/witness/witness_calculator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ use wasmer::{
use wasmer_compiler_llvm::LLVM;

use super::{fnv, Circom, SafeMemory, Wasm};
use crate::error::ReaderError::WitnessVersionNotSupported;
use crate::{r1cs::CircomInput, witness::error::WitnessCalculatorError::UnalignedParts};

/// A struct for managing and calculating witnesses in Circom circuits.
Expand Down Expand Up @@ -177,7 +178,7 @@ impl WitnessCalculator {
let version = instance.get_version(&mut store).unwrap_or(1);

if version != 2 {
todo!()
return Err(WitnessVersionNotSupported(version.to_string()).into());
}

let n32 = instance.get_field_num_len32(&mut store)?;
Expand Down Expand Up @@ -220,7 +221,7 @@ impl WitnessCalculator {
self.instance.init(&mut self.store, sanity_check)?;

if self.circom_version != 2 {
todo!()
return Err(WitnessVersionNotSupported(self.circom_version.to_string()).into());
}

let n32 = self.instance.get_field_num_len32(&mut self.store)?;
Expand Down

0 comments on commit 0fda740

Please sign in to comment.