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

Commit

Permalink
Merge branch 'main' of github.com:privacy-scaling-explorations/zkevm-…
Browse files Browse the repository at this point in the history
…circuits into mpt-testing
  • Loading branch information
adria0 committed Feb 5, 2024
2 parents a5539fe + 81e715a commit cc13281
Show file tree
Hide file tree
Showing 61 changed files with 580 additions and 424 deletions.
108 changes: 38 additions & 70 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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ members = [
]

[patch.crates-io]
halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", tag = "v2023_04_20" }
halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", tag = "v0.3.0" }

# Definition of benchmarks profile to use.
[profile.bench]
Expand Down
2 changes: 1 addition & 1 deletion bin/mpt-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ gadgets = { path = "../../gadgets" }
geth-utils = { path = "../../geth-utils" }
zkevm-circuits = { path = "../../zkevm-circuits", features=["test-circuits"]}
eyre = "0.6.11"
halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", tag = "v2023_04_20" }
halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", features=["circuit-params"], tag = "v0.3.0" }
serde_json = "1.0.111"
tokio = { version= "1.28.2", features = ["macros", "rt-multi-thread"] }
glob = "0.3.1"
Expand Down
16 changes: 10 additions & 6 deletions bin/mpt-test/src/circuit/state_update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ impl<F: Field> Circuit<F> for StateUpdateCircuit<F> {
MPTCircuitParams {
degree: self.mpt_circuit.degree,
disable_preimage_check: self.mpt_circuit.disable_preimage_check,
max_nodes: self.mpt_circuit.max_nodes,
}
}

Expand Down Expand Up @@ -298,14 +299,15 @@ impl<F: Field> Circuit<F> for StateUpdateCircuit<F> {

// assign MPT witness

let height =
config
.mpt_config
.assign(&mut layouter, &self.mpt_circuit.nodes, &challenges)?;
config.mpt_config.load_fixed_table(&mut layouter)?;
config
.mpt_config
.load_mult_table(&mut layouter, &challenges, height)?;
.assign(&mut layouter, &self.mpt_circuit.nodes, &challenges)?;
config.mpt_config.load_fixed_table(&mut layouter)?;
config.mpt_config.load_mult_table(
&mut layouter,
&challenges,
self.mpt_circuit.max_nodes,
)?;

#[cfg(feature = "disable-keccak")]
config.mpt_config.keccak_table.dev_load(
Expand Down Expand Up @@ -463,6 +465,7 @@ impl StateUpdateCircuit<Fr> {
pub fn new(
witness: Witness<Fr>,
degree: usize,
max_nodes: usize,
max_proof_count: usize,
) -> Result<StateUpdateCircuit<Fr>> {
let Witness {
Expand All @@ -486,6 +489,7 @@ impl StateUpdateCircuit<Fr> {
nodes: mpt_witness,
keccak_data: keccak_data.clone(),
degree,
max_nodes,
disable_preimage_check,
_marker: std::marker::PhantomData,
};
Expand Down
2 changes: 1 addition & 1 deletion bin/mpt-test/src/circuit/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ impl StateUpdateCircuit<Fr> {
let prover =
MockProver::<Fr>::run(self.degree as u32, self, vec![public_inputs.0]).unwrap();

prover.assert_satisfied_at_rows_par(0..num_rows, 0..num_rows);
prover.assert_satisfied_at_rows(0..num_rows, 0..num_rows);
}
}
1 change: 1 addition & 0 deletions bin/mpt-test/src/circuit/witness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use std::{
};

use eth_types::{Field, ToScalar};

use ethers::{
abi::Address,
prelude::*,
Expand Down
6 changes: 4 additions & 2 deletions bin/mpt-test/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,20 @@ async fn mock_prove(block_no: u64, access_list: &str) -> Result<()> {
let provider_url = "http://localhost:3000";

let access_list: AccessList = serde_json::from_str(access_list)?;
let proof_count = access_list.0.len() * 3
let proof_count = 2 * access_list.0.len() * 3
+ access_list
.0
.iter()
.map(|k| k.storage_keys.len())
.sum::<usize>();

let max_nodes = 40000;

let witness = Witness::<Fr>::build(provider_url, U64::from(block_no), Some(access_list), true)
.await?
.unwrap();

let circuit = StateUpdateCircuit::new(witness, 16, 2 * proof_count)?;
let circuit = StateUpdateCircuit::new(witness, 16, max_nodes, proof_count+10)?;
circuit.assert_satisfied();
Ok(())
}
Expand Down
4 changes: 2 additions & 2 deletions bus-mapping/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ mock = { path = "../mock", optional = true }

ethers-core = "=2.0.10"
ethers-providers = "=2.0.10"
halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", tag = "v2023_04_20" }
halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", tag = "v0.3.0" }
itertools = "0.10"
lazy_static = "1.4"
log = "0.4.14"
Expand All @@ -21,7 +21,7 @@ serde_json = "1.0.66"
strum = "0.24"
strum_macros = "0.24"
revm-precompile = { version = "=2.2.0", default-features = false, optional = true }

[dev-dependencies]
hex = "0.4.3"
pretty_assertions = "1.0.0"
Expand Down
Loading

0 comments on commit cc13281

Please sign in to comment.