Skip to content

Commit ca4f4d0

Browse files
committed
refactor: use into_proof_receipt function instead of Into trait
1 parent 0a44c32 commit ca4f4d0

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

crates/proof-impl/checkpoint/src/lib.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,10 @@ pub fn process_checkpoint_proof(
8989
} else {
9090
// Use previous checkpoint's bootstrap state and include previous proof
9191
let bootstrap = prev_checkpoint.bootstrap_state().clone();
92-
(bootstrap, Some(prev_checkpoint.clone().into()))
92+
(
93+
bootstrap,
94+
Some(prev_checkpoint.clone().into_proof_receipt()),
95+
)
9396
}
9497
}
9598
};

crates/state/src/batch.rs

+9-13
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ impl BatchCheckpoint {
4444
CheckpointProofOutput::new(self.batch_info().clone(), self.bootstrap_state().clone())
4545
}
4646

47+
pub fn into_proof_receipt(self) -> ProofReceipt {
48+
let proof = self.proof;
49+
let output = CheckpointProofOutput::new(self.batch_info, self.bootstrap);
50+
let public_values = PublicValues::new(
51+
borsh::to_vec(&output).expect("could not serialize checkpoint proof output"),
52+
);
53+
ProofReceipt::new(proof, public_values)
54+
}
55+
4756
pub fn proof(&self) -> &Proof {
4857
&self.proof
4958
}
@@ -60,19 +69,6 @@ impl BatchCheckpoint {
6069
}
6170
}
6271

63-
impl From<BatchCheckpoint> for ProofReceipt {
64-
fn from(batch_checkpoint: BatchCheckpoint) -> Self {
65-
let proof = batch_checkpoint.proof;
66-
let output =
67-
CheckpointProofOutput::new(batch_checkpoint.batch_info, batch_checkpoint.bootstrap);
68-
let public_values = PublicValues::new(
69-
borsh::to_vec(&output).expect("could not serialize checkpoint proof output"),
70-
);
71-
72-
ProofReceipt::new(proof, public_values)
73-
}
74-
}
75-
7672
#[derive(
7773
Clone, Debug, BorshDeserialize, BorshSerialize, Arbitrary, PartialEq, Eq, Serialize, Deserialize,
7874
)]

0 commit comments

Comments
 (0)