Skip to content

Commit 3414b2e

Browse files
committed
chore: fmt + clippy
1 parent 6170157 commit 3414b2e

File tree

8 files changed

+20
-31
lines changed

8 files changed

+20
-31
lines changed

prover/src/aggregator/verifier.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,9 @@ impl<'params> Verifier<'params> {
5858
// [`LAYER4_CONFIG_PATH`].
5959
env::set_var("COMPRESSION_CONFIG", &*LAYER4_CONFIG_PATH);
6060

61-
let params = params_map.get(&*LAYER4_DEGREE).expect(&format!(
62-
"KZG params don't contain degree={:?}",
63-
LAYER4_DEGREE
64-
));
61+
let params = params_map
62+
.get(&*LAYER4_DEGREE)
63+
.unwrap_or_else(|| panic!("KZG params don't contain degree={:?}", LAYER4_DEGREE));
6564

6665
Self {
6766
inner: common::Verifier::from_params(params, &raw_vk),

prover/src/config.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,7 @@ impl LayerId {
163163
///
164164
/// Every SNARK layer on top of the [`innermost layer`][LayerId::Inner] has an accumulator.
165165
pub fn accumulator(&self) -> bool {
166-
if let Self::Inner = self {
167-
false
168-
} else {
169-
true
170-
}
166+
!matches!(self, Self::Inner)
171167
}
172168
}
173169

prover/src/proof/proof_v2.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -91,19 +91,19 @@ impl<Inner: Proof + serde::de::DeserializeOwned> ProofV2<Inner> {
9191
/// Read and deserialize the proof.
9292
pub fn from_json<P: AsRef<Path>>(dir: P, suffix: &str) -> Result<Self, ProverError> {
9393
let path = Self::path_proof(dir, suffix);
94-
Ok(read_json_deep(path)?)
94+
read_json_deep(path)
9595
}
9696

9797
/// Serialize the proof and other peripheral data, before dumping in the provided directory.
9898
pub fn dump<P: AsRef<Path>>(&self, dir: P, suffix: &str) -> Result<(), ProverError> {
9999
// Dump the verifying key.
100-
write(Self::path_vk(&dir, &suffix), &self.vk)?;
100+
write(Self::path_vk(&dir, suffix), &self.vk)?;
101101

102102
// Dump the proof itself.
103-
write_json(Self::path_proof(&dir, &suffix), &self)?;
103+
write_json(Self::path_proof(&dir, suffix), &self)?;
104104

105105
// Dump any other data for the inner data.
106-
self.inner.dump(&dir, &suffix)?;
106+
self.inner.dump(&dir, suffix)?;
107107

108108
Ok(())
109109
}
@@ -210,7 +210,7 @@ impl BundleProofV2 {
210210
}
211211

212212
Ok(Self {
213-
inner: BundleProofV2Metadata::default(),
213+
inner: BundleProofV2Metadata,
214214
proof: proof.to_vec(),
215215
instances: instances.to_vec(),
216216
vk: vk.to_vec(),
@@ -275,7 +275,7 @@ impl Proof for ChunkProofV2Metadata {
275275
}
276276

277277
fn dump<P: AsRef<Path>>(&self, dir: P, suffix: &str) -> Result<(), ProverError> {
278-
write(Self::path_protocol(&dir, &suffix), &self.protocol)?;
278+
write(Self::path_protocol(&dir, suffix), &self.protocol)?;
279279

280280
Ok(())
281281
}
@@ -310,7 +310,7 @@ impl Proof for BatchProofV2Metadata {
310310
}
311311

312312
fn dump<P: AsRef<Path>>(&self, dir: P, suffix: &str) -> Result<(), ProverError> {
313-
write(Self::path_protocol(&dir, &suffix), &self.protocol)?;
313+
write(Self::path_protocol(&dir, suffix), &self.protocol)?;
314314

315315
Ok(())
316316
}

prover/src/utils/io.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ pub fn try_read<P: AsRef<Path>>(path: P) -> Option<Vec<u8>> {
118118
///
119119
/// Panics if any i/o error encountered.
120120
pub fn force_read<P: AsRef<Path> + std::fmt::Debug>(path: P) -> Vec<u8> {
121-
self::read(path.as_ref()).expect(&format!("no file found! path={path:?}"))
121+
self::read(path.as_ref()).unwrap_or_else(|_| panic!("no file found! path={path:?}"))
122122
}
123123

124124
/// Wrapper functionality to write bytes to a file.

prover/src/zkevm/circuit/builder.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,8 @@ fn block_traces_to_witness_block(block_traces: Vec<BlockTrace>) -> Result<Block,
136136
}
137137

138138
let mut traces = block_traces.into_iter();
139-
let mut builder = CircuitInputBuilder::new_from_l2_trace(
140-
get_super_circuit_params(),
141-
traces.next().unwrap(),
142-
)?;
139+
let mut builder =
140+
CircuitInputBuilder::new_from_l2_trace(get_super_circuit_params(), traces.next().unwrap())?;
143141
for (idx, block_trace) in traces.enumerate() {
144142
log::debug!(
145143
"add_more_l2_trace idx {}, block num {:?}",

prover/src/zkevm/prover.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ impl<'params> Prover<'params> {
122122
&chunk_info_reconstructed,
123123
chunk_info_provided,
124124
)
125-
.map_err(|e| ChunkProverError::Custom(e))?;
125+
.map_err(ChunkProverError::Custom)?;
126126
}
127127

128128
// Generate the final Layer-2 SNARK.

prover/src/zkevm/verifier.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,9 @@ impl<'params> Verifier<'params> {
4848
// [`LAYER2_CONFIG_PATH`].
4949
env::set_var("COMPRESSION_CONFIG", &*LAYER2_CONFIG_PATH);
5050

51-
let params = params_map.get(&*LAYER2_DEGREE).expect(&format!(
52-
"KZG params don't contain degree={:?}",
53-
LAYER2_DEGREE
54-
));
51+
let params = params_map
52+
.get(&*LAYER2_DEGREE)
53+
.unwrap_or_else(|| panic!("KZG params don't contain degree={:?}", LAYER2_DEGREE));
5554

5655
Self {
5756
inner: common::Verifier::from_params(params, &raw_vk),

testool/src/statetest/executor.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -637,15 +637,12 @@ pub fn run_test(
637637
#[cfg(feature = "inner-prove")]
638638
{
639639
eth_types::constants::set_env_coinbase(&st.env.current_coinbase);
640-
prover::test::inner_prove(&test_id, &witness_block);
640+
prover::inner_prove(&test_id, &witness_block);
641641
}
642642
#[cfg(feature = "chunk-prove")]
643643
{
644644
eth_types::constants::set_env_coinbase(&st.env.current_coinbase);
645-
prover::test::chunk_prove(
646-
&test_id,
647-
prover::ChunkProvingTask::new(vec![_scroll_trace], prover::ChunkKind::Halo2),
648-
);
645+
prover::chunk_prove(&test_id, prover::ChunkProvingTask::new(vec![_scroll_trace]));
649646
}
650647

651648
#[cfg(not(any(feature = "inner-prove", feature = "chunk-prove")))]

0 commit comments

Comments
 (0)