Skip to content

Commit fe9c3da

Browse files
committed
apollo_l1_provider: reduce number of provider error variants
1 parent 26dccbf commit fe9c3da

File tree

2 files changed

+2
-18
lines changed

2 files changed

+2
-18
lines changed

crates/apollo_l1_provider/src/l1_provider.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -230,13 +230,10 @@ impl L1Provider {
230230
);
231231
Ok(txs)
232232
}
233-
ProviderState::Pending => Err(L1ProviderError::UnexpectedProviderState {
233+
_ => Err(L1ProviderError::UnexpectedProviderState {
234234
expected: ProviderState::Propose,
235235
found: self.state,
236236
}),
237-
ProviderState::Bootstrap => Err(L1ProviderError::OutOfSessionGetTransactions),
238-
ProviderState::Validate => Err(L1ProviderError::GetTransactionConsensusBug),
239-
ProviderState::Uninitialized => Err(L1ProviderError::Uninitialized),
240237
}
241238
}
242239

@@ -258,13 +255,10 @@ impl L1Provider {
258255
ProviderState::Validate => {
259256
Ok(self.tx_manager.validate_tx(tx_hash, self.clock.unix_now()))
260257
}
261-
ProviderState::Propose => Err(L1ProviderError::ValidateTransactionConsensusBug),
262-
ProviderState::Pending => Err(L1ProviderError::UnexpectedProviderState {
258+
_ => Err(L1ProviderError::UnexpectedProviderState {
263259
expected: ProviderState::Validate,
264260
found: self.state,
265261
}),
266-
ProviderState::Bootstrap => Err(L1ProviderError::OutOfSessionValidate),
267-
ProviderState::Uninitialized => Err(L1ProviderError::Uninitialized),
268262
}
269263
}
270264

crates/apollo_l1_provider_types/src/errors.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,6 @@ use crate::ProviderState;
99

1010
#[derive(Clone, Debug, Error, PartialEq, Eq, Serialize, Deserialize)]
1111
pub enum L1ProviderError {
12-
#[error("`get_txs` while in `Validate` state")]
13-
GetTransactionConsensusBug,
14-
// This is likely due to a crash, restart block proposal.
15-
#[error("`get_txs` called when provider is not in proposer state")]
16-
OutOfSessionGetTransactions,
17-
// This is likely due to a crash, restart block proposal.
18-
#[error("`validate` called when provider is not in proposer state")]
19-
OutOfSessionValidate,
2012
// This error indicates that the provider is uninitialized.
2113
// It likely occurs if the provider restarted while the scraper remained active.
2214
// In that case, the scraper's restart logic will automatically reinitialize the provider.
@@ -28,8 +20,6 @@ pub enum L1ProviderError {
2820
UnexpectedProviderState { expected: ProviderState, found: ProviderState },
2921
#[error("Cannot transition from {from} to {to}")]
3022
UnexpectedProviderStateTransition { from: String, to: String },
31-
#[error("`validate` called while in `Propose` state")]
32-
ValidateTransactionConsensusBug,
3323
}
3424

3525
impl L1ProviderError {

0 commit comments

Comments
 (0)