@@ -44,8 +44,8 @@ use graph::prelude::{
44
44
use graph:: slog:: o;
45
45
use graph:: tokio:: sync:: RwLock ;
46
46
use graph:: tokio:: time:: timeout;
47
- use graph:: util:: conversions:: alloy_block_to_web3_block ;
48
- use graph:: util:: conversions:: alloy_block_to_web3_block_arc ;
47
+ use graph:: util:: conversions:: alloy_block_to_block ;
48
+ use graph:: util:: conversions:: alloy_block_to_block_arc ;
49
49
use graph:: {
50
50
blockchain:: { block_stream:: BlockWithTriggers , BlockPtr , IngestorError } ,
51
51
prelude:: {
@@ -1348,7 +1348,7 @@ impl EthereumAdapterTrait for EthereumAdapter {
1348
1348
if block. transactions . is_empty ( ) {
1349
1349
trace ! ( logger, "Block {} contains no transactions" , block_hash) ;
1350
1350
return Ok ( EthereumBlock {
1351
- block : Arc :: new ( alloy_block_to_web3_block ( block) ) ,
1351
+ block : Arc :: new ( alloy_block_to_block ( block) ) ,
1352
1352
transaction_receipts : Vec :: new ( ) ,
1353
1353
} ) ;
1354
1354
}
@@ -1367,7 +1367,7 @@ impl EthereumAdapterTrait for EthereumAdapter {
1367
1367
fetch_receipts_with_retry ( alloy, hashes, block_hash, logger, supports_block_receipts)
1368
1368
. await
1369
1369
. map ( |transaction_receipts| EthereumBlock {
1370
- block : Arc :: new ( alloy_block_to_web3_block ( block) ) ,
1370
+ block : Arc :: new ( alloy_block_to_block ( block) ) ,
1371
1371
transaction_receipts : transaction_receipts
1372
1372
. into_iter ( )
1373
1373
. map ( |receipt| alloy_transaction_receipt_to_web3_transaction_receipt ( receipt) )
@@ -1647,7 +1647,7 @@ impl EthereumAdapterTrait for EthereumAdapter {
1647
1647
. await ?;
1648
1648
let upsert_blocks: Vec < _ > = new_blocks
1649
1649
. iter ( )
1650
- . map ( |block| BlockFinality :: Final ( alloy_block_to_web3_block_arc ( block. clone ( ) ) ) )
1650
+ . map ( |block| BlockFinality :: Final ( alloy_block_to_block_arc ( block. clone ( ) ) ) )
1651
1651
. collect ( ) ;
1652
1652
let block_refs: Vec < _ > = upsert_blocks
1653
1653
. iter ( )
@@ -1802,7 +1802,7 @@ pub(crate) async fn blocks_with_triggers(
1802
1802
. map (
1803
1803
move |block| match triggers_by_block. remove ( & ( block. header . number ( ) as BlockNumber ) ) {
1804
1804
Some ( triggers) => Ok ( BlockWithTriggers :: new (
1805
- BlockFinality :: Final ( alloy_block_to_web3_block_arc ( block) ) ,
1805
+ BlockFinality :: Final ( alloy_block_to_block_arc ( block) ) ,
1806
1806
triggers,
1807
1807
& logger2,
1808
1808
) ) ,
@@ -1875,9 +1875,8 @@ pub(crate) async fn get_calls(
1875
1875
. calls_in_block (
1876
1876
& logger,
1877
1877
subgraph_metrics. clone ( ) ,
1878
- BlockNumber :: try_from ( ethereum_block. block . number . unwrap ( ) . as_u64 ( ) )
1879
- . unwrap ( ) ,
1880
- h256_to_b256 ( ethereum_block. block . hash . unwrap ( ) ) ,
1878
+ ethereum_block. block . number ( ) ,
1879
+ h256_to_b256 ( ethereum_block. block . hash_h256 ( ) . unwrap ( ) ) ,
1881
1880
)
1882
1881
. await ?
1883
1882
} ;
@@ -2061,7 +2060,7 @@ async fn filter_call_triggers_from_unsuccessful_transactions(
2061
2060
let transactions: Vec < & Transaction > = {
2062
2061
match & block. block {
2063
2062
BlockFinality :: Final ( ref block) => block
2064
- . transactions
2063
+ . transactions ( )
2065
2064
. iter ( )
2066
2065
. filter ( |transaction| transaction_hashes. contains ( & transaction. hash ) )
2067
2066
. collect ( ) ,
@@ -2626,12 +2625,14 @@ mod tests {
2626
2625
EthereumBlockWithCalls ,
2627
2626
} ;
2628
2627
use graph:: blockchain:: BlockPtr ;
2628
+ use graph:: components:: ethereum:: Block ;
2629
2629
use graph:: prelude:: alloy:: primitives:: B256 ;
2630
2630
use graph:: prelude:: alloy:: providers:: mock:: Asserter ;
2631
2631
use graph:: prelude:: alloy:: providers:: ProviderBuilder ;
2632
2632
use graph:: prelude:: tokio:: { self } ;
2633
+ use graph:: prelude:: web3:: types:: Block as Web3Block ;
2633
2634
use graph:: prelude:: web3:: types:: U64 ;
2634
- use graph:: prelude:: web3:: types:: { Address , Block , Bytes , H256 } ;
2635
+ use graph:: prelude:: web3:: types:: { Address , Bytes , H256 } ;
2635
2636
use graph:: prelude:: EthereumCall ;
2636
2637
use jsonrpc_core:: serde_json:: { self , Value } ;
2637
2638
use std:: collections:: HashSet ;
@@ -2640,13 +2641,15 @@ mod tests {
2640
2641
2641
2642
#[ test]
2642
2643
fn parse_block_triggers_every_block ( ) {
2644
+ let web3_block = Web3Block {
2645
+ hash : Some ( hash ( 2 ) ) ,
2646
+ number : Some ( U64 :: from ( 2 ) ) ,
2647
+ ..Default :: default ( )
2648
+ } ;
2649
+
2643
2650
let block = EthereumBlockWithCalls {
2644
2651
ethereum_block : EthereumBlock {
2645
- block : Arc :: new ( Block {
2646
- hash : Some ( hash ( 2 ) ) ,
2647
- number : Some ( U64 :: from ( 2 ) ) ,
2648
- ..Default :: default ( )
2649
- } ) ,
2652
+ block : Arc :: new ( Block :: new ( web3_block) ) ,
2650
2653
..Default :: default ( )
2651
2654
} ,
2652
2655
calls : Some ( vec ! [ EthereumCall {
@@ -2783,13 +2786,14 @@ mod tests {
2783
2786
2784
2787
#[ test]
2785
2788
fn parse_block_triggers_specific_call_not_found ( ) {
2789
+ let web3_block = Web3Block {
2790
+ hash : Some ( hash ( 2 ) ) ,
2791
+ number : Some ( U64 :: from ( 2 ) ) ,
2792
+ ..Default :: default ( )
2793
+ } ;
2786
2794
let block = EthereumBlockWithCalls {
2787
2795
ethereum_block : EthereumBlock {
2788
- block : Arc :: new ( Block {
2789
- hash : Some ( hash ( 2 ) ) ,
2790
- number : Some ( U64 :: from ( 2 ) ) ,
2791
- ..Default :: default ( )
2792
- } ) ,
2796
+ block : Arc :: new ( Block :: new ( web3_block) ) ,
2793
2797
..Default :: default ( )
2794
2798
} ,
2795
2799
calls : Some ( vec ! [ EthereumCall {
@@ -2815,13 +2819,15 @@ mod tests {
2815
2819
2816
2820
#[ test]
2817
2821
fn parse_block_triggers_specific_call_found ( ) {
2822
+ let web3_block = Web3Block {
2823
+ hash : Some ( hash ( 2 ) ) ,
2824
+ number : Some ( U64 :: from ( 2 ) ) ,
2825
+ ..Default :: default ( )
2826
+ } ;
2827
+
2818
2828
let block = EthereumBlockWithCalls {
2819
2829
ethereum_block : EthereumBlock {
2820
- block : Arc :: new ( Block {
2821
- hash : Some ( hash ( 2 ) ) ,
2822
- number : Some ( U64 :: from ( 2 ) ) ,
2823
- ..Default :: default ( )
2824
- } ) ,
2830
+ block : Arc :: new ( Block :: new ( web3_block) ) ,
2825
2831
..Default :: default ( )
2826
2832
} ,
2827
2833
calls : Some ( vec ! [ EthereumCall {
0 commit comments