Skip to content

Commit 7ff2d4c

Browse files
committed
feat: set proof as missed on error
1 parent 4645f14 commit 7ff2d4c

File tree

3 files changed

+28
-15
lines changed

3 files changed

+28
-15
lines changed

aggregation-mode/src/backend/mod.rs

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ enum AggregatedProofSubmissionError {
3232
Aggregation(ProofAggregationError),
3333
SendBlobTransaction,
3434
SendVerifyAggregatedProofTransaction(alloy::contract::Error),
35-
GettingReceiptVerifyAggregatedProofTransaction(PendingTransactionError),
35+
ReceiptError(PendingTransactionError),
3636
}
3737

3838
pub struct ProofAggregator {
@@ -48,6 +48,7 @@ pub struct Config {
4848
pub private_key: String,
4949
pub submit_proofs_every_secs: u64,
5050
pub max_proofs_in_queue: u16,
51+
pub proof_aggregation_service_address: String,
5152
}
5253

5354
impl ProofAggregator {
@@ -56,8 +57,11 @@ impl ProofAggregator {
5657
let signer = PrivateKeySigner::from_str(&config.private_key).expect("valid string");
5758
let wallet = EthereumWallet::from(signer);
5859
let provider = ProviderBuilder::new().wallet(wallet).on_http(rpc_url);
59-
let proof_aggregation_service =
60-
AlignedProofAggregationService::new(Address::default(), provider);
60+
let proof_aggregation_service = AlignedProofAggregationService::new(
61+
Address::from_str(&config.proof_aggregation_service_address)
62+
.expect("Address to be correct"),
63+
provider,
64+
);
6165

6266
Self {
6367
engine: ZKVMEngine::SP1,
@@ -84,7 +88,9 @@ impl ProofAggregator {
8488
}
8589
Err(err) => {
8690
error!("Error while aggregating and submitting proofs: {:?}", err);
87-
self.set_aggregated_proof_as_missed().await;
91+
if let Err(err) = self.set_aggregated_proof_as_missed().await {
92+
error!("Error while marking proof as failed: {:?}", err);
93+
};
8894
}
8995
};
9096
}
@@ -165,15 +171,14 @@ impl ProofAggregator {
165171
proof.proof.bytes().into(),
166172
)
167173
.send()
168-
// sign with aggregator wallet
169174
.await
170175
.map_err(
171176
AggregatedProofSubmissionError::SendVerifyAggregatedProofTransaction,
172177
)?;
173178

174-
res.get_receipt().await.map_err(
175-
AggregatedProofSubmissionError::GettingReceiptVerifyAggregatedProofTransaction,
176-
)
179+
res.get_receipt()
180+
.await
181+
.map_err(AggregatedProofSubmissionError::ReceiptError)
177182
}
178183
}
179184
}
@@ -186,6 +191,18 @@ impl ProofAggregator {
186191
Ok([0u8; 32])
187192
}
188193

189-
// TODO
190-
async fn set_aggregated_proof_as_missed(&self) {}
194+
async fn set_aggregated_proof_as_missed(
195+
&self,
196+
) -> Result<TransactionReceipt, AggregatedProofSubmissionError> {
197+
let res = self
198+
.proof_aggregation_service
199+
.markCurrentAggregatedProofAsMissed()
200+
.send()
201+
.await
202+
.map_err(AggregatedProofSubmissionError::SendVerifyAggregatedProofTransaction)?;
203+
204+
res.get_receipt()
205+
.await
206+
.map_err(AggregatedProofSubmissionError::ReceiptError)
207+
}
191208
}

aggregation-mode/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ async fn main() {
1919

2020
// TODO read proof aggregator yaml config file
2121
let config = Config {
22+
proof_aggregation_service_address: "0xcbEAF3BDe82155F56486Fb5a1072cb8baAf547cc".into(),
2223
private_key: "0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6".into(),
2324
rpc_url: "http://localhost:8545".into(),
2425
max_proofs_in_queue: proofs_to_push,

aggregation-mode/src/zk/aggregator.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ impl ProgramOutput {
1818
pub fn new(proof: AggregatedProof) -> Self {
1919
Self { proof }
2020
}
21-
22-
/// TODO: return the contract calldata to verify proof
23-
pub fn calldata(&self) -> Vec<u8> {
24-
vec![]
25-
}
2621
}
2722

2823
#[derive(Debug)]

0 commit comments

Comments
 (0)