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

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
ChihChengLiang committed Jan 11, 2024
1 parent 684b449 commit a020481
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 43 deletions.
12 changes: 10 additions & 2 deletions bus-mapping/src/circuit_input_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ pub struct CircuitInputBuilder<C: CircuitsParams> {
pub circuits_params: C,
/// Block Context
pub block_ctx: BlockContext,
/// Feature config
pub feature_config: FeatureConfig,
}

Expand Down Expand Up @@ -310,7 +311,7 @@ impl<'a, C: CircuitsParams> CircuitInputBuilder<C> {
ExecState::InvalidTx,
)?;
tx.steps_mut().push(invalid_tx_step);
}else {
} else {
panic!("invalid tx support not enabled")
}

Expand Down Expand Up @@ -489,6 +490,7 @@ impl CircuitInputBuilder<DynamicCParams> {
block: self.block,
circuits_params: c_params,
block_ctx: self.block_ctx,
feature_config: self.feature_config,
};

cib.set_end_block(c_params.max_rws)?;
Expand Down Expand Up @@ -773,7 +775,13 @@ impl<P: JsonRpcClient> BuilderClient<P> {
prev_state_root: Word,
) -> Result<CircuitInputBuilder<FixedCParams>, Error> {
let block = Block::new(self.chain_id, history_hashes, prev_state_root, eth_block)?;
let mut builder = CircuitInputBuilder::new(sdb, code_db, block, self.circuits_params);
let mut builder = CircuitInputBuilder::new(
sdb,
code_db,
block,
self.circuits_params,
FeatureConfig::default(),
);
builder.handle_block(eth_block, geth_traces)?;
Ok(builder)
}
Expand Down
3 changes: 2 additions & 1 deletion bus-mapping/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use crate::{
circuit_input_builder::{
get_state_accesses, Block, CircuitInputBuilder, CircuitsParams, DynamicCParams,
FixedCParams,
FeatureConfig, FixedCParams,
},
state_db::{self, CodeDB, StateDB},
};
Expand Down Expand Up @@ -45,6 +45,7 @@ impl<C: CircuitsParams> BlockData<C> {
)
.unwrap(),
self.circuits_params,
FeatureConfig::default(),
)
}

Expand Down
71 changes: 35 additions & 36 deletions zkevm-circuits/src/evm_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use crate::{
},
util::{Challenges, SubCircuit, SubCircuitConfig},
};
use bus_mapping::evm::OpcodeId;
use bus_mapping::{circuit_input_builder::FeatureConfig, evm::OpcodeId};
use eth_types::Field;
use execution::ExecutionConfig;
use itertools::Itertools;
Expand Down Expand Up @@ -74,6 +74,7 @@ pub struct EvmCircuitConfigArgs<F: Field> {
pub u8_table: UXTable<8>,
/// U16Table
pub u16_table: UXTable<16>,
/// Feature config
pub feature_config: FeatureConfig,
}

Expand Down Expand Up @@ -365,41 +366,39 @@ impl<F: Field> Circuit<F> for EvmCircuit<F> {
Self::default()
}

fn configure_with_params(
meta: &mut ConstraintSystem<F>,
params: Self::Params,
) -> Self::Config {
let tx_table = TxTable::construct(meta);
let rw_table = RwTable::construct(meta);
let bytecode_table = BytecodeTable::construct(meta);
let block_table = BlockTable::construct(meta);
let q_copy_table = meta.fixed_column();
let copy_table = CopyTable::construct(meta, q_copy_table);
let keccak_table = KeccakTable::construct(meta);
let exp_table = ExpTable::construct(meta);
let u8_table = UXTable::construct(meta);
let u16_table = UXTable::construct(meta);
let challenges = Challenges::construct(meta);
let challenges_expr = challenges.exprs(meta);

(
EvmCircuitConfig::new(
meta,
EvmCircuitConfigArgs {
challenges: challenges_expr,
tx_table,
rw_table,
bytecode_table,
block_table,
copy_table,
keccak_table,
exp_table,
u8_table,
u16_table,
},
),
challenges,
)
fn configure_with_params(meta: &mut ConstraintSystem<F>, params: Self::Params) -> Self::Config {
let tx_table = TxTable::construct(meta);
let rw_table = RwTable::construct(meta);
let bytecode_table = BytecodeTable::construct(meta);
let block_table = BlockTable::construct(meta);
let q_copy_table = meta.fixed_column();
let copy_table = CopyTable::construct(meta, q_copy_table);
let keccak_table = KeccakTable::construct(meta);
let exp_table = ExpTable::construct(meta);
let u8_table = UXTable::construct(meta);
let u16_table = UXTable::construct(meta);
let challenges = Challenges::construct(meta);
let challenges_expr = challenges.exprs(meta);

(
EvmCircuitConfig::new(
meta,
EvmCircuitConfigArgs {
challenges: challenges_expr,
tx_table,
rw_table,
bytecode_table,
block_table,
copy_table,
keccak_table,
exp_table,
u8_table,
u16_table,
feature_config: params,
},
),
challenges,
)
}

fn configure(_meta: &mut ConstraintSystem<F>) -> Self::Config {
Expand Down
3 changes: 2 additions & 1 deletion zkevm-circuits/src/evm_circuit/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use crate::{
Challenges, Expr,
},
};
use bus_mapping::operation::Target;
use bus_mapping::{circuit_input_builder::FeatureConfig, operation::Target};
use eth_types::{evm_unimplemented, Field};
use gadgets::util::not;
use halo2_proofs::{
Expand Down Expand Up @@ -684,6 +684,7 @@ impl<F: Field> ExecutionConfig<F> {
step_next.clone(),
challenges,
G::EXECUTION_STATE,
feature_config,
);

let gadget = G::configure(&mut cb);
Expand Down
4 changes: 3 additions & 1 deletion zkevm-circuits/src/evm_circuit/util/constraint_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ use crate::{
Challenges, Expr,
},
};
use bus_mapping::{operation::Target, state_db::EMPTY_CODE_HASH_LE};
use bus_mapping::{
circuit_input_builder::FeatureConfig, operation::Target, state_db::EMPTY_CODE_HASH_LE,
};
use eth_types::Field;
use gadgets::util::{not, sum};
use halo2_proofs::{
Expand Down
3 changes: 2 additions & 1 deletion zkevm-circuits/src/super_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ use crate::{
witness::{block_convert, Block, MptUpdates},
};
use bus_mapping::{
circuit_input_builder::{CircuitInputBuilder, FixedCParams},
circuit_input_builder::{CircuitInputBuilder, FeatureConfig, FixedCParams},
mock::BlockData,
};
use eth_types::{geth_types::GethData, Field};
Expand Down Expand Up @@ -221,6 +221,7 @@ impl<F: Field> SubCircuitConfig<F> for SuperCircuitConfig<F> {
exp_table,
u8_table,
u16_table,
feature_config: FeatureConfig::default(),
},
);

Expand Down
3 changes: 2 additions & 1 deletion zkevm-circuits/src/witness/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::{
util::{log2_ceil, word, SubCircuit},
};
use bus_mapping::{
circuit_input_builder::{self, CopyEvent, ExpEvent, FixedCParams, Withdrawal, FeatureConfig},
circuit_input_builder::{self, CopyEvent, ExpEvent, FeatureConfig, FixedCParams, Withdrawal},
state_db::CodeDB,
Error,
};
Expand Down Expand Up @@ -43,6 +43,7 @@ pub struct Block<F> {
pub exp_circuit_pad_to: usize,
/// Circuit Setup Parameters
pub circuits_params: FixedCParams,
/// Feature Config
pub feature_config: FeatureConfig,
/// Inputs to the SHA3 opcode
pub sha3_inputs: Vec<Vec<u8>>,
Expand Down

0 comments on commit a020481

Please sign in to comment.