Skip to content

Commit ae34d73

Browse files
fix clippy lint about boxing an enum variant
1 parent ce697ca commit ae34d73

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

  • aggregation_mode/proof_aggregator/src/backend

aggregation_mode/proof_aggregator/src/backend/mod.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ pub enum AggregatedProofSubmissionError {
5555
}
5656

5757
enum SubmitOutcome {
58-
Confirmed(TransactionReceipt),
58+
// NOTE: Boxed because enums are sized to their largest variant; without boxing,
59+
// every `SubmitOutcome` would reserve space for a full `TransactionReceipt`,
60+
// even in the `Pending` case (see clippy::large_enum_variant).
61+
Confirmed(Box<TransactionReceipt>),
5962
Pending(TxHash),
6063
}
6164

@@ -380,7 +383,7 @@ impl ProofAggregator {
380383
"Transaction confirmed successfully on attempt {}",
381384
attempt + 1
382385
);
383-
return Ok(receipt);
386+
return Ok(*receipt);
384387
}
385388
Ok(SubmitOutcome::Pending(tx_hash)) => {
386389
warn!(
@@ -556,7 +559,7 @@ impl ProofAggregator {
556559
let receipt_result = tokio::time::timeout(retry_interval, pending_tx.get_receipt()).await;
557560

558561
match receipt_result {
559-
Ok(Ok(receipt)) => Ok(SubmitOutcome::Confirmed(receipt)),
562+
Ok(Ok(receipt)) => Ok(SubmitOutcome::Confirmed(Box::new(receipt))),
560563
Ok(Err(err)) => Err(
561564
AggregatedProofSubmissionError::SendVerifyAggregatedProofTransaction(format!(
562565
"Error getting receipt: {err}"

0 commit comments

Comments
 (0)