@@ -54,11 +54,12 @@ impl CacheHandle {
5454 }
5555
5656 /// Fetch the blobs using [`Self::fetch_blobs`] and decode them to get the
57- /// Zenith block data.
58- pub async fn fetch_and_decode (
57+ /// Zenith block data using the provided coder .
58+ pub async fn fetch_and_decode_with_coder < C : SidecarCoder > (
5959 & self ,
6060 slot : usize ,
6161 extract : & ExtractedEvent < ' _ , Receipt , BlockSubmitted > ,
62+ mut coder : C ,
6263 ) -> FetchResult < Bytes > {
6364 let tx_hash = extract. tx_hash ( ) ;
6465 let versioned_hashes = extract
@@ -70,7 +71,7 @@ impl CacheHandle {
7071
7172 let blobs = self . fetch_blobs ( slot, tx_hash, versioned_hashes. to_owned ( ) ) . await ?;
7273
73- SimpleCoder :: default ( )
74+ coder
7475 . decode_all ( blobs. as_ref ( ) )
7576 . ok_or_else ( BlobFetcherError :: blob_decode_error) ?
7677 . into_iter ( )
@@ -79,19 +80,41 @@ impl CacheHandle {
7980 . ok_or_else ( || BlobFetcherError :: block_data_not_found ( tx_hash) )
8081 }
8182
82- /// Fetch the blobs, decode them, and construct a Zenith block from the
83- /// header and data.
84- pub async fn signet_block (
83+ /// Fetch the blobs using [`Self::fetch_blobs`] and decode them using
84+ /// [`SimpleCoder`] to get the Zenith block data.
85+ pub async fn fech_and_decode (
86+ & self ,
87+ slot : usize ,
88+ extract : & ExtractedEvent < ' _ , Receipt , BlockSubmitted > ,
89+ ) -> FetchResult < Bytes > {
90+ self . fetch_and_decode_with_coder ( slot, extract, SimpleCoder :: default ( ) ) . await
91+ }
92+
93+ /// Fetch the blobs, decode them using the provided coder, and construct a
94+ /// Zenith block from the header and data.
95+ pub async fn signet_block_with_coder < C : SidecarCoder > (
8596 & self ,
8697 host_block_number : u64 ,
8798 slot : usize ,
8899 extract : & ExtractedEvent < ' _ , Receipt , BlockSubmitted > ,
100+ coder : C ,
89101 ) -> FetchResult < ZenithBlock > {
90102 let header = extract. ru_header ( host_block_number) ;
91- self . fetch_and_decode ( slot, extract)
103+ self . fetch_and_decode_with_coder ( slot, extract, coder )
92104 . await
93105 . map ( |buf| ZenithBlock :: from_header_and_data ( header, buf) )
94106 }
107+
108+ /// Fetch the blobs, decode them using [`SimpleCoder`], and construct a
109+ /// Zenith block from the header and data.
110+ pub async fn signet_block (
111+ & self ,
112+ host_block_number : u64 ,
113+ slot : usize ,
114+ extract : & ExtractedEvent < ' _ , Receipt , BlockSubmitted > ,
115+ ) -> FetchResult < ZenithBlock > {
116+ self . signet_block_with_coder ( host_block_number, slot, extract, SimpleCoder :: default ( ) ) . await
117+ }
95118}
96119
97120/// Retrieves blobs and stores them in a cache for later use.
0 commit comments