Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clean up light mode ccc #1431

Merged
merged 1 commit into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bus-mapping/src/circuit_input_builder/builder_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ impl<P: JsonRpcClient> BuilderClient<P> {
) -> Result<CircuitInputBuilder, Error> {
let block_trace = external_tracer::l2trace(trace_config)?;
let mut builder =
CircuitInputBuilder::new_from_l2_trace(self.circuits_params, block_trace, false)?;
CircuitInputBuilder::new_from_l2_trace(self.circuits_params, block_trace)?;
builder
.finalize_building()
.expect("could not finalize building block");
Expand Down
5 changes: 1 addition & 4 deletions bus-mapping/src/circuit_input_builder/l2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ impl CircuitInputBuilder {
pub fn new_from_l2_trace(
circuits_params: CircuitsParams,
l2_trace: BlockTrace,
light_mode: bool,
) -> Result<Self, Error> {
let chain_id = l2_trace.chain_id;

Expand Down Expand Up @@ -152,7 +151,7 @@ impl CircuitInputBuilder {
);

Some(state)
} else if !light_mode {
} else {
let mpt_init_state = ZktrieState::from_trace_with_additional(
old_root,
Self::collect_account_proofs(&l2_trace.storage_trace),
Expand All @@ -171,8 +170,6 @@ impl CircuitInputBuilder {
);

Some(mpt_init_state)
} else {
None
};

let mut sdb = StateDB::new();
Expand Down
198 changes: 198 additions & 0 deletions go.work.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion integration-tests/tests/l2_trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fn test_circuit_input_builder_l2block(block_trace: BlockTrace) {
..Default::default()
};

let mut builder = CircuitInputBuilder::new_from_l2_trace(params, block_trace, false)
let mut builder = CircuitInputBuilder::new_from_l2_trace(params, block_trace)
.expect("could not handle block tx");

builder
Expand Down
13 changes: 1 addition & 12 deletions prover/src/zkevm/capacity_checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,6 @@ impl RowUsage {

#[derive(Debug)]
pub struct CircuitCapacityChecker {
/// When "light_mode" enabled, we skip zktrie subcircuit in row estimation to avoid the heavy
/// poseidon cost.
pub light_mode: bool,
pub acc_row_usage: RowUsage,
pub row_usages: Vec<RowUsage>,
pub builder_ctx: Option<(CodeDB, StateDB, Option<ZktrieState>)>,
Expand All @@ -115,7 +112,6 @@ impl CircuitCapacityChecker {
Self {
acc_row_usage: RowUsage::new(),
row_usages: Vec::new(),
light_mode: true,
builder_ctx: None,
}
}
Expand All @@ -124,9 +120,6 @@ impl CircuitCapacityChecker {
self.acc_row_usage = RowUsage::new();
self.row_usages = Vec::new();
}
pub fn set_light_mode(&mut self, light_mode: bool) {
self.light_mode = light_mode;
}
pub fn get_tx_num(&self) -> usize {
self.row_usages.len()
}
Expand Down Expand Up @@ -173,11 +166,7 @@ impl CircuitCapacityChecker {
(builder, Some(code_db))
} else {
(
CircuitInputBuilder::new_from_l2_trace(
get_super_circuit_params(),
trace,
self.light_mode,
)?,
CircuitInputBuilder::new_from_l2_trace(get_super_circuit_params(), trace)?,
None,
)
};
Expand Down
7 changes: 2 additions & 5 deletions prover/src/zkevm/circuit/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,8 @@ pub fn block_traces_to_witness_block(block_traces: Vec<BlockTrace>) -> Result<Bl
}

let mut traces = block_traces.into_iter();
let mut builder = CircuitInputBuilder::new_from_l2_trace(
get_super_circuit_params(),
traces.next().unwrap(),
false,
)?;
let mut builder =
CircuitInputBuilder::new_from_l2_trace(get_super_circuit_params(), traces.next().unwrap())?;
for (idx, block_trace) in traces.enumerate() {
log::debug!(
"add_more_l2_trace idx {}, block num {:?}",
Expand Down
5 changes: 2 additions & 3 deletions testool/src/statetest/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,8 @@ fn trace_config_to_witness_block_l2(
};

eth_types::constants::set_scroll_block_constants_with_trace(&block_trace);
let mut builder =
CircuitInputBuilder::new_from_l2_trace(circuits_params, block_trace.clone(), false)
.expect("could not handle block tx");
let mut builder = CircuitInputBuilder::new_from_l2_trace(circuits_params, block_trace.clone())
.expect("could not handle block tx");
builder
.finalize_building()
.expect("could not finalize building block");
Expand Down
2 changes: 1 addition & 1 deletion zkevm-circuits/src/super_circuit/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ fn test_super_circuit<
MOCK_DIFFICULTY.to_big_endian(&mut difficulty_be_bytes);
set_var("DIFFICULTY", hex::encode(difficulty_be_bytes));

let mut builder = CircuitInputBuilder::new_from_l2_trace(circuits_params, l2_trace, false)
let mut builder = CircuitInputBuilder::new_from_l2_trace(circuits_params, l2_trace)
.expect("could not handle block tx");

builder
Expand Down
1 change: 0 additions & 1 deletion zkevm-circuits/src/test_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ impl<const NACC: usize, const NTX: usize> CircuitTestBuilder<NACC, NTX> {
let mut builder = CircuitInputBuilder::new_from_l2_trace(
params,
self.test_ctx.unwrap().l2_trace().clone(),
false,
)
.expect("could not handle block tx");
builder
Expand Down
Loading