-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: clean exports * fix: lints * feat: error re-exports * touchups
- Loading branch information
Showing
15 changed files
with
137 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
//! Error types for kona's attributes builder. | ||
|
||
use alloc::string::String; | ||
use alloy_eips::BlockNumHash; | ||
use alloy_primitives::B256; | ||
|
||
/// An [AttributesBuilder] Error. | ||
/// | ||
/// [AttributesBuilder]: crate::traits::AttributesBuilder | ||
#[derive(derive_more::Display, Clone, Debug, PartialEq, Eq)] | ||
pub enum BuilderError { | ||
/// Mismatched blocks. | ||
#[display("Block mismatch. Expected {_0:?}, got {_1:?}")] | ||
BlockMismatch(BlockNumHash, BlockNumHash), | ||
/// Mismatched blocks for the start of an Epoch. | ||
#[display("Block mismatch on epoch reset. Expected {_0:?}, got {_1:?}")] | ||
BlockMismatchEpochReset(BlockNumHash, BlockNumHash, B256), | ||
/// [SystemConfig] update failed. | ||
/// | ||
/// [SystemConfig]: op_alloy_genesis::SystemConfig | ||
#[display("System config update failed")] | ||
SystemConfigUpdate, | ||
/// Broken time invariant between L2 and L1. | ||
#[display("Time invariant broken. L1 origin: {_0:?} | Next L2 time: {_1} | L1 block: {_2:?} | L1 timestamp {_3:?}")] | ||
BrokenTimeInvariant(BlockNumHash, u64, BlockNumHash, u64), | ||
/// Attributes unavailable. | ||
#[display("Attributes unavailable")] | ||
AttributesUnavailable, | ||
/// A custom error. | ||
#[display("Error in attributes builder: {_0}")] | ||
Custom(String), | ||
} | ||
|
||
impl core::error::Error for BuilderError {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
//! Error types for the kona derivation pipeline. | ||
|
||
mod attributes; | ||
pub use attributes::BuilderError; | ||
|
||
mod stages; | ||
pub use stages::BatchDecompressionError; | ||
|
||
mod pipeline; | ||
pub use pipeline::{ | ||
PipelineEncodingError, PipelineError, PipelineErrorKind, PipelineResult, ResetError, | ||
}; | ||
|
||
mod sources; | ||
pub use sources::{BlobDecodingError, BlobProviderError}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
//! Error types for sources. | ||
|
||
use alloc::string::String; | ||
|
||
/// Blob Decoding Error | ||
#[derive(derive_more::Display, Debug, PartialEq, Eq)] | ||
pub enum BlobDecodingError { | ||
/// Invalid field element | ||
#[display("Invalid field element")] | ||
InvalidFieldElement, | ||
/// Invalid encoding version | ||
#[display("Invalid encoding version")] | ||
InvalidEncodingVersion, | ||
/// Invalid length | ||
#[display("Invalid length")] | ||
InvalidLength, | ||
/// Missing Data | ||
#[display("Missing data")] | ||
MissingData, | ||
} | ||
|
||
impl core::error::Error for BlobDecodingError {} | ||
|
||
/// An error returned by the [BlobProviderError]. | ||
#[derive(derive_more::Display, Debug, PartialEq, Eq)] | ||
pub enum BlobProviderError { | ||
/// The number of specified blob hashes did not match the number of returned sidecars. | ||
#[display("Blob sidecar length mismatch: expected {_0}, got {_1}")] | ||
SidecarLengthMismatch(usize, usize), | ||
/// Slot derivation error. | ||
#[display("Failed to derive slot")] | ||
SlotDerivation, | ||
/// Blob decoding error. | ||
#[display("Blob decoding error: {_0}")] | ||
BlobDecoding(BlobDecodingError), | ||
/// Error pertaining to the backend transport. | ||
#[display("{_0}")] | ||
Backend(String), | ||
} | ||
|
||
impl From<BlobDecodingError> for BlobProviderError { | ||
fn from(err: BlobDecodingError) -> Self { | ||
Self::BlobDecoding(err) | ||
} | ||
} | ||
|
||
impl core::error::Error for BlobProviderError {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
//! Error types for derivation pipeline stages. | ||
|
||
use op_alloy_protocol::MAX_SPAN_BATCH_ELEMENTS; | ||
|
||
/// A frame decompression error. | ||
#[derive(derive_more::Display, Debug, PartialEq, Eq)] | ||
pub enum BatchDecompressionError { | ||
/// The buffer exceeds the [MAX_SPAN_BATCH_ELEMENTS] protocol parameter. | ||
#[display("The batch exceeds the maximum number of elements: {max_size}", max_size = MAX_SPAN_BATCH_ELEMENTS)] | ||
BatchTooLarge, | ||
} | ||
|
||
impl core::error::Error for BatchDecompressionError {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters