Skip to content

Commit 43c2b2b

Browse files
authored
Recursive Circuit Trait + framework (#21)
* moving array access to own file * wip * adding benchmark + test * fmt * no logging on CI * adding repeated poseidon * csv output
1 parent ff4b4bc commit 43c2b2b

File tree

8 files changed

+762
-24
lines changed

8 files changed

+762
-24
lines changed

Cargo.lock

+46-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ edition = "2021"
99
anyhow = "1.0.75"
1010
itertools = "0.12.0"
1111
ethers = { version ="2.0.11", default-features = false, features = ["rustls"]}
12-
plonky2 = {version = "0.1.4", features = ["std"]}
12+
plonky2 = { version = "0.1.4" }
1313

1414
# supporting latest plonky2
1515
plonky2_crypto = { git = "https://github.com/nikkolasg/plonky2-crypto" , branch = "feat/serialization" }
@@ -21,6 +21,9 @@ eth_trie = { git = "https://github.com/nikkolasg/eth-trie.rs" }
2121
rlp = "0.5.2"
2222
sha3 = "0.10.8"
2323
bincode = "1.3.3"
24+
hashbrown = "0.14.3"
25+
log = "0.4.14"
26+
env_logger = "0.9.0"
2427

2528
[dev-dependencies]
2629
anyhow = "1.0.75"

src/.DS_Store

6 KB
Binary file not shown.

src/benches/circuit.rs src/benches/array_access.rs

+3-16
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
#[cfg(test)]
22
mod tests {
33
use anyhow::Result;
4-
use log::{log_enabled, Level, LevelFilter};
54
use plonky2::field::types::Field;
65
use plonky2::iop::target::Target;
76
use plonky2::iop::witness::PartialWitness;
87
use plonky2::plonk::circuit_builder::CircuitBuilder;
98
use plonky2::plonk::circuit_data::CircuitConfig;
109
use plonky2::plonk::config::{GenericConfig, PoseidonGoldilocksConfig};
11-
use std::env;
12-
use std::io::Write;
1310
use std::time::Instant;
1411

12+
use crate::benches::init_logging;
13+
1514
#[test]
1615
fn compare_quin_random_access() -> Result<()> {
1716
use crate::rlp::quin_selector;
@@ -78,19 +77,7 @@ mod tests {
7877

7978
(0..(array_bits_of_length_max + 1))
8079
.map(comparison)
81-
.fold(Ok(()), |r, state| state.and(r))
82-
}
83-
84-
/// Sets RUST_LOG=debug and initializes the logger
85-
/// if it hasn't been enabled already.
86-
fn init_logging() {
87-
if !log_enabled!(Level::Debug) {
88-
env::set_var("RUST_LOG", "debug");
89-
env_logger::builder()
90-
.format(|buf, record| writeln!(buf, " {}", record.args()))
91-
.init();
92-
log::set_max_level(LevelFilter::Debug);
93-
}
80+
.try_fold((), |acc, item| Ok(acc).and(item))
9481
}
9582

9683
/// Compares the gate counts, LDE size, build time, proving time, and verification time

src/benches/mod.rs

+19-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,19 @@
1-
mod circuit;
1+
use std::env;
2+
3+
use log::{log_enabled, Level, LevelFilter};
4+
use std::io::Write;
5+
mod array_access;
6+
#[cfg(test)]
7+
mod recursion;
8+
9+
/// Sets RUST_LOG=debug and initializes the logger
10+
/// if it hasn't been enabled already.
11+
pub(crate) fn init_logging() {
12+
if !log_enabled!(Level::Debug) {
13+
env::set_var("RUST_LOG", "debug");
14+
env_logger::builder()
15+
.format(|buf, record| writeln!(buf, " {}", record.args()))
16+
.init();
17+
log::set_max_level(LevelFilter::Debug);
18+
}
19+
}

0 commit comments

Comments
 (0)