Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compression Circuit: snark-verifier-ce #1377

Draft
wants to merge 82 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
343447e
add ce dependecies and add circuit params
Jul 20, 2024
7933b82
move compression into own module
Jul 20, 2024
9dd339c
use aggregation circuit from ce-snark-verifier
Jul 22, 2024
b55f96e
export MockChunkCircuit
Jul 22, 2024
07af602
fix compression tests
Jul 22, 2024
bc324a0
fmt
Jul 22, 2024
19d70d6
clippy
Jul 22, 2024
a0fc98f
add roundtrip test
Jul 23, 2024
9bd9962
Merge branch 'develop' into feat/migrate_compression
z2trillion Jul 25, 2024
6b8d67a
Merge branch 'develop' into feat/migrate_compression
roynalnaruto Aug 5, 2024
cfec348
fix: clippy
roynalnaruto Aug 5, 2024
271633e
new cargo lock
z2trillion Jul 25, 2024
2205f36
disable recursion limit when deserializing snarks
z2trillion Jul 26, 2024
0041062
quick fix
z2trillion Jul 26, 2024
46d17a3
change stage
z2trillion Aug 5, 2024
cd4fe3b
fix cherry-pick
z2trillion Aug 5, 2024
b0a0bf1
Merge branch 'develop' into feat/migrate_compression
roynalnaruto Aug 27, 2024
50a4b31
update cargo lock to use scroll-tech repos
z2trillion Aug 30, 2024
54c4d74
Merge branch 'develop' into feat/migrate_compression
darth-cy Sep 4, 2024
a57d316
Correct import
darth-cy Sep 4, 2024
a98f446
Resolve trait bound
darth-cy Sep 4, 2024
4eedc28
Resolve clippy
darth-cy Sep 4, 2024
7424bf0
Correct fmt
darth-cy Sep 4, 2024
71b6a5f
Add comment
darth-cy Sep 4, 2024
32dc27d
update snark verifier
lispc Sep 5, 2024
7934dd4
Merge branch 'feat/migrate_compression' of github.com:scroll-tech/zke…
lispc Sep 5, 2024
b69ec74
chore: upgrade trie to make it forward compatible with future trace c…
lispc Aug 14, 2024
8958e5d
Add prover pairing check
darth-cy Sep 8, 2024
baf23ad
Merge branch 'develop' into feat/migrate_compression
darth-cy Sep 8, 2024
2642616
Correct wording
darth-cy Sep 8, 2024
bec5d76
Add accumulator pre-check for compression circuit
darth-cy Sep 8, 2024
ecb7223
Resolve clippy
darth-cy Sep 8, 2024
12b5a3d
fmt
darth-cy Sep 8, 2024
a799a60
Add accumulator pre-check into chunk verifier
darth-cy Sep 8, 2024
bd2c57f
clippy and fmt
darth-cy Sep 8, 2024
4a9c3c2
Merge branch 'develop' into feat/migrate_compression
darth-cy Sep 10, 2024
fc00dc8
Merge branch 'develop' into feat/migrate_compression
lispc Sep 10, 2024
724c101
Add pairing check in compression circuit construction for all accumul…
darth-cy Sep 12, 2024
8905ed3
fmt
darth-cy Sep 12, 2024
da87728
Merge branch 'develop' into feat/migrate_compression
darth-cy Sep 12, 2024
b18623f
Resolve conflict and rebuild
darth-cy Sep 12, 2024
af9a9cd
fmt
darth-cy Sep 12, 2024
2a3d270
Merge branch 'develop' into feat/migrate_compression
darth-cy Sep 18, 2024
3cc07cd
Merge branch 'develop' into feat/migrate_compression
roynalnaruto Sep 18, 2024
9073e45
Add standard plonk compression
darth-cy Sep 18, 2024
611a79b
Add evm_verify to standard plonk compression test
darth-cy Sep 18, 2024
5295f72
Remove feature branching for standard plonk assignment
darth-cy Sep 18, 2024
2e2191e
Remove evm code deployment
darth-cy Sep 18, 2024
8813d53
Readapt compression circuit construction logic from example
darth-cy Sep 18, 2024
dd9159f
Correct source of entropy
darth-cy Sep 18, 2024
ba1a232
Use standard plonk compression for mock prover
darth-cy Sep 18, 2024
6ef3770
Correct accumulator
darth-cy Sep 18, 2024
a072add
Remove rlc temporarily
darth-cy Sep 18, 2024
ac19f78
Recover rlc config
darth-cy Sep 18, 2024
d5604bd
Remove rlc lookup
darth-cy Sep 18, 2024
7e96751
Construct snark with old shplonk
darth-cy Sep 18, 2024
87a2322
Recover rlc
darth-cy Sep 18, 2024
b5d18f8
Clean up code
darth-cy Sep 18, 2024
494048c
Organize compression unit tests
darth-cy Sep 19, 2024
7d97d29
Adjust test compilation
darth-cy Sep 19, 2024
b086feb
Adjust compression tests
darth-cy Sep 19, 2024
9918fd7
Recover second layer compression
darth-cy Sep 19, 2024
62e6100
Remove rlc
darth-cy Sep 19, 2024
5fbb16f
Merge branch 'develop' into feat/migrate_compression
darth-cy Sep 20, 2024
8b6a9ad
First layer compression should not have accumulators
darth-cy Sep 20, 2024
dfce06c
Add pre-generated snark compression test
darth-cy Sep 22, 2024
dd6025f
Add compression params
darth-cy Sep 23, 2024
5523a3f
Reduce degree
darth-cy Sep 23, 2024
2bd43fd
Modify test
darth-cy Sep 23, 2024
1414ed2
Correct test
darth-cy Sep 23, 2024
d8a2058
Remove comments
darth-cy Sep 23, 2024
259b569
update test parameters
z2trillion Sep 26, 2024
d1ae93f
fix cargo.toml
z2trillion Sep 26, 2024
ab818be
Recompile Cargo.lock
darth-cy Sep 27, 2024
864a685
Add snark generation for layer2 compression
darth-cy Sep 27, 2024
108822d
Adjust compression unit tests:
darth-cy Sep 29, 2024
a6a172f
Adjust parameters
darth-cy Sep 30, 2024
50df657
Increase degree
darth-cy Sep 30, 2024
ab5a172
Correct degree
darth-cy Sep 30, 2024
03eb3e5
Temporarily disable layer 2
darth-cy Sep 30, 2024
3e0bcb4
Add number of advice columns
darth-cy Oct 2, 2024
32ca7cb
Merge branch 'develop' into feat/migrate_compression
darth-cy Oct 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
761 changes: 624 additions & 137 deletions Cargo.lock

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ members = [
"mock",
"testool",
"aggregator",
"prover"
"prover",
"compression",
]
resolver = "2"

Expand All @@ -33,7 +34,7 @@ ethers-core = { git = "https://github.com/scroll-tech/ethers-rs.git", branch = "
ethers-providers = "=2.0.7"
ethers-signers = "=2.0.7"
ff = "0.13"
halo2_proofs = { git = "https://github.com/scroll-tech/halo2.git", branch = "v1.1" }
halo2_proofs = { git = "https://github.com/scroll-tech/halo2.git", branch = "v1.1", features = ["circuit-params"] }
halo2curves = { version = "0.1.0", features = [ "derive_serde" ] }
poseidon-base = { package = "poseidon-base", git = "https://github.com/scroll-tech/poseidon-circuit.git", branch = "main" }
hash-circuit = { package = "poseidon-circuit", git = "https://github.com/scroll-tech/poseidon-circuit.git", branch = "main" }
Expand All @@ -59,6 +60,8 @@ serde_stacker = "0.1"
sha3 = "0.10"
snark-verifier = { git = "https://github.com/scroll-tech/snark-verifier", branch = "develop" }
snark-verifier-sdk = { git = "https://github.com/scroll-tech/snark-verifier", branch = "develop", default-features = false, features = ["loader_halo2", "loader_evm", "halo2-pse"] }
ce-snark-verifier = { git = "https://github.com/scroll-tech/snark-verifier", branch = "axiom-community-edition", package = "snark-verifier", default-features = false, features = ["loader_halo2", "halo2-pse", "loader_evm", "revm"] }
ce-snark-verifier-sdk = { git = "https://github.com/scroll-tech/snark-verifier", branch = "axiom-community-edition", package = "snark-verifier-sdk", default-features = false, features = ["loader_halo2", "halo2-pse", "loader_evm", "revm"] }
strum = "0.25"
strum_macros = "0.25"
subtle = "2.4"
Expand All @@ -75,7 +78,7 @@ ethers = { git = "https://github.com/scroll-tech/ethers-rs.git", branch = "v2.0.
ethers-etherscan = { git = "https://github.com/scroll-tech/ethers-rs.git", branch = "v2.0.7" }
ethers-signers = { git = "https://github.com/scroll-tech/ethers-rs.git", branch = "v2.0.7" }
gobuild = { git = "https://github.com/scroll-tech/gobuild.git" }
halo2curves = { git = "https://github.com/scroll-tech/halo2curves", branch = "v0.1.0" }
halo2curves = { git = "https://github.com/scroll-tech/halo2curves", branch = "use_pairing" }

[patch."https://github.com/privacy-scaling-explorations/halo2.git"]
halo2_proofs = { git = "https://github.com/scroll-tech/halo2.git", branch = "v1.1" }
Expand Down
1 change: 1 addition & 0 deletions aggregator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ halo2-ecc.workspace = true
halo2_proofs.workspace = true
snark-verifier.workspace = true
snark-verifier-sdk.workspace = true
ce-snark-verifier-sdk.workspace = true
strum.workspace = true
strum_macros.workspace = true

Expand Down
27 changes: 14 additions & 13 deletions aggregator/src/aggregation/rlc/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,22 @@ impl RlcConfig {
vec![cs1, cs2, cs3]
});

meta.lookup_any("rlc keccak lookup", |meta| {
let q = meta.query_selector(lookup_gate_selector);
let input_rlc = meta.query_advice(phase_2_column, Rotation::cur());
let output_rlc = meta.query_advice(phase_2_column, Rotation::next());
let data_len = meta.query_advice(phase_2_column, Rotation(2));
// compression_debug
// meta.lookup_any("rlc keccak lookup", |meta| {
// let q = meta.query_selector(lookup_gate_selector);
// let input_rlc = meta.query_advice(phase_2_column, Rotation::cur());
// let output_rlc = meta.query_advice(phase_2_column, Rotation::next());
// let data_len = meta.query_advice(phase_2_column, Rotation(2));

let input_exprs = vec![1.expr(), 1.expr(), input_rlc, data_len, output_rlc];
let table_exprs = keccak_table.table_exprs(meta);
// let input_exprs = vec![1.expr(), 1.expr(), input_rlc, data_len, output_rlc];
// let table_exprs = keccak_table.table_exprs(meta);

input_exprs
.into_iter()
.zip_eq(table_exprs)
.map(|(input, table)| (q.clone() * input, table))
.collect::<Vec<_>>()
});
// input_exprs
// .into_iter()
// .zip_eq(table_exprs)
// .map(|(input, table)| (q.clone() * input, table))
// .collect::<Vec<_>>()
// });

Self {
#[cfg(test)]
Expand Down
2 changes: 1 addition & 1 deletion aggregator/src/aggregation/rlc/gates.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use ethers_core::utils::keccak256;
use halo2_proofs::{
circuit::{AssignedCell, Cell, Region, RegionIndex, Value},
halo2curves::bn256::Fr,
halo2curves::{bn256::Fr, ff::Field},
plonk::Error,
};
use zkevm_circuits::util::Challenges;
Expand Down
1 change: 0 additions & 1 deletion aggregator/src/chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ impl ChunkInfo {
}

/// Sample a chunk info from random (for testing)
#[cfg(test)]
pub(crate) fn mock_random_chunk_info_for_testing<R: rand::RngCore>(r: &mut R) -> Self {
use eth_types::Address;
use ethers_core::types::TransactionRequest;
Expand Down
224 changes: 0 additions & 224 deletions aggregator/src/compression/circuit.rs

This file was deleted.

34 changes: 0 additions & 34 deletions aggregator/src/compression/circuit_ext.rs

This file was deleted.

6 changes: 3 additions & 3 deletions aggregator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ mod recursion;
// This module implements `Chunk` related data types.
// A chunk is a list of blocks.
mod chunk;
/// proof compression
mod compression;
/// Configurations
mod constants;
/// Core module for circuit assignment
Expand All @@ -32,8 +30,10 @@ pub use aggregation::*;
pub use batch::{BatchHash, BatchHeader};
pub use blob::BatchData;
pub use chunk::ChunkInfo;
pub use compression::*;
pub use constants::MAX_AGG_SNARKS;
pub(crate) use constants::*;
pub use param::*;
pub use recursion::*;

mod mock_chunk;
pub use mock_chunk::MockChunkCircuit;
Loading
Loading