Skip to content

Commit 919369b

Browse files
committed
apollo_l2_provider: remove panic on unknown L1 event type; add support for cancellations
1 parent 87e6760 commit 919369b

File tree

3 files changed

+7
-14
lines changed

3 files changed

+7
-14
lines changed

crates/apollo_l1_provider/src/l1_provider.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,13 @@ impl L1Provider {
231231
);
232232
});
233233
}
234+
Event::TransactionCanceled(event_data) => {
235+
// TODO(guyn): delete the transaction from the provider.
236+
info!(
237+
"Cancellation finalized with data: {event_data:?}. THIS DOES NOT DELETE \
238+
THE TRANSACTION FROM THE PROVIDER YET."
239+
);
240+
}
234241
Event::TransactionConsumed { tx_hash, timestamp: consumed_at } => {
235242
if let Err(previously_consumed_at) =
236243
self.tx_manager.consume_tx(tx_hash, consumed_at, self.clock.unix_now())
@@ -241,7 +248,6 @@ impl L1Provider {
241248
);
242249
}
243250
}
244-
_ => return Err(L1ProviderError::unsupported_l1_event(event)),
245251
}
246252
}
247253
Ok(())

crates/apollo_l1_provider/src/l1_scraper.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -424,13 +424,6 @@ fn handle_client_error<B: BaseLayerContract + Send + Sync>(
424424
L1ProviderClientError::L1ProviderError(L1ProviderError::Uninitialized) => {
425425
Err(L1ScraperError::NeedsRestart)
426426
}
427-
L1ProviderClientError::L1ProviderError(L1ProviderError::UnsupportedL1Event(event)) => {
428-
panic!(
429-
"Scraper-->Provider consistency error: the event {event} is not supported by the \
430-
provider, but has been scraped and sent to it nonetheless. Check the list of \
431-
tracked events in the scraper and compare to the provider's."
432-
)
433-
}
434427
error => panic!("Unexpected error: {error}"),
435428
}
436429
}

crates/apollo_l1_provider_types/src/errors.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ pub enum L1ProviderError {
2626
UnexpectedHeight { expected_height: BlockNumber, got: BlockNumber },
2727
#[error("Cannot transition from {from} to {to}")]
2828
UnexpectedProviderStateTransition { from: String, to: String },
29-
#[error("L1 event not supported: {0}")]
30-
UnsupportedL1Event(String),
3129
#[error("`validate` called while in `Propose` state")]
3230
ValidateTransactionConsensusBug,
3331
}
@@ -36,10 +34,6 @@ impl L1ProviderError {
3634
pub fn unexpected_transition(from: impl ToString, to: impl ToString) -> Self {
3735
Self::UnexpectedProviderStateTransition { from: from.to_string(), to: to.to_string() }
3836
}
39-
40-
pub fn unsupported_l1_event(event: Event) -> Self {
41-
Self::UnsupportedL1Event(event.to_string())
42-
}
4337
}
4438

4539
#[derive(Clone, Debug, Error)]

0 commit comments

Comments
 (0)