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 {
884
884
logger : Logger ,
885
885
block_nums : Vec < BlockNumber > ,
886
886
) -> impl Stream < Item = BlockPtr , Error = Error > + Send {
887
- let web3 = self . web3 . clone ( ) ;
887
+ let alloy = self . alloy . clone ( ) ;
888
888
889
889
stream:: iter_ok :: < _ , Error > ( block_nums. into_iter ( ) . map ( move |block_num| {
890
- let web3 = web3 . clone ( ) ;
890
+ let alloy = alloy . clone ( ) ;
891
891
retry ( format ! ( "load block ptr {}" , block_num) , & logger)
892
892
. redact_log_urls ( true )
893
893
. when ( |res| !res. is_ok ( ) && !detect_null_block ( res) )
894
894
. no_limit ( )
895
895
. timeout_secs ( ENV_VARS . json_rpc_timeout . as_secs ( ) )
896
896
. run ( move || {
897
- let web3 = web3 . clone ( ) ;
897
+ let alloy = alloy . cheap_clone ( ) ;
898
898
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
+ ) )
903
903
. await ?;
904
904
905
905
block. ok_or_else ( || {
@@ -920,7 +920,7 @@ impl EthereumAdapter {
920
920
} ) )
921
921
. buffered ( ENV_VARS . block_batch_size )
922
922
. filter_map ( |b| b)
923
- . map ( |b| b . into ( ) )
923
+ . map ( |b| BlockPtr :: from ( ( b . header . hash , b . header . number as i32 ) ) )
924
924
}
925
925
926
926
/// 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 {
241
241
}
242
242
}
243
243
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
+
244
253
impl From < ( Vec < u8 > , u64 ) > for BlockPtr {
245
254
fn from ( ( bytes, number) : ( Vec < u8 > , u64 ) ) -> Self {
246
255
let number = i32:: try_from ( number) . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments