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

Commit

Permalink
chore: fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
KimiWu123 committed Oct 4, 2023
1 parent 5c8f0d8 commit 953da96
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 16 deletions.
4 changes: 2 additions & 2 deletions bus-mapping/src/circuit_input_builder/withdrawal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use eth_types::Address;
use crate::Error;

#[derive(Debug, Default)]
/// Context of a [`Withdrawal`] which can mutate in an [`ExecStep`].
/// Context of a [`Withdrawal`].
pub struct WithdrawalContext {
/// Unique identifier of a withdrawal. This value starts from 0 and then increases
/// monotonically.
Expand Down Expand Up @@ -50,7 +50,7 @@ impl Withdrawal {
}
/// Return the amount in this withdrawal
pub fn amount_in_wei(&self) -> u64 {
self.amount * 10 ^ 9
self.amount * (10 ^ 9)
}

/// Constructor for padding withdrawal in withdrawal circuit
Expand Down
3 changes: 2 additions & 1 deletion circuit-benchmarks/src/pi_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ mod tests {
const BENCHMARK_ID: &str = "Pi Circuit";

const MAX_TXS: usize = 10;
const MAX_WITHDRAWALS: usize = 10;
const MAX_CALLDATA: usize = 128;

let degree: u32 = var("DEGREE")
Expand All @@ -42,7 +43,7 @@ mod tests {
.expect("Cannot parse DEGREE env var as u32");

let public_data = generate_publicdata(MAX_TXS);
let circuit = PiCircuit::<Fr>::new(MAX_TXS, MAX_CALLDATA, public_data);
let circuit = PiCircuit::<Fr>::new(MAX_TXS, MAX_WITHDRAWALS, MAX_CALLDATA, public_data);
let public_inputs = circuit.instance();
let instance: Vec<&[Fr]> = public_inputs.iter().map(|input| &input[..]).collect();
let instances = &[&instance[..]];
Expand Down
1 change: 1 addition & 0 deletions circuit-benchmarks/src/super_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ mod tests {

let circuits_params = FixedCParams {
max_txs: 1,
max_withdrawals: 1,
max_calldata: 32,
max_rws: 256,
max_copy_rows: 256,
Expand Down
1 change: 1 addition & 0 deletions integration-tests/tests/circuit_input_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ async fn test_circuit_input_builder_block(block_num: u64) {
FixedCParams {
max_rws: 16384,
max_txs: 1,
max_withdrawals: 1,
max_calldata: 4000,
max_bytecode: 4000,
max_copy_rows: 16384,
Expand Down
1 change: 0 additions & 1 deletion mock/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ pub use sha3::Sha3CodeGen;
pub use test_ctx::TestContext;
pub use test_ctx2::TestContext2;
pub use transaction::{AddrOrWallet, MockTransaction, CORRECT_MOCK_TXS};
pub(crate) use withdrawal::MockWithdrawal;

/// Mock block gas limit
pub const MOCK_BLOCK_GAS_LIMIT: u64 = 10_000_000_000_000_000;
Expand Down
4 changes: 2 additions & 2 deletions mock/src/test_ctx2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub struct TestContext2<const NACC: usize, const NTX: usize, const NWD: usize> {
/// Account list
pub accounts: [Account; NACC],
/// history hashes contains most recent 256 block hashes in history, where
/// the lastest one is at history_hashes[history_hashes.len() - 1].
/// the latest one is at history_hashes[history_hashes.len() - 1].
pub history_hashes: Vec<Word>,
/// Block from geth
pub eth_block: eth_types::Block<eth_types::Transaction>,
Expand Down Expand Up @@ -196,7 +196,7 @@ pub fn gen_geth_traces(
.iter()
.map(eth_types::geth_types::Transaction::from)
.collect(),
withdrawals: withdrawals,
withdrawals,
logger_config,
};
let traces = trace(&trace_config)?;
Expand Down
4 changes: 2 additions & 2 deletions mock/src/withdrawal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ impl From<MockWithdrawal> for ethers_core::types::Withdrawal {
impl From<MockWithdrawal> for Withdrawal {
fn from(mock: MockWithdrawal) -> Self {
Withdrawal {
id: mock.id.into(),
id: mock.id,
validator_id: mock.validator_id,
address: mock.address,
amount: mock.amount.into(),
amount: mock.amount,
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion zkevm-circuits/src/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ impl PublicData {
let all_wd_bytes = iter::empty()
.chain(self.withdrawals.clone())
.chain((0..(max_withdrawals - self.withdrawals.len())).map(|_| wd_defaults))
.flat_map(|wd| wd_bytes_fn(wd));
.flat_map(wd_bytes_fn);

result.chain(all_wd_bytes).collect_vec()
}
Expand Down
2 changes: 1 addition & 1 deletion zkevm-circuits/src/pi_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1459,7 +1459,7 @@ impl<F: Field> PiCircuitConfig<F> {
rpi_bytes,
current_offset,
challenges,
zero_cell.clone(),
zero_cell,
)?;

Ok(())
Expand Down
2 changes: 1 addition & 1 deletion zkevm-circuits/src/pi_circuit/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use super::*;
use bus_mapping::{
circuit_input_builder::FixedCParams, mock::BlockData, state_db::EMPTY_CODE_HASH_LE,
};
use eth_types::{address, bytecode, geth_types::GethData, Word, H160, H256};
use eth_types::{bytecode, geth_types::GethData, Word, H160, H256};
use ethers_signers::{LocalWallet, Signer};
use halo2_proofs::{
dev::{MockProver, VerifyFailure},
Expand Down
2 changes: 1 addition & 1 deletion zkevm-circuits/src/super_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ impl<F: Field> SubCircuitConfig<F> for SuperCircuitConfig<F> {
max_calldata,
block_table: block_table.clone(),
tx_table: tx_table.clone(),
wd_table: wd_table.clone(),
wd_table,
keccak_table: keccak_table.clone(),
challenges: challenges.clone(),
},
Expand Down
8 changes: 5 additions & 3 deletions zkevm-circuits/src/table/wd_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ impl WdTable {
layouter.assign_region(
|| "wd table",
|mut region| {
let mut offset = 0;
let advice_columns = [
self.id,
self.validator_id,
Expand All @@ -74,7 +73,11 @@ impl WdTable {
let padding_withdrawals: Vec<_> = (withdrawals.len()..max_withdrawals)
.map(|i| Withdrawal::padding_withdrawal(i + 1))
.collect();
for wd in withdrawals.iter().chain(padding_withdrawals.iter()) {
for (offset, wd) in withdrawals
.iter()
.chain(padding_withdrawals.iter())
.enumerate()
{
let address_word = Word::from(wd.address);
let row = [
Value::known(F::from(wd.id)),
Expand All @@ -90,7 +93,6 @@ impl WdTable {
&row,
"assign wd table",
)?;
offset += 1;
}

Ok(())
Expand Down
2 changes: 1 addition & 1 deletion zkevm-circuits/src/witness/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ impl<F: Field> Block<F> {

/// Return the root of withdrawals in this block
pub fn withdrawals_root(&self) -> H256 {
self.eth_block.withdrawals_root.clone().unwrap()
self.eth_block.withdrawals_root.unwrap()
}

/// Obtains the expected Circuit degree needed in order to be able to test
Expand Down

0 comments on commit 953da96

Please sign in to comment.