From 4b67bf9655aec0eeec5e5c988e5af3438581cb8e Mon Sep 17 00:00:00 2001 From: Todd Norton Date: Thu, 7 Nov 2024 13:46:31 +0100 Subject: [PATCH 1/8] chore: Add GKR scheme to config --- expander_compiler/ec_go_lib/src/lib.rs | 10 ++++ expander_compiler/src/circuit/config.rs | 16 +++++- expander_compiler/src/layering/wire.rs | 72 ++++++++++++++++--------- 3 files changed, 71 insertions(+), 27 deletions(-) diff --git a/expander_compiler/ec_go_lib/src/lib.rs b/expander_compiler/ec_go_lib/src/lib.rs index 800b2cd2..0f8fd90b 100644 --- a/expander_compiler/ec_go_lib/src/lib.rs +++ b/expander_compiler/ec_go_lib/src/lib.rs @@ -49,6 +49,7 @@ fn compile_inner(ir_source: Vec, config_id: u64) -> Result<(Vec, Vec 1 => compile_inner_with_config::(ir_source), 2 => compile_inner_with_config::(ir_source), 3 => compile_inner_with_config::(ir_source), + 4 => compile_inner_with_config::(ir_source), _ => Err(format!("unknown config id: {}", config_id)), } } @@ -224,6 +225,10 @@ pub extern "C" fn prove_circuit_file( circuit_filename, witness, ), + 4 => prove_circuit_file_inner::( + circuit_filename, + witness, + ), _ => panic!("unknown config id: {}", config_id), }; let proof_len = proof.len(); @@ -271,6 +276,11 @@ pub extern "C" fn verify_circuit_file( witness, proof, ), + 4 => verify_circuit_file_inner::( + circuit_filename, + witness, + proof, + ), _ => panic!("unknown config id: {}", config_id), } } diff --git a/expander_compiler/src/circuit/config.rs b/expander_compiler/src/circuit/config.rs index f90fb6a5..d210bce0 100644 --- a/expander_compiler/src/circuit/config.rs +++ b/expander_compiler/src/circuit/config.rs @@ -1,10 +1,12 @@ -use std::{fmt::Debug, hash::Hash}; - use crate::field::Field; +use expander_config::GKRScheme; +use std::{fmt::Debug, hash::Hash}; pub trait Config: Default + Clone + Ord + Debug + Hash + Copy + 'static { type CircuitField: Field; + const SCHEME: GKRScheme = GKRScheme::Vanilla; + const CONFIG_ID: usize; const COST_INPUT: usize = 1000; @@ -25,6 +27,16 @@ impl Config for M31Config { const CONFIG_ID: usize = 1; } +#[derive(Default, Clone, Copy, Hash, PartialEq, Eq, PartialOrd, Ord, Debug)] +pub struct M31Gkr2Config {} + +impl Config for M31Gkr2Config { + type CircuitField = crate::field::M31; + + const CONFIG_ID: usize = 4; + const SCHEME: GKRScheme = GKRScheme::GkrSquare; +} + #[derive(Default, Clone, Copy, Hash, PartialEq, Eq, PartialOrd, Ord, Debug)] pub struct BN254Config {} diff --git a/expander_compiler/src/layering/wire.rs b/expander_compiler/src/layering/wire.rs index c7d0a71f..5881a189 100644 --- a/expander_compiler/src/layering/wire.rs +++ b/expander_compiler/src/layering/wire.rs @@ -1,3 +1,4 @@ +use expander_config::GKRScheme; use std::collections::HashMap; use crate::{ @@ -20,6 +21,32 @@ struct LayoutQuery { var_pos: HashMap, } +/// Add value at `input_pos` to `output_pos` with coefficient `coef`. +fn push_add_gate( + res: &mut Segment, + input_pos: usize, + output_pos: usize, + coef: Coef, +) { + match C::SCHEME { + GKRScheme::Vanilla => { + res.gate_adds.push(GateAdd { + inputs: [input_pos], + output: output_pos, + coef, + }); + } + GKRScheme::GkrSquare => { + res.gate_customs.push(GateCustom { + gate_type: 12346, // power1 gate + inputs: vec![input_pos], + output: output_pos, + coef, + }); + } + } +} + impl LayoutQuery { // given a parent layer layout, this function query the layout of a sub circuit fn query( @@ -278,11 +305,12 @@ impl<'a, C: Config> CompileContext<'a, C> { }; // if it's not the first layer, just relay it if ic.min_layer[*x] != next_layer { - res.gate_adds.push(GateAdd { - inputs: [aq.var_pos[x]], - output: pos, - coef: Coef::Constant(C::CircuitField::one()), - }); + push_add_gate( + &mut res, + aq.var_pos[x], + pos, + Coef::Constant(C::CircuitField::one()), + ); continue; } if let Some(value) = ic.constant_like_variables.get(x) { @@ -302,11 +330,12 @@ impl<'a, C: Config> CompileContext<'a, C> { }); } VarSpec::Linear(vid) => { - res.gate_adds.push(GateAdd { - inputs: [aq.var_pos[vid]], - output: pos, - coef: Coef::Constant(term.coef), - }); + push_add_gate( + &mut res, + aq.var_pos[vid], + pos, + Coef::Constant(term.coef), + ); } VarSpec::Quad(vid0, vid1) => { res.gate_muls.push(GateMul { @@ -324,11 +353,7 @@ impl<'a, C: Config> CompileContext<'a, C> { }); } VarSpec::RandomLinear(vid) => { - res.gate_adds.push(GateAdd { - inputs: [aq.var_pos[vid]], - output: pos, - coef: Coef::Random, - }); + push_add_gate(&mut res, aq.var_pos[vid], pos, Coef::Random); } } } @@ -345,11 +370,7 @@ impl<'a, C: Config> CompileContext<'a, C> { } else { Coef::Random }; - res.gate_adds.push(GateAdd { - inputs: [aq.var_pos[v]], - output: pos, - coef, - }); + push_add_gate(&mut res, aq.var_pos[v], pos, coef); } for i in cc.sub_circuit_ids.iter() { let insn_id = ic.sub_circuit_insn_ids[*i]; @@ -373,11 +394,12 @@ impl<'a, C: Config> CompileContext<'a, C> { placement.iter().position(|x| *x == vpid).unwrap() } }; - res.gate_adds.push(GateAdd { - inputs: [sub_cur_layout_all[&insn_id].offset + spos], - output: pos, - coef: Coef::Constant(C::CircuitField::one()), - }); + push_add_gate( + &mut res, + sub_cur_layout_all[&insn_id].offset + spos, + pos, + Coef::Constant(C::CircuitField::one()), + ); } } From 669159b03dfeb29396ba88469504ae84ae16e9be Mon Sep 17 00:00:00 2001 From: Todd Norton Date: Mon, 11 Nov 2024 19:44:44 +0100 Subject: [PATCH 2/8] feat: builder.power_gate --- expander_compiler/src/frontend/api.rs | 2 ++ expander_compiler/src/frontend/builder.rs | 30 +++++++++++++++++++++++ expander_compiler/src/hints/mod.rs | 8 ++++++ expander_compiler/tests/example.rs | 12 +++++---- 4 files changed, 47 insertions(+), 5 deletions(-) diff --git a/expander_compiler/src/frontend/api.rs b/expander_compiler/src/frontend/api.rs index d0bad08d..e40f5cb9 100644 --- a/expander_compiler/src/frontend/api.rs +++ b/expander_compiler/src/frontend/api.rs @@ -42,6 +42,8 @@ pub trait BasicAPI { y: impl ToVariableOrValue, ); fn get_random_value(&mut self) -> Variable; + /// Can be either power5 or power7 + fn power_gate(&mut self, x: impl ToVariableOrValue, power: usize) -> Variable; } pub trait UnconstrainedAPI { diff --git a/expander_compiler/src/frontend/builder.rs b/expander_compiler/src/frontend/builder.rs index 220927d3..0e0c6dac 100644 --- a/expander_compiler/src/frontend/builder.rs +++ b/expander_compiler/src/frontend/builder.rs @@ -174,6 +174,28 @@ impl BasicAPI for Builder { self.new_var() } + fn power_gate(&mut self, x: impl ToVariableOrValue, power: usize) -> Variable { + match power { + 5 => { + let x = self.convert_to_variable(x); + self.instructions.push(SourceInstruction::CustomGate { + gate_type: 12345, + inputs: vec![x.id], + }); + self.new_var() + } + 7 => { + let x = self.convert_to_variable(x); + self.instructions.push(SourceInstruction::CustomGate { + gate_type: 12347, + inputs: vec![x.id], + }); + self.new_var() + } + _ => panic!("Unsupported power gate"), + } + } + fn div( &mut self, x: impl ToVariableOrValue, @@ -445,6 +467,14 @@ impl BasicAPI for RootBuilder { fn get_random_value(&mut self) -> Variable { self.last_builder().get_random_value() } + + fn power_gate( + &mut self, + x: impl ToVariableOrValue<::CircuitField>, + power: usize, + ) -> Variable { + self.last_builder().power_gate(x, power) + } } impl RootBuilder { diff --git a/expander_compiler/src/hints/mod.rs b/expander_compiler/src/hints/mod.rs index b9a312c6..04fd7f84 100644 --- a/expander_compiler/src/hints/mod.rs +++ b/expander_compiler/src/hints/mod.rs @@ -64,6 +64,7 @@ impl BuiltinHintIds { } } +/// ??? Placeholder for the actual implementation fn stub_impl_general(hint_id: usize, inputs: &Vec, num_outputs: usize) -> Vec { let mut hasher = DefaultHasher::new(); hint_id.hash(&mut hasher); @@ -236,6 +237,13 @@ fn binop_hint_on_u256 U256>(inputs: &[F], f: G) - } pub fn stub_impl(hint_id: usize, inputs: &Vec, num_outputs: usize) -> Vec { + if hint_id == 12345 { + let a2 = inputs[0] * inputs[0]; + let a4 = a2 * a2; + return vec![a4 * inputs[0]]; + } else if hint_id == 12346 { + return vec![inputs[0]]; + } match BuiltinHintIds::from_usize(hint_id) { Some(hint_id) => impl_builtin_hint(hint_id, inputs, num_outputs), None => stub_impl_general(hint_id, inputs, num_outputs), diff --git a/expander_compiler/tests/example.rs b/expander_compiler/tests/example.rs index bccac8f0..4364feca 100644 --- a/expander_compiler/tests/example.rs +++ b/expander_compiler/tests/example.rs @@ -1,14 +1,16 @@ use expander_compiler::frontend::*; use extra::Serde; +// Circuit that asserts x^5 = y declare_circuit!(Circuit { x: Variable, y: Variable, }); -impl Define for Circuit { - fn define(&self, builder: &mut API) { - builder.assert_is_equal(self.x, self.y); +impl Define for Circuit { + fn define(&self, builder: &mut API) { + let x5 = builder.power_gate(self.x, 5); + builder.assert_is_equal(x5, self.y); } } @@ -16,8 +18,8 @@ impl Define for Circuit { fn example_full() { let compile_result = compile(&Circuit::default()).unwrap(); let assignment = Circuit:: { - x: M31::from(123), - y: M31::from(123), + x: M31::from(2), + y: M31::from(32), }; let witness = compile_result .witness_solver From 5c26f9466fa9711b84acacb7d10593d5eed635f3 Mon Sep 17 00:00:00 2001 From: Todd Norton Date: Tue, 12 Nov 2024 13:52:38 +0100 Subject: [PATCH 3/8] fix: import Nebra's expander fork --- Cargo.lock | 674 +++++++++++++++++++++++++++++++++++++---------------- Cargo.toml | 14 +- 2 files changed, 478 insertions(+), 210 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a3e937ae..50dcbe1a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,18 +4,18 @@ version = 3 [[package]] name = "addr2line" -version = "0.22.0" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" dependencies = [ "gimli", ] [[package]] -name = "adler" -version = "1.0.2" +name = "adler2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" [[package]] name = "aho-corasick" @@ -49,9 +49,9 @@ checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" [[package]] name = "anstream" -version = "0.6.15" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" +checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" dependencies = [ "anstyle", "anstyle-parse", @@ -64,42 +64,42 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.8" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" +checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" [[package]] name = "anstyle-parse" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" +checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.1.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" +checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" dependencies = [ - "windows-sys", + "windows-sys 0.59.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.4" +version = "3.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" +checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125" dependencies = [ "anstyle", - "windows-sys", + "windows-sys 0.59.0", ] [[package]] name = "arith" version = "0.1.0" -source = "git+https://github.com/PolyhedraZK/Expander?branch=dev#d03a433274ebe40ae9ca44dcc6a14a4b020dac81" +source = "git+https://github.com/NebraZKP/Expander?branch=gkr2-baby-bear#8221796462a28644244c86bac33bf4cd5a5f1afc" dependencies = [ "ark-std", "cfg-if", @@ -126,35 +126,35 @@ dependencies = [ [[package]] name = "arrayref" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d151e35f61089500b617991b791fc8bfd237ae50cd5950803758a179b41e67a" +checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "backtrace" -version = "0.3.73" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" dependencies = [ "addr2line", - "cc", "cfg-if", "libc", "miniz_oxide", "object", "rustc-demangle", + "windows-targets", ] [[package]] @@ -165,9 +165,9 @@ checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "bindgen" -version = "0.69.4" +version = "0.69.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" +checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088" dependencies = [ "bitflags", "cexpr", @@ -182,7 +182,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.79", + "syn 2.0.87", "which", ] @@ -257,9 +257,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.7.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" +checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da" [[package]] name = "cast" @@ -269,9 +269,12 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.1.10" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9e8aabfac534be767c909e0690571677d49f41bd8465ae876fe043d52ba5292" +checksum = "1aeb932158bd710538c73702db6945cb68a8fb08c519e6e12706b94263b36db8" +dependencies = [ + "shlex", +] [[package]] name = "cexpr" @@ -332,7 +335,7 @@ dependencies = [ [[package]] name = "circuit" version = "0.1.0" -source = "git+https://github.com/PolyhedraZK/Expander?branch=dev#d03a433274ebe40ae9ca44dcc6a14a4b020dac81" +source = "git+https://github.com/NebraZKP/Expander?branch=gkr2-baby-bear#8221796462a28644244c86bac33bf4cd5a5f1afc" dependencies = [ "arith", "ark-std", @@ -371,9 +374,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.16" +version = "4.5.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed6719fffa43d0d87e5fd8caeab59be1554fb028cd30edc88fc4369b17971019" +checksum = "b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8" dependencies = [ "clap_builder", "clap_derive", @@ -381,9 +384,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.15" +version = "4.5.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216aec2b177652e3846684cbfe25c9964d18ec45234f0f5da5157b207ed1aab6" +checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54" dependencies = [ "anstream", "anstyle", @@ -393,14 +396,14 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.13" +version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" +checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] @@ -411,14 +414,14 @@ checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" [[package]] name = "colorchoice" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" +checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" [[package]] name = "config" version = "0.1.0" -source = "git+https://github.com/PolyhedraZK/Expander?branch=dev#d03a433274ebe40ae9ca44dcc6a14a4b020dac81" +source = "git+https://github.com/NebraZKP/Expander?branch=gkr2-baby-bear#8221796462a28644244c86bac33bf4cd5a5f1afc" dependencies = [ "arith", "ark-std", @@ -432,9 +435,9 @@ dependencies = [ [[package]] name = "constant_time_eq" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" +checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" [[package]] name = "conv" @@ -453,9 +456,9 @@ checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpufeatures" -version = "0.2.12" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +checksum = "0ca741a962e1b0bff6d724a1a0958b686406e853bb14061f218562e1896f95e6" dependencies = [ "libc", ] @@ -560,6 +563,17 @@ dependencies = [ "subtle", ] +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + [[package]] name = "ec_go_lib" version = "0.1.0" @@ -582,9 +596,9 @@ checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] name = "encoding_rs" -version = "0.8.34" +version = "0.8.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" dependencies = [ "cfg-if", ] @@ -625,7 +639,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -687,9 +701,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures-channel" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", "futures-sink", @@ -697,27 +711,27 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-sink" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-util" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-core", "futures-sink", @@ -751,7 +765,7 @@ dependencies = [ [[package]] name = "gf2" version = "0.1.0" -source = "git+https://github.com/PolyhedraZK/Expander?branch=dev#d03a433274ebe40ae9ca44dcc6a14a4b020dac81" +source = "git+https://github.com/NebraZKP/Expander?branch=gkr2-baby-bear#8221796462a28644244c86bac33bf4cd5a5f1afc" dependencies = [ "arith", "ark-std", @@ -768,7 +782,7 @@ dependencies = [ [[package]] name = "gf2_128" version = "0.1.0" -source = "git+https://github.com/PolyhedraZK/Expander?branch=dev#d03a433274ebe40ae9ca44dcc6a14a4b020dac81" +source = "git+https://github.com/NebraZKP/Expander?branch=gkr2-baby-bear#8221796462a28644244c86bac33bf4cd5a5f1afc" dependencies = [ "arith", "ark-std", @@ -778,14 +792,14 @@ dependencies = [ [[package]] name = "gimli" -version = "0.29.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "gkr" version = "0.1.0" -source = "git+https://github.com/PolyhedraZK/Expander?branch=dev#d03a433274ebe40ae9ca44dcc6a14a4b020dac81" +source = "git+https://github.com/NebraZKP/Expander?branch=gkr2-baby-bear#8221796462a28644244c86bac33bf4cd5a5f1afc" dependencies = [ "arith", "ark-std", @@ -886,9 +900,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.14.5" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3" [[package]] name = "headers" @@ -938,7 +952,7 @@ version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" dependencies = [ - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -976,9 +990,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.9.4" +version = "1.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" +checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" [[package]] name = "httpdate" @@ -994,9 +1008,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.30" +version = "0.14.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a152ddd61dfaec7273fe8419ab357f33aee0d914c5f4efbf0d96fa749eea5ec9" +checksum = "8c08302e8fa335b151b788c775ff56e7a03ae64ff85c548ee820fecb70356e85" dependencies = [ "bytes", "futures-channel", @@ -1018,9 +1032,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.60" +version = "0.1.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" +checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -1039,21 +1053,150 @@ dependencies = [ "cc", ] +[[package]] +name = "icu_collections" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locid" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locid_transform" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locid_transform_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" + +[[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" + +[[package]] +name = "icu_properties" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" + +[[package]] +name = "icu_provider" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + [[package]] name = "idna" -version = "0.5.0" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" dependencies = [ - "unicode-bidi", - "unicode-normalization", + "icu_normalizer", + "icu_properties", ] [[package]] name = "indexmap" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", "hashbrown", @@ -1067,7 +1210,7 @@ checksum = "261f68e344040fbd0edea105bef17c66edf46f984ddb1115b775ce31be948f4b" dependencies = [ "hermit-abi 0.4.0", "libc", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -1102,9 +1245,9 @@ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "js-sys" -version = "0.3.69" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" dependencies = [ "wasm-bindgen", ] @@ -1126,9 +1269,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.155" +version = "0.2.162" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +checksum = "18d287de67fe55fd7e1581fe933d965a5a9477b38e949cfa9f8574ef01506398" [[package]] name = "libffi" @@ -1165,6 +1308,12 @@ version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +[[package]] +name = "litemap" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704" + [[package]] name = "lock_api" version = "0.4.12" @@ -1190,7 +1339,7 @@ checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "mersenne31" version = "0.1.0" -source = "git+https://github.com/PolyhedraZK/Expander?branch=dev#d03a433274ebe40ae9ca44dcc6a14a4b020dac81" +source = "git+https://github.com/NebraZKP/Expander?branch=gkr2-baby-bear#8221796462a28644244c86bac33bf4cd5a5f1afc" dependencies = [ "arith", "ark-std", @@ -1228,11 +1377,11 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.7.4" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" dependencies = [ - "adler", + "adler2", ] [[package]] @@ -1244,7 +1393,7 @@ dependencies = [ "hermit-abi 0.3.9", "libc", "wasi", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -1331,18 +1480,18 @@ dependencies = [ [[package]] name = "object" -version = "0.36.4" +version = "0.36.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a" +checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.19.0" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "oorandom" @@ -1411,29 +1560,29 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pin-project" -version = "1.1.5" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" +checksum = "be57f64e946e500c8ee36ef6331845d40a93055567ec57e8fae13efd33759b95" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.5" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" +checksum = "3c0f5fad0874fc7abcd4d750e76917eaebbecaa2c20bde22e1dbeeba8beb758c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] name = "pin-project-lite" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" +checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" [[package]] name = "pin-utils" @@ -1478,7 +1627,7 @@ dependencies = [ [[package]] name = "polynomials" version = "0.1.0" -source = "git+https://github.com/PolyhedraZK/Expander?branch=dev#d03a433274ebe40ae9ca44dcc6a14a4b020dac81" +source = "git+https://github.com/NebraZKP/Expander?branch=gkr2-baby-bear#8221796462a28644244c86bac33bf4cd5a5f1afc" dependencies = [ "arith", "ark-std", @@ -1488,34 +1637,37 @@ dependencies = [ [[package]] name = "ppv-lite86" -version = "0.2.17" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] [[package]] name = "prettyplease" -version = "0.2.22" +version = "0.2.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479cf940fbbb3426c32c5d5176f62ad57549a0bb84773423ba8be9d089f5faba" +checksum = "64d1ec885c64d0457d564db4ec299b2dae3f9c02808b8ad9c3a089c591b18033" dependencies = [ "proc-macro2", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -1558,9 +1710,9 @@ dependencies = [ [[package]] name = "raw-cpuid" -version = "11.1.0" +version = "11.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb9ee317cfe3fbd54b36a511efc1edd42e216903c9cd575e686dd68a2ba90d8d" +checksum = "1ab240315c661615f2ee9f0f2cd32d5a7343a84d5ebcccb99d46e6637565e7b0" dependencies = [ "bitflags", ] @@ -1587,18 +1739,18 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.3" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" +checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" dependencies = [ "bitflags", ] [[package]] name = "regex" -version = "1.10.6" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", @@ -1608,9 +1760,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.7" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", @@ -1619,9 +1771,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "rustc-demangle" @@ -1637,15 +1789,15 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustix" -version = "0.38.34" +version = "0.38.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +checksum = "99e4ea3e1cdc4b559b8e5650f9c8e5998e3e5c1343b4eaf034565f32318d63c0" dependencies = [ "bitflags", "errno", "libc", "linux-raw-sys", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -1677,29 +1829,29 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "serde" -version = "1.0.209" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99fce0ffe7310761ca6bf9faf5115afbc19688edd00171d81b1bb1b116c63e09" +checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.209" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170" +checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] name = "serde_json" -version = "1.0.127" +version = "1.0.132" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8043c06d9f82bd7271361ed64f415fe5e12a77fdb52e573e7f06a516dea329ad" +checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03" dependencies = [ "itoa", "memchr", @@ -1784,7 +1936,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -1793,6 +1945,12 @@ version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "static_assertions" version = "1.1.0" @@ -1814,7 +1972,7 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "sumcheck" version = "0.1.0" -source = "git+https://github.com/PolyhedraZK/Expander?branch=dev#d03a433274ebe40ae9ca44dcc6a14a4b020dac81" +source = "git+https://github.com/NebraZKP/Expander?branch=gkr2-baby-bear#8221796462a28644244c86bac33bf4cd5a5f1afc" dependencies = [ "arith", "circuit", @@ -1838,15 +1996,26 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.79" +version = "2.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" +checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] +[[package]] +name = "synstructure" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + [[package]] name = "tap" version = "1.0.1" @@ -1855,22 +2024,22 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "thiserror" -version = "1.0.63" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.63" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] @@ -1883,35 +2052,30 @@ dependencies = [ ] [[package]] -name = "tinytemplate" -version = "1.2.1" +name = "tinystr" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" dependencies = [ - "serde", - "serde_json", + "displaydoc", + "zerovec", ] [[package]] -name = "tinyvec" -version = "1.8.0" +name = "tinytemplate" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" +checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" dependencies = [ - "tinyvec_macros", + "serde", + "serde_json", ] -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - [[package]] name = "tokio" -version = "1.40.0" +version = "1.41.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" +checksum = "22cfb5bee7a6a52939ca9224d6ac897bb669134078daa8735560897f69de4d33" dependencies = [ "backtrace", "bytes", @@ -1922,7 +2086,7 @@ dependencies = [ "signal-hook-registry", "socket2", "tokio-macros", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -1933,7 +2097,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] @@ -1950,9 +2114,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.11" +version = "0.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" +checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" dependencies = [ "bytes", "futures-core", @@ -1990,7 +2154,7 @@ dependencies = [ [[package]] name = "transcript" version = "0.1.0" -source = "git+https://github.com/PolyhedraZK/Expander?branch=dev#d03a433274ebe40ae9ca44dcc6a14a4b020dac81" +source = "git+https://github.com/NebraZKP/Expander?branch=gkr2-baby-bear#8221796462a28644244c86bac33bf4cd5a5f1afc" dependencies = [ "arith", "sha2", @@ -2039,33 +2203,15 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "unicase" -version = "2.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" -dependencies = [ - "version_check", -] - -[[package]] -name = "unicode-bidi" -version = "0.3.15" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" +checksum = "7e51b68083f157f853b6379db119d1c1be0e6e4dec98101079dec41f6f5cf6df" [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "unicode-normalization" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" -dependencies = [ - "tinyvec", -] +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unroll" @@ -2079,9 +2225,9 @@ dependencies = [ [[package]] name = "url" -version = "2.5.2" +version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" +checksum = "8d157f1b96d14500ffdc1f10ba712e780825526c03d9a49b4d0324b0d9113ada" dependencies = [ "form_urlencoded", "idna", @@ -2094,6 +2240,18 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + [[package]] name = "utf8parse" version = "0.2.2" @@ -2162,34 +2320,35 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" dependencies = [ "cfg-if", + "once_cell", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2197,28 +2356,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" +checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" [[package]] name = "web-sys" -version = "0.3.69" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" +checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112" dependencies = [ "js-sys", "wasm-bindgen", @@ -2242,7 +2401,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys", + "windows-sys 0.59.0", ] [[package]] @@ -2263,6 +2422,15 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets", +] + [[package]] name = "windows-targets" version = "0.52.6" @@ -2327,6 +2495,18 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + [[package]] name = "wyz" version = "0.5.1" @@ -2335,3 +2515,91 @@ checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" dependencies = [ "tap", ] + +[[package]] +name = "yoke" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c5b1314b079b0930c31e3af543d8ee1757b1951ae1e1565ec704403a7240ca5" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28cc31741b18cb6f1d5ff12f5b7523e3d6eb0852bbbad19d73905511d9849b95" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", + "synstructure", +] + +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "byteorder", + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + +[[package]] +name = "zerofrom" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ec111ce797d0e0784a1116d0ddcdbea84322cd79e5d5ad173daeba4f93ab55" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ea7b4a3637ea8669cedf0f1fd5c286a17f3de97b8dd5a70a6c167a1730e63a5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", + "synstructure", +] + +[[package]] +name = "zerovec" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] diff --git a/Cargo.toml b/Cargo.toml index 98bcbd0b..492673f0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,11 +19,11 @@ tiny-keccak = { version = "2.0", features = ["keccak"] } halo2curves = { git = "https://github.com/PolyhedraZK/halo2curves", default-features = false, features = [ "bits", ] } -arith = { git = "https://github.com/PolyhedraZK/Expander", branch = "dev" } -expander_config = { git = "https://github.com/PolyhedraZK/Expander", branch = "dev", package = "config" } -expander_circuit = { git = "https://github.com/PolyhedraZK/Expander", branch = "dev", package = "circuit" } -gkr = { git = "https://github.com/PolyhedraZK/Expander", branch = "dev" } -gf2 = { git = "https://github.com/PolyhedraZK/Expander", branch = "dev" } -mersenne31 = { git = "https://github.com/PolyhedraZK/Expander", branch = "dev" } -expander_transcript = { git = "https://github.com/PolyhedraZK/Expander", branch = "dev", package = "transcript" } +arith = { git = "https://github.com/NebraZKP/Expander", branch = "gkr2-baby-bear" } +expander_config = { git = "https://github.com/NebraZKP/Expander", branch = "gkr2-baby-bear", package = "config" } +expander_circuit = { git = "https://github.com/NebraZKP/Expander", branch = "gkr2-baby-bear", package = "circuit" } +gkr = { git = "https://github.com/NebraZKP/Expander", branch = "gkr2-baby-bear" } +gf2 = { git = "https://github.com/NebraZKP/Expander", branch = "gkr2-baby-bear" } +mersenne31 = { git = "https://github.com/NebraZKP/Expander", branch = "gkr2-baby-bear" } +expander_transcript = { git = "https://github.com/NebraZKP/Expander", branch = "gkr2-baby-bear", package = "transcript" } From 2e06bcdc864482eabc24ffe8af337292602bd19a Mon Sep 17 00:00:00 2001 From: SupremoUGH Date: Tue, 12 Nov 2024 14:03:48 +0100 Subject: [PATCH 4/8] babybear impls field --- Cargo.lock | 200 +++++++++++++++++++++++++++++++++ Cargo.toml | 1 + expander_compiler/Cargo.toml | 1 + expander_compiler/src/field.rs | 2 + 4 files changed, 204 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 50dcbe1a..0381859e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -142,6 +142,20 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" +[[package]] +name = "babybear" +version = "0.1.0" +source = "git+https://github.com/NebraZKP/Expander?branch=gkr2-baby-bear#8221796462a28644244c86bac33bf4cd5a5f1afc" +dependencies = [ + "arith", + "ark-std", + "ethnum", + "p3-baby-bear", + "p3-field", + "p3-monty-31", + "rand", +] + [[package]] name = "backtrace" version = "0.3.74" @@ -654,6 +668,7 @@ version = "0.1.0" dependencies = [ "arith", "ark-std", + "babybear", "chrono", "circuit", "clap", @@ -741,6 +756,12 @@ dependencies = [ "slab", ] +[[package]] +name = "gcd" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d758ba1b47b00caf47f24925c0074ecb20d6dfcffe7f6d53395c0465674841a" + [[package]] name = "generic-array" version = "0.14.7" @@ -1237,6 +1258,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.11" @@ -1458,6 +1488,7 @@ checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" dependencies = [ "num-integer", "num-traits", + "rand", ] [[package]] @@ -1478,6 +1509,18 @@ dependencies = [ "autocfg", ] +[[package]] +name = "nums" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf3c74f925fb8cfc49a8022f2afce48a0683b70f9e439885594e84c5edbf5b01" +dependencies = [ + "num-bigint", + "num-integer", + "num-traits", + "rand", +] + [[package]] name = "object" version = "0.36.5" @@ -1499,6 +1542,135 @@ version = "11.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b410bbe7e14ab526a0e86877eb47c6996a2bd7746f027ba551028c925390e4e9" +[[package]] +name = "p3-baby-bear" +version = "0.1.0" +source = "git+https://github.com/Plonky3/Plonky3.git#0785778806c618731d57591c34c9377e970889c8" +dependencies = [ + "p3-field", + "p3-mds", + "p3-monty-31", + "p3-poseidon2", + "p3-symmetric", + "rand", + "serde", +] + +[[package]] +name = "p3-dft" +version = "0.1.0" +source = "git+https://github.com/Plonky3/Plonky3.git#0785778806c618731d57591c34c9377e970889c8" +dependencies = [ + "itertools 0.13.0", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-util", + "tracing", +] + +[[package]] +name = "p3-field" +version = "0.1.0" +source = "git+https://github.com/Plonky3/Plonky3.git#0785778806c618731d57591c34c9377e970889c8" +dependencies = [ + "itertools 0.13.0", + "num-bigint", + "num-integer", + "num-traits", + "nums", + "p3-maybe-rayon", + "p3-util", + "rand", + "serde", + "tracing", +] + +[[package]] +name = "p3-matrix" +version = "0.1.0" +source = "git+https://github.com/Plonky3/Plonky3.git#0785778806c618731d57591c34c9377e970889c8" +dependencies = [ + "itertools 0.13.0", + "p3-field", + "p3-maybe-rayon", + "p3-util", + "rand", + "serde", + "tracing", + "transpose", +] + +[[package]] +name = "p3-maybe-rayon" +version = "0.1.0" +source = "git+https://github.com/Plonky3/Plonky3.git#0785778806c618731d57591c34c9377e970889c8" + +[[package]] +name = "p3-mds" +version = "0.1.0" +source = "git+https://github.com/Plonky3/Plonky3.git#0785778806c618731d57591c34c9377e970889c8" +dependencies = [ + "itertools 0.13.0", + "p3-dft", + "p3-field", + "p3-matrix", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-monty-31" +version = "0.1.0" +source = "git+https://github.com/Plonky3/Plonky3.git#0785778806c618731d57591c34c9377e970889c8" +dependencies = [ + "itertools 0.13.0", + "num-bigint", + "p3-dft", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "rand", + "serde", + "tracing", + "transpose", +] + +[[package]] +name = "p3-poseidon2" +version = "0.1.0" +source = "git+https://github.com/Plonky3/Plonky3.git#0785778806c618731d57591c34c9377e970889c8" +dependencies = [ + "gcd", + "p3-field", + "p3-mds", + "p3-symmetric", + "rand", +] + +[[package]] +name = "p3-symmetric" +version = "0.1.0" +source = "git+https://github.com/Plonky3/Plonky3.git#0785778806c618731d57591c34c9377e970889c8" +dependencies = [ + "itertools 0.13.0", + "p3-field", + "serde", +] + +[[package]] +name = "p3-util" +version = "0.1.0" +source = "git+https://github.com/Plonky3/Plonky3.git#0785778806c618731d57591c34c9377e970889c8" +dependencies = [ + "serde", +] + [[package]] name = "pairing" version = "0.23.0" @@ -1957,6 +2129,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "strength_reduce" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe895eb47f22e2ddd4dabc02bce419d2e643c8e3b585c78158b349195bc24d82" + [[package]] name = "strsim" version = "0.11.1" @@ -2139,9 +2317,21 @@ checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ "log", "pin-project-lite", + "tracing-attributes", "tracing-core", ] +[[package]] +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + [[package]] name = "tracing-core" version = "0.1.32" @@ -2161,6 +2351,16 @@ dependencies = [ "tiny-keccak", ] +[[package]] +name = "transpose" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad61aed86bc3faea4300c7aee358b4c6d0c8d6ccc36524c96e4c92ccf26e77e" +dependencies = [ + "num-integer", + "strength_reduce", +] + [[package]] name = "try-lock" version = "0.2.5" diff --git a/Cargo.toml b/Cargo.toml index 492673f0..9f41ecc0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,6 +20,7 @@ halo2curves = { git = "https://github.com/PolyhedraZK/halo2curves", default-feat "bits", ] } arith = { git = "https://github.com/NebraZKP/Expander", branch = "gkr2-baby-bear" } +babybear = { git = "https://github.com/NebraZKP/Expander", branch = "gkr2-baby-bear"} expander_config = { git = "https://github.com/NebraZKP/Expander", branch = "gkr2-baby-bear", package = "config" } expander_circuit = { git = "https://github.com/NebraZKP/Expander", branch = "gkr2-baby-bear", package = "circuit" } gkr = { git = "https://github.com/NebraZKP/Expander", branch = "gkr2-baby-bear" } diff --git a/expander_compiler/Cargo.toml b/expander_compiler/Cargo.toml index a955bc20..0a008ecd 100644 --- a/expander_compiler/Cargo.toml +++ b/expander_compiler/Cargo.toml @@ -14,6 +14,7 @@ halo2curves.workspace = true tiny-keccak.workspace = true expander_config.workspace = true expander_circuit.workspace = true +babybear.workspace = true gkr.workspace = true arith.workspace = true gf2.workspace = true diff --git a/expander_compiler/src/field.rs b/expander_compiler/src/field.rs index c6d9c2e5..03ca9202 100644 --- a/expander_compiler/src/field.rs +++ b/expander_compiler/src/field.rs @@ -1,12 +1,14 @@ pub use arith::{BN254Fr as BN254, Field as FieldArith, FieldForECC as FieldModulus}; pub use gf2::GF2; pub use mersenne31::M31; +pub use babybear::BabyBear; use crate::utils::serde::Serde; use arith::{FieldForECC, FieldSerde, FieldSerdeError}; pub trait Field: FieldArith + FieldForECC + FieldSerde {} +impl Field for BabyBear {} impl Field for BN254 {} impl Field for GF2 {} impl Field for M31 {} From 4f838547289e59cf64b74a7625c1e9636696497a Mon Sep 17 00:00:00 2001 From: SupremoUGH Date: Tue, 12 Nov 2024 14:23:03 +0100 Subject: [PATCH 5/8] babybear config --- Cargo.lock | 23 ++++++++++++----------- expander_compiler/ec_go_lib/src/lib.rs | 18 ++++++++++++++++++ expander_compiler/src/circuit/config.rs | 19 +++++++++++++++++++ expander_compiler/src/field.rs | 2 +- 4 files changed, 50 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0381859e..ae8a17dd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -99,7 +99,7 @@ dependencies = [ [[package]] name = "arith" version = "0.1.0" -source = "git+https://github.com/NebraZKP/Expander?branch=gkr2-baby-bear#8221796462a28644244c86bac33bf4cd5a5f1afc" +source = "git+https://github.com/NebraZKP/Expander?branch=gkr2-baby-bear#a5060701a0114ef8f9bdd03d033e46fc947741b5" dependencies = [ "ark-std", "cfg-if", @@ -145,7 +145,7 @@ checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "babybear" version = "0.1.0" -source = "git+https://github.com/NebraZKP/Expander?branch=gkr2-baby-bear#8221796462a28644244c86bac33bf4cd5a5f1afc" +source = "git+https://github.com/NebraZKP/Expander?branch=gkr2-baby-bear#a5060701a0114ef8f9bdd03d033e46fc947741b5" dependencies = [ "arith", "ark-std", @@ -349,7 +349,7 @@ dependencies = [ [[package]] name = "circuit" version = "0.1.0" -source = "git+https://github.com/NebraZKP/Expander?branch=gkr2-baby-bear#8221796462a28644244c86bac33bf4cd5a5f1afc" +source = "git+https://github.com/NebraZKP/Expander?branch=gkr2-baby-bear#a5060701a0114ef8f9bdd03d033e46fc947741b5" dependencies = [ "arith", "ark-std", @@ -435,10 +435,11 @@ checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" [[package]] name = "config" version = "0.1.0" -source = "git+https://github.com/NebraZKP/Expander?branch=gkr2-baby-bear#8221796462a28644244c86bac33bf4cd5a5f1afc" +source = "git+https://github.com/NebraZKP/Expander?branch=gkr2-baby-bear#a5060701a0114ef8f9bdd03d033e46fc947741b5" dependencies = [ "arith", "ark-std", + "babybear", "gf2", "gf2_128", "halo2curves", @@ -786,7 +787,7 @@ dependencies = [ [[package]] name = "gf2" version = "0.1.0" -source = "git+https://github.com/NebraZKP/Expander?branch=gkr2-baby-bear#8221796462a28644244c86bac33bf4cd5a5f1afc" +source = "git+https://github.com/NebraZKP/Expander?branch=gkr2-baby-bear#a5060701a0114ef8f9bdd03d033e46fc947741b5" dependencies = [ "arith", "ark-std", @@ -803,7 +804,7 @@ dependencies = [ [[package]] name = "gf2_128" version = "0.1.0" -source = "git+https://github.com/NebraZKP/Expander?branch=gkr2-baby-bear#8221796462a28644244c86bac33bf4cd5a5f1afc" +source = "git+https://github.com/NebraZKP/Expander?branch=gkr2-baby-bear#a5060701a0114ef8f9bdd03d033e46fc947741b5" dependencies = [ "arith", "ark-std", @@ -820,7 +821,7 @@ checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "gkr" version = "0.1.0" -source = "git+https://github.com/NebraZKP/Expander?branch=gkr2-baby-bear#8221796462a28644244c86bac33bf4cd5a5f1afc" +source = "git+https://github.com/NebraZKP/Expander?branch=gkr2-baby-bear#a5060701a0114ef8f9bdd03d033e46fc947741b5" dependencies = [ "arith", "ark-std", @@ -1369,7 +1370,7 @@ checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "mersenne31" version = "0.1.0" -source = "git+https://github.com/NebraZKP/Expander?branch=gkr2-baby-bear#8221796462a28644244c86bac33bf4cd5a5f1afc" +source = "git+https://github.com/NebraZKP/Expander?branch=gkr2-baby-bear#a5060701a0114ef8f9bdd03d033e46fc947741b5" dependencies = [ "arith", "ark-std", @@ -1799,7 +1800,7 @@ dependencies = [ [[package]] name = "polynomials" version = "0.1.0" -source = "git+https://github.com/NebraZKP/Expander?branch=gkr2-baby-bear#8221796462a28644244c86bac33bf4cd5a5f1afc" +source = "git+https://github.com/NebraZKP/Expander?branch=gkr2-baby-bear#a5060701a0114ef8f9bdd03d033e46fc947741b5" dependencies = [ "arith", "ark-std", @@ -2150,7 +2151,7 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "sumcheck" version = "0.1.0" -source = "git+https://github.com/NebraZKP/Expander?branch=gkr2-baby-bear#8221796462a28644244c86bac33bf4cd5a5f1afc" +source = "git+https://github.com/NebraZKP/Expander?branch=gkr2-baby-bear#a5060701a0114ef8f9bdd03d033e46fc947741b5" dependencies = [ "arith", "circuit", @@ -2344,7 +2345,7 @@ dependencies = [ [[package]] name = "transcript" version = "0.1.0" -source = "git+https://github.com/NebraZKP/Expander?branch=gkr2-baby-bear#8221796462a28644244c86bac33bf4cd5a5f1afc" +source = "git+https://github.com/NebraZKP/Expander?branch=gkr2-baby-bear#a5060701a0114ef8f9bdd03d033e46fc947741b5" dependencies = [ "arith", "sha2", diff --git a/expander_compiler/ec_go_lib/src/lib.rs b/expander_compiler/ec_go_lib/src/lib.rs index 0f8fd90b..9bf27875 100644 --- a/expander_compiler/ec_go_lib/src/lib.rs +++ b/expander_compiler/ec_go_lib/src/lib.rs @@ -50,6 +50,8 @@ fn compile_inner(ir_source: Vec, config_id: u64) -> Result<(Vec, Vec 2 => compile_inner_with_config::(ir_source), 3 => compile_inner_with_config::(ir_source), 4 => compile_inner_with_config::(ir_source), + 5 => compile_inner_with_config::(ir_source), + 6 => compile_inner_with_config::(ir_source), _ => Err(format!("unknown config id: {}", config_id)), } } @@ -229,6 +231,14 @@ pub extern "C" fn prove_circuit_file( circuit_filename, witness, ), + 5 => prove_circuit_file_inner::< + expander_config::BabyBearExt4ConfigSha2, + config::BabyBearConfig, + >(circuit_filename, witness), + 6 => prove_circuit_file_inner::< + expander_config::BabyBearExt4ConfigSha2, + config::BabyBearGkr2Config, + >(circuit_filename, witness), _ => panic!("unknown config id: {}", config_id), }; let proof_len = proof.len(); @@ -281,6 +291,14 @@ pub extern "C" fn verify_circuit_file( witness, proof, ), + 5 => verify_circuit_file_inner::< + expander_config::BabyBearExt4ConfigSha2, + config::BabyBearConfig, + >(circuit_filename, witness, proof), + 6 => verify_circuit_file_inner::< + expander_config::BabyBearExt4ConfigSha2, + config::BabyBearGkr2Config, + >(circuit_filename, witness, proof), _ => panic!("unknown config id: {}", config_id), } } diff --git a/expander_compiler/src/circuit/config.rs b/expander_compiler/src/circuit/config.rs index d210bce0..4ca061c3 100644 --- a/expander_compiler/src/circuit/config.rs +++ b/expander_compiler/src/circuit/config.rs @@ -60,3 +60,22 @@ impl Config for GF2Config { const ENABLE_RANDOM_COMBINATION: bool = false; } + +#[derive(Default, Clone, Copy, Hash, PartialEq, Eq, PartialOrd, Ord, Debug)] +pub struct BabyBearConfig {} + +impl Config for BabyBearConfig { + type CircuitField = crate::field::BabyBear; + + const CONFIG_ID: usize = 5; +} + +#[derive(Default, Clone, Copy, Hash, PartialEq, Eq, PartialOrd, Ord, Debug)] +pub struct BabyBearGkr2Config {} + +impl Config for BabyBearGkr2Config { + type CircuitField = crate::field::BabyBear; + + const CONFIG_ID: usize = 6; + const SCHEME: GKRScheme = GKRScheme::GkrSquare; +} diff --git a/expander_compiler/src/field.rs b/expander_compiler/src/field.rs index 03ca9202..f932d03d 100644 --- a/expander_compiler/src/field.rs +++ b/expander_compiler/src/field.rs @@ -1,7 +1,7 @@ pub use arith::{BN254Fr as BN254, Field as FieldArith, FieldForECC as FieldModulus}; +pub use babybear::BabyBear; pub use gf2::GF2; pub use mersenne31::M31; -pub use babybear::BabyBear; use crate::utils::serde::Serde; use arith::{FieldForECC, FieldSerde, FieldSerdeError}; From f482c40f434ed2199ecea3370f74e773c564b39c Mon Sep 17 00:00:00 2001 From: Duncan Tebbs Date: Sat, 16 Nov 2024 14:32:33 +0000 Subject: [PATCH 6/8] update expander branch --- Cargo.lock | 22 +++++++++++----------- Cargo.toml | 17 ++++++++--------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ae8a17dd..6986e777 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -99,7 +99,7 @@ dependencies = [ [[package]] name = "arith" version = "0.1.0" -source = "git+https://github.com/NebraZKP/Expander?branch=gkr2-baby-bear#a5060701a0114ef8f9bdd03d033e46fc947741b5" +source = "git+https://github.com/NebraZKP/Expander?rev=5470aaee59718f4d48977b63fac3baa046e7f5bb#5470aaee59718f4d48977b63fac3baa046e7f5bb" dependencies = [ "ark-std", "cfg-if", @@ -145,7 +145,7 @@ checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "babybear" version = "0.1.0" -source = "git+https://github.com/NebraZKP/Expander?branch=gkr2-baby-bear#a5060701a0114ef8f9bdd03d033e46fc947741b5" +source = "git+https://github.com/NebraZKP/Expander?rev=5470aaee59718f4d48977b63fac3baa046e7f5bb#5470aaee59718f4d48977b63fac3baa046e7f5bb" dependencies = [ "arith", "ark-std", @@ -349,7 +349,7 @@ dependencies = [ [[package]] name = "circuit" version = "0.1.0" -source = "git+https://github.com/NebraZKP/Expander?branch=gkr2-baby-bear#a5060701a0114ef8f9bdd03d033e46fc947741b5" +source = "git+https://github.com/NebraZKP/Expander?rev=5470aaee59718f4d48977b63fac3baa046e7f5bb#5470aaee59718f4d48977b63fac3baa046e7f5bb" dependencies = [ "arith", "ark-std", @@ -435,7 +435,7 @@ checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" [[package]] name = "config" version = "0.1.0" -source = "git+https://github.com/NebraZKP/Expander?branch=gkr2-baby-bear#a5060701a0114ef8f9bdd03d033e46fc947741b5" +source = "git+https://github.com/NebraZKP/Expander?rev=5470aaee59718f4d48977b63fac3baa046e7f5bb#5470aaee59718f4d48977b63fac3baa046e7f5bb" dependencies = [ "arith", "ark-std", @@ -787,7 +787,7 @@ dependencies = [ [[package]] name = "gf2" version = "0.1.0" -source = "git+https://github.com/NebraZKP/Expander?branch=gkr2-baby-bear#a5060701a0114ef8f9bdd03d033e46fc947741b5" +source = "git+https://github.com/NebraZKP/Expander?rev=5470aaee59718f4d48977b63fac3baa046e7f5bb#5470aaee59718f4d48977b63fac3baa046e7f5bb" dependencies = [ "arith", "ark-std", @@ -804,7 +804,7 @@ dependencies = [ [[package]] name = "gf2_128" version = "0.1.0" -source = "git+https://github.com/NebraZKP/Expander?branch=gkr2-baby-bear#a5060701a0114ef8f9bdd03d033e46fc947741b5" +source = "git+https://github.com/NebraZKP/Expander?rev=5470aaee59718f4d48977b63fac3baa046e7f5bb#5470aaee59718f4d48977b63fac3baa046e7f5bb" dependencies = [ "arith", "ark-std", @@ -821,7 +821,7 @@ checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "gkr" version = "0.1.0" -source = "git+https://github.com/NebraZKP/Expander?branch=gkr2-baby-bear#a5060701a0114ef8f9bdd03d033e46fc947741b5" +source = "git+https://github.com/NebraZKP/Expander?rev=5470aaee59718f4d48977b63fac3baa046e7f5bb#5470aaee59718f4d48977b63fac3baa046e7f5bb" dependencies = [ "arith", "ark-std", @@ -1370,7 +1370,7 @@ checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "mersenne31" version = "0.1.0" -source = "git+https://github.com/NebraZKP/Expander?branch=gkr2-baby-bear#a5060701a0114ef8f9bdd03d033e46fc947741b5" +source = "git+https://github.com/NebraZKP/Expander?rev=5470aaee59718f4d48977b63fac3baa046e7f5bb#5470aaee59718f4d48977b63fac3baa046e7f5bb" dependencies = [ "arith", "ark-std", @@ -1800,7 +1800,7 @@ dependencies = [ [[package]] name = "polynomials" version = "0.1.0" -source = "git+https://github.com/NebraZKP/Expander?branch=gkr2-baby-bear#a5060701a0114ef8f9bdd03d033e46fc947741b5" +source = "git+https://github.com/NebraZKP/Expander?rev=5470aaee59718f4d48977b63fac3baa046e7f5bb#5470aaee59718f4d48977b63fac3baa046e7f5bb" dependencies = [ "arith", "ark-std", @@ -2151,7 +2151,7 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "sumcheck" version = "0.1.0" -source = "git+https://github.com/NebraZKP/Expander?branch=gkr2-baby-bear#a5060701a0114ef8f9bdd03d033e46fc947741b5" +source = "git+https://github.com/NebraZKP/Expander?rev=5470aaee59718f4d48977b63fac3baa046e7f5bb#5470aaee59718f4d48977b63fac3baa046e7f5bb" dependencies = [ "arith", "circuit", @@ -2345,7 +2345,7 @@ dependencies = [ [[package]] name = "transcript" version = "0.1.0" -source = "git+https://github.com/NebraZKP/Expander?branch=gkr2-baby-bear#a5060701a0114ef8f9bdd03d033e46fc947741b5" +source = "git+https://github.com/NebraZKP/Expander?rev=5470aaee59718f4d48977b63fac3baa046e7f5bb#5470aaee59718f4d48977b63fac3baa046e7f5bb" dependencies = [ "arith", "sha2", diff --git a/Cargo.toml b/Cargo.toml index 9f41ecc0..2b24106c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,12 +19,11 @@ tiny-keccak = { version = "2.0", features = ["keccak"] } halo2curves = { git = "https://github.com/PolyhedraZK/halo2curves", default-features = false, features = [ "bits", ] } -arith = { git = "https://github.com/NebraZKP/Expander", branch = "gkr2-baby-bear" } -babybear = { git = "https://github.com/NebraZKP/Expander", branch = "gkr2-baby-bear"} -expander_config = { git = "https://github.com/NebraZKP/Expander", branch = "gkr2-baby-bear", package = "config" } -expander_circuit = { git = "https://github.com/NebraZKP/Expander", branch = "gkr2-baby-bear", package = "circuit" } -gkr = { git = "https://github.com/NebraZKP/Expander", branch = "gkr2-baby-bear" } -gf2 = { git = "https://github.com/NebraZKP/Expander", branch = "gkr2-baby-bear" } -mersenne31 = { git = "https://github.com/NebraZKP/Expander", branch = "gkr2-baby-bear" } -expander_transcript = { git = "https://github.com/NebraZKP/Expander", branch = "gkr2-baby-bear", package = "transcript" } - +arith = { git = "https://github.com/NebraZKP/Expander", rev = "5470aaee59718f4d48977b63fac3baa046e7f5bb" } +babybear = { git = "https://github.com/NebraZKP/Expander", rev = "5470aaee59718f4d48977b63fac3baa046e7f5bb"} +expander_config = { git = "https://github.com/NebraZKP/Expander", rev = "5470aaee59718f4d48977b63fac3baa046e7f5bb", package = "config" } +expander_circuit = { git = "https://github.com/NebraZKP/Expander", rev = "5470aaee59718f4d48977b63fac3baa046e7f5bb", package = "circuit" } +gkr = { git = "https://github.com/NebraZKP/Expander", rev = "5470aaee59718f4d48977b63fac3baa046e7f5bb" } +gf2 = { git = "https://github.com/NebraZKP/Expander", rev = "5470aaee59718f4d48977b63fac3baa046e7f5bb" } +mersenne31 = { git = "https://github.com/NebraZKP/Expander", rev = "5470aaee59718f4d48977b63fac3baa046e7f5bb" } +expander_transcript = { git = "https://github.com/NebraZKP/Expander", rev = "5470aaee59718f4d48977b63fac3baa046e7f5bb", package = "transcript" } From 7c5c8bbd2f201017d4d53cc90c5b9195362d0d40 Mon Sep 17 00:00:00 2001 From: Todd Norton Date: Mon, 18 Nov 2024 12:08:41 +0100 Subject: [PATCH 7/8] fix: enable const_generic expressions --- expander_compiler/ec_go_lib/src/lib.rs | 4 ++++ expander_compiler/tests/example_call_expander.rs | 3 +++ 2 files changed, 7 insertions(+) diff --git a/expander_compiler/ec_go_lib/src/lib.rs b/expander_compiler/ec_go_lib/src/lib.rs index 9bf27875..efe2e4c0 100644 --- a/expander_compiler/ec_go_lib/src/lib.rs +++ b/expander_compiler/ec_go_lib/src/lib.rs @@ -1,3 +1,5 @@ +#![allow(incomplete_features)] +#![feature(generic_const_exprs)] use arith::FieldSerde; use expander_compiler::circuit::layered; use libc::{c_uchar, c_ulong, malloc}; @@ -159,6 +161,7 @@ fn prove_circuit_file_inner( ) -> Vec where C::SimdCircuitField: arith::SimdField, + [(); C::DEGREE_PLUS_ONE]:, { let config = expander_config::Config::::new( expander_config::GKRScheme::Vanilla, @@ -183,6 +186,7 @@ fn verify_circuit_file_inner( ) -> u8 where C::SimdCircuitField: arith::SimdField, + [(); C::DEGREE_PLUS_ONE]:, { let config = expander_config::Config::::new( expander_config::GKRScheme::Vanilla, diff --git a/expander_compiler/tests/example_call_expander.rs b/expander_compiler/tests/example_call_expander.rs index 8ea12c7e..714c729f 100644 --- a/expander_compiler/tests/example_call_expander.rs +++ b/expander_compiler/tests/example_call_expander.rs @@ -1,3 +1,5 @@ +#![allow(incomplete_features)] +#![feature(generic_const_exprs)] use arith::Field; use expander_compiler::frontend::*; use expander_config::{ @@ -23,6 +25,7 @@ impl Define for Circuit { fn example() where GKRC: expander_config::GKRConfig, + [(); GKRC::DEGREE_PLUS_ONE]:, { let n_witnesses = ::pack_size(); println!("n_witnesses: {}", n_witnesses); From 17c0e3f790e8d7872dd7b8c8b39c0bac7e159ba7 Mon Sep 17 00:00:00 2001 From: SupremoUGH Date: Tue, 12 Nov 2024 15:52:17 +0100 Subject: [PATCH 8/8] added 12347 --- expander_compiler/src/hints/mod.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/expander_compiler/src/hints/mod.rs b/expander_compiler/src/hints/mod.rs index 04fd7f84..fb06a45c 100644 --- a/expander_compiler/src/hints/mod.rs +++ b/expander_compiler/src/hints/mod.rs @@ -243,10 +243,15 @@ pub fn stub_impl(hint_id: usize, inputs: &Vec, num_outputs: usize) return vec![a4 * inputs[0]]; } else if hint_id == 12346 { return vec![inputs[0]]; + } else if hint_id == 12347 { + let a2 = inputs[0].square(); + let a4 = a2.square(); + let a6 = a4 * a2; + return vec![a6 * inputs[0]]; } match BuiltinHintIds::from_usize(hint_id) { Some(hint_id) => impl_builtin_hint(hint_id, inputs, num_outputs), - None => stub_impl_general(hint_id, inputs, num_outputs), + None => panic!("invalid hint_id") } }