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

Commit

Permalink
chore: some leftovers
Browse files Browse the repository at this point in the history
  • Loading branch information
KimiWu123 committed Jan 30, 2024
1 parent fc1065c commit 93ecb19
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 26 deletions.
1 change: 0 additions & 1 deletion zkevm-circuits/src/evm_circuit/execution/callop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ impl<F: Field> ExecutionGadget<F> for CallOpGadget<F> {
// whether the call is to a precompiled contract.
// precompile contracts are stored from address 0x01 to 0x09.
let is_code_address_zero = IsZeroGadget::construct(cb, call_gadget.callee_address.expr());
// FIXME try to remove 0x0A
let is_precompile_lt =
LtGadget::construct(cb, call_gadget.callee_address.expr(), 0x0A.expr());
let is_precompile = and::expr([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ impl<F: Field> ExecutionGadget<F> for ErrorOOGPrecompileGadget<F> {
let n_words = (call.call_data_length + 31) / 32;
precompile_call.base_gas_cost() + n_words * GasCost::PRECOMPILE_IDENTITY_PER_WORD
}
// PrecompileCalls::Bn128Add | PrecompileCalls::Bn128Mul | PrecompileCalls::Ecrecover =>
// { precompile_call.base_gas_cost()
// PrecompileCalls::Bn128Add | PrecompileCalls::Bn128Mul => {
// precompile_call.base_gas_cost()
// }
_ => unreachable!(),
};
Expand Down
1 change: 0 additions & 1 deletion zkevm-circuits/src/evm_circuit/util/instrumentation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ pub struct ExecStateReport {
pub keccak_table: StateReportRow,
pub exp_table: StateReportRow,
pub sig_table: StateReportRow,
pub pow_of_rand_table: StateReportRow,
}

impl From<ExecutionState> for ExecStateReport {
Expand Down
17 changes: 11 additions & 6 deletions zkevm-circuits/src/evm_circuit/util/precompile_gadget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,21 @@ impl<F: Field> PrecompileGadget<F> {
// Identity
cb.require_equal(
"input length and precompile return length are the same",
cd_length,
precompile_return_length,
cd_length.clone(),
precompile_return_length.clone(),
);
}), // add more precompile constraint closures
}),
Box::new(|cb| {
// Identity
// EcRecover
cb.require_equal(
"ECRecover: input length and precompile return length are the same",
cd_length.clone(),
128.expr(),
);
cb.require_equal(
"ECRecover: input length and precompile return length are the same",
1.expr(),
1.expr(),
precompile_return_length.clone(),
32.expr(),
);
}),
];
Expand Down
18 changes: 9 additions & 9 deletions zkevm-circuits/src/sig_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ use std::{iter, marker::PhantomData};
/// Circuit configuration arguments
pub struct SigCircuitConfigArgs<F: Field> {
/// KeccakTable
pub keccak_table: KeccakTable,
pub _keccak_table: KeccakTable,
/// SigTable
pub sig_table: SigTable,
/// Challenges
Expand All @@ -81,7 +81,7 @@ where
/// selector for keccak lookup table
q_keccak: Selector,
/// Used to lookup pk->pk_hash(addr)
keccak_table: KeccakTable,
_keccak_table: KeccakTable,
/// The exposed table to be used by tx circuit and ecrecover
sig_table: SigTable,
}
Expand All @@ -96,7 +96,7 @@ where
fn new(
meta: &mut ConstraintSystem<F>,
Self::ConfigArgs {
keccak_table,
_keccak_table,
sig_table,
challenges: _,
}: Self::ConfigArgs,
Expand Down Expand Up @@ -188,19 +188,19 @@ where
is_enable * meta.query_advice(rlc_column, Rotation(3)),
];
let table = [
meta.query_advice(keccak_table.is_enabled, Rotation::cur()),
meta.query_advice(keccak_table.input_rlc, Rotation::cur()),
meta.query_advice(keccak_table.input_len, Rotation::cur()),
meta.query_advice(keccak_table.output.lo(), Rotation::cur()),
meta.query_advice(keccak_table.output.hi(), Rotation::cur()),
meta.query_advice(_keccak_table.is_enabled, Rotation::cur()),
meta.query_advice(_keccak_table.input_rlc, Rotation::cur()),
meta.query_advice(_keccak_table.input_len, Rotation::cur()),
meta.query_advice(_keccak_table.output.lo(), Rotation::cur()),
meta.query_advice(_keccak_table.output.hi(), Rotation::cur()),
];

input.into_iter().zip(table).collect()
});

Self {
ecdsa_config,
keccak_table,
_keccak_table,
sig_table,
q_keccak,
rlc_column,
Expand Down
9 changes: 2 additions & 7 deletions zkevm-circuits/src/sig_circuit/dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ impl<F: Field + halo2_base::utils::ScalarField> SigCircuitTesterConfig<F> {
let sign_verify = SigCircuitConfig::new(
meta,
SigCircuitConfigArgs {
keccak_table,
_keccak_table: keccak_table,
challenges: challenges_expr,
sig_table,
},
Expand Down Expand Up @@ -54,16 +54,11 @@ impl<F: Field + halo2_base::utils::ScalarField> Circuit<F> for SigCircuit<F> {
) -> Result<(), Error> {
let challenges = config.challenges.values(&mut layouter);
self.synthesize_sub(&config.sign_verify, &challenges, &mut layouter)?;
config.sign_verify.keccak_table.dev_load(
config.sign_verify._keccak_table.dev_load(
&mut layouter,
&keccak_inputs_sign_verify(&self.signatures),
&challenges,
)?;
// self.assert_sig_is_valid(
// &config.sign_verify,
// &mut layouter,
// assigned_sig_verifs.as_slice(),
// )?;
Ok(())
}
}

0 comments on commit 93ecb19

Please sign in to comment.