From 0786aca112368865e8c4eccdd657a213cf272b9e Mon Sep 17 00:00:00 2001 From: Dream Wu Date: Wed, 4 Sep 2024 10:39:22 +0800 Subject: [PATCH] rename feature dual-bytecode --- zkevm-circuits/Cargo.toml | 4 +-- .../src/bytecode_circuit/circuit.rs | 4 +-- zkevm-circuits/src/copy_circuit.rs | 30 +++++++++---------- zkevm-circuits/src/copy_circuit/dev.rs | 12 ++++---- zkevm-circuits/src/evm_circuit.rs | 22 +++++++------- zkevm-circuits/src/evm_circuit/execution.rs | 10 +++---- .../execution/error_invalid_jump.rs | 2 +- zkevm-circuits/src/evm_circuit/param.rs | 8 ++--- zkevm-circuits/src/evm_circuit/table.rs | 8 ++--- .../src/evm_circuit/util/common_gadget.rs | 6 ++-- .../evm_circuit/util/constraint_builder.rs | 12 ++++---- .../src/evm_circuit/util/instrumentation.rs | 4 +-- zkevm-circuits/src/super_circuit.rs | 28 ++++++++--------- zkevm-circuits/src/table.rs | 8 ++--- zkevm-circuits/src/witness/block.rs | 18 +++++------ 15 files changed, 88 insertions(+), 88 deletions(-) diff --git a/zkevm-circuits/Cargo.toml b/zkevm-circuits/Cargo.toml index 77fa620a71..f691d33413 100644 --- a/zkevm-circuits/Cargo.toml +++ b/zkevm-circuits/Cargo.toml @@ -57,7 +57,7 @@ paste = "1.0" default = ["test", "test-circuits", "debug-annotations", "parallel_syn"] test = ["mock", "bus-mapping/test"] -scroll = ["bus-mapping/scroll", "eth-types/scroll", "mock?/scroll", "zktrie", "poseidon-codehash", "dual_bytecode"] +scroll = ["bus-mapping/scroll", "eth-types/scroll", "mock?/scroll", "zktrie", "poseidon-codehash", "dual-bytecode"] strict-ccc = ["bus-mapping/strict-ccc"] test-circuits = [] @@ -71,5 +71,5 @@ debug-annotations = [] enable-stack = ["bus-mapping/enable-stack"] enable-memory = ["bus-mapping/enable-memory"] enable-storage = ["bus-mapping/enable-storage"] -dual_bytecode = [] +dual-bytecode = [] diff --git a/zkevm-circuits/src/bytecode_circuit/circuit.rs b/zkevm-circuits/src/bytecode_circuit/circuit.rs index 804287c5f7..8b3bfe8981 100644 --- a/zkevm-circuits/src/bytecode_circuit/circuit.rs +++ b/zkevm-circuits/src/bytecode_circuit/circuit.rs @@ -1015,7 +1015,7 @@ impl BytecodeCircuit { Self::new(bytecodes, bytecode_size) } - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] /// Creates bytecode sub circuit from block, is_first_bytecode indicates first or second /// sub bytecode circuit. pub fn new_from_block_for_dual_circuit( @@ -1055,7 +1055,7 @@ impl SubCircuit for BytecodeCircuit { /// Return the minimum number of rows required to prove the block fn min_num_rows_block(block: &witness::Block) -> (usize, usize) { if block.bytecode_map.is_some() { - // when enable feature "dual_bytecode", get two sets of bytecodes here. + // when enable feature "dual-bytecode", get two sets of bytecodes here. let (first_bytecodes, second_bytecodes) = block.get_bytecodes_for_dual_sub_circuits(); let minimum_row: usize = max( first_bytecodes diff --git a/zkevm-circuits/src/copy_circuit.rs b/zkevm-circuits/src/copy_circuit.rs index d3812f94aa..cdbec8bc48 100644 --- a/zkevm-circuits/src/copy_circuit.rs +++ b/zkevm-circuits/src/copy_circuit.rs @@ -122,7 +122,7 @@ pub struct CopyCircuitConfig { pub is_word_end: IsEqualConfig, /// non pad and non mask witness to reduce the degree of lookups. pub non_pad_non_mask: Column, - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] /// Whether the bytecode is belong to the first bytecode sub circuit . pub is_first_bytecode_table: Column, // External tables @@ -132,7 +132,7 @@ pub struct CopyCircuitConfig { pub rw_table: RwTable, /// BytecodeTable pub bytecode_table: BytecodeTable, - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] /// BytecodeTable1 pub bytecode_table1: BytecodeTable, } @@ -145,7 +145,7 @@ pub struct CopyCircuitConfigArgs { pub rw_table: RwTable, /// BytecodeTable pub bytecode_table: BytecodeTable, - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] /// BytecodeTable1 pub bytecode_table1: BytecodeTable, /// CopyTable @@ -167,7 +167,7 @@ impl SubCircuitConfig for CopyCircuitConfig { tx_table, rw_table, bytecode_table, - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] bytecode_table1, copy_table, q_enable, @@ -187,7 +187,7 @@ impl SubCircuitConfig for CopyCircuitConfig { let [is_pad, is_tx_calldata, is_bytecode, is_memory, is_memory_copy, is_tx_log, is_access_list_address, is_access_list_storage_key] = array_init(|_| meta.advice_column()); let is_first = copy_table.is_first; - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] let is_first_bytecode_table = meta.advice_column(); let id = copy_table.id; let addr = copy_table.addr; @@ -206,7 +206,7 @@ impl SubCircuitConfig for CopyCircuitConfig { tx_table.annotate_columns(meta); rw_table.annotate_columns(meta); bytecode_table.annotate_columns(meta); - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] bytecode_table1.annotate_columns(meta); copy_table.annotate_columns(meta); @@ -401,7 +401,7 @@ impl SubCircuitConfig for CopyCircuitConfig { ); constrain_rw_word_complete(cb, is_last_step, is_rw_word_type.expr(), is_word_end); - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] constrain_is_first_bytecode_table(cb, meta, is_first_bytecode_table, is_last_col); } @@ -465,14 +465,14 @@ impl SubCircuitConfig for CopyCircuitConfig { // lookup first bytecode table meta.lookup_any("Bytecode lookup", |meta| { - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] let is_first_bytecode = meta.query_advice(is_first_bytecode_table, CURRENT); let mut cond = meta.query_fixed(q_enable, CURRENT) * meta.query_advice(is_bytecode, CURRENT) * meta.query_advice(non_pad_non_mask, CURRENT); - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] { cond = cond * is_first_bytecode.expr(); } @@ -493,7 +493,7 @@ impl SubCircuitConfig for CopyCircuitConfig { }); // lookup second bytecode table - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] meta.lookup_any("Bytecode lookup", |meta| { let is_first_bytecode = meta.query_advice(is_first_bytecode_table, CURRENT); @@ -659,12 +659,12 @@ impl SubCircuitConfig for CopyCircuitConfig { is_src_end, is_word_end, non_pad_non_mask, - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] is_first_bytecode_table, tx_table, rw_table, bytecode_table, - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] bytecode_table1, } } @@ -728,7 +728,7 @@ impl CopyCircuitConfig { self.mask, self.front_mask, self.word_index, - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] self.is_first_bytecode_table, ] .iter() @@ -971,7 +971,7 @@ impl CopyCircuitConfig { *offset, || Value::known(F::zero()), )?; - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] // is_first_bytecode_table region.assign_advice( || format!("assign is_first_bytecode_table {}", *offset), @@ -1223,7 +1223,7 @@ impl CopyCircuit { Self::new( block.copy_events.clone(), block.circuits_params.max_copy_rows, - //#[cfg(feature = "dual_bytecode")] + //#[cfg(feature = "dual-bytecode")] block.bytecode_map.clone(), ) } diff --git a/zkevm-circuits/src/copy_circuit/dev.rs b/zkevm-circuits/src/copy_circuit/dev.rs index e64ebe6c8c..9d3babc52a 100644 --- a/zkevm-circuits/src/copy_circuit/dev.rs +++ b/zkevm-circuits/src/copy_circuit/dev.rs @@ -25,7 +25,7 @@ impl Circuit for CopyCircuit { let tx_table = TxTable::construct(meta); let rw_table = RwTable::construct(meta); let bytecode_table = BytecodeTable::construct(meta); - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] let bytecode_table1 = BytecodeTable::construct(meta); let q_enable = meta.fixed_column(); @@ -40,7 +40,7 @@ impl Circuit for CopyCircuit { tx_table, rw_table, bytecode_table, - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] bytecode_table1, copy_table, q_enable, @@ -74,21 +74,21 @@ impl Circuit for CopyCircuit { challenge_values.evm_word(), )?; - // when enable feature "dual_bytecode", get two sets of bytecodes here. + // when enable feature "dual-bytecode", get two sets of bytecodes here. if self.bytecode_map.is_some() { - // enable feature = "dual_bytecode" + // enable feature = "dual-bytecode" let (first_bytecodes, second_bytecodes) = Block::split_bytecodes_for_dual_sub_circuits( &self.external_data.bytecodes, self.bytecode_map .as_ref() - .expect("bytecode_map is not none when enable feature 'dual_bytecode'"), + .expect("bytecode_map is not none when enable feature 'dual-bytecode'"), ); config .0 .bytecode_table .dev_load(&mut layouter, first_bytecodes, &challenge_values)?; - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] config.0.bytecode_table1.dev_load( &mut layouter, second_bytecodes, diff --git a/zkevm-circuits/src/evm_circuit.rs b/zkevm-circuits/src/evm_circuit.rs index f9dd0a816b..9c3a81e0f8 100644 --- a/zkevm-circuits/src/evm_circuit.rs +++ b/zkevm-circuits/src/evm_circuit.rs @@ -45,7 +45,7 @@ pub struct EvmCircuitConfig { tx_table: TxTable, rw_table: RwTable, bytecode_table: BytecodeTable, - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] bytecode_table1: BytecodeTable, block_table: BlockTable, copy_table: CopyTable, @@ -68,7 +68,7 @@ pub struct EvmCircuitConfigArgs { pub rw_table: RwTable, /// BytecodeTable pub bytecode_table: BytecodeTable, - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] /// BytecodeTable pub bytecode_table1: BytecodeTable, /// BlockTable @@ -110,7 +110,7 @@ impl SubCircuitConfig for EvmCircuitConfig { tx_table, rw_table, bytecode_table, - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] bytecode_table1, block_table, copy_table, @@ -133,7 +133,7 @@ impl SubCircuitConfig for EvmCircuitConfig { &tx_table, &rw_table, &bytecode_table, - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] &bytecode_table1, &block_table, ©_table, @@ -153,7 +153,7 @@ impl SubCircuitConfig for EvmCircuitConfig { tx_table.annotate_columns(meta); rw_table.annotate_columns(meta); bytecode_table.annotate_columns(meta); - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] bytecode_table1.annotate_columns(meta); block_table.annotate_columns(meta); copy_table.annotate_columns(meta); @@ -171,7 +171,7 @@ impl SubCircuitConfig for EvmCircuitConfig { tx_table, rw_table, bytecode_table, - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] bytecode_table1, block_table, copy_table, @@ -465,7 +465,7 @@ impl Circuit for EvmCircuit { let rw_table = RwTable::construct(meta); let tx_table = TxTable::construct(meta); let bytecode_table = BytecodeTable::construct(meta); - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] let bytecode_table1 = BytecodeTable::construct(meta); let block_table = BlockTable::construct(meta); let q_copy_table = meta.fixed_column(); @@ -485,7 +485,7 @@ impl Circuit for EvmCircuit { tx_table, rw_table, bytecode_table, - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] bytecode_table1, block_table, copy_table, @@ -528,9 +528,9 @@ impl Circuit for EvmCircuit { challenges.evm_word(), )?; - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] { - // when enable feature "dual_bytecode", get two sets of bytecodes here. + // when enable feature "dual-bytecode", get two sets of bytecodes here. let (first_bytecodes, second_bytecodes) = block.get_bytecodes_for_dual_sub_circuits(); if !first_bytecodes.is_empty() { // assign first bytecode_table @@ -547,7 +547,7 @@ impl Circuit for EvmCircuit { } } - #[cfg(not(feature = "dual_bytecode"))] + #[cfg(not(feature = "dual-bytecode"))] config .bytecode_table .dev_load(&mut layouter, block.bytecodes.values(), &challenges)?; diff --git a/zkevm-circuits/src/evm_circuit/execution.rs b/zkevm-circuits/src/evm_circuit/execution.rs index e8bfd52005..ffc699279a 100644 --- a/zkevm-circuits/src/evm_circuit/execution.rs +++ b/zkevm-circuits/src/evm_circuit/execution.rs @@ -391,7 +391,7 @@ impl ExecutionConfig { tx_table: &dyn LookupTable, rw_table: &dyn LookupTable, bytecode_table: &dyn LookupTable, - #[cfg(feature = "dual_bytecode")] bytecode_table1: &dyn LookupTable, + #[cfg(feature = "dual-bytecode")] bytecode_table1: &dyn LookupTable, block_table: &dyn LookupTable, copy_table: &dyn LookupTable, keccak_table: &dyn LookupTable, @@ -688,7 +688,7 @@ impl ExecutionConfig { tx_table, rw_table, bytecode_table, - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] bytecode_table1, block_table, copy_table, @@ -959,7 +959,7 @@ impl ExecutionConfig { tx_table: &dyn LookupTable, rw_table: &dyn LookupTable, bytecode_table: &dyn LookupTable, - #[cfg(feature = "dual_bytecode")] bytecode_table1: &dyn LookupTable, + #[cfg(feature = "dual-bytecode")] bytecode_table1: &dyn LookupTable, block_table: &dyn LookupTable, copy_table: &dyn LookupTable, keccak_table: &dyn LookupTable, @@ -981,7 +981,7 @@ impl ExecutionConfig { Table::Tx => tx_table, Table::Rw => rw_table, Table::Bytecode => bytecode_table, - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] Table::Bytecode1 => bytecode_table1, Table::Block => block_table, Table::Copy => copy_table, @@ -1424,7 +1424,7 @@ impl ExecutionConfig { ("EVM_lookup_tx", TX_TABLE_LOOKUPS), ("EVM_lookup_rw", RW_TABLE_LOOKUPS), ("EVM_lookup_bytecode", BYTECODE_TABLE_LOOKUPS), - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] ("EVM_lookup_bytecode1", BYTECODE_TABLE_LOOKUPS), ("EVM_lookup_block", BLOCK_TABLE_LOOKUPS), ("EVM_lookup_copy", COPY_TABLE_LOOKUPS), diff --git a/zkevm-circuits/src/evm_circuit/execution/error_invalid_jump.rs b/zkevm-circuits/src/evm_circuit/execution/error_invalid_jump.rs index 2142fc3369..bd4f4ff9da 100644 --- a/zkevm-circuits/src/evm_circuit/execution/error_invalid_jump.rs +++ b/zkevm-circuits/src/evm_circuit/execution/error_invalid_jump.rs @@ -88,7 +88,7 @@ impl ExecutionGadget for ErrorInvalidJumpGadget { ); }); - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] cb.condition( not::expr(code_len_gadget.is_first_bytecode_table.expr()), |cb| { diff --git a/zkevm-circuits/src/evm_circuit/param.rs b/zkevm-circuits/src/evm_circuit/param.rs index fe5d47961e..482387eb81 100644 --- a/zkevm-circuits/src/evm_circuit/param.rs +++ b/zkevm-circuits/src/evm_circuit/param.rs @@ -34,8 +34,8 @@ pub(crate) const EVM_LOOKUP_COLS: usize = FIXED_TABLE_LOOKUPS + TX_TABLE_LOOKUPS + RW_TABLE_LOOKUPS + BYTECODE_TABLE_LOOKUPS - // only add when feature 'dual_bytecode' is enabled - + if cfg!(feature = "dual_bytecode"){ + // only add when feature 'dual-bytecode' is enabled + + if cfg!(feature = "dual-bytecode"){ BYTECODE_TABLE_LOOKUPS }else{ 0 @@ -65,7 +65,7 @@ pub(crate) const LOOKUP_CONFIG: &[(Table, usize)] = &[ (Table::ModExp, MODEXP_TABLE_LOOKUPS), (Table::Ecc, ECC_TABLE_LOOKUPS), (Table::PowOfRand, POW_OF_RAND_TABLE_LOOKUPS), - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] (Table::Bytecode1, BYTECODE_TABLE_LOOKUPS), ]; @@ -80,7 +80,7 @@ pub const RW_TABLE_LOOKUPS: usize = 8; /// Bytecode Table lookups done in EVMCircuit pub const BYTECODE_TABLE_LOOKUPS: usize = 1; -// #[cfg(feature = "dual_bytecode")] +// #[cfg(feature = "dual-bytecode")] // pub const BYTECODE_TABLE_LOOKUPS: usize = 2; /// Block Table lookups done in EVMCircuit diff --git a/zkevm-circuits/src/evm_circuit/table.rs b/zkevm-circuits/src/evm_circuit/table.rs index 9dc8e758c5..913b1125b6 100644 --- a/zkevm-circuits/src/evm_circuit/table.rs +++ b/zkevm-circuits/src/evm_circuit/table.rs @@ -169,7 +169,7 @@ pub(crate) enum Table { Tx, Rw, Bytecode, - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] Bytecode1, Block, Copy, @@ -275,7 +275,7 @@ pub(crate) enum Lookup { push_rlc: Expression, }, - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] /// Lookup to second bytecode table, which contains all used creation code and /// contract code. Bytecode1 { @@ -405,7 +405,7 @@ impl Lookup { Self::Tx { .. } => Table::Tx, Self::Rw { .. } => Table::Rw, Self::Bytecode { .. } => Table::Bytecode, - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] Self::Bytecode1 { .. } => Table::Bytecode1, Self::Block { .. } => Table::Block, Self::CopyTable { .. } => Table::Copy, @@ -474,7 +474,7 @@ impl Lookup { push_rlc.clone(), ] } - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] Self::Bytecode1 { hash, tag, diff --git a/zkevm-circuits/src/evm_circuit/util/common_gadget.rs b/zkevm-circuits/src/evm_circuit/util/common_gadget.rs index 6515fc7897..e69a28b14a 100644 --- a/zkevm-circuits/src/evm_circuit/util/common_gadget.rs +++ b/zkevm-circuits/src/evm_circuit/util/common_gadget.rs @@ -101,7 +101,7 @@ impl SameContextGadget { } // Check if current bytecode is belong to first bytecode table. - // Note: always return true when feature 'dual_bytecode' is disabled. + // Note: always return true when feature 'dual-bytecode' is disabled. pub(crate) fn is_first_sub_bytecode(&self) -> Expression { self.is_first_bytecode_table.expr() } @@ -151,7 +151,7 @@ impl BytecodeLengthGadget { cb.bytecode_length(code_hash.expr(), code_length.expr()); }); - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] cb.condition(not::expr(is_first_bytecode_table.clone().expr()), |cb| { cb.bytecode1_length(code_hash.expr(), code_length.expr()); }); @@ -1625,7 +1625,7 @@ impl CommonErrorGadget { cb.opcode_lookup_rlc(opcode.expr(), push_rlc.clone()); }); - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] cb.condition(not::expr(is_first_bytecode_table.expr()), |cb| { cb.opcode_lookup_rlc2(opcode.expr(), push_rlc); }); diff --git a/zkevm-circuits/src/evm_circuit/util/constraint_builder.rs b/zkevm-circuits/src/evm_circuit/util/constraint_builder.rs index 4599b5eaf2..33967162ac 100644 --- a/zkevm-circuits/src/evm_circuit/util/constraint_builder.rs +++ b/zkevm-circuits/src/evm_circuit/util/constraint_builder.rs @@ -668,7 +668,7 @@ impl<'a, F: Field> EVMConstraintBuilder<'a, F> { cb.opcode_lookup_rlc(opcode.expr(), push_rlc.clone()); }); - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] self.condition(not::expr(is_first_bytecode_table.expr()), |cb| { cb.opcode_lookup_rlc2(opcode.expr(), push_rlc); }); @@ -686,7 +686,7 @@ impl<'a, F: Field> EVMConstraintBuilder<'a, F> { cb.opcode_lookup_at_rlc(index.clone(), opcode.clone(), 0.expr()); }); - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] self.condition(not::expr(is_first_bytecode_table), |cb| { cb.opcode_lookup_at_rlc2(index, opcode, 0.expr()); }); @@ -696,7 +696,7 @@ impl<'a, F: Field> EVMConstraintBuilder<'a, F> { self.opcode_lookup_at_rlc(self.curr.state.program_counter.expr(), opcode, push_rlc); } - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] // helper to lookup second bytecode table. pub(crate) fn opcode_lookup_rlc2(&mut self, opcode: Expression, push_rlc: Expression) { self.opcode_lookup_at_rlc2(self.curr.state.program_counter.expr(), opcode, push_rlc); @@ -724,7 +724,7 @@ impl<'a, F: Field> EVMConstraintBuilder<'a, F> { ); } - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] // lookup bytecode_table1. pub(crate) fn opcode_lookup_at_rlc2( &mut self, @@ -770,7 +770,7 @@ impl<'a, F: Field> EVMConstraintBuilder<'a, F> { ) } - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] pub(crate) fn bytecode_lookup2( &mut self, code_hash: Expression, @@ -806,7 +806,7 @@ impl<'a, F: Field> EVMConstraintBuilder<'a, F> { ); } - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] pub(crate) fn bytecode1_length(&mut self, code_hash: Expression, value: Expression) { self.add_lookup( "Bytecode1 (length)", diff --git a/zkevm-circuits/src/evm_circuit/util/instrumentation.rs b/zkevm-circuits/src/evm_circuit/util/instrumentation.rs index d07aa20de5..988a711d4b 100644 --- a/zkevm-circuits/src/evm_circuit/util/instrumentation.rs +++ b/zkevm-circuits/src/evm_circuit/util/instrumentation.rs @@ -93,7 +93,7 @@ impl Instrument { CellType::Lookup(Table::Bytecode) => { report.bytecode_table = data_entry; } - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] CellType::Lookup(Table::Bytecode1) => { report.bytecode_table1 = data_entry; } @@ -146,7 +146,7 @@ pub(crate) struct ExecStateReport { pub(crate) tx_table: StateReportRow, pub(crate) rw_table: StateReportRow, pub(crate) bytecode_table: StateReportRow, - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] pub(crate) bytecode_table1: StateReportRow, pub(crate) block_table: StateReportRow, pub(crate) copy_table: StateReportRow, diff --git a/zkevm-circuits/src/super_circuit.rs b/zkevm-circuits/src/super_circuit.rs index c41136e1fa..66b12d7aae 100644 --- a/zkevm-circuits/src/super_circuit.rs +++ b/zkevm-circuits/src/super_circuit.rs @@ -127,12 +127,12 @@ pub struct SuperCircuitConfig { sha256_circuit: SHA256CircuitConfig, #[cfg(not(feature = "poseidon-codehash"))] bytecode_circuit: BytecodeCircuitConfig, - #[cfg(all(feature = "dual_bytecode", not(feature = "poseidon-codehash")))] + #[cfg(all(feature = "dual-bytecode", not(feature = "poseidon-codehash")))] bytecode_circuit1: BytecodeCircuitConfig, #[cfg(feature = "poseidon-codehash")] bytecode_circuit: ToHashBlockCircuitConfig, - #[cfg(all(feature = "dual_bytecode", feature = "poseidon-codehash"))] + #[cfg(all(feature = "dual-bytecode", feature = "poseidon-codehash"))] bytecode_circuit1: ToHashBlockCircuitConfig, copy_circuit: CopyCircuitConfig, keccak_circuit: KeccakCircuitConfig, @@ -290,7 +290,7 @@ impl SubCircuitConfig for SuperCircuitConfig { }, ); - #[cfg(all(feature = "dual_bytecode", not(feature = "poseidon-codehash")))] + #[cfg(all(feature = "dual-bytecode", not(feature = "poseidon-codehash")))] let bytecode_circuit1 = BytecodeCircuitConfig::new( meta, BytecodeCircuitConfigArgs { @@ -312,7 +312,7 @@ impl SubCircuitConfig for SuperCircuitConfig { }, ); - #[cfg(all(feature = "dual_bytecode", feature = "poseidon-codehash"))] + #[cfg(all(feature = "dual-bytecode", feature = "poseidon-codehash"))] let bytecode_circuit1 = ToHashBlockCircuitConfig::new( meta, ToHashBlockBytecodeCircuitConfigArgs { @@ -333,7 +333,7 @@ impl SubCircuitConfig for SuperCircuitConfig { tx_table: tx_table.clone(), rw_table, bytecode_table: bytecode_table.clone(), - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] bytecode_table1: bytecode_table1.clone(), copy_table, q_enable: q_copy_table, @@ -382,7 +382,7 @@ impl SubCircuitConfig for SuperCircuitConfig { tx_table: tx_table.clone(), rw_table, bytecode_table, - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] bytecode_table1, block_table: block_table.clone(), copy_table, @@ -440,7 +440,7 @@ impl SubCircuitConfig for SuperCircuitConfig { ecc_circuit, sha256_circuit, bytecode_circuit, - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] bytecode_circuit1, copy_circuit, keccak_circuit, @@ -485,7 +485,7 @@ pub struct SuperCircuit< pub pi_circuit: PiCircuit, /// Bytecode Circuit pub bytecode_circuit: BytecodeCircuit, - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] /// second Bytecode Circuit pub bytecode_circuit1: BytecodeCircuit, /// Copy Circuit @@ -641,12 +641,12 @@ impl< let pi_circuit = PiCircuit::new_from_block(block); // Get each sub circuit's bytecodes and assign - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] let bytecode_circuit = BytecodeCircuit::new_from_block_for_dual_circuit(block, true); - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] let bytecode_circuit1 = BytecodeCircuit::new_from_block_for_dual_circuit(block, false); - #[cfg(not(feature = "dual_bytecode"))] + #[cfg(not(feature = "dual-bytecode"))] let bytecode_circuit = BytecodeCircuit::new_from_block(block); let copy_circuit = CopyCircuit::new_from_block_no_external(block); @@ -666,7 +666,7 @@ impl< tx_circuit, pi_circuit, bytecode_circuit, - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] bytecode_circuit1, copy_circuit, exp_circuit, @@ -690,7 +690,7 @@ impl< instance.extend_from_slice(&self.pi_circuit.instance()); instance.extend_from_slice(&self.tx_circuit.instance()); instance.extend_from_slice(&self.bytecode_circuit.instance()); - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] instance.extend_from_slice(&self.bytecode_circuit1.instance()); instance.extend_from_slice(&self.copy_circuit.instance()); instance.extend_from_slice(&self.state_circuit.instance()); @@ -745,7 +745,7 @@ impl< log::debug!("assigning bytecode_circuit"); self.bytecode_circuit .synthesize_sub(&config.bytecode_circuit, challenges, layouter)?; - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] { log::debug!("assigning second bytecode_circuit1"); self.bytecode_circuit1.synthesize_sub( diff --git a/zkevm-circuits/src/table.rs b/zkevm-circuits/src/table.rs index f484162ec0..c1ebb77d22 100644 --- a/zkevm-circuits/src/table.rs +++ b/zkevm-circuits/src/table.rs @@ -1760,10 +1760,10 @@ pub struct CopyTable { } type CopyTableRow = [(Value, &'static str); 8]; -#[cfg(feature = "dual_bytecode")] +#[cfg(feature = "dual-bytecode")] type CopyCircuitRow = [(Value, &'static str); 11]; -#[cfg(not(feature = "dual_bytecode"))] +#[cfg(not(feature = "dual-bytecode"))] type CopyCircuitRow = [(Value, &'static str); 10]; /// CopyThread is the state used while generating rows of the copy table. @@ -1986,7 +1986,7 @@ impl CopyTable { (rw_counter, rwc_inc_left) }; - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] // For codecopy & extcodecopy copy bytecodes, src_type == Bytecode. // For return in creating/deploy contract case, dst_type == Bytecode. let is_first_bytecode_table = if copy_event.src_type == CopyDataType::Bytecode { @@ -2030,7 +2030,7 @@ impl CopyTable { (Value::known(F::from(copy_step.mask)), "mask"), (Value::known(F::from(thread.front_mask)), "front_mask"), (Value::known(F::from(word_index)), "word_index"), - #[cfg(feature = "dual_bytecode")] + #[cfg(feature = "dual-bytecode")] ( // set value from block get bytecode circuit. Value::known(F::from(is_first_bytecode_table)), diff --git a/zkevm-circuits/src/witness/block.rs b/zkevm-circuits/src/witness/block.rs index 4c55c516be..815613a3d4 100644 --- a/zkevm-circuits/src/witness/block.rs +++ b/zkevm-circuits/src/witness/block.rs @@ -286,24 +286,24 @@ impl Block { } // This helper returns bytecodes's whether `code_hash` is belong to first bytecode circuit. - // always return true when feature 'dual_bytecode' is disabled. + // always return true when feature 'dual-bytecode' is disabled. pub(crate) fn is_first_sub_bytecode_circuit(&self, code_hash: &U256) -> bool { // bytecode_map should cover the target 'code_hash', // but for extcodecopy, the external_address can be non existed code hash. // `unwrap` here is not safe. if self.bytecode_map.is_none() { - // not config feature 'dual_bytecode' case. + // not config feature 'dual-bytecode' case. true } else { let bytecode_map = self .bytecode_map .as_ref() - .expect("bytecode_map is not none when enable 'dual_bytecode' feature"); + .expect("bytecode_map is not none when enable 'dual-bytecode' feature"); *bytecode_map.get(code_hash).unwrap_or(&true) } } - // Get two sets of bytecodes for two bytecode sub circuits when enable feature 'dual_bytecode'. + // Get two sets of bytecodes for two bytecode sub circuits when enable feature 'dual-bytecode'. pub(crate) fn get_bytecodes_for_dual_sub_circuits(&self) -> (Vec<&Bytecode>, Vec<&Bytecode>) { if self.bytecode_map.is_none() { log::error!("error: bytecode_map is none"); @@ -314,14 +314,14 @@ impl Block { &self.bytecodes, self.bytecode_map .as_ref() - .expect("bytecode_map is not none when enable feature 'dual_bytecode'"), + .expect("bytecode_map is not none when enable feature 'dual-bytecode'"), ); (first_subcircuit_bytecodes, second_subcircuit_bytecodes) } // Split two sets of bytecodes for two bytecode sub circuits. - //#[cfg(feature = "dual_bytecode")] + //#[cfg(feature = "dual-bytecode")] pub(crate) fn split_bytecodes_for_dual_sub_circuits<'a>( bytecodes: &'a BTreeMap, bytecode_map: &BTreeMap, @@ -643,8 +643,8 @@ pub fn block_convert( } let bytecodes: BTreeMap = get_bytecodes(code_db); - // if not enable 'dual_bytecode' feature, set bytecode_map to None. - let bytecode_map = if cfg!(feature = "dual_bytecode") { + // if not enable 'dual-bytecode' feature, set bytecode_map to None. + let bytecode_map = if cfg!(feature = "dual-bytecode") { Some(get_bytecode_map(&bytecodes)) } else { None @@ -717,7 +717,7 @@ pub fn get_bytecodes(code_db: &CodeDB) -> BTreeMap { bytecodes } -// helper to extract bytecode map info (code_hash, is_first_bytecode_table) when enable feature 'dual_bytecode'. +// helper to extract bytecode map info (code_hash, is_first_bytecode_table) when enable feature 'dual-bytecode'. pub fn get_bytecode_map(bytecodes: &BTreeMap) -> BTreeMap { let bytecode_pairs = bytecodes .iter()