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

Commit

Permalink
feat: remove pow_of_rand_table
Browse files Browse the repository at this point in the history
  • Loading branch information
KimiWu123 committed Jan 28, 2024
1 parent 0e6ebbc commit 0e4aca8
Show file tree
Hide file tree
Showing 9 changed files with 6 additions and 192 deletions.
14 changes: 2 additions & 12 deletions zkevm-circuits/src/evm_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ pub use crate::witness;
use crate::{
evm_circuit::param::{MAX_STEP_HEIGHT, STEP_STATE_HEIGHT},
table::{
BlockTable, BytecodeTable, CopyTable, ExpTable, KeccakTable, LookupTable, PowOfRandTable,
RwTable, SigTable, TxTable, UXTable,
BlockTable, BytecodeTable, CopyTable, ExpTable, KeccakTable, LookupTable, RwTable,
SigTable, TxTable, UXTable,
},
util::{Challenges, SubCircuit, SubCircuitConfig},
};
Expand Down Expand Up @@ -51,7 +51,6 @@ pub struct EvmCircuitConfig<F> {
keccak_table: KeccakTable,
exp_table: ExpTable,
sig_table: SigTable,
pow_of_rand_table: PowOfRandTable,
}

/// Circuit configuration arguments
Expand All @@ -78,8 +77,6 @@ pub struct EvmCircuitConfigArgs<F: Field> {
pub u16_table: UXTable<16>,
/// SigTable
pub sig_table: SigTable,
/// Power of Randomness Table.
pub pow_of_rand_table: PowOfRandTable,
}

impl<F: Field> SubCircuitConfig<F> for EvmCircuitConfig<F> {
Expand All @@ -100,7 +97,6 @@ impl<F: Field> SubCircuitConfig<F> for EvmCircuitConfig<F> {
u8_table,
u16_table,
sig_table,
pow_of_rand_table,
}: Self::ConfigArgs,
) -> Self {
let fixed_table = [(); 4].map(|_| meta.fixed_column());
Expand All @@ -118,7 +114,6 @@ impl<F: Field> SubCircuitConfig<F> for EvmCircuitConfig<F> {
&keccak_table,
&exp_table,
&sig_table,
&pow_of_rand_table,
));

u8_table.annotate_columns(meta);
Expand All @@ -136,7 +131,6 @@ impl<F: Field> SubCircuitConfig<F> for EvmCircuitConfig<F> {
u8_table.annotate_columns(meta);
u16_table.annotate_columns(meta);
sig_table.annotate_columns(meta);
pow_of_rand_table.annotate_columns(meta);

Self {
fixed_table,
Expand All @@ -151,7 +145,6 @@ impl<F: Field> SubCircuitConfig<F> for EvmCircuitConfig<F> {
keccak_table,
exp_table,
sig_table,
pow_of_rand_table,
}
}
}
Expand Down Expand Up @@ -281,7 +274,6 @@ impl<F: Field> SubCircuit<F> for EvmCircuit<F> {
let block = self.block.as_ref().unwrap();

config.load_fixed_table(layouter, self.fixed_table_tags.clone())?;
config.pow_of_rand_table.assign(layouter, &challenges)?;
config.execution.assign_block(layouter, block, challenges)
}
}
Expand Down Expand Up @@ -392,7 +384,6 @@ impl<F: Field> Circuit<F> for EvmCircuit<F> {
let challenges_expr = challenges.exprs(meta);

let sig_table = SigTable::construct(meta);
let pow_of_rand_table = PowOfRandTable::construct(meta, &challenges_expr);
(
EvmCircuitConfig::new(
meta,
Expand All @@ -408,7 +399,6 @@ impl<F: Field> Circuit<F> for EvmCircuit<F> {
u8_table,
u16_table,
sig_table,
pow_of_rand_table,
},
),
challenges,
Expand Down
4 changes: 0 additions & 4 deletions zkevm-circuits/src/evm_circuit/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,6 @@ impl<F: Field> ExecutionConfig<F> {
keccak_table: &dyn LookupTable<F>,
exp_table: &dyn LookupTable<F>,
sig_table: &dyn LookupTable<F>,
pow_of_rand_table: &dyn LookupTable<F>,
) -> Self {
let mut instrument = Instrument::default();
let q_usable = meta.complex_selector();
Expand Down Expand Up @@ -636,7 +635,6 @@ impl<F: Field> ExecutionConfig<F> {
keccak_table,
exp_table,
sig_table,
pow_of_rand_table,
&challenges,
&cell_manager,
);
Expand Down Expand Up @@ -872,7 +870,6 @@ impl<F: Field> ExecutionConfig<F> {
keccak_table: &dyn LookupTable<F>,
exp_table: &dyn LookupTable<F>,
sig_table: &dyn LookupTable<F>,
pow_of_rand_table: &dyn LookupTable<F>,
challenges: &Challenges<Expression<F>>,
cell_manager: &CellManager<CMFixedWidthStrategy>,
) {
Expand All @@ -893,7 +890,6 @@ impl<F: Field> ExecutionConfig<F> {
Table::Keccak => keccak_table,
Table::Exp => exp_table,
Table::Sig => sig_table,
Table::PowOfRand => pow_of_rand_table,
}
.table_exprs(meta);
vec![(
Expand Down
1 change: 0 additions & 1 deletion zkevm-circuits/src/evm_circuit/param.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ pub const LOOKUP_CONFIG: &[(Table, usize)] = &[
(Table::Keccak, KECCAK_TABLE_LOOKUPS),
(Table::Exp, EXP_TABLE_LOOKUPS),
(Table::Sig, SIG_TABLE_LOOKUPS),
(Table::PowOfRand, POW_OF_RAND_TABLE_LOOKUPS),
];

/// Fixed Table lookups done in EVMCircuit
Expand Down
16 changes: 1 addition & 15 deletions zkevm-circuits/src/evm_circuit/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,6 @@ pub enum Table {
Exp,
/// Lookup for sig table
Sig,
/// Lookup for power of randomness table
PowOfRand,
}

#[derive(Clone, Debug)]
Expand Down Expand Up @@ -371,10 +369,7 @@ pub(crate) enum Lookup<F> {
recovered_addr: Expression<F>,
is_valid: Expression<F>,
},
PowOfRandTable {
exponent: Expression<F>,
pow_of_rand: Expression<F>,
},

/// Conditional lookup enabled by the first element.
Conditional(Expression<F>, Box<Lookup<F>>),
}
Expand All @@ -395,7 +390,6 @@ impl<F: Field> Lookup<F> {
Self::KeccakTable { .. } => Table::Keccak,
Self::ExpTable { .. } => Table::Exp,
Self::SigTable { .. } => Table::Sig,
Self::PowOfRandTable { .. } => Table::PowOfRand,
Self::Conditional(_, lookup) => lookup.table(),
}
}
Expand Down Expand Up @@ -533,14 +527,6 @@ impl<F: Field> Lookup<F> {
recovered_addr.clone(),
is_valid.clone(),
],
Self::PowOfRandTable {
exponent,
pow_of_rand,
} => vec![
1.expr(), // q_enable
exponent.clone(),
pow_of_rand.clone(),
],
Self::Conditional(condition, lookup) => lookup
.input_exprs()
.into_iter()
Expand Down
15 changes: 0 additions & 15 deletions zkevm-circuits/src/evm_circuit/util/constraint_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1442,21 +1442,6 @@ impl<'a, F: Field> EVMConstraintBuilder<'a, F> {
);
}

/// Power of Randomness Table
pub(crate) fn pow_of_rand_lookup(
&mut self,
exponent: Expression<F>,
pow_of_rand: Expression<F>,
) {
self.add_lookup(
"power of randomness",
Lookup::PowOfRandTable {
exponent,
pow_of_rand,
},
)
}

/// Keccak Table
pub(crate) fn keccak_table_lookup(
&mut self,
Expand Down
3 changes: 0 additions & 3 deletions zkevm-circuits/src/evm_circuit/util/instrumentation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,6 @@ impl Instrument {
CellType::Lookup(Table::Sig) => {
report.sig_table = data_entry;
}
CellType::Lookup(Table::PowOfRand) => {
report.pow_of_rand_table = data_entry;
}
}
}
report_collection.push(report);
Expand Down
6 changes: 2 additions & 4 deletions zkevm-circuits/src/super_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ use crate::{
pi_circuit::{PiCircuit, PiCircuitConfig, PiCircuitConfigArgs},
state_circuit::{StateCircuit, StateCircuitConfig, StateCircuitConfigArgs},
table::{
BlockTable, BytecodeTable, CopyTable, ExpTable, KeccakTable, MptTable, PowOfRandTable,
RwTable, SigTable, TxTable, UXTable, WdTable,
BlockTable, BytecodeTable, CopyTable, ExpTable, KeccakTable, MptTable, RwTable, SigTable,
TxTable, UXTable, WdTable,
},
tx_circuit::{TxCircuit, TxCircuitConfig, TxCircuitConfigArgs},
util::{log2_ceil, Challenges, SubCircuit, SubCircuitConfig},
Expand Down Expand Up @@ -148,7 +148,6 @@ impl<F: Field> SubCircuitConfig<F> for SuperCircuitConfig<F> {
power_of_randomness[0].clone(),
);
let sig_table = SigTable::construct(meta);
let pow_of_rand_table = PowOfRandTable::construct(meta, &challenges.clone());

let keccak_circuit = KeccakCircuitConfig::new(
meta,
Expand Down Expand Up @@ -224,7 +223,6 @@ impl<F: Field> SubCircuitConfig<F> for SuperCircuitConfig<F> {
u8_table,
u16_table,
sig_table,
pow_of_rand_table,
},
);

Expand Down
5 changes: 1 addition & 4 deletions zkevm-circuits/src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use core::iter::once;
use eth_types::{Field, ToScalar, U256};
use gadgets::{
binary_number::{BinaryNumberChip, BinaryNumberConfig},
util::{and, not, split_u256, split_u256_limb64, Expr},
util::{split_u256, split_u256_limb64},
};
use halo2_proofs::{
circuit::{Layouter, Region, Value},
Expand All @@ -39,8 +39,6 @@ pub(crate) mod exp_table;
pub(crate) mod keccak_table;
/// mpt table
pub mod mpt_table;
/// power of random table
pub(crate) mod pow_of_rand_table;
/// rw table
pub(crate) mod rw_table;
/// signature table
Expand All @@ -60,7 +58,6 @@ pub use keccak_table::KeccakTable;
pub(crate) use ux_table::UXTable;

pub use mpt_table::{MPTProofType, MptTable};
pub(crate) use pow_of_rand_table::PowOfRandTable;
pub(crate) use rw_table::RwTable;
pub(crate) use sig_table::SigTable;
pub(crate) use tx_table::{
Expand Down
134 changes: 0 additions & 134 deletions zkevm-circuits/src/table/pow_of_rand_table.rs

This file was deleted.

0 comments on commit 0e4aca8

Please sign in to comment.