Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/zkemail/relayer-utils into …
Browse files Browse the repository at this point in the history
…feat/expose_more_wasm
  • Loading branch information
SoraSuegami committed Dec 13, 2024
2 parents 542c279 + cda92bf commit a5413df
Show file tree
Hide file tree
Showing 6 changed files with 413 additions and 15 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"wasm:postbuild": "node build.js",
"build": "npm run wasm:build && npm run wasm:postbuild"
},
"version": "0.4.55",
"version": "0.4.58",
"devDependencies": {
"@types/bun": "latest",
"prettier": "^3.3.3"
Expand Down
5 changes: 5 additions & 0 deletions src/circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,11 @@ pub async fn generate_circuit_inputs_with_decomposed_regexes_and_external_inputs

// Add the first index to the circuit inputs
circuit_inputs[format!("{}RegexIdx", decomposed_regex.name)] = idxes[0].0.into();

for (i, idx) in idxes.iter().enumerate().skip(1) {
// Add the remaining indices to the circuit inputs
circuit_inputs[format!("{}RegexIdx{}", decomposed_regex.name, i)] = idx.0.into();
}
}

// Process each external input and add it to the circuit inputs
Expand Down
4 changes: 2 additions & 2 deletions src/cryptos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#[cfg(target_arch = "wasm32")]
use crate::EmailHeaders;
use crate::{field_to_hex, find_index_in_body, hex_to_field, remove_quoted_printable_soft_breaks};
use anyhow::{anyhow, Result};
use crate::{field_to_hex, hex_to_field};
use anyhow::Result;
use ethers::types::Bytes;
use halo2curves::ff::Field;
use poseidon_rs::{poseidon_bytes, poseidon_fields, Fr, PoseidonError};
Expand Down
12 changes: 0 additions & 12 deletions src/parse_email.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,18 +290,6 @@ impl ParsedEmail {
/// - `Vec<usize>`: A mapping from cleaned indices to original indices. For cleaned indices that
/// correspond to actual content, `index_map[i]` gives the original position of
/// that byte in `body`. For padded bytes, the value is `usize::MAX`.
///
/// # Example
///
/// ```
/// let body = b"Hello=\r\nWorld".to_vec();
/// // body: [72,101,108,108,111,61,13,10,87,111,114,108,100]
/// let (clean_content, index_map) = remove_quoted_printable_soft_breaks(body);
///
/// // clean_content might look like [72,101,108,108,111,87,111,114,108,100,0,0,0]
/// // index_map might map:
/// // 0->0, 1->1, 2->2, 3->3, 4->4, 5->8, 6->9, 7->10, 8->11, 9->12, and the rest are usize::MAX.
/// ```
pub fn remove_quoted_printable_soft_breaks(body: Vec<u8>) -> (Vec<u8>, Vec<usize>) {
let original_len = body.len();
let mut cleaned = Vec::with_capacity(original_len);
Expand Down
Loading

0 comments on commit a5413df

Please sign in to comment.