Skip to content

Commit 2752c38

Browse files
committed
Fix linter issues
1 parent afd7a5c commit 2752c38

File tree

5 files changed

+48
-44
lines changed

5 files changed

+48
-44
lines changed

crates/core/src/lib.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ impl Signer {
167167
.collect();
168168

169169
let hash_tree = HashTree::new(&param, pub_key_hashes);
170-
let root = hash_tree.root.clone();
170+
let root = hash_tree.root;
171171

172172
Self {
173173
rng,
@@ -371,7 +371,7 @@ mod tests {
371371
let mut signer = Signer::new(StdRng::seed_from_u64(0), 1000000, spec.clone(), 8);
372372

373373
// Get public verification parameters
374-
let root = signer.root.clone();
374+
let root = signer.root;
375375
let param = signer.param.clone();
376376

377377
let message1 = Message([10; 32]);
@@ -404,9 +404,9 @@ mod tests {
404404

405405
// Register validator roots
406406
let roots = vec![
407-
validator1.root.clone(),
408-
validator2.root.clone(),
409-
validator3.root.clone(),
407+
validator1.root,
408+
validator2.root,
409+
validator3.root,
410410
];
411411

412412
// Create the validator roots collection for verification
@@ -425,19 +425,19 @@ mod tests {
425425
ValidatorSignature {
426426
epoch: 0,
427427
signature: sig1,
428-
xmss_root: validator1.root.clone(),
428+
xmss_root: validator1.root,
429429
param: validator1.param.clone(),
430430
},
431431
ValidatorSignature {
432432
epoch: 0,
433433
signature: sig2,
434-
xmss_root: validator2.root.clone(),
434+
xmss_root: validator2.root,
435435
param: validator2.param.clone(),
436436
},
437437
ValidatorSignature {
438438
epoch: 0,
439439
signature: sig3,
440-
xmss_root: validator3.root.clone(),
440+
xmss_root: validator3.root,
441441
param: validator3.param.clone(),
442442
},
443443
]);
@@ -450,13 +450,13 @@ mod tests {
450450
ValidatorSignature {
451451
epoch: 0,
452452
signature: validator1.sign(1, &message).expect("Failed to sign"),
453-
xmss_root: validator1.root.clone(),
453+
xmss_root: validator1.root,
454454
param: validator1.param.clone(),
455455
},
456456
ValidatorSignature {
457457
epoch: 0,
458458
signature: validator2.sign(1, &message).expect("Failed to sign"),
459-
xmss_root: validator2.root.clone(),
459+
xmss_root: validator2.root,
460460
param: validator2.param.clone(),
461461
},
462462
]);
@@ -470,7 +470,7 @@ mod tests {
470470
let invalid_aggregated = AggregatedSignature::new(vec![ValidatorSignature {
471471
epoch: 2,
472472
signature: bad_sig,
473-
xmss_root: validator1.root.clone(),
473+
xmss_root: validator1.root,
474474
param: validator1.param.clone(),
475475
}]);
476476

crates/shared/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ pub fn create_test_data(
6464
})
6565
.collect();
6666

67-
let validator_roots: Vec<_> = validators.iter().map(|v| v.root.clone()).collect();
67+
let validator_roots: Vec<_> = validators.iter().map(|v| v.root).collect();
6868
let validator_params: Vec<_> = validators.iter().map(|v| v.param.clone()).collect();
6969

7070
// Each validator signs the message
@@ -75,7 +75,7 @@ pub fn create_test_data(
7575
ValidatorSignature {
7676
epoch,
7777
signature,
78-
xmss_root: validator.root.clone(),
78+
xmss_root: validator.root,
7979
param: validator.param.clone(),
8080
}
8181
})

crates/sp1/guest/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use leansig_shared::XmssTestData;
88
pub fn main() {
99
// Read the test data containing both public inputs and aggregated signature
1010
let test_data = sp1_zkvm::io::read::<XmssTestData>();
11-
11+
1212
// Extract the components
1313
let public_inputs = test_data.public_inputs;
1414
let aggregated_signature = test_data.aggregated_signature;
@@ -31,4 +31,4 @@ pub fn main() {
3131

3232
// Optionally commit a success flag
3333
sp1_zkvm::io::commit(&verification_result);
34-
}
34+
}

crates/sp1/host/benches/xmss_benchmark.rs

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
// Copyright 2025 Irreducible Inc.
2-
use criterion::{Criterion, black_box, criterion_group, criterion_main};
3-
use leansig_core::spec::{SPEC_1, SPEC_2, Spec};
4-
use sp1_sdk::{ProverClient, SP1Stdin, SP1ProofWithPublicValues};
2+
use criterion::{black_box, criterion_group, criterion_main, Criterion};
3+
use leansig_core::spec::{Spec, SPEC_1, SPEC_2};
54
use leansig_shared::{create_test_data, XmssTestData};
5+
use sp1_sdk::{ProverClient, SP1ProofWithPublicValues, SP1Stdin};
66
use std::time::{Duration, Instant};
77

8-
const ELF: &[u8] = include_bytes!("../../../../target/elf-compilation/riscv32im-succinct-zkvm-elf/release/sp1-guest");
8+
const ELF: &[u8] = include_bytes!(
9+
"../../../../target/elf-compilation/riscv32im-succinct-zkvm-elf/release/sp1-guest"
10+
);
911

1012
/// Configuration parameters for benchmarking
1113
struct BenchmarkConfig {
@@ -64,40 +66,35 @@ impl Job {
6466
config.num_validators,
6567
config.spec.clone(),
6668
config.tree_height,
67-
10000, // max_retries for nonce grinding
68-
None, // use default message [42; 32]
69-
None, // use default epoch 0
69+
10000, // max_retries for nonce grinding
70+
None, // use default message [42; 32]
71+
None, // use default epoch 0
7072
);
7173

72-
Self {
73-
test_data,
74-
}
74+
Self { test_data }
7575
}
7676

7777
/// Execute witness generation phase (SP1 setup + stdin preparation)
7878
fn exec_compute(&self) -> (SP1Stdin, Duration) {
7979
let start = Instant::now();
80-
80+
8181
let mut stdin = SP1Stdin::new();
8282
stdin.write(&self.test_data);
83-
83+
8484
let elapsed = start.elapsed();
8585

8686
(stdin, elapsed)
8787
}
8888

8989
/// Execute proving phase
90-
fn prove_stdin(
91-
&self,
92-
stdin: &SP1Stdin,
93-
) -> (SP1ProofWithPublicValues, Duration) {
90+
fn prove_stdin(&self, stdin: &SP1Stdin) -> (SP1ProofWithPublicValues, Duration) {
9491
let client = ProverClient::from_env();
9592
let (pk, _vk) = client.setup(ELF);
96-
93+
9794
let start = Instant::now();
9895
let proof = client.prove(&pk, stdin).run().unwrap();
9996
let elapsed = start.elapsed();
100-
97+
10198
(proof, elapsed)
10299
}
103100
}
@@ -156,7 +153,7 @@ fn xmss_benchmarks(c: &mut Criterion) {
156153
// We need to recreate stdin for each iteration since it gets consumed
157154
let mut fresh_stdin = SP1Stdin::new();
158155
fresh_stdin.write(&job.test_data);
159-
156+
160157
let (proof, _duration) = job.prove_stdin(&fresh_stdin);
161158
black_box(proof);
162159
});
@@ -177,7 +174,7 @@ fn xmss_benchmarks(c: &mut Criterion) {
177174
group.bench_function("proof_verification", |b| {
178175
let client = ProverClient::from_env();
179176
let (_pk, vk) = client.setup(ELF);
180-
177+
181178
b.iter(|| {
182179
client.verify(&proof, &vk).unwrap();
183180
});
@@ -186,10 +183,14 @@ fn xmss_benchmarks(c: &mut Criterion) {
186183
// Print additional metrics
187184
println!("\nSP1 Additional Metrics:");
188185
let proof_size_bytes = bincode::serialize(&proof).unwrap().len();
189-
println!(" Proof Size: {:.2} KiB ({} bytes)", proof_size_bytes as f64 / 1024.0, proof_size_bytes);
186+
println!(
187+
" Proof Size: {:.2} KiB ({} bytes)",
188+
proof_size_bytes as f64 / 1024.0,
189+
proof_size_bytes
190+
);
190191

191192
group.finish();
192193
}
193194

194195
criterion_group!(sp1_xmss_signature, xmss_benchmarks);
195-
criterion_main!(sp1_xmss_signature);
196+
criterion_main!(sp1_xmss_signature);

crates/sp1/host/src/main.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// Copyright 2025 Irreducible Inc.
2-
use leansig_core::{
3-
AggregatedVerifier, spec,
4-
};
2+
use leansig_core::{spec, AggregatedVerifier};
53
use leansig_shared::create_test_data;
64
use sp1_sdk::{ProverClient, SP1Stdin};
75
use tracing_subscriber;
86

9-
const ELF: &[u8] = include_bytes!("../../../../target/elf-compilation/riscv32im-succinct-zkvm-elf/release/sp1-guest");
7+
const ELF: &[u8] = include_bytes!(
8+
"../../../../target/elf-compilation/riscv32im-succinct-zkvm-elf/release/sp1-guest"
9+
);
1010

1111
fn main() {
1212
// Initialize tracing. In order to view logs, run `RUST_LOG=info cargo run`
@@ -22,7 +22,10 @@ fn main() {
2222
test_data.public_inputs.spec.clone(),
2323
);
2424
assert!(
25-
verifier.verify(&test_data.public_inputs.message, &test_data.aggregated_signature),
25+
verifier.verify(
26+
&test_data.public_inputs.message,
27+
&test_data.aggregated_signature
28+
),
2629
"failed to verify aggregated signature"
2730
);
2831

@@ -47,9 +50,9 @@ fn main() {
4750
// Get the public values from the proof as committed by the guest.
4851
let _committed_public_inputs = proof.public_values.read::<leansig_shared::PublicInputs>();
4952
let committed_verification_result = proof.public_values.read::<bool>();
50-
53+
5154
println!("Verification result: {}", committed_verification_result);
5255
assert!(committed_verification_result, "Guest verification failed");
5356

5457
println!("Successfully verified proof!");
55-
}
58+
}

0 commit comments

Comments
 (0)