Skip to content

Commit 4a549ee

Browse files
committed
refactor: ProofDataInput name
1 parent 6f60421 commit 4a549ee

3 files changed

Lines changed: 13 additions & 13 deletions

File tree

aggregation_mode/aggregation_programs/sp1/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,20 @@ impl SP1VkAndPubInputs {
1919
}
2020

2121
#[derive(Serialize, Deserialize)]
22-
pub enum ProofDataInput {
22+
pub enum ProofVkAndPubInputs {
2323
SP1Compressed(SP1VkAndPubInputs),
2424
}
2525

26-
impl ProofDataInput {
26+
impl ProofVkAndPubInputs {
2727
pub fn hash(&self) -> [u8; 32] {
2828
match self {
29-
ProofDataInput::SP1Compressed(proof_data) => proof_data.hash(),
29+
ProofVkAndPubInputs::SP1Compressed(proof_data) => proof_data.hash(),
3030
}
3131
}
3232
}
3333

3434
#[derive(Serialize, Deserialize)]
3535
pub struct Input {
36-
pub proofs_data: Vec<ProofDataInput>,
36+
pub proofs_vk_and_pub_inputs: Vec<ProofVkAndPubInputs>,
3737
pub merkle_root: [u8; 32],
3838
}

aggregation_mode/aggregation_programs/sp1/src/main.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ sp1_zkvm::entrypoint!(main);
33

44
use sha2::{Digest, Sha256};
55
use sha3::Keccak256;
6-
use sp1_aggregation_program::{Input, ProofDataInput};
6+
use sp1_aggregation_program::{Input, ProofVkAndPubInputs};
77

88
fn combine_hashes(hash_a: &[u8; 32], hash_b: &[u8; 32]) -> [u8; 32] {
99
let mut hasher = Keccak256::new();
@@ -13,7 +13,7 @@ fn combine_hashes(hash_a: &[u8; 32], hash_b: &[u8; 32]) -> [u8; 32] {
1313
}
1414

1515
/// Computes the merkle root for the given proofs using the vk
16-
fn compute_merkle_root(proofs: &[ProofDataInput]) -> [u8; 32] {
16+
fn compute_merkle_root(proofs: &[ProofVkAndPubInputs]) -> [u8; 32] {
1717
let mut leaves: Vec<[u8; 32]> = proofs
1818
.chunks(2)
1919
.map(|chunk| match chunk {
@@ -41,9 +41,9 @@ pub fn main() {
4141
let input = sp1_zkvm::io::read::<Input>();
4242

4343
// Verify the proofs.
44-
for proof in input.proofs_data.iter() {
44+
for proof in input.proofs_vk_and_pub_inputs.iter() {
4545
match proof {
46-
ProofDataInput::SP1Compressed(proof) => {
46+
ProofVkAndPubInputs::SP1Compressed(proof) => {
4747
let vkey = proof.vk;
4848
let public_values = &proof.public_inputs;
4949
let public_values_digest = Sha256::digest(public_values);
@@ -52,7 +52,7 @@ pub fn main() {
5252
}
5353
}
5454

55-
let merkle_root = compute_merkle_root(&input.proofs_data);
55+
let merkle_root = compute_merkle_root(&input.proofs_vk_and_pub_inputs);
5656

5757
assert_eq!(merkle_root, input.merkle_root);
5858

aggregation_mode/src/aggregators/sp1_aggregator.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::sync::LazyLock;
22

33
use alloy::primitives::Keccak256;
4-
use sp1_aggregation_program::{ProofDataInput, SP1VkAndPubInputs};
4+
use sp1_aggregation_program::{ProofVkAndPubInputs, SP1VkAndPubInputs};
55
use sp1_sdk::{
66
EnvProver, HashableKey, Prover, ProverClient, SP1ProofWithPublicValues, SP1Stdin,
77
SP1VerifyingKey,
@@ -44,15 +44,15 @@ pub(crate) fn aggregate_proofs(
4444
let mut stdin = SP1Stdin::new();
4545

4646
let mut program_input = sp1_aggregation_program::Input {
47-
proofs_data: vec![],
47+
proofs_vk_and_pub_inputs: vec![],
4848
merkle_root: input.merkle_root,
4949
};
5050

5151
// write vk + public inputs
5252
for proof in input.proofs.iter() {
5353
program_input
54-
.proofs_data
55-
.push(ProofDataInput::SP1Compressed(SP1VkAndPubInputs {
54+
.proofs_vk_and_pub_inputs
55+
.push(ProofVkAndPubInputs::SP1Compressed(SP1VkAndPubInputs {
5656
public_inputs: proof.proof_with_pub_values.public_values.to_vec(),
5757
vk: proof.vk().hash_u32(),
5858
}));

0 commit comments

Comments
 (0)