From 8d387a909eed269d2ecb4379edaec296d63ec360 Mon Sep 17 00:00:00 2001 From: john xu Date: Mon, 27 Feb 2023 13:59:29 +0800 Subject: [PATCH 1/3] feat: get txs from l1 --- Cargo.lock | 46 ++++++++++++++++++++++++++------- Cargo.toml | 6 +++++ common/src/prover.rs | 13 +++++++--- coordinator/src/shared_state.rs | 4 ++- prover/src/bin/prover_cmd.rs | 2 +- prover/src/circuit_witness.rs | 27 ++++++++++++++----- prover/src/circuits.rs | 6 ++++- prover/src/server.rs | 11 +++++--- prover/src/shared_state.rs | 22 ++++++++++------ prover/tests/proverd.rs | 4 +-- 10 files changed, 107 insertions(+), 34 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 188a343d..856a5c5b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -341,7 +341,6 @@ checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" [[package]] name = "bus-mapping" version = "0.1.0" -source = "git+https://github.com/smtmfft/zkevm-circuits.git?branch=feature/root-circuit#348d771db62c2bbda4aaabe45dd1ac40605a0700" dependencies = [ "eth-types", "ethers-core", @@ -988,7 +987,6 @@ dependencies = [ [[package]] name = "eth-types" version = "0.1.0" -source = "git+https://github.com/smtmfft/zkevm-circuits.git?branch=feature/root-circuit#348d771db62c2bbda4aaabe45dd1ac40605a0700" dependencies = [ "ethers-core", "ethers-signers", @@ -1139,13 +1137,23 @@ dependencies = [ "thiserror", ] +[[package]] +name = "external-tracer" +version = "0.1.0" +dependencies = [ + "eth-types", + "geth-utils 0.1.0", + "serde", + "serde_json", +] + [[package]] name = "external-tracer" version = "0.1.0" source = "git+https://github.com/smtmfft/zkevm-circuits.git?branch=feature/root-circuit#348d771db62c2bbda4aaabe45dd1ac40605a0700" dependencies = [ "eth-types", - "geth-utils", + "geth-utils 0.1.0 (git+https://github.com/smtmfft/zkevm-circuits.git?branch=feature/root-circuit)", "serde", "serde_json", ] @@ -1344,7 +1352,6 @@ dependencies = [ [[package]] name = "gadgets" version = "0.1.0" -source = "git+https://github.com/smtmfft/zkevm-circuits.git?branch=feature/root-circuit#348d771db62c2bbda4aaabe45dd1ac40605a0700" dependencies = [ "digest 0.7.6", "eth-types", @@ -1381,6 +1388,15 @@ dependencies = [ "version_check", ] +[[package]] +name = "geth-utils" +version = "0.1.0" +dependencies = [ + "env_logger", + "gobuild", + "log", +] + [[package]] name = "geth-utils" version = "0.1.0" @@ -1862,7 +1878,6 @@ dependencies = [ [[package]] name = "keccak256" version = "0.1.0" -source = "git+https://github.com/smtmfft/zkevm-circuits.git?branch=feature/root-circuit#348d771db62c2bbda4aaabe45dd1ac40605a0700" dependencies = [ "env_logger", "eth-types", @@ -2018,6 +2033,20 @@ dependencies = [ "windows-sys 0.45.0", ] +[[package]] +name = "mock" +version = "0.1.0" +dependencies = [ + "eth-types", + "ethers-core", + "ethers-signers", + "external-tracer 0.1.0", + "itertools", + "lazy_static", + "rand", + "rand_chacha", +] + [[package]] name = "mock" version = "0.1.0" @@ -2026,7 +2055,7 @@ dependencies = [ "eth-types", "ethers-core", "ethers-signers", - "external-tracer", + "external-tracer 0.1.0 (git+https://github.com/smtmfft/zkevm-circuits.git?branch=feature/root-circuit)", "itertools", "lazy_static", "rand", @@ -2478,7 +2507,7 @@ dependencies = [ "hyper", "itertools", "log", - "mock", + "mock 0.1.0 (git+https://github.com/smtmfft/zkevm-circuits.git?branch=feature/root-circuit)", "rand", "rand_xorshift", "serde", @@ -3899,7 +3928,6 @@ checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f" [[package]] name = "zkevm-circuits" version = "0.1.0" -source = "git+https://github.com/smtmfft/zkevm-circuits.git?branch=feature/root-circuit#348d771db62c2bbda4aaabe45dd1ac40605a0700" dependencies = [ "array-init", "bus-mapping", @@ -3920,7 +3948,7 @@ dependencies = [ "libsecp256k1", "log", "maingate", - "mock", + "mock 0.1.0", "num", "num-bigint", "rand", diff --git a/Cargo.toml b/Cargo.toml index e93355c4..41710630 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,3 +11,9 @@ lto = "thin" [patch."https://github.com/privacy-scaling-explorations/halo2.git"] halo2_proofs = { git = "https://github.com/smtmfft/halo2.git", rev = "50ee8ad785c53232824e60b4ff6df32b69970358", package = "halo2_proofs" } + +[patch."https://github.com/smtmfft/zkevm-circuits.git"] +bus-mapping = {path = "../zkevm-circuits/bus-mapping" } +eth-types = { path = "../zkevm-circuits/eth-types" } +zkevm-circuits = { path = "../zkevm-circuits/zkevm-circuits" } + diff --git a/common/src/prover.rs b/common/src/prover.rs index 8e0f90c3..9c2e30ec 100644 --- a/common/src/prover.rs +++ b/common/src/prover.rs @@ -48,10 +48,14 @@ pub struct ProofRequestOptions { pub circuit: String, /// the block number pub block: u64, - /// the rpc url - pub rpc: String, + /// the l1 rpc url + pub l1_rpc: String, + /// the l2 rpc url + pub l2_rpc: String, /// the prover address pub prover: String, + /// the propose tx hash + pub propose_tx_hash: String, /// retry proof computation if error pub retry: bool, /// Parameters file or directory to use. @@ -74,7 +78,10 @@ pub struct ProofRequestOptions { impl PartialEq for ProofRequestOptions { fn eq(&self, other: &Self) -> bool { self.block == other.block - && self.rpc == other.rpc + && self.l1_rpc == other.l1_rpc + && self.l2_rpc == other.l2_rpc + && self.prover == other.prover + && self.propose_tx_hash == other.propose_tx_hash && self.param == other.param && self.circuit == other.circuit && self.mock == other.mock diff --git a/coordinator/src/shared_state.rs b/coordinator/src/shared_state.rs index 75283c14..dd44983e 100644 --- a/coordinator/src/shared_state.rs +++ b/coordinator/src/shared_state.rs @@ -1058,8 +1058,10 @@ impl SharedState { let proof_options = ProofRequestOptions { circuit: config.circuit_name.clone(), block: block_num.as_u64(), - rpc: config.l2_rpc_url.to_string(), + l1_rpc: config.l1_rpc_url.to_string(), + l2_rpc: config.l2_rpc_url.to_string(), prover: String::from(""), + propose_tx_hash: String::from(""), retry: false, param: config.params_path.clone(), mock: config.mock_prover, diff --git a/prover/src/bin/prover_cmd.rs b/prover/src/bin/prover_cmd.rs index 284cd8b5..7494659f 100644 --- a/prover/src/bin/prover_cmd.rs +++ b/prover/src/bin/prover_cmd.rs @@ -29,7 +29,7 @@ async fn main() { let request = ProofRequestOptions { circuit: "super".to_string(), block: block_num, - rpc: rpc_url, + l2_rpc: rpc_url, retry: false, param: Some(params_path), mock: false, diff --git a/prover/src/circuit_witness.rs b/prover/src/circuit_witness.rs index 893b76fb..2cd1ae4b 100644 --- a/prover/src/circuit_witness.rs +++ b/prover/src/circuit_witness.rs @@ -1,13 +1,14 @@ use bus_mapping::circuit_input_builder::BuilderClient; use bus_mapping::circuit_input_builder::CircuitsParams; use bus_mapping::mock::BlockData; +use bus_mapping::public_input_builder::get_txs_rlp; use bus_mapping::rpc::GethClient; -use eth_types::geth_types; use eth_types::geth_types::GethData; use eth_types::Address; use eth_types::ToBigEndian; use eth_types::Word; use eth_types::H256; +use eth_types::{geth_types, Bytes}; use ethers_providers::Http; use halo2_proofs::halo2curves::bn256::Fr; use std::str::FromStr; @@ -21,6 +22,7 @@ pub struct CircuitWitness { pub eth_block: eth_types::Block, pub block: bus_mapping::circuit_input_builder::Block, pub code_db: bus_mapping::state_db::CodeDB, + pub txs_rlp: Bytes, } impl CircuitWitness { @@ -58,6 +60,7 @@ impl CircuitWitness { eth_block: empty_data.eth_block, block: builder.block, code_db: builder.code_db, + txs_rlp: Bytes::from(vec![]), }) } @@ -65,12 +68,23 @@ impl CircuitWitness { /// Expects a go-ethereum node with debug & archive capabilities on `rpc_url`. pub async fn from_rpc( block_num: &u64, - rpc_url: &str, + l1_rpc_url: &str, + propose_tx_hash: &str, + l2_rpc_url: &str, ) -> Result> { - let url = Http::from_str(rpc_url)?; - let geth_client = GethClient::new(url); + let l1_url = Http::from_str(l1_rpc_url)?; + let l1_geth_client = GethClient::new(l1_url); + let propose_tx_hash = eth_types::H256::from_slice( + &hex::decode(propose_tx_hash).expect("parse propose tx hash"), + ); + let txs_rlp = get_txs_rlp(&l1_geth_client, propose_tx_hash).await?; + + let l2_url = Http::from_str(l2_rpc_url)?; + let l2_geth_client = GethClient::new(l2_url); // TODO: add support for `eth_getHeaderByNumber` - let block = geth_client.get_block_by_number((*block_num).into()).await?; + let block = l2_geth_client + .get_block_by_number((*block_num).into()) + .await?; let circuit_config = crate::match_circuit_params_txs!(block.transactions.len(), CIRCUIT_CONFIG, { return Err(format!( @@ -86,7 +100,7 @@ impl CircuitWitness { max_rws: circuit_config.max_rws, keccak_padding: Some(circuit_config.keccak_padding), }; - let builder = BuilderClient::new(geth_client, circuit_params).await?; + let builder = BuilderClient::new(l2_geth_client, circuit_params).await?; let (builder, eth_block) = builder.gen_inputs(*block_num).await?; Ok(Self { @@ -94,6 +108,7 @@ impl CircuitWitness { eth_block, block: builder.block, code_db: builder.code_db, + txs_rlp, }) } diff --git a/prover/src/circuits.rs b/prover/src/circuits.rs index dbb86a10..1bc7b0db 100644 --- a/prover/src/circuits.rs +++ b/prover/src/circuits.rs @@ -62,7 +62,11 @@ pub fn gen_pi_circuit< let prover = eth_types::Address::from_slice( &hex::decode(prover_address.as_bytes()).expect("parse_address"), ); - let circuit = PiTestCircuit::(PiCircuit::new_from_block_with_prover(&block, prover)); + let circuit = PiTestCircuit::(PiCircuit::new_from_block_with_extra( + &block, + prover, + witness.txs_rlp.clone(), + )); Ok(circuit) } diff --git a/prover/src/server.rs b/prover/src/server.rs index 29b13573..92579bed 100644 --- a/prover/src/server.rs +++ b/prover/src/server.rs @@ -185,9 +185,14 @@ async fn handle_method( let options: ProofRequestOptions = serde_json::from_value(options.to_owned()).map_err(|e| e.to_string())?; - let witness = CircuitWitness::from_rpc(&options.block, &options.rpc) - .await - .map_err(|e| e.to_string())?; + let witness = CircuitWitness::from_rpc( + &options.block, + &options.l1_rpc, + &options.propose_tx_hash, + &options.l2_rpc, + ) + .await + .map_err(|e| e.to_string())?; let circuit_config = crate::match_circuit_params!(witness.gas_used(), CIRCUIT_CONFIG, { diff --git a/prover/src/shared_state.rs b/prover/src/shared_state.rs index ebf7f5e8..fb0594c4 100644 --- a/prover/src/shared_state.rs +++ b/prover/src/shared_state.rs @@ -16,11 +16,11 @@ use halo2_proofs::plonk::Circuit; use halo2_proofs::plonk::{keygen_pk, keygen_vk}; use halo2_proofs::poly::commitment::Params; use hyper::Uri; +use rand::{thread_rng, Rng}; use snark_verifier::loader::native::NativeLoader; use snark_verifier::system::halo2::compile; use snark_verifier::system::halo2::transcript::evm::EvmTranscript; use snark_verifier::system::halo2::Config as PlonkConfig; -use rand::{thread_rng, Rng}; use std::collections::HashMap; use std::fmt::Write; use std::fs::File; @@ -89,11 +89,13 @@ macro_rules! gen_proof { { CIRCUIT_CONFIG.max_txs }, { CIRCUIT_CONFIG.max_calldata }, { CIRCUIT_CONFIG.max_rws }, - _>(&witness, task_options.prover, fixed_rng())?; + _, + >(&witness, task_options.prover, fixed_rng())?; circuit_proof.k = CIRCUIT_CONFIG.min_k as u8; circuit_proof.instance = collect_instance(&circuit.0.instance()); - let prover = MockProver::run(CIRCUIT_CONFIG.min_k as u32, &circuit, circuit.0.instance()) - .expect("MockProver::run"); + let prover = + MockProver::run(CIRCUIT_CONFIG.min_k as u32, &circuit, circuit.0.instance()) + .expect("MockProver::run"); prover.verify_par().expect("MockProver::verify_par"); circuit_proof.duration = Instant::now().duration_since(time_started).as_millis() as u32; } else { @@ -372,10 +374,14 @@ impl SharedState { let self_copy = self.clone(); tokio::spawn(async move { - let witness = - CircuitWitness::from_rpc(&task_options_copy.block, &task_options_copy.rpc) - .await - .map_err(|e| e.to_string())?; + let witness = CircuitWitness::from_rpc( + &task_options_copy.block, + &task_options_copy.l1_rpc, + &task_options_copy.propose_tx_hash, + &task_options_copy.l2_rpc, + ) + .await + .map_err(|e| e.to_string())?; let (config, circuit_proof, aggregation_proof) = crate::match_circuit_params_txs!( witness.txs().len(), diff --git a/prover/tests/proverd.rs b/prover/tests/proverd.rs index f0947fb3..1172a276 100644 --- a/prover/tests/proverd.rs +++ b/prover/tests/proverd.rs @@ -28,14 +28,14 @@ async fn proverd_simple_signaling() { circuit: "super".to_string(), block: 1, retry: false, - rpc: "http://localhost:1111".to_string(), + l2_rpc: "http://localhost:1111".to_string(), ..Default::default() }; let proof_b = ProofRequestOptions { circuit: "super".to_string(), block: 2, retry: false, - rpc: "http://localhost:1111".to_string(), + l2_rpc: "http://localhost:1111".to_string(), ..Default::default() }; From 4cd8b7706ecd7a179a46b0f01c80d9f65761ff86 Mon Sep 17 00:00:00 2001 From: john xu Date: Mon, 27 Feb 2023 16:02:17 +0800 Subject: [PATCH 2/3] chore: remove patch --- Cargo.lock | 46 +++++++---------------------------- Cargo.toml | 8 +----- prover/src/circuit_witness.rs | 2 +- 3 files changed, 11 insertions(+), 45 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 856a5c5b..188a343d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -341,6 +341,7 @@ checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" [[package]] name = "bus-mapping" version = "0.1.0" +source = "git+https://github.com/smtmfft/zkevm-circuits.git?branch=feature/root-circuit#348d771db62c2bbda4aaabe45dd1ac40605a0700" dependencies = [ "eth-types", "ethers-core", @@ -987,6 +988,7 @@ dependencies = [ [[package]] name = "eth-types" version = "0.1.0" +source = "git+https://github.com/smtmfft/zkevm-circuits.git?branch=feature/root-circuit#348d771db62c2bbda4aaabe45dd1ac40605a0700" dependencies = [ "ethers-core", "ethers-signers", @@ -1137,23 +1139,13 @@ dependencies = [ "thiserror", ] -[[package]] -name = "external-tracer" -version = "0.1.0" -dependencies = [ - "eth-types", - "geth-utils 0.1.0", - "serde", - "serde_json", -] - [[package]] name = "external-tracer" version = "0.1.0" source = "git+https://github.com/smtmfft/zkevm-circuits.git?branch=feature/root-circuit#348d771db62c2bbda4aaabe45dd1ac40605a0700" dependencies = [ "eth-types", - "geth-utils 0.1.0 (git+https://github.com/smtmfft/zkevm-circuits.git?branch=feature/root-circuit)", + "geth-utils", "serde", "serde_json", ] @@ -1352,6 +1344,7 @@ dependencies = [ [[package]] name = "gadgets" version = "0.1.0" +source = "git+https://github.com/smtmfft/zkevm-circuits.git?branch=feature/root-circuit#348d771db62c2bbda4aaabe45dd1ac40605a0700" dependencies = [ "digest 0.7.6", "eth-types", @@ -1388,15 +1381,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "geth-utils" -version = "0.1.0" -dependencies = [ - "env_logger", - "gobuild", - "log", -] - [[package]] name = "geth-utils" version = "0.1.0" @@ -1878,6 +1862,7 @@ dependencies = [ [[package]] name = "keccak256" version = "0.1.0" +source = "git+https://github.com/smtmfft/zkevm-circuits.git?branch=feature/root-circuit#348d771db62c2bbda4aaabe45dd1ac40605a0700" dependencies = [ "env_logger", "eth-types", @@ -2033,20 +2018,6 @@ dependencies = [ "windows-sys 0.45.0", ] -[[package]] -name = "mock" -version = "0.1.0" -dependencies = [ - "eth-types", - "ethers-core", - "ethers-signers", - "external-tracer 0.1.0", - "itertools", - "lazy_static", - "rand", - "rand_chacha", -] - [[package]] name = "mock" version = "0.1.0" @@ -2055,7 +2026,7 @@ dependencies = [ "eth-types", "ethers-core", "ethers-signers", - "external-tracer 0.1.0 (git+https://github.com/smtmfft/zkevm-circuits.git?branch=feature/root-circuit)", + "external-tracer", "itertools", "lazy_static", "rand", @@ -2507,7 +2478,7 @@ dependencies = [ "hyper", "itertools", "log", - "mock 0.1.0 (git+https://github.com/smtmfft/zkevm-circuits.git?branch=feature/root-circuit)", + "mock", "rand", "rand_xorshift", "serde", @@ -3928,6 +3899,7 @@ checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f" [[package]] name = "zkevm-circuits" version = "0.1.0" +source = "git+https://github.com/smtmfft/zkevm-circuits.git?branch=feature/root-circuit#348d771db62c2bbda4aaabe45dd1ac40605a0700" dependencies = [ "array-init", "bus-mapping", @@ -3948,7 +3920,7 @@ dependencies = [ "libsecp256k1", "log", "maingate", - "mock 0.1.0", + "mock", "num", "num-bigint", "rand", diff --git a/Cargo.toml b/Cargo.toml index 41710630..61f9d930 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,10 +10,4 @@ opt-level = 3 lto = "thin" [patch."https://github.com/privacy-scaling-explorations/halo2.git"] -halo2_proofs = { git = "https://github.com/smtmfft/halo2.git", rev = "50ee8ad785c53232824e60b4ff6df32b69970358", package = "halo2_proofs" } - -[patch."https://github.com/smtmfft/zkevm-circuits.git"] -bus-mapping = {path = "../zkevm-circuits/bus-mapping" } -eth-types = { path = "../zkevm-circuits/eth-types" } -zkevm-circuits = { path = "../zkevm-circuits/zkevm-circuits" } - +halo2_proofs = { git = "https://github.com/smtmfft/halo2.git", rev = "50ee8ad785c53232824e60b4ff6df32b69970358", package = "halo2_proofs" } \ No newline at end of file diff --git a/prover/src/circuit_witness.rs b/prover/src/circuit_witness.rs index 2cd1ae4b..ed4dafde 100644 --- a/prover/src/circuit_witness.rs +++ b/prover/src/circuit_witness.rs @@ -60,7 +60,7 @@ impl CircuitWitness { eth_block: empty_data.eth_block, block: builder.block, code_db: builder.code_db, - txs_rlp: Bytes::from(vec![]), + txs_rlp: Bytes::default(), }) } From b905679318ce3c0e6bb613020161e871efc10201 Mon Sep 17 00:00:00 2001 From: john xu Date: Tue, 28 Feb 2023 12:06:10 +0800 Subject: [PATCH 3/3] fix: bump ethers version to fix bug --- Cargo.lock | 360 +++++++++++++++++++++++++++++++++++++---- coordinator/Cargo.toml | 19 ++- prover/Cargo.toml | 16 +- 3 files changed, 356 insertions(+), 39 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 188a343d..f4d71b0b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9,11 +9,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" dependencies = [ "cfg-if", - "cipher", + "cipher 0.3.0", "cpufeatures", "opaque-debug 0.3.0", ] +[[package]] +name = "aes" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "433cfd6710c9986c576a25ca913c39d66a6474107b406f34f91d4a8923395241" +dependencies = [ + "cfg-if", + "cipher 0.4.3", + "cpufeatures", +] + [[package]] name = "ahash" version = "0.7.6" @@ -344,8 +355,8 @@ version = "0.1.0" source = "git+https://github.com/smtmfft/zkevm-circuits.git?branch=feature/root-circuit#348d771db62c2bbda4aaabe45dd1ac40605a0700" dependencies = [ "eth-types", - "ethers-core", - "ethers-providers", + "ethers-core 0.17.0", + "ethers-providers 0.17.0", "gadgets", "halo2_proofs 0.2.0", "itertools", @@ -446,6 +457,16 @@ dependencies = [ "generic-array 0.14.6", ] +[[package]] +name = "cipher" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1873270f8f7942c191139cb8a40fd228da6c3fd2fc376d7e92d47aa14aeb59e" +dependencies = [ + "crypto-common", + "inout", +] + [[package]] name = "clap" version = "4.1.6" @@ -568,14 +589,23 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb4a24b1aaf0fd0ce8b45161144d6f42cd91677fd5940fd431183eb023b3a2b8" +[[package]] +name = "convert_case" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" +dependencies = [ + "unicode-segmentation", +] + [[package]] name = "coordinator" version = "0.1.0" dependencies = [ "clap", "env_logger", - "ethers-core", - "ethers-signers", + "ethers-core 1.0.2", + "ethers-signers 1.0.2", "hyper", "log", "rand", @@ -689,7 +719,16 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "049bb91fb4aaf0e3c7efa6cd5ef877dbbbd15b39dad06d9948de4ec8a75761ea" dependencies = [ - "cipher", + "cipher 0.3.0", +] + +[[package]] +name = "ctr" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" +dependencies = [ + "cipher 0.4.3", ] [[package]] @@ -816,6 +855,17 @@ dependencies = [ "zeroize", ] +[[package]] +name = "derive_more" +version = "0.99.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "digest" version = "0.7.6" @@ -969,14 +1019,36 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f65b750ac950f2f825b36d08bef4cda4112e19a7b1a68f6e2bb499413e12440" dependencies = [ - "aes", - "ctr", + "aes 0.7.5", + "ctr 0.8.0", + "digest 0.10.6", + "hex", + "hmac 0.12.1", + "pbkdf2 0.11.0", + "rand", + "scrypt 0.8.1", + "serde", + "serde_json", + "sha2 0.10.6", + "sha3 0.10.6", + "thiserror", + "uuid", +] + +[[package]] +name = "eth-keystore" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fda3bf123be441da5260717e0661c25a2fd9cb2b2c1d20bf2e05580047158ab" +dependencies = [ + "aes 0.8.2", + "ctr 0.9.2", "digest 0.10.6", "hex", "hmac 0.12.1", "pbkdf2 0.11.0", "rand", - "scrypt", + "scrypt 0.10.0", "serde", "serde_json", "sha2 0.10.6", @@ -990,8 +1062,8 @@ name = "eth-types" version = "0.1.0" source = "git+https://github.com/smtmfft/zkevm-circuits.git?branch=feature/root-circuit#348d771db62c2bbda4aaabe45dd1ac40605a0700" dependencies = [ - "ethers-core", - "ethers-signers", + "ethers-core 0.17.0", + "ethers-signers 0.17.0", "halo2_proofs 0.2.0", "hex", "itertools", @@ -1016,7 +1088,24 @@ version = "17.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4966fba78396ff92db3b817ee71143eccd98acf0f876b8d600e585a670c5d1b" dependencies = [ - "ethereum-types", + "ethereum-types 0.13.1", + "hex", + "once_cell", + "regex", + "serde", + "serde_json", + "sha3 0.10.6", + "thiserror", + "uint", +] + +[[package]] +name = "ethabi" +version = "18.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7413c5f74cc903ea37386a8965a936cbeb334bd270862fdece542c1b2dcbc898" +dependencies = [ + "ethereum-types 0.14.1", "hex", "once_cell", "regex", @@ -1036,7 +1125,22 @@ dependencies = [ "crunchy", "fixed-hash 0.7.0", "impl-rlp", - "impl-serde", + "impl-serde 0.3.2", + "tiny-keccak", +] + +[[package]] +name = "ethbloom" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c22d4b5885b6aa2fe5e8b9329fb8d232bf739e434e6b87347c63bdd00c120f60" +dependencies = [ + "crunchy", + "fixed-hash 0.8.0", + "impl-codec", + "impl-rlp", + "impl-serde 0.4.0", + "scale-info", "tiny-keccak", ] @@ -1046,14 +1150,30 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2827b94c556145446fcce834ca86b7abf0c39a805883fe20e72c5bfdb5a0dc6" dependencies = [ - "ethbloom", + "ethbloom 0.12.1", "fixed-hash 0.7.0", "impl-rlp", - "impl-serde", + "impl-serde 0.3.2", "primitive-types 0.11.1", "uint", ] +[[package]] +name = "ethereum-types" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee" +dependencies = [ + "ethbloom 0.13.0", + "fixed-hash 0.8.0", + "impl-codec", + "impl-rlp", + "impl-serde 0.4.0", + "primitive-types 0.12.1", + "scale-info", + "uint", +] + [[package]] name = "ethers-core" version = "0.17.0" @@ -1063,9 +1183,9 @@ dependencies = [ "arrayvec", "bytes", "chrono", - "convert_case", + "convert_case 0.5.0", "elliptic-curve", - "ethabi", + "ethabi 17.2.0", "fastrlp", "generic-array 0.14.6", "hex", @@ -1084,6 +1204,35 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "ethers-core" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ade3e9c97727343984e1ceada4fdab11142d2ee3472d2c67027d56b1251d4f15" +dependencies = [ + "arrayvec", + "bytes", + "chrono", + "convert_case 0.6.0", + "elliptic-curve", + "ethabi 18.0.0", + "generic-array 0.14.6", + "hex", + "k256", + "open-fastrlp", + "proc-macro2", + "rand", + "rlp", + "rlp-derive", + "serde", + "serde_json", + "strum", + "syn", + "thiserror", + "tiny-keccak", + "unicode-xid", +] + [[package]] name = "ethers-providers" version = "0.17.0" @@ -1093,7 +1242,44 @@ dependencies = [ "async-trait", "auto_impl", "base64 0.13.1", - "ethers-core", + "ethers-core 0.17.0", + "futures-channel", + "futures-core", + "futures-timer", + "futures-util", + "getrandom", + "hashers", + "hex", + "http", + "once_cell", + "parking_lot 0.11.2", + "pin-project", + "reqwest", + "serde", + "serde_json", + "thiserror", + "tokio", + "tokio-tungstenite", + "tracing", + "tracing-futures", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-timer", + "web-sys", + "ws_stream_wasm", +] + +[[package]] +name = "ethers-providers" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1a9e0597aa6b2fdc810ff58bc95e4eeaa2c219b3e615ed025106ecb027407d8" +dependencies = [ + "async-trait", + "auto_impl", + "base64 0.13.1", + "ethers-core 1.0.2", "futures-channel", "futures-core", "futures-timer", @@ -1131,8 +1317,26 @@ dependencies = [ "coins-bip32", "coins-bip39", "elliptic-curve", - "eth-keystore", - "ethers-core", + "eth-keystore 0.4.2", + "ethers-core 0.17.0", + "hex", + "rand", + "sha2 0.10.6", + "thiserror", +] + +[[package]] +name = "ethers-signers" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f41ced186867f64773db2e55ffdd92959e094072a1d09a5e5e831d443204f98" +dependencies = [ + "async-trait", + "coins-bip32", + "coins-bip39", + "elliptic-curve", + "eth-keystore 0.5.0", + "ethers-core 1.0.2", "hex", "rand", "sha2 0.10.6", @@ -1165,7 +1369,7 @@ dependencies = [ "arrayvec", "auto_impl", "bytes", - "ethereum-types", + "ethereum-types 0.13.1", "fastrlp-derive", ] @@ -1737,6 +1941,15 @@ dependencies = [ "serde", ] +[[package]] +name = "impl-serde" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" +dependencies = [ + "serde", +] + [[package]] name = "impl-trait-for-tuples" version = "0.2.2" @@ -1759,6 +1972,15 @@ dependencies = [ "serde", ] +[[package]] +name = "inout" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +dependencies = [ + "generic-array 0.14.6", +] + [[package]] name = "instant" version = "0.1.12" @@ -2024,8 +2246,8 @@ version = "0.1.0" source = "git+https://github.com/smtmfft/zkevm-circuits.git?branch=feature/root-circuit#348d771db62c2bbda4aaabe45dd1ac40605a0700" dependencies = [ "eth-types", - "ethers-core", - "ethers-signers", + "ethers-core 0.17.0", + "ethers-signers 0.17.0", "external-tracer", "itertools", "lazy_static", @@ -2168,6 +2390,31 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +[[package]] +name = "open-fastrlp" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "786393f80485445794f6043fd3138854dd109cc6c4bd1a6383db304c9ce9b9ce" +dependencies = [ + "arrayvec", + "auto_impl", + "bytes", + "ethereum-types 0.14.1", + "open-fastrlp-derive", +] + +[[package]] +name = "open-fastrlp-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "003b2be5c6c53c1cfeb0a238b8a1c3915cd410feb684457a36c10038f764bb1c" +dependencies = [ + "bytes", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "os_str_bytes" version = "6.4.1" @@ -2395,7 +2642,7 @@ dependencies = [ "fixed-hash 0.7.0", "impl-codec", "impl-rlp", - "impl-serde", + "impl-serde 0.3.2", "uint", ] @@ -2408,6 +2655,8 @@ dependencies = [ "fixed-hash 0.8.0", "impl-codec", "impl-rlp", + "impl-serde 0.4.0", + "scale-info", "uint", ] @@ -2471,8 +2720,8 @@ dependencies = [ "clap", "env_logger", "eth-types", - "ethers-providers", - "ethers-signers", + "ethers-providers 1.0.2", + "ethers-signers 1.0.2", "halo2_proofs 0.2.0", "hex", "hyper", @@ -2878,7 +3127,40 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c0fbb5f676da676c260ba276a8f43a8dc67cf02d1438423aeb1c677a7212686" dependencies = [ - "cipher", + "cipher 0.3.0", +] + +[[package]] +name = "salsa20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" +dependencies = [ + "cipher 0.4.3", +] + +[[package]] +name = "scale-info" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "001cf62ece89779fd16105b5f515ad0e5cedcd5440d3dd806bb067978e7c3608" +dependencies = [ + "cfg-if", + "derive_more", + "parity-scale-codec", + "scale-info-derive", +] + +[[package]] +name = "scale-info-derive" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "303959cf613a6f6efd19ed4b4ad5bf79966a13352716299ad532cfb115f4205c" +dependencies = [ + "proc-macro-crate 1.3.0", + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -2902,7 +3184,19 @@ dependencies = [ "hmac 0.12.1", "password-hash 0.3.2", "pbkdf2 0.10.1", - "salsa20", + "salsa20 0.9.0", + "sha2 0.10.6", +] + +[[package]] +name = "scrypt" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f9e24d2b632954ded8ab2ef9fea0a0c769ea56ea98bddbafbad22caeeadf45d" +dependencies = [ + "hmac 0.12.1", + "pbkdf2 0.11.0", + "salsa20 0.10.2", "sha2 0.10.6", ] @@ -3564,6 +3858,12 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "unicode-segmentation" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" + [[package]] name = "unicode-width" version = "0.1.10" @@ -3908,8 +4208,8 @@ dependencies = [ "ecdsa 0.1.0", "env_logger", "eth-types", - "ethers-core", - "ethers-signers", + "ethers-core 0.17.0", + "ethers-signers 0.17.0", "gadgets", "halo2_proofs 0.2.0", "hex", diff --git a/coordinator/Cargo.toml b/coordinator/Cargo.toml index e6c29e8c..d2cf3c27 100644 --- a/coordinator/Cargo.toml +++ b/coordinator/Cargo.toml @@ -8,9 +8,15 @@ edition = "2021" [dependencies] clap = { version = "4.0.15", features = ["derive", "env"] } env_logger = "0.9.0" -ethers-core = "0.17.0" -ethers-signers = "0.17.0" -hyper = { version = "0.14.16", features = ["client", "server", "http1", "http2", "runtime"] } +ethers-core = "1.0.2" +ethers-signers = "1.0.2" +hyper = { version = "0.14.16", features = [ + "client", + "server", + "http1", + "http2", + "runtime", +] } log = "0.4.14" rand = "0.8.4" serde = { version = "1.0.136", features = ["derive"] } @@ -20,5 +26,10 @@ tokio = { version = "1.16.1", features = ["macros", "rt-multi-thread", "time"] } zkevm_common = { path = "../common" } [dev-dependencies] -tokio = { version = "1.16.1", features = ["macros", "rt-multi-thread", "time", "parking_lot"] } +tokio = { version = "1.16.1", features = [ + "macros", + "rt-multi-thread", + "time", + "parking_lot", +] } rust-lzma = "0.5.1" diff --git a/prover/Cargo.toml b/prover/Cargo.toml index 3dd00d4d..eddafbb9 100644 --- a/prover/Cargo.toml +++ b/prover/Cargo.toml @@ -8,11 +8,17 @@ license = "MIT OR Apache-2.0" halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", tag = "v2022_10_22" } bus-mapping = { git = "https://github.com/smtmfft/zkevm-circuits.git", branch = "feature/root-circuit" } eth-types = { git = "https://github.com/smtmfft/zkevm-circuits.git", branch = "feature/root-circuit" } -zkevm-circuits = { git = "https://github.com/smtmfft/zkevm-circuits.git", branch = "feature/root-circuit", features = ["test"] } -snark-verifier = { git = "https://github.com/privacy-scaling-explorations/snark-verifier", tag = "v2022_12_23", default-features = false, features = ["loader_evm", "loader_halo2", "system_halo2"] } +zkevm-circuits = { git = "https://github.com/smtmfft/zkevm-circuits.git", branch = "feature/root-circuit", features = [ + "test", +] } +snark-verifier = { git = "https://github.com/privacy-scaling-explorations/snark-verifier", tag = "v2022_12_23", default-features = false, features = [ + "loader_evm", + "loader_halo2", + "system_halo2", +] } env_logger = "0.9.0" -ethers-providers = "0.17.0" +ethers-providers = "1.0.2" hyper = { version = "0.14.16", features = ["server"] } rand_xorshift = "0.3" log = "0.4.14" @@ -27,9 +33,9 @@ clap = { version = "4.0.14", features = ["derive", "env"] } hex = "0.4.3" # autogen -mock = { git = "https://github.com/smtmfft/zkevm-circuits.git", branch = "feature/root-circuit", optional = true } +mock = { git = "https://github.com/smtmfft/zkevm-circuits.git", branch = "feature/root-circuit", optional = true } -ethers-signers = { version = "0.17.0", optional = true } +ethers-signers = { version = "1.0.2", optional = true } zkevm_dev = { path = "../dev", optional = true } [features]