-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
34 additions
and
1 deletion.
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
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,25 @@ | ||
//! Traits for working with protocol types. | ||
use alloc::{boxed::Box, string::ToString}; | ||
use async_trait::async_trait; | ||
use core::fmt::Display; | ||
use op_alloy_consensus::OpBlock; | ||
|
||
use crate::L2BlockInfo; | ||
|
||
/// Describes the functionality of a data source that fetches safe blocks. | ||
#[async_trait] | ||
pub trait BatchValidationProvider { | ||
/// The error type for the [BatchValidationProvider]. | ||
type Error: Display + ToString; | ||
|
||
/// Returns the [L2BlockInfo] given a block number. | ||
/// | ||
/// Errors if the block does not exist. | ||
async fn l2_block_info_by_number(&mut self, number: u64) -> Result<L2BlockInfo, Self::Error>; | ||
|
||
/// Returns the [OpBlock] for a given number. | ||
/// | ||
/// Errors if no block is available for the given block number. | ||
async fn block_by_number(&mut self, number: u64) -> Result<OpBlock, Self::Error>; | ||
} |
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