Skip to content
This repository was archived by the owner on Apr 18, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ProverBenchFromHalo2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
steps:
- run: echo "halo2 PR ${{ env.HALO2PR }} submitted by ${{ env.GH_USER }}"
- run: echo "Running prover benchmarking due to ${{ github.event.inputs.event-type }}."
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
ref: 'halo2benchmarking'
- run: .github/proverCiScripts/wakeUpProver.sh
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
os: ${{ fromJSON(needs.runner.outputs.runner-matrix2) }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: set HOME env
run: |
echo "HOME=/home/CI" >> $GITHUB_ENV
Expand Down Expand Up @@ -97,7 +97,7 @@ jobs:
os: ${{ fromJSON(needs.runner.outputs.runner-matrix1) }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: set HOME env
run: |
echo "HOME=/home/CI" >> $GITHUB_ENV
Expand Down Expand Up @@ -152,7 +152,7 @@ jobs:
- wasm32-wasi

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
override: false
Expand Down Expand Up @@ -195,7 +195,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
override: false
Expand Down Expand Up @@ -231,7 +231,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
override: false
Expand Down Expand Up @@ -273,7 +273,7 @@ jobs:
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
override: false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gh-actions-prover-benches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

steps:
- name: Check out repository code
uses: actions/checkout@v2
uses: actions/checkout@v3
- run: .github/proverCiScripts/wakeUpProver.sh
shell: bash
- run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
needs: set-outputs

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
override: false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
components: clippy
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/select-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ jobs:
runs-on: ${{ inputs.bastion-host }}
concurrency: ${{ needs.select.outputs.matrix1 }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- run: .github/ciChecksScripts/wakeUpRunner.sh
2 changes: 1 addition & 1 deletion .github/workflows/test-features.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- test-circuits
- warn-unimplemented
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
override: false
Expand Down
60 changes: 38 additions & 22 deletions testool/src/statetest/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,8 @@ fn trace_config_to_witness_block_l1(
pub const MAX_TXS: usize = 100;
pub const MAX_INNER_BLOCKS: usize = 100;
pub const MAX_EXP_STEPS: usize = 10_000;
pub const MAX_CALLDATA: usize = 600_000;
pub const MAX_CALLDATA: usize = 350_000;
pub const MAX_RLP_ROWS: usize = 800_000;
pub const MAX_BYTECODE: usize = 600_000;
pub const MAX_MPT_ROWS: usize = 1_000_000;
pub const MAX_KECCAK_ROWS: usize = 1_000_000;
Expand All @@ -448,7 +449,7 @@ fn get_sub_circuit_limit_l2() -> Vec<usize> {
MAX_RWS, // copy
MAX_KECCAK_ROWS, // keccak
MAX_RWS, // tx
MAX_CALLDATA, // rlp
MAX_RLP_ROWS, // rlp
8 * MAX_EXP_STEPS, // exp
MAX_KECCAK_ROWS, // modexp
MAX_RWS, // pi
Expand All @@ -473,7 +474,7 @@ fn get_params_for_super_circuit_test_l2() -> CircuitsParams {
max_vertical_circuit_rows: MAX_VERTICLE_ROWS,
max_exp_steps: MAX_EXP_STEPS,
max_mpt_rows: MAX_MPT_ROWS,
max_rlp_rows: MAX_CALLDATA,
max_rlp_rows: MAX_RLP_ROWS,
max_ec_ops: PrecompileEcParams {
ec_add: MAX_PRECOMPILE_EC_ADD,
ec_mul: MAX_PRECOMPILE_EC_MUL,
Expand Down Expand Up @@ -599,11 +600,23 @@ pub fn run_test(
CircuitTestBuilder::<1, 1>::new_from_block(witness_block)
.copy_checks(None)
.run();
} else if (*CIRCUIT) == "ccc" {
} else {
let prover = match (*CIRCUIT).as_str() {
"modexp" => test_with::<ModExpCircuit<Fr>>(&witness_block),
"bytecode" => test_with::<BytecodeCircuit<Fr>>(&witness_block),
"ecc" => test_with::<EccCircuit<Fr, 9>>(&witness_block),
"sig" => test_with::<SigCircuit<Fr>>(&witness_block),
_ => unimplemented!(),
};
prover.assert_satisfied_par();
}
} else {
log::debug!("test super circuit {}", *CIRCUIT);
if (*CIRCUIT) == "ccc" {
let row_usage = ScrollSuperCircuit::min_num_rows_block_subcircuits(&witness_block);
let mut overflow = false;
for (num, limit) in row_usage.iter().zip_eq(get_sub_circuit_limit_l2().iter()) {
if num.row_num_real >= *limit {
if num.row_num_real > *limit {
log::warn!(
"ccc detail: suite.id {}, st.id {}, circuit {}, num {}, limit {}",
suite.id,
Expand All @@ -615,29 +628,32 @@ pub fn run_test(
overflow = true;
}
}
let max_row_usage = row_usage.iter().max_by_key(|r| r.row_num_real).unwrap();
if overflow {
log::warn!("ccc overflow: suite.id {}, st.id {}", suite.id, st.id);
log::warn!(
"ccc overflow: st.id {}, detail {} {}",
st.id,
max_row_usage.name,
max_row_usage.row_num_real
);
panic!("{} {}", max_row_usage.name, max_row_usage.row_num_real);
} else {
log::info!("ccc ok: suite.id {}, st.id {}", suite.id, st.id);
log::info!(
"ccc ok: st.id {}, detail {} {}",
st.id,
max_row_usage.name,
max_row_usage.row_num_real
);
}
} else {
let prover = match (*CIRCUIT).as_str() {
"modexp" => test_with::<ModExpCircuit<Fr>>(&witness_block),
"bytecode" => test_with::<BytecodeCircuit<Fr>>(&witness_block),
"ecc" => test_with::<EccCircuit<Fr, 9>>(&witness_block),
"sig" => test_with::<SigCircuit<Fr>>(&witness_block),
_ => unimplemented!(),
};
// TODO: do we need to automatically adjust this k?
let k = 20;
// TODO: remove this MOCK_RANDOMNESS?
let circuit = ScrollSuperCircuit::new_from_block(&witness_block);
let instance = circuit.instance();
let prover = MockProver::run(k, &circuit, instance).unwrap();
prover.assert_satisfied_par();
}
} else {
// TODO: do we need to automatically adjust this k?
let k = 20;
// TODO: remove this MOCK_RANDOMNESS?
let circuit = ScrollSuperCircuit::new_from_block(&witness_block);
let instance = circuit.instance();
let prover = MockProver::run(k, &circuit, instance).unwrap();
prover.assert_satisfied_par();
};
//#[cfg(feature = "scroll")]
{
Expand Down
9 changes: 6 additions & 3 deletions zkevm-circuits/src/ecc_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1362,14 +1362,17 @@ impl<F: Field, const XI_0: i64> SubCircuit<F> for EccCircuit<F, XI_0> {
let ec_adds = block.get_ec_add_ops().len();
let ec_muls = block.get_ec_mul_ops().len();
let ec_pairings = block.get_ec_pairing_ops().len();
let max_ec_ops = &block.circuits_params.max_ec_ops;
log::debug!("ecc circuit row usage: ecadd {ec_adds}/{}, ecmul {ec_muls}/{}, ecpairing {ec_pairings}/{}",
max_ec_ops.ec_add, max_ec_ops.ec_mul, max_ec_ops.ec_pairing);

// Instead of showing actual minimum row usage,
// halo2-lib based circuits use min_row_num to represent a percentage of total-used capacity
// This functionality allows l2geth to decide if additional ops can be added.
let min_row_num = [
(row_num / block.circuits_params.max_ec_ops.ec_add) * ec_adds,
(row_num / block.circuits_params.max_ec_ops.ec_mul) * ec_muls,
(row_num / block.circuits_params.max_ec_ops.ec_pairing) * ec_pairings,
(row_num / max_ec_ops.ec_add) * ec_adds,
(row_num / max_ec_ops.ec_mul) * ec_muls,
(row_num / max_ec_ops.ec_pairing) * ec_pairings,
]
.into_iter()
.max()
Expand Down
2 changes: 1 addition & 1 deletion zkevm-circuits/src/evm_circuit/param.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub const TX_TABLE_LOOKUPS: usize = 4;
pub const RW_TABLE_LOOKUPS: usize = 8;

/// Bytecode Table lookups done in EVMCircuit
pub const BYTECODE_TABLE_LOOKUPS: usize = 4;
pub const BYTECODE_TABLE_LOOKUPS: usize = 8;

/// Block Table lookups done in EVMCircuit
pub const BLOCK_TABLE_LOOKUPS: usize = 1;
Expand Down
9 changes: 8 additions & 1 deletion zkevm-circuits/src/super_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,14 @@ impl<
row_num_total,
})
.collect_vec();
log::debug!("row_usage_details {row_usage_details:?}");
{
let mut row_usage_details_sorted = row_usage_details.clone();
row_usage_details_sorted.sort_by_key(|r| r.row_num_real);
row_usage_details_sorted.reverse();
for detail in &row_usage_details_sorted {
log::debug!("row detail {} {}", detail.name, detail.row_num_real);
}
}
row_usage_details
}
}
Expand Down