File tree Expand file tree Collapse file tree 2 files changed +17
-8
lines changed
Expand file tree Collapse file tree 2 files changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -884,22 +884,22 @@ impl EthereumAdapter {
884884 logger : Logger ,
885885 block_nums : Vec < BlockNumber > ,
886886 ) -> impl Stream < Item = BlockPtr , Error = Error > + Send {
887- let web3 = self . web3 . clone ( ) ;
887+ let alloy = self . alloy . clone ( ) ;
888888
889889 stream:: iter_ok :: < _ , Error > ( block_nums. into_iter ( ) . map ( move |block_num| {
890- let web3 = web3 . clone ( ) ;
890+ let alloy = alloy . clone ( ) ;
891891 retry ( format ! ( "load block ptr {}" , block_num) , & logger)
892892 . redact_log_urls ( true )
893893 . when ( |res| !res. is_ok ( ) && !detect_null_block ( res) )
894894 . no_limit ( )
895895 . timeout_secs ( ENV_VARS . json_rpc_timeout . as_secs ( ) )
896896 . run ( move || {
897- let web3 = web3 . clone ( ) ;
897+ let alloy = alloy . cheap_clone ( ) ;
898898 async move {
899- let block = web3
900- . eth ( )
901- . block ( BlockId :: Number ( Web3BlockNumber :: Number ( block_num. into ( ) ) ) )
902- . boxed ( )
899+ let block = alloy
900+ . get_block_by_number ( alloy_rpc_types :: BlockNumberOrTag :: Number (
901+ block_num as u64 ,
902+ ) )
903903 . await ?;
904904
905905 block. ok_or_else ( || {
@@ -920,7 +920,7 @@ impl EthereumAdapter {
920920 } ) )
921921 . buffered ( ENV_VARS . block_batch_size )
922922 . filter_map ( |b| b)
923- . map ( |b| b . into ( ) )
923+ . map ( |b| BlockPtr :: from ( ( b . header . hash , b . header . number as i32 ) ) )
924924 }
925925
926926 /// Check if `block_ptr` refers to a block that is on the main chain, according to the Ethereum
Original file line number Diff line number Diff line change @@ -241,6 +241,15 @@ impl From<(H256, i32)> for BlockPtr {
241241 }
242242}
243243
244+ impl From < ( alloy:: primitives:: B256 , i32 ) > for BlockPtr {
245+ fn from ( ( hash, number) : ( alloy:: primitives:: B256 , i32 ) ) -> BlockPtr {
246+ BlockPtr {
247+ hash : hash. into ( ) ,
248+ number,
249+ }
250+ }
251+ }
252+
244253impl From < ( Vec < u8 > , u64 ) > for BlockPtr {
245254 fn from ( ( bytes, number) : ( Vec < u8 > , u64 ) ) -> Self {
246255 let number = i32:: try_from ( number) . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments