Describe test regexes by json.

This commit is contained in:
SoraSuegami
2023-05-23 16:36:20 +09:00
parent 7367d77373
commit a2695d4087
40 changed files with 648 additions and 28781 deletions

6
.gitignore vendored
View File

@@ -14,4 +14,8 @@ Cargo.lock
/target
/Cargo.lock
/build
/build
/test_data/*.txt
*.bin
*.hex
*.sol

View File

@@ -19,7 +19,7 @@ halo2-ecc = { version = "0.2.2", default-features = false, features = [
# halo2-dynamic-sha256 = { path = "../halo2-dynamic-sha256-1" }
halo2-dynamic-sha256 = { git = "https://github.com/zkemail/halo2-dynamic-sha256.git", version = "0.1.0", branch = "feat/main_gate_base" }
halo2-rsa = { git = "https://github.com/zkemail/halo2-rsa.git", version = "0.1.0", branch = "feat/new_bigint", default-features = false }
halo2-regex = { git = "https://github.com/zkemail/halo2-regex.git", version = "0.1.0", branch = "feat/multi_regex" }
halo2-regex = { git = "https://github.com/zkemail/halo2-regex.git", version = "0.1.0", branch = "feat/multi_path" }
# halo2-regex = { path = "../halo2-regex-2", version = "0.1.0" }
halo2-base64 = { git = "https://github.com/zkemail/halo2-base64.git", version = "0.1.0", branch = "main" }
num-traits = "0.2.15"

View File

@@ -1,23 +1,29 @@
{
"degree": 19,
"num_advice": 40,
"num_advice": 60,
"num_lookup_advice": 1,
"num_fixed": 1,
"lookup_bits": 18,
"bodyhash_regex_filepath": "./test_data/regex_bodyhash.txt",
"bodyhash_substr_filepath": "./test_data/substr_bodyhash.txt",
"bodyhash_regex_filepath": "./test_data/bodyhash_allstr.txt",
"bodyhash_substr_filepath": "./test_data/bodyhash_substr_0.txt",
"header_regex_filepathes": [
"./test_data/regex_from.txt"
"./test_data/from_allstr.txt"
],
"header_substr_filepathes": [
"./test_data/substr_from.txt"
[
"./test_data/from_substr_0.txt"
]
],
"body_regex_filepathes": [
"./test_data/test1_email_body_allstr.txt"
],
"body_regex_filepath": "./test_data/regex_body_test1.txt",
"body_substr_filepathes": [
"./test_data/substr_body_test1_1.txt"
[
"./test_data/test1_email_body_substr_0.txt"
]
],
"num_sha2_compression_per_column": 1,
"header_max_byte_size": 512,
"header_max_byte_size": 1024,
"body_max_byte_size": 512,
"public_key_bits": 2048,
"header_substr_regexes": [

View File

@@ -1,26 +1,34 @@
{
"degree": 19,
"num_advice": 40,
"num_advice": 60,
"num_lookup_advice": 1,
"num_fixed": 1,
"lookup_bits": 18,
"bodyhash_regex_filepath": "./test_data/regex_bodyhash.txt",
"bodyhash_substr_filepath": "./test_data/substr_bodyhash.txt",
"bodyhash_regex_filepath": "./test_data/bodyhash_allstr.txt",
"bodyhash_substr_filepath": "./test_data/bodyhash_substr_0.txt",
"header_regex_filepathes": [
"./test_data/regex_from.txt",
"./test_data/regex_to.txt"
"./test_data/from_allstr.txt",
"./test_data/to_allstr.txt"
],
"header_substr_filepathes": [
"./test_data/substr_from.txt",
"./test_data/substr_to.txt"
[
"./test_data/from_substr_0.txt"
],
[
"./test_data/to_substr_0.txt"
]
],
"body_regex_filepathes":[
"./test_data/test2_email_body_allstr.txt"
],
"body_regex_filepath":"./test_data/regex_body_test2.txt",
"body_substr_filepathes": [
"./test_data/substr_body_test2_1.txt",
"./test_data/substr_body_test2_2.txt"
[
"./test_data/test2_email_body_substr_0.txt",
"./test_data/test2_email_body_substr_1.txt"
]
],
"num_sha2_compression_per_column": 1,
"header_max_byte_size": 512,
"header_max_byte_size": 1024,
"body_max_byte_size": 512,
"public_key_bits": 2048,
"header_substr_regexes": [
@@ -36,7 +44,7 @@
"(?<=email was meant for @)(a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|_)+"
],
[
"and (a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z)+(?=.)"
"(?<=and )(a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z)+(?=.)"
]
]
}

View File

@@ -1,29 +1,31 @@
{
"degree": 19,
"num_advice": 38,
"num_advice": 60,
"num_lookup_advice": 1,
"num_fixed": 1,
"lookup_bits": 18,
"bodyhash_regex_filepath": "./test_data/regex_bodyhash.txt",
"bodyhash_substr_filepath": "./test_data/substr_bodyhash.txt",
"bodyhash_regex_filepath": "./test_data/bodyhash_allstr.txt",
"bodyhash_substr_filepath": "./test_data/bodyhash_substr_0.txt",
"header_regex_filepathes": [
"./test_data/regex_from.txt",
"./test_data/regex_to.txt",
"./test_data/regex_subject.txt"
"./test_data/from_allstr.txt",
"./test_data/to_allstr.txt",
"./test_data/subject_allstr.txt"
],
"header_substr_filepathes": [
"./test_data/substr_from.txt",
"./test_data/substr_to.txt",
"./test_data/substr_subject.txt"
["./test_data/from_substr_0.txt"],
["./test_data/to_substr_0.txt"],
["./test_data/subject_substr_0.txt","./test_data/subject_substr_1.txt","./test_data/subject_substr_2.txt"]
],
"body_regex_filepath": "./test_data/regex_body_test_ex1.txt",
"body_regex_filepathes": ["./test_data/test_ex1_email_body_allstr.txt"],
"body_substr_filepathes": [
"./test_data/substr_body_test_ex1_1.txt",
"./test_data/substr_body_test_ex1_2.txt",
"./test_data/substr_body_test_ex1_3.txt"
[
"./test_data/test_ex1_email_body_substr_0.txt",
"./test_data/test_ex1_email_body_substr_1.txt",
"./test_data/test_ex1_email_body_substr_2.txt"
]
],
"num_sha2_compression_per_column": 1,
"header_max_byte_size": 512,
"header_max_byte_size": 1024,
"body_max_byte_size": 512,
"public_key_bits": 2048,
"header_substr_regexes": [
@@ -34,7 +36,19 @@
"(?<=to:).*@.*(?=\r)"
],
[
"(?<=subject:).*(?=\r)"
"(?<=subject:).*(?=\r)",
"(a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|_|\\.|-| )*((a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|_|\\.|-)+@(a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|_|\\.|-)+)?",
"(a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|_|\\.|-| )*"
],
[
"(?<=subject:).*(?=\r)",
"(a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|_|\\.|-| )*((a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|_|\\.|-)+@(a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|_|\\.|-)+)?(a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|_|\\.|-| )*",
"((a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|_|\\.|-)+@(a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|_|\\.|-)+)?"
],
[
"(?<=subject:).*(?=\r)",
"((a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|_|\\.|-)+@(a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|_|\\.|-)+)?(a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|_|\\.|-| )*(?=\r)",
"(a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|_|\\.|-| )*"
]
],
"body_substr_regexes": [

View File

@@ -1,29 +1,31 @@
{
"degree": 19,
"num_advice": 38,
"num_advice": 60,
"num_lookup_advice": 1,
"num_fixed": 1,
"lookup_bits": 18,
"bodyhash_regex_filepath": "./test_data/regex_bodyhash.txt",
"bodyhash_substr_filepath": "./test_data/substr_bodyhash.txt",
"bodyhash_regex_filepath": "./test_data/bodyhash_allstr.txt",
"bodyhash_substr_filepath": "./test_data/bodyhash_substr_0.txt",
"header_regex_filepathes": [
"./test_data/regex_from.txt",
"./test_data/regex_to.txt",
"./test_data/regex_subject.txt"
"./test_data/from_allstr.txt",
"./test_data/to_allstr.txt",
"./test_data/subject_allstr.txt"
],
"header_substr_filepathes": [
"./test_data/substr_from.txt",
"./test_data/substr_to.txt",
"./test_data/substr_subject.txt"
["./test_data/from_substr_0.txt"],
["./test_data/to_substr_0.txt"],
["./test_data/subject_substr_0.txt","./test_data/subject_substr_1.txt","./test_data/subject_substr_2.txt"]
],
"body_regex_filepath": "./test_data/regex_body_test_ex2.txt",
"body_regex_filepathes": ["./test_data/test_ex2_email_body_allstr.txt"],
"body_substr_filepathes": [
"./test_data/substr_body_test_ex2_1.txt",
"./test_data/substr_body_test_ex2_2.txt",
"./test_data/substr_body_test_ex2_3.txt"
[
"./test_data/test_ex2_email_body_substr_0.txt",
"./test_data/test_ex2_email_body_substr_1.txt",
"./test_data/test_ex2_email_body_substr_2.txt"
]
],
"num_sha2_compression_per_column": 1,
"header_max_byte_size": 512,
"header_max_byte_size": 1024,
"body_max_byte_size": 512,
"public_key_bits": 2048,
"header_substr_regexes": [
@@ -34,11 +36,23 @@
"(?<=to:).*@.*(?=\r)"
],
[
"(?<=subject:).*(?=\r)"
"(?<=subject:).*(?=\r)",
"(a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|_|\\.|-| )*((a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|_|\\.|-)+@(a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|_|\\.|-)+)?",
"(a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|_|\\.|-| )*"
],
[
"(?<=subject:).*(?=\r)",
"(a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|_|\\.|-| )*((a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|_|\\.|-)+@(a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|_|\\.|-)+)?(a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|_|\\.|-| )*",
"((a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|_|\\.|-)+@(a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|_|\\.|-)+)?"
],
[
"(?<=subject:).*(?=\r)",
"((a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|_|\\.|-)+@(a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|_|\\.|-)+)?(a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|_|\\.|-| )*(?=\r)",
"(a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|_|\\.|-| )*"
]
],
"body_substr_regexes": [
[
[
"Swap (0|1|2|3|4|5|6|7|8|9|\\.)+ ",
"(0|1|2|3|4|5|6|7|8|9|\\.)+"
],

View File

@@ -1,7 +1,7 @@
#[cfg(not(target_arch = "wasm32"))]
mod helpers;
#[cfg(not(target_arch = "wasm32"))]
pub mod vrm;
// #[cfg(not(target_arch = "wasm32"))]
// pub mod vrm;
// #[cfg(not(target_arch = "wasm32"))]
// pub mod snark_verifier_sdk;
pub mod regex_sha2;
@@ -25,6 +25,7 @@ use halo2_base::{
use halo2_base::{AssignedValue, QuantumCell};
use halo2_dynamic_sha256::{AssignedHashResult, Sha256DynamicConfig};
use halo2_regex::defs::RegexDefs;
pub use halo2_regex::vrm;
use halo2_regex::{
defs::{AllstrRegexDef, SubstrRegexDef},
AssignedRegexResult,
@@ -42,8 +43,6 @@ use sha2::{Digest, Sha256};
use snark_verifier::loader::LoadedScalar;
use snark_verifier_sdk::CircuitExt;
use std::env::set_var;
use std::fmt::format;
use std::fs::File;
#[derive(Debug, Clone)]
@@ -72,7 +71,7 @@ impl<F: PrimeField> EmailVerifyConfig<F> {
bodyhash_defs: RegexDefs,
header_regex_defs: Vec<RegexDefs>,
body_max_byte_size: usize,
body_regex_defs: RegexDefs,
body_regex_defs: Vec<RegexDefs>,
public_key_bits: usize,
) -> Self {
let header_defs = [vec![bodyhash_defs], header_regex_defs].concat();
@@ -88,7 +87,7 @@ impl<F: PrimeField> EmailVerifyConfig<F> {
body_max_byte_size,
// num_sha2_compression_per_column,
range_config.clone(),
vec![body_regex_defs],
body_regex_defs,
);
let biguint_config = halo2_rsa::BigUintConfig::construct(range_config, 64);
let rsa_config = RSAConfig::construct(biguint_config, public_key_bits, 5);
@@ -204,9 +203,9 @@ pub struct DefaultEmailVerifyConfigParams {
pub bodyhash_regex_filepath: String,
pub bodyhash_substr_filepath: String,
pub header_regex_filepathes: Vec<String>,
pub header_substr_filepathes: Vec<String>,
pub body_regex_filepath: String,
pub body_substr_filepathes: Vec<String>,
pub header_substr_filepathes: Vec<Vec<String>>,
pub body_regex_filepathes: Vec<String>,
pub body_substr_filepathes: Vec<Vec<String>>,
pub num_sha2_compression_per_column: usize,
pub header_max_byte_size: usize,
pub body_max_byte_size: usize,
@@ -263,31 +262,27 @@ impl<F: PrimeField> Circuit<F> for DefaultEmailVerifyCircuit<F> {
allstr: bodyhash_allstr_def,
substrs: vec![bodyhash_substr_def],
};
let header_allstr_defs = params
let body_regex_defs = params
.body_regex_filepathes
.iter()
.zip(params.body_substr_filepathes.iter())
.map(|(allstr_path, substr_pathes)| {
let allstr = AllstrRegexDef::read_from_text(&allstr_path);
let substrs = substr_pathes.into_iter().map(|path| SubstrRegexDef::read_from_text(&path)).collect_vec();
RegexDefs { allstr, substrs }
})
.collect_vec();
let header_regex_defs = params
.header_regex_filepathes
.into_iter()
.map(|path| AllstrRegexDef::read_from_text(&path))
.collect::<Vec<AllstrRegexDef>>();
let header_substr_defs = params
.header_substr_filepathes
.into_iter()
.map(|path| SubstrRegexDef::read_from_text(&path))
.collect::<Vec<SubstrRegexDef>>();
let body_allstr_def = AllstrRegexDef::read_from_text(&params.body_regex_filepath);
let body_substr_defs = params
.body_substr_filepathes
.into_iter()
.map(|path| SubstrRegexDef::read_from_text(&path))
.collect::<Vec<SubstrRegexDef>>();
let header_regex_defs = header_allstr_defs
.into_iter()
.zip(header_substr_defs.into_iter())
.map(|(allstr, substr)| RegexDefs { allstr, substrs: vec![substr] })
.collect::<Vec<RegexDefs>>();
let body_regex_defs = RegexDefs {
allstr: body_allstr_def,
substrs: body_substr_defs,
};
.iter()
.zip(params.header_substr_filepathes.iter())
.map(|(allstr_path, substr_pathes)| {
let allstr = AllstrRegexDef::read_from_text(&allstr_path);
let substrs = substr_pathes.into_iter().map(|path| SubstrRegexDef::read_from_text(&path)).collect_vec();
RegexDefs { allstr, substrs }
})
.collect_vec();
let inner = EmailVerifyConfig::configure(
meta,
// params.num_sha2_compression_per_column,
@@ -522,18 +517,40 @@ mod test {
dev::{CircuitCost, FailureLocation, MockProver, VerifyFailure},
halo2curves::bn256::{Fr, G1},
};
use halo2_regex::vrm::DecomposedRegexConfig;
use halo2_rsa::RSAPubE;
use mailparse::parse_mail;
use num_bigint::BigUint;
use rand::thread_rng;
use rsa::{PublicKeyParts, RsaPrivateKey};
use snark_verifier_sdk::CircuitExt;
use std::io::Read;
use std::{io::Read, path::Path};
use temp_env;
#[test]
fn test_generated_email1() {
temp_env::with_var(EMAIL_VERIFY_CONFIG_ENV, Some("./configs/test1_email_verify.config"), || {
let regex_bodyhash_decomposed: DecomposedRegexConfig = serde_json::from_reader(File::open("./test_data/bodyhash_defs.json").unwrap()).unwrap();
regex_bodyhash_decomposed
.gen_regex_files(
&Path::new("./test_data/bodyhash_allstr.txt").to_path_buf(),
&[Path::new("./test_data/bodyhash_substr_0.txt").to_path_buf()],
)
.unwrap();
let regex_from_decomposed: DecomposedRegexConfig = serde_json::from_reader(File::open("./test_data/from_defs.json").unwrap()).unwrap();
regex_from_decomposed
.gen_regex_files(
&Path::new("./test_data/from_allstr.txt").to_path_buf(),
&[Path::new("./test_data/from_substr_0.txt").to_path_buf()],
)
.unwrap();
let regex_body_decomposed: DecomposedRegexConfig = serde_json::from_reader(File::open("./test_data/test1_email_body_defs.json").unwrap()).unwrap();
regex_body_decomposed
.gen_regex_files(
&Path::new("./test_data/test1_email_body_allstr.txt").to_path_buf(),
&[Path::new("./test_data/test1_email_body_substr_0.txt").to_path_buf()],
)
.unwrap();
let params = DefaultEmailVerifyCircuit::<Fr>::read_config_params();
let mut rng = thread_rng();
let _private_key = RsaPrivateKey::new(&mut rng, params.public_key_bits).expect("failed to generate a key");
@@ -580,6 +597,37 @@ mod test {
#[test]
fn test_generated_email2() {
temp_env::with_var(EMAIL_VERIFY_CONFIG_ENV, Some("./configs/test2_email_verify.config"), || {
let regex_bodyhash_decomposed: DecomposedRegexConfig = serde_json::from_reader(File::open("./test_data/bodyhash_defs.json").unwrap()).unwrap();
regex_bodyhash_decomposed
.gen_regex_files(
&Path::new("./test_data/bodyhash_allstr.txt").to_path_buf(),
&[Path::new("./test_data/bodyhash_substr_0.txt").to_path_buf()],
)
.unwrap();
let regex_from_decomposed: DecomposedRegexConfig = serde_json::from_reader(File::open("./test_data/from_defs.json").unwrap()).unwrap();
regex_from_decomposed
.gen_regex_files(
&Path::new("./test_data/from_allstr.txt").to_path_buf(),
&[Path::new("./test_data/from_substr_0.txt").to_path_buf()],
)
.unwrap();
let regex_to_decomposed: DecomposedRegexConfig = serde_json::from_reader(File::open("./test_data/to_defs.json").unwrap()).unwrap();
regex_to_decomposed
.gen_regex_files(
&Path::new("./test_data/to_allstr.txt").to_path_buf(),
&[Path::new("./test_data/to_substr_0.txt").to_path_buf()],
)
.unwrap();
let regex_body_decomposed: DecomposedRegexConfig = serde_json::from_reader(File::open("./test_data/test2_email_body_defs.json").unwrap()).unwrap();
regex_body_decomposed
.gen_regex_files(
&Path::new("./test_data/test2_email_body_allstr.txt").to_path_buf(),
&[
Path::new("./test_data/test2_email_body_substr_0.txt").to_path_buf(),
Path::new("./test_data/test2_email_body_substr_1.txt").to_path_buf(),
],
)
.unwrap();
let params = DefaultEmailVerifyCircuit::<Fr>::read_config_params();
let mut rng = thread_rng();
let _private_key = RsaPrivateKey::new(&mut rng, params.public_key_bits).expect("failed to generate a key");
@@ -588,7 +636,6 @@ mod test {
let message = concat!(
"From: alice@zkemail.com\r\n",
"To: bob@example.com\r\n",
"Subject: Hello.\r\n",
"\r\n",
"email was meant for @zkemailverify and halo.",
)
@@ -596,7 +643,7 @@ mod test {
let email = parse_mail(message).unwrap();
let logger = slog::Logger::root(slog::Discard, slog::o!());
let signer = SignerBuilder::new()
.with_signed_headers(&["Subject", "To", "From"])
.with_signed_headers(&["To", "From"])
.unwrap()
.with_private_key(private_key)
.with_selector("default")
@@ -633,6 +680,49 @@ mod test {
#[tokio::test]
async fn test_existing_email1() {
let regex_bodyhash_decomposed: DecomposedRegexConfig = serde_json::from_reader(File::open("./test_data/bodyhash_defs.json").unwrap()).unwrap();
regex_bodyhash_decomposed
.gen_regex_files(
&Path::new("./test_data/bodyhash_allstr.txt").to_path_buf(),
&[Path::new("./test_data/bodyhash_substr_0.txt").to_path_buf()],
)
.unwrap();
let regex_from_decomposed: DecomposedRegexConfig = serde_json::from_reader(File::open("./test_data/from_defs.json").unwrap()).unwrap();
regex_from_decomposed
.gen_regex_files(
&Path::new("./test_data/from_allstr.txt").to_path_buf(),
&[Path::new("./test_data/from_substr_0.txt").to_path_buf()],
)
.unwrap();
let regex_to_decomposed: DecomposedRegexConfig = serde_json::from_reader(File::open("./test_data/to_defs.json").unwrap()).unwrap();
regex_to_decomposed
.gen_regex_files(
&Path::new("./test_data/to_allstr.txt").to_path_buf(),
&[Path::new("./test_data/to_substr_0.txt").to_path_buf()],
)
.unwrap();
let regex_subject_decomposed: DecomposedRegexConfig = serde_json::from_reader(File::open("./test_data/subject_defs.json").unwrap()).unwrap();
regex_subject_decomposed
.gen_regex_files(
&Path::new("./test_data/subject_allstr.txt").to_path_buf(),
&[
Path::new("./test_data/subject_substr_0.txt").to_path_buf(),
Path::new("./test_data/subject_substr_1.txt").to_path_buf(),
Path::new("./test_data/subject_substr_2.txt").to_path_buf(),
],
)
.unwrap();
let regex_body_decomposed: DecomposedRegexConfig = serde_json::from_reader(File::open("./test_data/test_ex1_email_body_defs.json").unwrap()).unwrap();
regex_body_decomposed
.gen_regex_files(
&Path::new("./test_data/test_ex1_email_body_allstr.txt").to_path_buf(),
&[
Path::new("./test_data/test_ex1_email_body_substr_0.txt").to_path_buf(),
Path::new("./test_data/test_ex1_email_body_substr_1.txt").to_path_buf(),
Path::new("./test_data/test_ex1_email_body_substr_2.txt").to_path_buf(),
],
)
.unwrap();
let email_bytes = {
let mut f = File::open("./test_data/test_email1.eml").unwrap();
let mut buf = Vec::new();
@@ -672,6 +762,49 @@ mod test {
#[tokio::test]
async fn test_existing_email2() {
let regex_bodyhash_decomposed: DecomposedRegexConfig = serde_json::from_reader(File::open("./test_data/bodyhash_defs.json").unwrap()).unwrap();
regex_bodyhash_decomposed
.gen_regex_files(
&Path::new("./test_data/bodyhash_allstr.txt").to_path_buf(),
&[Path::new("./test_data/bodyhash_substr_0.txt").to_path_buf()],
)
.unwrap();
let regex_from_decomposed: DecomposedRegexConfig = serde_json::from_reader(File::open("./test_data/from_defs.json").unwrap()).unwrap();
regex_from_decomposed
.gen_regex_files(
&Path::new("./test_data/from_allstr.txt").to_path_buf(),
&[Path::new("./test_data/from_substr_0.txt").to_path_buf()],
)
.unwrap();
let regex_to_decomposed: DecomposedRegexConfig = serde_json::from_reader(File::open("./test_data/to_defs.json").unwrap()).unwrap();
regex_to_decomposed
.gen_regex_files(
&Path::new("./test_data/to_allstr.txt").to_path_buf(),
&[Path::new("./test_data/to_substr_0.txt").to_path_buf()],
)
.unwrap();
let regex_subject_decomposed: DecomposedRegexConfig = serde_json::from_reader(File::open("./test_data/subject_defs.json").unwrap()).unwrap();
regex_subject_decomposed
.gen_regex_files(
&Path::new("./test_data/subject_allstr.txt").to_path_buf(),
&[
Path::new("./test_data/subject_substr_0.txt").to_path_buf(),
Path::new("./test_data/subject_substr_1.txt").to_path_buf(),
Path::new("./test_data/subject_substr_2.txt").to_path_buf(),
],
)
.unwrap();
let regex_body_decomposed: DecomposedRegexConfig = serde_json::from_reader(File::open("./test_data/test_ex2_email_body_defs.json").unwrap()).unwrap();
regex_body_decomposed
.gen_regex_files(
&Path::new("./test_data/test_ex2_email_body_allstr.txt").to_path_buf(),
&[
Path::new("./test_data/test_ex2_email_body_substr_0.txt").to_path_buf(),
Path::new("./test_data/test_ex2_email_body_substr_1.txt").to_path_buf(),
Path::new("./test_data/test_ex2_email_body_substr_2.txt").to_path_buf(),
],
)
.unwrap();
let email_bytes = {
let mut f = File::open("./test_data/test_email2.eml").unwrap();
let mut buf = Vec::new();

View File

@@ -115,9 +115,11 @@ mod test {
use halo2_base::halo2_proofs::poly::kzg::multiopen::{ProverGWC, VerifierGWC};
use halo2_base::halo2_proofs::poly::kzg::strategy::SingleStrategy;
use halo2_base::halo2_proofs::transcript::{Blake2bRead, Blake2bWrite, Challenge255, TranscriptReadBuffer, TranscriptWriterBuffer};
use halo2_regex::vrm::DecomposedRegexConfig;
use rand::rngs::OsRng;
use std::collections::HashSet;
use std::marker::PhantomData;
use std::path::Path;
use super::*;
@@ -196,12 +198,16 @@ mod test {
// );
let regex_defs = vec![
RegexDefs {
allstr: AllstrRegexDef::read_from_text("./test_data/regex_from.txt"),
substrs: vec![SubstrRegexDef::read_from_text("./test_data/substr_from.txt")],
allstr: AllstrRegexDef::read_from_text("./test_data/from_allstr.txt"),
substrs: vec![SubstrRegexDef::read_from_text("./test_data/from_substr_0.txt")],
},
RegexDefs {
allstr: AllstrRegexDef::read_from_text("./test_data/regex_subject.txt"),
substrs: vec![SubstrRegexDef::read_from_text("./test_data/substr_subject.txt")],
allstr: AllstrRegexDef::read_from_text("./test_data/subject_allstr.txt"),
substrs: vec![
SubstrRegexDef::read_from_text("./test_data/subject_substr_0.txt"),
SubstrRegexDef::read_from_text("./test_data/subject_substr_1.txt"),
SubstrRegexDef::read_from_text("./test_data/subject_substr_2.txt"),
],
},
];
let inner = RegexSha2Config::configure(meta, Self::MAX_BYTE_SIZE, range_config, regex_defs);
@@ -288,6 +294,24 @@ mod test {
#[test]
fn test_regex_sha2_valid_case1() {
let regex_from_decomposed: DecomposedRegexConfig = serde_json::from_reader(File::open("./test_data/from_defs.json").unwrap()).unwrap();
regex_from_decomposed
.gen_regex_files(
&Path::new("./test_data/from_allstr.txt").to_path_buf(),
&[Path::new("./test_data/from_substr_0.txt").to_path_buf()],
)
.unwrap();
let regex_subject_decomposed: DecomposedRegexConfig = serde_json::from_reader(File::open("./test_data/subject_defs.json").unwrap()).unwrap();
regex_subject_decomposed
.gen_regex_files(
&Path::new("./test_data/subject_allstr.txt").to_path_buf(),
&[
Path::new("./test_data/subject_substr_0.txt").to_path_buf(),
Path::new("./test_data/subject_substr_1.txt").to_path_buf(),
Path::new("./test_data/subject_substr_2.txt").to_path_buf(),
],
)
.unwrap();
let email_bytes = {
let mut f = File::open("./test_data/test_email1.eml").unwrap();
let mut buf = Vec::new();

View File

@@ -0,0 +1,38 @@
{
"max_byte_size": 1024,
"parts": [
{
"is_public": false,
"regex_def": "((0|1|2|3|4|5|6|7|8|9|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|!|\"|#|$|%|&|'|\\(|\\)|\\*|\\+|,|-|.|/|:|;|<|=|>|\\?|@|[|\\\\|]|^|_|`|{|\\||}|~| |\t|\n|\r|\\x0b|\\x0c)+\r\n)?",
"max_size": 1024
},
{
"is_public": false,
"regex_def": "dkim-signature:",
"max_size": 15
},
{
"is_public": false,
"regex_def": "((a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z)=(0|1|2|3|4|5|6|7|8|9|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|!|\"|#|$|%|&|'|\\(|\\)|\\*|\\+|,|-|.|/|:|<|=|>|\\?|@|[|\\\\|]|^|_|`|{|\\||}|~| |\t|\n|\r|\\x0b|\\x0c)+; )+bh=",
"max_size": 128
},
{
"is_public": true,
"regex_def": "(a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|\\+|/|=)+",
"max_size": 128,
"solidity": {
"type": "String"
}
},
{
"is_public": false,
"regex_def": ";",
"max_size": 1
},
{
"is_public": false,
"regex_def": "(0|1|2|3|4|5|6|7|8|9|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|!|\"|#|$|%|&|'|\\(|\\)|\\*|\\+|,|-|.|/|:|;|<|=|>|\\?|@|[|\\\\|]|^|_|`|{|\\||}|~| |\t|\n|\r|\\x0b|\\x0c)*",
"max_size": 1024
}
]
}

38
test_data/from_defs.json Normal file
View File

@@ -0,0 +1,38 @@
{
"max_byte_size": 1024,
"parts": [
{
"is_public": false,
"regex_def": "((0|1|2|3|4|5|6|7|8|9|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|!|\"|#|$|%|&|'|\\(|\\)|\\*|\\+|,|-|.|/|:|;|<|=|>|\\?|@|[|\\\\|]|^|_|`|{|\\||}|~| |\t|\n|\r|\\x0b|\\x0c)+\r\n)?",
"max_size": 1024
},
{
"is_public": false,
"regex_def": "from:",
"max_size": 5
},
{
"is_public": false,
"regex_def": "((a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|_|\\.|\"| |@)+<)?",
"max_size": 40
},
{
"is_public": true,
"regex_def": "(a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|_|\\.|-)+@(a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|_|\\.|-)+",
"max_size": 40,
"solidity": {
"type": "String"
}
},
{
"is_public": false,
"regex_def": ">?\r\n",
"max_size": 3
},
{
"is_public": false,
"regex_def": "(0|1|2|3|4|5|6|7|8|9|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|!|\"|#|$|%|&|'|\\(|\\)|\\*|\\+|,|-|.|/|:|;|<|=|>|\\?|@|[|\\\\|]|^|_|`|{|\\||}|~| |\t|\n|\r|\\x0b|\\x0c)*",
"max_size": 1024
}
]
}

View File

@@ -1,153 +0,0 @@
0
8
25
0 2 101
1 4 46
1 1 48
1 1 49
1 1 50
1 1 51
1 1 52
1 1 53
1 1 54
1 1 55
1 1 56
1 1 57
1 1 65
1 1 66
1 1 67
1 1 68
1 1 69
1 1 70
1 1 71
1 1 72
1 1 73
1 1 74
1 1 75
1 1 76
1 1 77
1 1 78
1 1 79
1 1 80
1 1 81
1 1 82
1 1 83
1 1 84
1 1 85
1 1 86
1 1 87
1 1 88
1 1 89
1 1 90
1 1 95
1 1 97
1 1 98
1 1 99
1 1 100
1 1 101
1 1 102
1 1 103
1 1 104
1 1 105
1 1 106
1 1 107
1 1 108
1 1 109
1 1 110
1 1 111
1 1 112
1 1 113
1 1 114
1 1 115
1 1 116
1 1 117
1 1 118
1 1 119
1 1 120
1 1 121
1 1 122
2 3 109
3 5 97
4 7 13
5 6 105
6 9 108
7 8 10
9 10 32
10 11 119
11 12 97
12 13 115
13 14 32
14 15 109
15 16 101
16 17 97
17 18 110
18 19 116
19 20 32
20 21 102
21 22 111
22 23 114
23 24 32
24 25 64
25 1 48
25 1 49
25 1 50
25 1 51
25 1 52
25 1 53
25 1 54
25 1 55
25 1 56
25 1 57
25 1 65
25 1 66
25 1 67
25 1 68
25 1 69
25 1 70
25 1 71
25 1 72
25 1 73
25 1 74
25 1 75
25 1 76
25 1 77
25 1 78
25 1 79
25 1 80
25 1 81
25 1 82
25 1 83
25 1 84
25 1 85
25 1 86
25 1 87
25 1 88
25 1 89
25 1 90
25 1 95
25 1 97
25 1 98
25 1 99
25 1 100
25 1 101
25 1 102
25 1 103
25 1 104
25 1 105
25 1 106
25 1 107
25 1 108
25 1 109
25 1 110
25 1 111
25 1 112
25 1 113
25 1 114
25 1 115
25 1 116
25 1 117
25 1 118
25 1 119
25 1 120
25 1 121
25 1 122

View File

@@ -1,212 +0,0 @@
0
11
31
0 2 101
1 4 32
1 5 46
1 1 48
1 1 49
1 1 50
1 1 51
1 1 52
1 1 53
1 1 54
1 1 55
1 1 56
1 1 57
1 1 65
1 1 66
1 1 67
1 1 68
1 1 69
1 1 70
1 1 71
1 1 72
1 1 73
1 1 74
1 1 75
1 1 76
1 1 77
1 1 78
1 1 79
1 1 80
1 1 81
1 1 82
1 1 83
1 1 84
1 1 85
1 1 86
1 1 87
1 1 88
1 1 89
1 1 90
1 1 95
1 1 97
1 1 98
1 1 99
1 1 100
1 1 101
1 1 102
1 1 103
1 1 104
1 1 105
1 1 106
1 1 107
1 1 108
1 1 109
1 1 110
1 1 111
1 1 112
1 1 113
1 1 114
1 1 115
1 1 116
1 1 117
1 1 118
1 1 119
1 1 120
1 1 121
1 1 122
2 3 109
3 6 97
4 8 97
5 9 13
6 7 105
7 14 108
8 10 110
9 11 10
10 12 100
12 13 32
13 15 97
13 15 98
13 15 99
13 15 100
13 15 101
13 15 102
13 15 103
13 15 104
13 15 105
13 15 106
13 15 107
13 15 108
13 15 109
13 15 110
13 15 111
13 15 112
13 15 113
13 15 114
13 15 115
13 15 116
13 15 117
13 15 118
13 15 119
13 15 120
13 15 121
13 15 122
14 16 32
15 4 32
15 5 46
15 15 97
15 15 98
15 15 99
15 15 100
15 15 101
15 15 102
15 15 103
15 15 104
15 15 105
15 15 106
15 15 107
15 15 108
15 15 109
15 15 110
15 15 111
15 15 112
15 15 113
15 15 114
15 15 115
15 15 116
15 15 117
15 15 118
15 15 119
15 15 120
15 15 121
15 15 122
16 17 119
17 18 97
18 19 115
19 20 32
20 21 109
21 22 101
22 23 97
23 24 110
24 25 116
25 26 32
26 27 102
27 28 111
28 29 114
29 30 32
30 31 64
31 1 48
31 1 49
31 1 50
31 1 51
31 1 52
31 1 53
31 1 54
31 1 55
31 1 56
31 1 57
31 1 65
31 1 66
31 1 67
31 1 68
31 1 69
31 1 70
31 1 71
31 1 72
31 1 73
31 1 74
31 1 75
31 1 76
31 1 77
31 1 78
31 1 79
31 1 80
31 1 81
31 1 82
31 1 83
31 1 84
31 1 85
31 1 86
31 1 87
31 1 88
31 1 89
31 1 90
31 1 95
31 1 97
31 1 98
31 1 99
31 1 100
31 1 101
31 1 102
31 1 103
31 1 104
31 1 105
31 1 106
31 1 107
31 1 108
31 1 109
31 1 110
31 1 111
31 1 112
31 1 113
31 1 114
31 1 115
31 1 116
31 1 117
31 1 118
31 1 119
31 1 120
31 1 121
31 1 122

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,49 @@
{
"max_byte_size": 1024,
"parts": [
{
"is_public": false,
"regex_def": "((0|1|2|3|4|5|6|7|8|9|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|!|\"|#|$|%|&|'|\\(|\\)|\\*|\\+|,|-|.|/|:|;|<|=|>|\\?|@|[|\\\\|]|^|_|`|{|\\||}|~| |\t|\n|\r|\\x0b|\\x0c)+\r\n)?",
"max_size": 1024
},
{
"is_public": false,
"regex_def": "subject:",
"max_size": 8
},
{
"is_public": true,
"regex_def": "(a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|_|\\.|-| )*",
"max_size": 1024,
"solidity": {
"type": "String"
}
},
{
"is_public": true,
"regex_def": "((a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|_|\\.|-)+@(a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|_|\\.|-)+)?",
"max_size": 40,
"solidity": {
"type": "String"
}
},
{
"is_public": true,
"regex_def": "(a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|_|\\.|-| )*",
"max_size": 1024,
"solidity": {
"type": "String"
}
},
{
"is_public": false,
"regex_def": ">?\r\n",
"max_size": 3
},
{
"is_public": false,
"regex_def": "(0|1|2|3|4|5|6|7|8|9|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|!|\"|#|$|%|&|'|\\(|\\)|\\*|\\+|,|-|.|/|:|;|<|=|>|\\?|@|[|\\\\|]|^|_|`|{|\\||}|~| |\t|\n|\r|\\x0b|\\x0c)*",
"max_size": 1024
}
]
}

View File

@@ -1,5 +0,0 @@
15
0
1023
25 1
1 1

View File

@@ -1,5 +0,0 @@
15
0
1023
25 1
1 1

View File

@@ -1,5 +0,0 @@
40
0
1023
31 1
1 1

View File

@@ -1,9 +0,0 @@
40
0
1023
13 15
15 15
4 8
8 10
10 12
12 13

View File

@@ -1,5 +0,0 @@
20
0
511
69 70
70 70

View File

@@ -1,9 +0,0 @@
20
0
511
75 76
71 72
72 74
71 73
73 75
74 76

View File

@@ -1,86 +0,0 @@
20
0
511
80 82
6 8
11 83
91 93
87 90
86 89
92 81
5 7
83 86
7 81
9 11
9 81
8 10
92 83
11 81
89 91
82 81
81 81
86 86
12 85
94 3
81 83
4 6
11 13
3 83
14 15
7 83
10 12
4 6
83 85
4 85
90 92
10 85
94 83
7 9
92 94
91 93
85 86
12 14
84 81
14 15
83 85
93 85
6 85
9 83
90 81
3 81
94 81
80 81
8 10
13 83
12 14
8 85
5 81
87 83
85 86
2 85
10 12
83 86
89 91
3 5
82 82
85 85
15 85
86 89
93 2
5 83
13 81
84 83
81 82
87 81
90 83
82 83
86 85
93 2
2 4
6 8
91 85
84 87
2 4
89 85
82 84
14 85

View File

@@ -1,5 +0,0 @@
20
0
511
52 52
51 52

View File

@@ -1,9 +0,0 @@
3
0
511
56 58
53 54
53 55
55 57
57 58
54 56

View File

@@ -1,9 +0,0 @@
3
0
511
62 63
62 64
66 67
63 65
64 66
65 67

View File

@@ -1,5 +0,0 @@
44
0
1023
28 1
1 1

View File

@@ -1,12 +0,0 @@
44
0
1023
16 18
16 19
18 18
18 22
18 19
19 18
19 22
22 27
27 27

View File

@@ -1,5 +0,0 @@
44
0
1023
39 3
3 3

View File

@@ -1,8 +0,0 @@
20
0
1023
16 1
1 1
1 12
12 15
15 15

View File

@@ -1,5 +0,0 @@
44
0
1023
11 12
12 12

View File

@@ -1,23 +0,0 @@
44
0
1023
7 9
9 9
9 10
9 13
10 9
10 10
10 13
10 14
13 18
13 19
14 9
14 13
14 10
18 18
18 19
19 18
19 24
19 19
24 18
24 19

View File

@@ -0,0 +1,28 @@
{
"max_byte_size": 1024,
"parts": [
{
"is_public": false,
"regex_def": "email was meant for @",
"max_size": 21
},
{
"is_public": true,
"regex_def": "(a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|_)+",
"max_size": 1024,
"solidity": {
"type": "String"
}
},
{
"is_public": false,
"regex_def": ".",
"max_size": 1
},
{
"is_public": false,
"regex_def": "(0|1|2|3|4|5|6|7|8|9|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|!|\"|#|$|%|&|'|\\(|\\)|\\*|\\+|,|-|.|/|:|;|<|=|>|\\?|@|[|\\\\|]|^|_|`|{|\\||}|~| |\t|\n|\r|\\x0b|\\x0c)*",
"max_size": 1024
}
]
}

View File

@@ -0,0 +1,38 @@
{
"max_byte_size": 1024,
"parts": [
{
"is_public": false,
"regex_def": "email was meant for @",
"max_size": 21
},
{
"is_public": true,
"regex_def": "(a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|_)+",
"max_size": 1024,
"solidity": {
"type": "String"
}
},
{
"is_public": false,
"regex_def": " and ",
"max_size": 5
},
{
"is_public": true,
"regex_def": "(a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z)+",
"max_size": 1024
},
{
"is_public": false,
"regex_def": ".",
"max_size": 1
},
{
"is_public": false,
"regex_def": "(0|1|2|3|4|5|6|7|8|9|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|!|\"|#|$|%|&|'|\\(|\\)|\\*|\\+|,|-|.|/|:|;|<|=|>|\\?|@|[|\\\\|]|^|_|`|{|\\||}|~| |\t|\n|\r|\\x0b|\\x0c)*",
"max_size": 1024
}
]
}

View File

@@ -0,0 +1,59 @@
{
"max_byte_size": 1024,
"parts": [
{
"is_public": false,
"regex_def": "(0|1|2|3|4|5|6|7|8|9|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|!|\"|#|$|%|&|'|\\(|\\)|\\*|\\+|,|-|.|/|:|;|<|=|>|\\?|@|[|\\\\|]|^|_|`|{|\\||}|~| |\t|\n|\r|\\x0b|\\x0c)*",
"max_size": 1024
},
{
"is_public": false,
"regex_def": "Content-Type: text/plain; charset=\"UTF-8\"\r\n\r\n",
"max_size": 45
},
{
"is_public": false,
"regex_def": "Transfer ",
"max_size": 9
},
{
"is_public": true,
"regex_def": "(0|1|2|3|4|5|6|7|8|9|\\.)+",
"max_size": 20,
"solidity": {
"type": "Decimal"
}
},
{
"is_public": false,
"regex_def": " ",
"max_size": 1
},
{
"is_public": true,
"regex_def": "(A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z)+",
"max_size": 10,
"solidity": {
"type": "String"
}
},
{
"is_public": false,
"regex_def": " to ",
"max_size": 4
},
{
"is_public": true,
"regex_def": "(a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|_|\\.|-)+@(a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|_|\\.|-)+",
"max_size": 20,
"solidity": {
"type": "String"
}
},
{
"is_public": false,
"regex_def": "\r\n(0|1|2|3|4|5|6|7|8|9|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|!|\"|#|$|%|&|'|\\(|\\)|\\*|\\+|,|-|.|/|:|;|<|=|>|\\?|@|[|\\\\|]|^|_|`|{|\\||}|~| |\t|\n|\r|\\x0b|\\x0c)*",
"max_size": 1024
}
]
}

View File

@@ -0,0 +1,64 @@
{
"max_byte_size": 1024,
"parts": [
{
"is_public": false,
"regex_def": "(0|1|2|3|4|5|6|7|8|9|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|!|\"|#|$|%|&|'|\\(|\\)|\\*|\\+|,|-|.|/|:|;|<|=|>|\\?|@|[|\\\\|]|^|_|`|{|\\||}|~| |\t|\n|\r|\\x0b|\\x0c)*",
"max_size": 1024
},
{
"is_public": false,
"regex_def": "Content-Type: text/plain; charset=\"UTF-8\"\r\n\r\n",
"max_size": 45
},
{
"is_public": false,
"regex_def": "Swap ",
"max_size": 9
},
{
"is_public": true,
"regex_def": "(0|1|2|3|4|5|6|7|8|9|\\.)+",
"max_size": 20,
"solidity": {
"type": "Decimal"
}
},
{
"is_public": false,
"regex_def": " ",
"max_size": 1
},
{
"is_public": true,
"regex_def": "(A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z)+",
"max_size": 10,
"solidity": {
"type": "String"
}
},
{
"is_public": false,
"regex_def": " to ",
"max_size": 4
},
{
"is_public": true,
"regex_def": "(ETH|DAI)",
"max_size": 3,
"solidity": {
"type": "String"
}
},
{
"is_public": false,
"regex_def": " via Uniswap",
"max_size": 13
},
{
"is_public": false,
"regex_def": "\r\n(0|1|2|3|4|5|6|7|8|9|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|!|\"|#|$|%|&|'|\\(|\\)|\\*|\\+|,|-|.|/|:|;|<|=|>|\\?|@|[|\\\\|]|^|_|`|{|\\||}|~| |\t|\n|\r|\\x0b|\\x0c)*",
"max_size": 1024
}
]
}

38
test_data/to_defs.json Normal file
View File

@@ -0,0 +1,38 @@
{
"max_byte_size": 1024,
"parts": [
{
"is_public": false,
"regex_def": "((0|1|2|3|4|5|6|7|8|9|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|!|\"|#|$|%|&|'|\\(|\\)|\\*|\\+|,|-|.|/|:|;|<|=|>|\\?|@|[|\\\\|]|^|_|`|{|\\||}|~| |\t|\n|\r|\\x0b|\\x0c)+\r\n)?",
"max_size": 1024
},
{
"is_public": false,
"regex_def": "to:",
"max_size": 3
},
{
"is_public": false,
"regex_def": "((a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|_|\\.|\"| |@)+<)?",
"max_size": 40
},
{
"is_public": true,
"regex_def": "(a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|_|\\.|-)+@(a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|_|\\.|-)+",
"max_size": 40,
"solidity": {
"type": "String"
}
},
{
"is_public": false,
"regex_def": ">?\r\n",
"max_size": 3
},
{
"is_public": false,
"regex_def": "(0|1|2|3|4|5|6|7|8|9|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|!|\"|#|$|%|&|'|\\(|\\)|\\*|\\+|,|-|.|/|:|;|<|=|>|\\?|@|[|\\\\|]|^|_|`|{|\\||}|~| |\t|\n|\r|\\x0b|\\x0c)*",
"max_size": 1024
}
]
}