Skip to content
This repository was archived by the owner on Apr 18, 2025. It is now read-only.

Commit 0b2187a

Browse files
committed
impl CircuitExt for SuperCircuit
1 parent 89a382c commit 0b2187a

File tree

4 files changed

+128
-34
lines changed

4 files changed

+128
-34
lines changed

Cargo.lock

Lines changed: 103 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

zkevm-circuits/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ libsecp256k1 = "0.7"
3838
num-bigint = { version = "0.4" }
3939
subtle = "2.4"
4040
rand_chacha = "0.3"
41-
snark-verifier = { git = "https://github.com/privacy-scaling-explorations/snark-verifier", tag = "v2023_02_02", default-features = false, features = ["loader_halo2", "system_halo2"] }
41+
snark-verifier = { git = "https://github.com/scroll-tech/snark-verifier", branch = "halo2-ecc-snark-verifier-0323" }
42+
snark-verifier-sdk = { git = "https://github.com/scroll-tech/snark-verifier", branch = "halo2-ecc-snark-verifier-0323", default-features=false, features = ["loader_halo2", "loader_evm", "halo2-pse"] }
4243
hex = "0.4.3"
4344
rayon = "1.5"
4445
once_cell = "1.17.0"

zkevm-circuits/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ pub mod mpt_circuit;
2727
pub mod pi_circuit;
2828
pub mod poseidon_circuit;
2929
pub mod rlp_circuit;
30-
pub mod root_circuit;
30+
// we don't use this for aggregation
31+
//pub mod root_circuit;
3132
pub mod state_circuit;
3233
pub mod super_circuit;
3334
pub mod table;

zkevm-circuits/src/super_circuit.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ use halo2_proofs::{
9494
circuit::{Layouter, SimpleFloorPlanner, Value},
9595
plonk::{Circuit, ConstraintSystem, Error, Expression},
9696
};
97+
use itertools::Itertools;
98+
use snark_verifier_sdk::CircuitExt;
9799

98100
use crate::{
99101
pi_circuit::{PiCircuit, PiCircuitConfig, PiCircuitConfigArgs},
@@ -305,6 +307,8 @@ impl<F: Field> SubCircuitConfig<F> for SuperCircuitConfig<F> {
305307
if meta.max_phase() != 0 {
306308
log::warn!("max_phase: {}", meta.max_phase());
307309
}
310+
// simple selector brings a lot of trouble when (de)serialize
311+
debug_assert_eq!(meta.num_simple_selectors, 0);
308312

309313
SuperCircuitConfig::<F> {
310314
block_table,
@@ -593,6 +597,23 @@ impl<
593597
}
594598
}
595599

600+
impl<
601+
F: Field,
602+
const MAX_TXS: usize,
603+
const MAX_CALLDATA: usize,
604+
const MAX_INNER_BLOCKS: usize,
605+
const MOCK_RANDOMNESS: u64,
606+
> CircuitExt<F> for SuperCircuit<F, MAX_TXS, MAX_CALLDATA, MAX_INNER_BLOCKS, MOCK_RANDOMNESS>
607+
{
608+
fn num_instance(&self) -> Vec<usize> {
609+
self.instances().iter().map(|l| l.len()).collect_vec()
610+
}
611+
612+
fn instances(&self) -> Vec<Vec<F>> {
613+
self.instance()
614+
}
615+
}
616+
596617
impl<
597618
F: Field,
598619
const MAX_TXS: usize,

0 commit comments

Comments
 (0)