Skip to content
This repository has been archived by the owner on Jul 10, 2023. It is now read-only.

Commit

Permalink
Cumulative updates (#129)
Browse files Browse the repository at this point in the history
- add snark-verifier `parallel` feature flag
- fix autogen on ref protect branches to push to a dedicated branch
instead
- small cosmetic change in prover/autogen

---------

Co-authored-by: github-actions <github-actions@github.com>
  • Loading branch information
pinkiebell and github-actions committed Feb 24, 2023
1 parent e6d466a commit ddb0dcc
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 35 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

16 changes: 8 additions & 8 deletions docker/geth/templates/l1-testnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@
"000000000000000000000070692d333030303030": {
"balance": "0",
"comment": "Proxy:verifier-pi-300000-0x000000000000000000000070692d333030303030",
"code": "0x608060405260043610601c5760003560e01c80630900f010146043575b363d3d373d3d3d3d828236833d19545af4925050503d82833e8015603e573d82f35b503d81fd5b348015604e57600080fd5b50605f605a3660046061565b3d1955565b005b600060208284031215607257600080fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114609557600080fd5b939250505056fea164736f6c6343000810000a",
"code": "0x608060405260043610601c5760003560e01c80630900f010146043575b363d3d373d3d3d3d828236833d19545af4925050503d82833e8015603e573d82f35b503d81fd5b348015604e57600080fd5b50605f605a3660046061565b3d1955565b005b600060208284031215607257600080fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114609557600080fd5b939250505056",
"storage": {
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff": "00000000000000000000cc1f8b84333343ea55a4"
}
Expand All @@ -242,7 +242,7 @@
"00000000000000000070692d3330303030302d61": {
"balance": "0",
"comment": "Proxy:verifier-pi-300000-a-0x00000000000000000070692d3330303030302d61",
"code": "0x608060405260043610601c5760003560e01c80630900f010146043575b363d3d373d3d3d3d828236833d19545af4925050503d82833e8015603e573d82f35b503d81fd5b348015604e57600080fd5b50605f605a3660046061565b3d1955565b005b600060208284031215607257600080fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114609557600080fd5b939250505056fea164736f6c6343000810000a",
"code": "0x608060405260043610601c5760003560e01c80630900f010146043575b363d3d373d3d3d3d828236833d19545af4925050503d82833e8015603e573d82f35b503d81fd5b348015604e57600080fd5b50605f605a3660046061565b3d1955565b005b600060208284031215607257600080fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114609557600080fd5b939250505056",
"storage": {
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff": "0000000000000000007134dc5587303343ea52d5"
}
Expand All @@ -255,7 +255,7 @@
"00000000000000000000000070692d3633303030": {
"balance": "0",
"comment": "Proxy:verifier-pi-63000-0x00000000000000000000000070692d3633303030",
"code": "0x608060405260043610601c5760003560e01c80630900f010146043575b363d3d373d3d3d3d828236833d19545af4925050503d82833e8015603e573d82f35b503d81fd5b348015604e57600080fd5b50605f605a3660046061565b3d1955565b005b600060208284031215607257600080fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114609557600080fd5b939250505056fea164736f6c6343000810000a",
"code": "0x608060405260043610601c5760003560e01c80630900f010146043575b363d3d373d3d3d3d828236833d19545af4925050503d82833e8015603e573d82f35b503d81fd5b348015604e57600080fd5b50605f605a3660046061565b3d1955565b005b600060208284031215607257600080fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114609557600080fd5b939250505056",
"storage": {
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff": "00000000000000000000cbaf92c02d3946ea55a4"
}
Expand All @@ -268,7 +268,7 @@
"0000000000000000000070692d36333030302d61": {
"balance": "0",
"comment": "Proxy:verifier-pi-63000-a-0x0000000000000000000070692d36333030302d61",
"code": "0x608060405260043610601c5760003560e01c80630900f010146043575b363d3d373d3d3d3d828236833d19545af4925050503d82833e8015603e573d82f35b503d81fd5b348015604e57600080fd5b50605f605a3660046061565b3d1955565b005b600060208284031215607257600080fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114609557600080fd5b939250505056fea164736f6c6343000810000a",
"code": "0x608060405260043610601c5760003560e01c80630900f010146043575b363d3d373d3d3d3d828236833d19545af4925050503d82833e8015603e573d82f35b503d81fd5b348015604e57600080fd5b50605f605a3660046061565b3d1955565b005b600060208284031215607257600080fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114609557600080fd5b939250505056",
"storage": {
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff": "000000000000000000013c184f8d333343ea52d5"
}
Expand All @@ -294,7 +294,7 @@
"00000000000000000073757065722d3633303030": {
"balance": "0",
"comment": "Proxy:verifier-super-63000-0x00000000000000000073757065722d3633303030",
"code": "0x608060405260043610601c5760003560e01c80630900f010146043575b363d3d373d3d3d3d828236833d19545af4925050503d82833e8015603e573d82f35b503d81fd5b348015604e57600080fd5b50605f605a3660046061565b3d1955565b005b600060208284031215607257600080fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114609557600080fd5b939250505056fea164736f6c6343000810000a",
"code": "0x608060405260043610601c5760003560e01c80630900f010146043575b363d3d373d3d3d3d828236833d19545af4925050503d82833e8015603e573d82f35b503d81fd5b348015604e57600080fd5b50605f605a3660046061565b3d1955565b005b600060208284031215607257600080fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114609557600080fd5b939250505056",
"storage": {
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff": "00000000000000000074411f87c92d3946ea55a4"
}
Expand All @@ -307,7 +307,7 @@
"000000000000000073757065722d333030303030": {
"balance": "0",
"comment": "Proxy:verifier-super-300000-0x000000000000000073757065722d333030303030",
"code": "0x608060405260043610601c5760003560e01c80630900f010146043575b363d3d373d3d3d3d828236833d19545af4925050503d82833e8015603e573d82f35b503d81fd5b348015604e57600080fd5b50605f605a3660046061565b3d1955565b005b600060208284031215607257600080fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114609557600080fd5b939250505056fea164736f6c6343000810000a",
"code": "0x608060405260043610601c5760003560e01c80630900f010146043575b363d3d373d3d3d3d828236833d19545af4925050503d82833e8015603e573d82f35b503d81fd5b348015604e57600080fd5b50605f605a3660046061565b3d1955565b005b600060208284031215607257600080fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114609557600080fd5b939250505056",
"storage": {
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff": "000000000000000073763c149484333343ea55a4"
}
Expand All @@ -333,7 +333,7 @@
"00000000000073757065722d3330303030302d61": {
"balance": "0",
"comment": "Proxy:verifier-super-300000-a-0x00000000000073757065722d3330303030302d61",
"code": "0x608060405260043610601c5760003560e01c80630900f010146043575b363d3d373d3d3d3d828236833d19545af4925050503d82833e8015603e573d82f35b503d81fd5b348015604e57600080fd5b50605f605a3660046061565b3d1955565b005b600060208284031215607257600080fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114609557600080fd5b939250505056fea164736f6c6343000810000a",
"code": "0x608060405260043610601c5760003560e01c80630900f010146043575b363d3d373d3d3d3d828236833d19545af4925050503d82833e8015603e573d82f35b503d81fd5b348015604e57600080fd5b50605f605a3660046061565b3d1955565b005b600060208284031215607257600080fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114609557600080fd5b939250505056",
"storage": {
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff": "000000000000737570663ddc5587303343ea52d5"
}
Expand All @@ -346,7 +346,7 @@
"0000000000000073757065722d36333030302d61": {
"balance": "0",
"comment": "Proxy:verifier-super-63000-a-0x0000000000000073757065722d36333030302d61",
"code": "0x608060405260043610601c5760003560e01c80630900f010146043575b363d3d373d3d3d3d828236833d19545af4925050503d82833e8015603e573d82f35b503d81fd5b348015604e57600080fd5b50605f605a3660046061565b3d1955565b005b600060208284031215607257600080fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114609557600080fd5b939250505056fea164736f6c6343000810000a",
"code": "0x608060405260043610601c5760003560e01c80630900f010146043575b363d3d373d3d3d3d828236833d19545af4925050503d82833e8015603e573d82f35b503d81fd5b348015604e57600080fd5b50605f605a3660046061565b3d1955565b005b600060208284031215607257600080fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114609557600080fd5b939250505056",
"storage": {
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff": "0000000000000073757131214f8d333343ea52d5"
}
Expand Down
2 changes: 1 addition & 1 deletion prover/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.gi
bus-mapping = { git = "https://github.com/privacy-scaling-explorations/zkevm-circuits.git", branch = "main" }
eth-types = { git = "https://github.com/privacy-scaling-explorations/zkevm-circuits.git", branch = "main", features = ["warn-unimplemented"] }
zkevm-circuits = { git = "https://github.com/privacy-scaling-explorations/zkevm-circuits.git", branch = "main", features = ["test-circuits"] }
snark-verifier = { git = "https://github.com/privacy-scaling-explorations/snark-verifier.git", tag = "v2023_02_02", default-features = false, features = ["loader_evm"] }
snark-verifier = { git = "https://github.com/privacy-scaling-explorations/snark-verifier.git", tag = "v2023_02_02", default-features = false, features = ["loader_evm", "parallel"] }
env_logger = "0.9.0"
ethers-providers = "0.17.0"
hyper = { version = "0.14.16", features = ["server"] }
Expand Down
34 changes: 9 additions & 25 deletions prover/tests/autogen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,12 @@ use prover::circuit_witness::CircuitWitness;
use prover::circuits::gen_super_circuit;
use prover::utils::fixed_rng;
use prover::Fr;
use prover::MOCK_RANDOMNESS;
use std::collections::BTreeMap;
use std::collections::HashMap;
use std::fmt::Write;
use std::fs::File;
use std::io::Write as fwrite;
use zkevm_circuits::evm_circuit::witness::block_convert;
use zkevm_circuits::super_circuit::SuperCircuit;
use zkevm_common::prover::*;
use zkevm_dev::bytecode::*;

Expand Down Expand Up @@ -171,26 +169,12 @@ impl<F: Field> Assignment<F> for Assembly {
}
}

fn run_assembly<
const MAX_TXS: usize,
const MAX_CALLDATA: usize,
const MAX_BYTECODE: usize,
const MAX_RWS: usize,
const MAX_COPY_ROWS: usize,
>(
witness: CircuitWitness,
) -> Result<usize, String> {
let circuit = gen_super_circuit::<MAX_TXS, MAX_CALLDATA, MAX_RWS, MAX_COPY_ROWS, _>(
&witness,
fixed_rng(),
)
.expect("gen_static_circuit");

fn estimate_rows<ConcreteCircuit: Circuit<Fr>>(circuit: &ConcreteCircuit) -> Result<usize, String> {
let mut cs = ConstraintSystem::default();
let config = SuperCircuit::<Fr, MAX_TXS, MAX_CALLDATA, MOCK_RANDOMNESS>::configure(&mut cs);
let config = ConcreteCircuit::configure(&mut cs);
let mut assembly = Assembly::default();
let constants = cs.constants();
SimpleFloorPlanner::synthesize(&mut assembly, &circuit, config, constants.to_vec())
SimpleFloorPlanner::synthesize(&mut assembly, circuit, config, constants.to_vec())
.map_err(|e| e.to_string())?;

Ok(assembly.highest_row + cs.blinding_factors() + 1)
Expand Down Expand Up @@ -313,12 +297,12 @@ macro_rules! estimate {
// calculate circuit stats
{
circuit_config.pad_to = MAX_RWS;

let highest_row =
run_assembly::<MAX_TXS, MAX_CALLDATA, MAX_BYTECODE, MAX_RWS, MAX_COPY_ROWS>(
circuit_witness,
)
.unwrap();
let circuit = gen_super_circuit::<MAX_TXS, MAX_CALLDATA, MAX_RWS, MAX_COPY_ROWS, _>(
&circuit_witness,
fixed_rng(),
)
.expect("gen_static_circuit");
let highest_row = estimate_rows(&circuit).unwrap();
let log2_ceil = |n| u32::BITS - (n as u32).leading_zeros() - (n & (n - 1) == 0) as u32;
let k = log2_ceil(highest_row) as usize;
let remaining_rows = (1 << k) - highest_row;
Expand Down
6 changes: 5 additions & 1 deletion scripts/ci_autogen_commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,8 @@ fi
git config user.email 'github-actions@github.com'
git config user.name github-actions
git commit -am 'updates from autogen workflow' || exit 0
git push
if [ "${GITHUB_REF_PROTECTED}" = "true" ]; then
git push origin "autogen-$(git rev-parse HEAD)"
else
git push
fi

0 comments on commit ddb0dcc

Please sign in to comment.