File tree Expand file tree Collapse file tree 4 files changed +22
-12
lines changed
Expand file tree Collapse file tree 4 files changed +22
-12
lines changed Original file line number Diff line number Diff line change @@ -95,7 +95,7 @@ mod tests {
9595
9696 use alloy_eips:: eip4844:: Blob ;
9797 use alloy_primitives:: { address, b256, bytes, U256 } ;
98- use rollup_node_providers:: { L1MessageProvider , L1ProviderError } ;
98+ use rollup_node_providers:: { L1BlobProvider , L1MessageProvider , L1ProviderError } ;
9999 use scroll_alloy_consensus:: TxL1Message ;
100100 use scroll_codec:: decoding:: test_utils:: read_to_bytes;
101101 use tokio:: sync:: Mutex ;
Original file line number Diff line number Diff line change 1+ use crate :: L1ProviderError ;
2+ use alloy_eips:: eip4844:: Blob ;
3+ use alloy_primitives:: B256 ;
4+ use std:: sync:: Arc ;
5+
6+ /// An instance of the trait can be used to fetch L1 blob data.
7+ #[ async_trait:: async_trait]
8+ pub trait L1BlobProvider {
9+ /// Returns corresponding blob data for the provided hash.
10+ async fn blob (
11+ & self ,
12+ block_timestamp : u64 ,
13+ hash : B256 ,
14+ ) -> Result < Option < Arc < Blob > > , L1ProviderError > ;
15+ }
Original file line number Diff line number Diff line change 1+ pub ( crate ) mod blob;
12pub ( crate ) mod message;
23
3- use crate :: { beacon_client:: OnlineBeaconClient , l1:: message:: L1MessageProvider } ;
4+ use crate :: { beacon_client:: OnlineBeaconClient , l1:: message:: L1MessageProvider , L1BlobProvider } ;
45use std:: { num:: NonZeroUsize , sync:: Arc } ;
56
67use alloy_eips:: eip4844:: { Blob , BlobTransactionSidecarItem } ;
@@ -11,15 +12,8 @@ use scroll_db::DatabaseError;
1112use tokio:: sync:: Mutex ;
1213
1314/// An instance of the trait can be used to provide L1 data.
14- #[ async_trait:: async_trait]
15- pub trait L1Provider : L1MessageProvider {
16- /// Returns corresponding blob data for the provided hash.
17- async fn blob (
18- & self ,
19- block_timestamp : u64 ,
20- hash : B256 ,
21- ) -> Result < Option < Arc < Blob > > , L1ProviderError > ;
22- }
15+ pub trait L1Provider : L1BlobProvider + L1MessageProvider { }
16+ impl < T > L1Provider for T where T : L1BlobProvider + L1MessageProvider { }
2317
2418/// An error occurring at the [`L1Provider`].
2519#[ derive( Debug , thiserror:: Error ) ]
@@ -91,7 +85,7 @@ impl<P> OnlineL1Provider<P> {
9185}
9286
9387#[ async_trait:: async_trait]
94- impl < P : L1MessageProvider + Sync > L1Provider for OnlineL1Provider < P > {
88+ impl < P : L1MessageProvider + Sync > L1BlobProvider for OnlineL1Provider < P > {
9589 /// Returns the requested blob corresponding to the passed hash.
9690 async fn blob (
9791 & self ,
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ pub use execution_payload::ExecutionPayloadProvider;
88mod execution_payload;
99
1010pub use l1:: {
11+ blob:: L1BlobProvider ,
1112 message:: { DatabaseL1MessageProvider , L1MessageProvider } ,
1213 L1Provider , L1ProviderError , OnlineL1Provider ,
1314} ;
You can’t perform that action at this time.
0 commit comments