Skip to content

Commit

Permalink
v0.8.1: (1) aggregate 15 chunks (2) parallel assignment (#262)
Browse files Browse the repository at this point in the history
* Test max-snark.

* U

* Update layer3.config.

* Update configs.

* U

* Revert "U"

This reverts commit aa997ef.

* U

* upgrade zkevm circuits

* add CircuitCapacityChecker::get_tx_num

* Set `KECCAK_ROW=50` when init batch-prover.

---------

Co-authored-by: Zhuo Zhang <[email protected]>
  • Loading branch information
silathdiir and lispc authored Sep 7, 2023
1 parent b38be04 commit b6d98c3
Show file tree
Hide file tree
Showing 10 changed files with 391 additions and 40 deletions.
24 changes: 12 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bin/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bin"
version = "0.8.0"
version = "0.8.1"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
14 changes: 7 additions & 7 deletions prover/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
[package]
name = "prover"
version = "0.8.0"
version = "0.8.1"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", tag = "v2023_02_02" }

aggregator = { git = "https://github.com/scroll-tech/zkevm-circuits.git", tag = "v0.8.0" }
bus-mapping = { git = "https://github.com/scroll-tech/zkevm-circuits.git", tag = "v0.8.0" }
eth-types = { git = "https://github.com/scroll-tech/zkevm-circuits.git", tag = "v0.8.0" }
mock = { git = "https://github.com/scroll-tech/zkevm-circuits.git", tag = "v0.8.0" }
mpt-zktrie = { git = "https://github.com/scroll-tech/zkevm-circuits.git", tag = "v0.8.0" }
zkevm-circuits = { git = "https://github.com/scroll-tech/zkevm-circuits.git", tag = "v0.8.0", default-features = false, features = ["shanghai", "scroll"] }
aggregator = { git = "https://github.com/scroll-tech/zkevm-circuits.git", tag = "v0.8.1" }
bus-mapping = { git = "https://github.com/scroll-tech/zkevm-circuits.git", tag = "v0.8.1" }
eth-types = { git = "https://github.com/scroll-tech/zkevm-circuits.git", tag = "v0.8.1" }
mock = { git = "https://github.com/scroll-tech/zkevm-circuits.git", tag = "v0.8.1" }
mpt-zktrie = { git = "https://github.com/scroll-tech/zkevm-circuits.git", tag = "v0.8.1" }
zkevm-circuits = { git = "https://github.com/scroll-tech/zkevm-circuits.git", tag = "v0.8.1", default-features = false, features = ["shanghai", "scroll", "parallel_syn"] }

snark-verifier = { git = "https://github.com/scroll-tech/snark-verifier", tag = "v0.1.4" }
snark-verifier-sdk = { git = "https://github.com/scroll-tech/snark-verifier", tag = "v0.1.4", default-features = false, features = ["loader_halo2", "loader_evm", "halo2-pse"] }
Expand Down
6 changes: 3 additions & 3 deletions prover/configs/layer3.config
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"strategy": "Simple",
"degree": 19,
"degree": 20,
"num_advice": [
80
59
],
"num_lookup_advice": [
10
7
],
"num_fixed": 2,
"lookup_bits": 18,
Expand Down
4 changes: 2 additions & 2 deletions prover/configs/layer4.config
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"strategy": "Simple",
"degree": 25,
"degree": 26,
"num_advice": [
3
1
],
"num_lookup_advice": [
1
Expand Down
6 changes: 4 additions & 2 deletions prover/src/aggregator/prover.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
use crate::{
common,
config::{LayerId, AGG_DEGREES},
consts::{AGG_VK_FILENAME, CHUNK_PROTOCOL_FILENAME},
consts::{AGG_KECCAK_ROW, AGG_VK_FILENAME, CHUNK_PROTOCOL_FILENAME},
io::{force_to_read, try_to_read},
BatchProof, ChunkProof,
};
use aggregator::{ChunkHash, MAX_AGG_SNARKS};
use anyhow::{bail, Result};
use sha2::{Digest, Sha256};
use snark_verifier_sdk::Snark;
use std::iter::repeat;
use std::{env, iter::repeat};

#[derive(Debug)]
pub struct Prover {
Expand All @@ -21,6 +21,8 @@ pub struct Prover {

impl Prover {
pub fn from_dirs(params_dir: &str, assets_dir: &str) -> Self {
env::set_var("KECCAK_ROW", AGG_KECCAK_ROW.to_string());

let inner = common::Prover::from_params_dir(params_dir, &AGG_DEGREES);
let chunk_protocol = force_to_read(assets_dir, &CHUNK_PROTOCOL_FILENAME);

Expand Down
1 change: 1 addition & 0 deletions prover/src/consts.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::utils::read_env_var;
use once_cell::sync::Lazy;

pub static AGG_KECCAK_ROW: Lazy<usize> = Lazy::new(|| read_env_var("AGG_KECCAK_ROW", 50));
pub static AGG_VK_FILENAME: Lazy<String> =
Lazy::new(|| read_env_var("AGG_VK_FILENAME", "agg_vk.vkey".to_string()));
pub static CHUNK_PROTOCOL_FILENAME: Lazy<String> =
Expand Down
3 changes: 3 additions & 0 deletions prover/src/zkevm/capacity_checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ impl CircuitCapacityChecker {
self.acc_row_usage = RowUsage::new();
self.row_usages = Vec::new();
}
pub fn get_tx_num(&self) -> usize {
self.row_usages.len()
}
pub fn get_acc_row_usage(&self, normalize: bool) -> RowUsage {
if normalize {
self.acc_row_usage.normalize()
Expand Down
365 changes: 355 additions & 10 deletions prover/tests/test_data/full_proof_1.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ function simple_tests() {
}

function replace_zkevm_circuits_branch() {
TO='tag = "v0.8.0"'
FROM='branch = "develop"'
TO='tag = "v0.8.1"'
FROM='branch = "feat/max_snark=16"'
#FROM='branch = "refactor/partial-db"'
sed -i "s#zkevm-circuits.git\", $FROM#zkevm-circuits.git\", $TO#" */Cargo.toml
cargo update -p zkevm-circuits
cargo update -p eth-types
git diff */Cargo.toml Cargo.lock
#git diff */Cargo.toml Cargo.lock
}

replace_zkevm_circuits_branch
Expand Down

0 comments on commit b6d98c3

Please sign in to comment.