Skip to content

Commit

Permalink
rename feature dual-bytecode
Browse files Browse the repository at this point in the history
  • Loading branch information
DreamWuGit committed Sep 4, 2024
1 parent 5e840fa commit 0786aca
Show file tree
Hide file tree
Showing 15 changed files with 88 additions and 88 deletions.
4 changes: 2 additions & 2 deletions zkevm-circuits/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand All @@ -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 = []

4 changes: 2 additions & 2 deletions zkevm-circuits/src/bytecode_circuit/circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,7 @@ impl<F: Field> BytecodeCircuit<F> {
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(
Expand Down Expand Up @@ -1055,7 +1055,7 @@ impl<F: Field> SubCircuit<F> for BytecodeCircuit<F> {
/// 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
Expand Down
30 changes: 15 additions & 15 deletions zkevm-circuits/src/copy_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ pub struct CopyCircuitConfig<F> {
pub is_word_end: IsEqualConfig<F>,
/// non pad and non mask witness to reduce the degree of lookups.
pub non_pad_non_mask: Column<Advice>,
#[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<Advice>,
// External tables
Expand All @@ -132,7 +132,7 @@ pub struct CopyCircuitConfig<F> {
pub rw_table: RwTable,
/// BytecodeTable
pub bytecode_table: BytecodeTable,
#[cfg(feature = "dual_bytecode")]
#[cfg(feature = "dual-bytecode")]
/// BytecodeTable1
pub bytecode_table1: BytecodeTable,
}
Expand All @@ -145,7 +145,7 @@ pub struct CopyCircuitConfigArgs<F: Field> {
pub rw_table: RwTable,
/// BytecodeTable
pub bytecode_table: BytecodeTable,
#[cfg(feature = "dual_bytecode")]
#[cfg(feature = "dual-bytecode")]
/// BytecodeTable1
pub bytecode_table1: BytecodeTable,
/// CopyTable
Expand All @@ -167,7 +167,7 @@ impl<F: Field> SubCircuitConfig<F> for CopyCircuitConfig<F> {
tx_table,
rw_table,
bytecode_table,
#[cfg(feature = "dual_bytecode")]
#[cfg(feature = "dual-bytecode")]
bytecode_table1,
copy_table,
q_enable,
Expand All @@ -187,7 +187,7 @@ impl<F: Field> SubCircuitConfig<F> for CopyCircuitConfig<F> {
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;
Expand All @@ -206,7 +206,7 @@ impl<F: Field> SubCircuitConfig<F> for CopyCircuitConfig<F> {
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);
Expand Down Expand Up @@ -401,7 +401,7 @@ impl<F: Field> SubCircuitConfig<F> for CopyCircuitConfig<F> {
);
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);
}

Expand Down Expand Up @@ -465,14 +465,14 @@ impl<F: Field> SubCircuitConfig<F> for CopyCircuitConfig<F> {

// 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();
}
Expand All @@ -493,7 +493,7 @@ impl<F: Field> SubCircuitConfig<F> for CopyCircuitConfig<F> {
});

// 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);

Expand Down Expand Up @@ -659,12 +659,12 @@ impl<F: Field> SubCircuitConfig<F> for CopyCircuitConfig<F> {
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,
}
}
Expand Down Expand Up @@ -728,7 +728,7 @@ impl<F: Field> CopyCircuitConfig<F> {
self.mask,
self.front_mask,
self.word_index,
#[cfg(feature = "dual_bytecode")]
#[cfg(feature = "dual-bytecode")]
self.is_first_bytecode_table,
]
.iter()
Expand Down Expand Up @@ -971,7 +971,7 @@ impl<F: Field> CopyCircuitConfig<F> {
*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),
Expand Down Expand Up @@ -1223,7 +1223,7 @@ impl<F: Field> CopyCircuit<F> {
Self::new(
block.copy_events.clone(),
block.circuits_params.max_copy_rows,
//#[cfg(feature = "dual_bytecode")]
//#[cfg(feature = "dual-bytecode")]
block.bytecode_map.clone(),
)
}
Expand Down
12 changes: 6 additions & 6 deletions zkevm-circuits/src/copy_circuit/dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl<F: Field> Circuit<F> for CopyCircuit<F> {
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();
Expand All @@ -40,7 +40,7 @@ impl<F: Field> Circuit<F> for CopyCircuit<F> {
tx_table,
rw_table,
bytecode_table,
#[cfg(feature = "dual_bytecode")]
#[cfg(feature = "dual-bytecode")]
bytecode_table1,
copy_table,
q_enable,
Expand Down Expand Up @@ -74,21 +74,21 @@ impl<F: Field> Circuit<F> for CopyCircuit<F> {
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,
Expand Down
22 changes: 11 additions & 11 deletions zkevm-circuits/src/evm_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub struct EvmCircuitConfig<F> {
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,
Expand All @@ -68,7 +68,7 @@ pub struct EvmCircuitConfigArgs<F: Field> {
pub rw_table: RwTable,
/// BytecodeTable
pub bytecode_table: BytecodeTable,
#[cfg(feature = "dual_bytecode")]
#[cfg(feature = "dual-bytecode")]
/// BytecodeTable
pub bytecode_table1: BytecodeTable,
/// BlockTable
Expand Down Expand Up @@ -110,7 +110,7 @@ impl<F: Field> SubCircuitConfig<F> for EvmCircuitConfig<F> {
tx_table,
rw_table,
bytecode_table,
#[cfg(feature = "dual_bytecode")]
#[cfg(feature = "dual-bytecode")]
bytecode_table1,
block_table,
copy_table,
Expand All @@ -133,7 +133,7 @@ impl<F: Field> SubCircuitConfig<F> for EvmCircuitConfig<F> {
&tx_table,
&rw_table,
&bytecode_table,
#[cfg(feature = "dual_bytecode")]
#[cfg(feature = "dual-bytecode")]
&bytecode_table1,
&block_table,
&copy_table,
Expand All @@ -153,7 +153,7 @@ impl<F: Field> SubCircuitConfig<F> for EvmCircuitConfig<F> {
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);
Expand All @@ -171,7 +171,7 @@ impl<F: Field> SubCircuitConfig<F> for EvmCircuitConfig<F> {
tx_table,
rw_table,
bytecode_table,
#[cfg(feature = "dual_bytecode")]
#[cfg(feature = "dual-bytecode")]
bytecode_table1,
block_table,
copy_table,
Expand Down Expand Up @@ -465,7 +465,7 @@ impl<F: Field> Circuit<F> for EvmCircuit<F> {
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();
Expand All @@ -485,7 +485,7 @@ impl<F: Field> Circuit<F> for EvmCircuit<F> {
tx_table,
rw_table,
bytecode_table,
#[cfg(feature = "dual_bytecode")]
#[cfg(feature = "dual-bytecode")]
bytecode_table1,
block_table,
copy_table,
Expand Down Expand Up @@ -528,9 +528,9 @@ impl<F: Field> Circuit<F> for EvmCircuit<F> {
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
Expand All @@ -547,7 +547,7 @@ impl<F: Field> Circuit<F> for EvmCircuit<F> {
}
}

#[cfg(not(feature = "dual_bytecode"))]
#[cfg(not(feature = "dual-bytecode"))]
config
.bytecode_table
.dev_load(&mut layouter, block.bytecodes.values(), &challenges)?;
Expand Down
10 changes: 5 additions & 5 deletions zkevm-circuits/src/evm_circuit/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ impl<F: Field> ExecutionConfig<F> {
tx_table: &dyn LookupTable<F>,
rw_table: &dyn LookupTable<F>,
bytecode_table: &dyn LookupTable<F>,
#[cfg(feature = "dual_bytecode")] bytecode_table1: &dyn LookupTable<F>,
#[cfg(feature = "dual-bytecode")] bytecode_table1: &dyn LookupTable<F>,
block_table: &dyn LookupTable<F>,
copy_table: &dyn LookupTable<F>,
keccak_table: &dyn LookupTable<F>,
Expand Down Expand Up @@ -688,7 +688,7 @@ impl<F: Field> ExecutionConfig<F> {
tx_table,
rw_table,
bytecode_table,
#[cfg(feature = "dual_bytecode")]
#[cfg(feature = "dual-bytecode")]
bytecode_table1,
block_table,
copy_table,
Expand Down Expand Up @@ -959,7 +959,7 @@ impl<F: Field> ExecutionConfig<F> {
tx_table: &dyn LookupTable<F>,
rw_table: &dyn LookupTable<F>,
bytecode_table: &dyn LookupTable<F>,
#[cfg(feature = "dual_bytecode")] bytecode_table1: &dyn LookupTable<F>,
#[cfg(feature = "dual-bytecode")] bytecode_table1: &dyn LookupTable<F>,
block_table: &dyn LookupTable<F>,
copy_table: &dyn LookupTable<F>,
keccak_table: &dyn LookupTable<F>,
Expand All @@ -981,7 +981,7 @@ impl<F: Field> ExecutionConfig<F> {
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,
Expand Down Expand Up @@ -1424,7 +1424,7 @@ impl<F: Field> ExecutionConfig<F> {
("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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ impl<F: Field> ExecutionGadget<F> for ErrorInvalidJumpGadget<F> {
);
});

#[cfg(feature = "dual_bytecode")]
#[cfg(feature = "dual-bytecode")]
cb.condition(
not::expr(code_len_gadget.is_first_bytecode_table.expr()),
|cb| {
Expand Down
8 changes: 4 additions & 4 deletions zkevm-circuits/src/evm_circuit/param.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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),
];

Expand All @@ -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
Expand Down
Loading

0 comments on commit 0786aca

Please sign in to comment.