@@ -3,52 +3,53 @@ use futures03::{future::BoxFuture, stream::FuturesUnordered};
33use graph:: abi;
44use graph:: abi:: DynSolValueExt ;
55use graph:: abi:: FunctionExt ;
6- use graph:: blockchain:: client:: ChainClient ;
76use graph:: blockchain:: BlockHash ;
87use graph:: blockchain:: ChainIdentifier ;
98use graph:: blockchain:: ExtendedBlockPtr ;
9+ use graph:: blockchain:: client:: ChainClient ;
1010use graph:: components:: ethereum:: * ;
1111use graph:: components:: transaction_receipt:: LightTransactionReceipt ;
1212use graph:: data:: store:: ethereum:: call;
1313use graph:: data:: store:: scalar;
14- use graph:: data:: subgraph:: UnifiedMappingApiVersion ;
1514use graph:: data:: subgraph:: API_VERSION_0_0_7 ;
15+ use graph:: data:: subgraph:: UnifiedMappingApiVersion ;
1616use graph:: data_source:: common:: ContractCall ;
1717use graph:: derive:: CheapClone ;
18- use graph:: futures01:: stream;
1918use graph:: futures01:: Future ;
2019use graph:: futures01:: Stream ;
20+ use graph:: futures01:: stream;
2121use graph:: futures03:: future:: try_join_all;
2222use graph:: futures03:: {
23- self , compat :: Future01CompatExt , FutureExt , StreamExt , TryFutureExt , TryStreamExt ,
23+ self , FutureExt , StreamExt , TryFutureExt , TryStreamExt , compat :: Future01CompatExt ,
2424} ;
2525use graph:: prelude:: {
2626 alloy:: {
2727 self ,
2828 network:: TransactionResponse ,
2929 primitives:: { Address , B256 } ,
3030 providers:: {
31+ Identity , Provider , RootProvider ,
3132 ext:: TraceApi ,
3233 fillers:: {
3334 BlobGasFiller , ChainIdFiller , FillProvider , GasFiller , JoinFill , NonceFiller ,
3435 } ,
35- Identity , Provider , RootProvider ,
3636 } ,
3737 rpc:: types:: {
38- trace:: { filter:: TraceFilter as AlloyTraceFilter , parity:: LocalizedTransactionTrace } ,
3938 TransactionInput , TransactionRequest ,
39+ trace:: { filter:: TraceFilter as AlloyTraceFilter , parity:: LocalizedTransactionTrace } ,
4040 } ,
4141 transports:: { RpcError , TransportErrorKind } ,
4242 } ,
4343 tokio:: try_join,
4444} ;
4545use graph:: slog:: o;
4646use graph:: {
47- blockchain:: { block_stream :: BlockWithTriggers , BlockPtr , IngestorError } ,
47+ blockchain:: { BlockPtr , IngestorError , block_stream :: BlockWithTriggers } ,
4848 prelude:: {
49- anyhow:: { self , anyhow, bail, ensure, Context } ,
50- debug, error, hex, info, retry, trace, warn, BlockNumber , ChainStore , CheapClone ,
51- DynTryFuture , Error , EthereumCallCache , Logger , TimeoutError ,
49+ BlockNumber , ChainStore , CheapClone , DynTryFuture , Error , EthereumCallCache , Logger ,
50+ TimeoutError ,
51+ anyhow:: { self , Context , anyhow, bail, ensure} ,
52+ debug, error, hex, info, retry, trace, warn,
5253 } ,
5354} ;
5455use itertools:: Itertools ;
@@ -61,24 +62,24 @@ use std::time::{Duration, Instant};
6162use tokio:: sync:: RwLock ;
6263use tokio:: time:: timeout;
6364
65+ use crate :: Chain ;
66+ use crate :: NodeCapabilities ;
67+ use crate :: TriggerFilter ;
6468use crate :: adapter:: EthGetLogsFilter ;
6569use crate :: adapter:: EthereumRpcError ;
6670use crate :: adapter:: ProviderStatus ;
6771use crate :: call_helper:: interpret_eth_call_error;
6872use crate :: chain:: BlockFinality ;
6973use crate :: chain:: ChainSettings ;
7074use crate :: trigger:: { LogPosition , LogRef } ;
71- use crate :: Chain ;
72- use crate :: NodeCapabilities ;
73- use crate :: TriggerFilter ;
7475use crate :: {
76+ ENV_VARS ,
7577 adapter:: {
7678 ContractCallError , EthereumAdapter as EthereumAdapterTrait , EthereumBlockFilter ,
7779 EthereumCallFilter , EthereumLogFilter , ProviderEthRpcMetrics , SubgraphEthRpcMetrics ,
7880 } ,
7981 transport:: Transport ,
8082 trigger:: { EthereumBlockTriggerType , EthereumTrigger } ,
81- ENV_VARS ,
8283} ;
8384
8485type AlloyProvider = FillProvider <
@@ -1014,7 +1015,8 @@ impl EthereumAdapter {
10141015 ) -> Pin <
10151016 Box <
10161017 dyn std:: future:: Future < Output = Result < Vec < EthereumTrigger > , anyhow:: Error > >
1017- + std:: marker:: Send ,
1018+ + std:: marker:: Send
1019+ + ' _ ,
10181020 > ,
10191021 > {
10201022 // Create a HashMap of block numbers to Vec<EthereumBlockTriggerType>
@@ -1053,15 +1055,13 @@ impl EthereumAdapter {
10531055 let block_futures = blocks_matching_polling_filter. map ( move |ptrs| {
10541056 ptrs. into_iter ( )
10551057 . flat_map ( |ptr| {
1056- let triggers = matching_blocks
1058+ matching_blocks
10571059 . get ( & ptr. number )
10581060 // Safe to unwrap since we are iterating over ptrs which was created from
10591061 // the keys of matching_blocks
10601062 . unwrap ( )
10611063 . iter ( )
1062- . map ( move |trigger| EthereumTrigger :: Block ( ptr. clone ( ) , trigger. clone ( ) ) ) ;
1063-
1064- triggers
1064+ . map ( move |trigger| EthereumTrigger :: Block ( ptr. clone ( ) , trigger. clone ( ) ) )
10651065 } )
10661066 . collect :: < Vec < _ > > ( )
10671067 } ) ;
@@ -1126,7 +1126,7 @@ impl EthereumAdapter {
11261126 logger : Logger ,
11271127 from : BlockNumber ,
11281128 to : BlockNumber ,
1129- ) -> Box < dyn Future < Item = Vec < BlockPtr > , Error = Error > + Send > {
1129+ ) -> Box < dyn Future < Item = Vec < BlockPtr > , Error = Error > + Send + ' _ > {
11301130 // Currently we can't go to the DB for this because there might be duplicate entries for
11311131 // the same block number.
11321132 debug ! ( & logger, "Requesting hashes for blocks [{}, {}]" , from, to) ;
@@ -1140,7 +1140,7 @@ impl EthereumAdapter {
11401140 & self ,
11411141 logger : Logger ,
11421142 blocks : Vec < BlockNumber > ,
1143- ) -> Box < dyn Future < Item = Vec < BlockPtr > , Error = Error > + Send > {
1143+ ) -> Box < dyn Future < Item = Vec < BlockPtr > , Error = Error > + Send + ' _ > {
11441144 // Currently we can't go to the DB for this because there might be duplicate entries for
11451145 // the same block number.
11461146 debug ! ( & logger, "Requesting hashes for blocks {:?}" , blocks) ;
@@ -1587,15 +1587,26 @@ impl EthereumAdapterTrait for EthereumAdapter {
15871587
15881588 fn log_call_error ( logger : & ProviderLogger , e : & ContractCallError , call : & ContractCall ) {
15891589 match e {
1590- ContractCallError :: AlloyError ( e) => error ! ( logger,
1590+ ContractCallError :: AlloyError ( e) => error ! (
1591+ logger,
15911592 "Ethereum node returned an error when calling function \" {}\" of contract \" {}\" : {}" ,
1592- call. function. name, call. contract_name, e) ,
1593- ContractCallError :: Timeout => error ! ( logger,
1593+ call. function. name,
1594+ call. contract_name,
1595+ e
1596+ ) ,
1597+ ContractCallError :: Timeout => error ! (
1598+ logger,
15941599 "Ethereum node did not respond when calling function \" {}\" of contract \" {}\" " ,
1595- call. function. name, call. contract_name) ,
1596- _ => error ! ( logger,
1600+ call. function. name,
1601+ call. contract_name
1602+ ) ,
1603+ _ => error ! (
1604+ logger,
15971605 "Failed to call function \" {}\" of contract \" {}\" : {}" ,
1598- call. function. name, call. contract_name, e) ,
1606+ call. function. name,
1607+ call. contract_name,
1608+ e
1609+ ) ,
15991610 }
16001611 }
16011612
@@ -2125,7 +2136,7 @@ async fn filter_call_triggers_from_unsuccessful_transactions(
21252136 // And obtain all Transaction values for the calls in this block.
21262137 let transactions: Vec < & AnyTransaction > = {
21272138 match & block. block {
2128- BlockFinality :: Final ( ref block) => block
2139+ BlockFinality :: Final ( block) => block
21292140 . transactions ( )
21302141 . ok_or_else ( || anyhow ! ( "Block transactions not available" ) ) ?
21312142 . iter ( )
@@ -2696,15 +2707,15 @@ mod tests {
26962707 use crate :: trigger:: { EthereumBlockTriggerType , EthereumTrigger } ;
26972708
26982709 use super :: {
2699- check_block_receipt_support , parse_block_triggers , EthereumBlock , EthereumBlockFilter ,
2700- EthereumBlockWithCalls ,
2710+ EthereumBlock , EthereumBlockFilter , EthereumBlockWithCalls , check_block_receipt_support ,
2711+ parse_block_triggers ,
27012712 } ;
27022713 use graph:: blockchain:: BlockPtr ;
27032714 use graph:: components:: ethereum:: AnyNetworkBare ;
2704- use graph:: prelude:: alloy:: primitives:: { Address , Bytes , B256 } ;
2705- use graph:: prelude:: alloy:: providers:: mock:: Asserter ;
2715+ use graph:: prelude:: alloy:: primitives:: { Address , B256 , Bytes } ;
27062716 use graph:: prelude:: alloy:: providers:: ProviderBuilder ;
2707- use graph:: prelude:: { create_minimal_block_for_test, EthereumCall , LightEthereumBlock } ;
2717+ use graph:: prelude:: alloy:: providers:: mock:: Asserter ;
2718+ use graph:: prelude:: { EthereumCall , LightEthereumBlock , create_minimal_block_for_test} ;
27082719 use jsonrpc_core:: serde_json:: { self , Value } ;
27092720 use std:: collections:: HashSet ;
27102721 use std:: iter:: FromIterator ;
0 commit comments