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

Commit

Permalink
Merge f5a6c74 into ca49a06
Browse files Browse the repository at this point in the history
  • Loading branch information
pinkiebell committed Feb 21, 2023
2 parents ca49a06 + f5a6c74 commit d98315b
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 21 deletions.
16 changes: 8 additions & 8 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions common/src/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ pub struct CircuitConfig {
pub max_bytecode: usize,
pub max_rws: usize,
pub max_copy_rows: usize,
pub max_exp_steps: usize,
pub min_k: usize,
pub pad_to: usize,
pub min_k_aggregation: usize,
Expand Down
22 changes: 16 additions & 6 deletions coordinator/tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,9 @@ macro_rules! wait_for_tx_no_panic {

#[macro_export]
macro_rules! finalize_chain {
($shared_state:expr, $use_dummy:expr) => {
($shared_state:expr, $use_dummy:expr) => {{
const MAX_DEADLINE_ERRORS: usize = 3;
let mut deadline_count = 0;
loop {
let rw = $shared_state.rw.lock().await;
if rw.chain_state.head_block_hash == rw.chain_state.finalized_block_hash {
Expand All @@ -199,10 +201,18 @@ macro_rules! finalize_chain {
if $use_dummy {
$shared_state.config.lock().await.dummy_prover = true;
}
$shared_state
.finalize_blocks()
.await
.expect("finalize_blocks");
let result = $shared_state.finalize_blocks().await;
if result.is_err() {
let msg = result.err().unwrap();
if msg.find("deadline has elapsed").is_some() {
deadline_count += 1;
if deadline_count > MAX_DEADLINE_ERRORS {
panic!("finalize_chain: exceeded MAX_DEADLINE_ERRORS in finalize_blocks");
}
} else {
panic!("finalize_chain: {msg}");
}
}
if $use_dummy {
$shared_state.config.lock().await.dummy_prover = dummy_prover;
}
Expand All @@ -212,7 +222,7 @@ macro_rules! finalize_chain {
sync!($shared_state);
}
}
};
}};
($shared_state:expr) => {
finalize_chain!($shared_state, false)
};
Expand Down
8 changes: 4 additions & 4 deletions docker/geth/templates/l1-testnet.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions prover/src/circuit_autogen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ macro_rules! match_circuit_params {
max_bytecode: 24634,
max_rws: 476052,
max_copy_rows: 896002,
max_exp_steps: 4200,
min_k: 20,
pad_to: 476052,
min_k_aggregation: 26,
Expand All @@ -25,6 +26,7 @@ macro_rules! match_circuit_params {
max_bytecode: 139500,
max_rws: 3161966,
max_copy_rows: 5952002,
max_exp_steps: 27900,
min_k: 23,
pad_to: 3161966,
min_k_aggregation: 26,
Expand Down
5 changes: 4 additions & 1 deletion prover/src/circuit_witness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ impl CircuitWitness {
max_bytecode: circuit_config.max_bytecode,
max_rws: circuit_config.max_rws,
max_copy_rows: circuit_config.max_copy_rows,
max_exp_steps: circuit_config.max_exp_steps,
max_evm_rows: circuit_config.pad_to,
keccak_padding: Some(circuit_config.keccak_padding),
};
let empty_data = GethData {
Expand Down Expand Up @@ -86,6 +88,8 @@ impl CircuitWitness {
max_bytecode: circuit_config.max_bytecode,
max_rws: circuit_config.max_rws,
max_copy_rows: circuit_config.max_copy_rows,
max_exp_steps: circuit_config.max_exp_steps,
max_evm_rows: circuit_config.pad_to,
keccak_padding: Some(circuit_config.keccak_padding),
};
let builder = BuilderClient::new(geth_client, circuit_params).await?;
Expand All @@ -102,7 +106,6 @@ impl CircuitWitness {
pub fn evm_witness(&self) -> zkevm_circuits::witness::Block<Fr> {
let mut block =
evm_circuit::witness::block_convert(&self.block, &self.code_db).expect("block_convert");
block.evm_circuit_pad_to = self.circuit_config.pad_to;
block.exp_circuit_pad_to = self.circuit_config.pad_to;
// fixed randomness used in PublicInput contract and SuperCircuit
block.randomness = Fr::from(0x100);
Expand Down
2 changes: 1 addition & 1 deletion prover/src/circuits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use zkevm_circuits::bytecode_circuit::circuit::BytecodeCircuit;
use zkevm_circuits::copy_circuit::CopyCircuit;
use zkevm_circuits::evm_circuit::EvmCircuit;
use zkevm_circuits::exp_circuit::ExpCircuit;
use zkevm_circuits::keccak_circuit::keccak_packed_multi::KeccakCircuit;
use zkevm_circuits::keccak_circuit::KeccakCircuit;
use zkevm_circuits::pi_circuit::PiCircuit;
use zkevm_circuits::pi_circuit::PiTestCircuit;
use zkevm_circuits::state_circuit::StateCircuit;
Expand Down
4 changes: 4 additions & 0 deletions prover/tests/autogen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ macro_rules! estimate {
// TODO: doesn't account for instruction + memory expansion
const MAX_COPY_BYTES: usize = (TX_GAS_LIMIT / COPY_GAS) * 32;
const MAX_COPY_ROWS: usize = (MAX_COPY_BYTES * 2) + 2;
const MAX_EXP_STEPS: usize = TX_GAS_LIMIT / 10;

let bytecode = $BYTECODE_FN(TX_GAS_LIMIT);
let history_hashes = vec![Word::one(); 256];
Expand All @@ -228,6 +229,7 @@ macro_rules! estimate {
max_bytecode: MAX_BYTECODE,
max_rws: MAX_RWS,
max_copy_rows: MAX_COPY_ROWS,
max_exp_steps: MAX_EXP_STEPS,
min_k: 0,
pad_to: 0,
min_k_aggregation: 0,
Expand Down Expand Up @@ -276,6 +278,8 @@ macro_rules! estimate {
max_bytecode: circuit_config.max_bytecode,
max_rws: circuit_config.max_rws,
max_copy_rows: circuit_config.max_copy_rows,
max_exp_steps: circuit_config.max_exp_steps,
max_evm_rows: circuit_config.pad_to,
keccak_padding: Some(circuit_config.keccak_padding),
};
let mut builder =
Expand Down
1 change: 0 additions & 1 deletion scripts/rpc_prover.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
set -e

curl \
--silent \
-H 'content-type: application/json' \
-d '{"id":0, "jsonrpc":"2.0","method":"'$1'", "params":['$2']}' \
"$PROVERD_LOOKUP"

0 comments on commit d98315b

Please sign in to comment.