@@ -2,6 +2,7 @@ use anyhow::Error;
2
2
use ethabi:: { Error as ABIError , Function , ParamType , Token } ;
3
3
use futures:: Future ;
4
4
use graph:: blockchain:: ChainIdentifier ;
5
+ use graph:: env:: env_var;
5
6
use mockall:: automock;
6
7
use mockall:: predicate:: * ;
7
8
use std:: cmp;
@@ -26,7 +27,10 @@ use crate::{data_source::DataSource, Chain};
26
27
pub type EventSignature = H256 ;
27
28
pub type FunctionSelector = [ u8 ; 4 ] ;
28
29
29
- const ETH_GET_LOGS_MAX_CONTRACTS : usize = 1000 ;
30
+ lazy_static ! {
31
+ static ref ETH_GET_LOGS_MAX_CONTRACTS : usize =
32
+ env_var( "GRAPH_ETH_GET_LOGS_MAX_CONTRACTS" , 2000 ) ;
33
+ }
30
34
31
35
#[ derive( Clone , Debug ) ]
32
36
pub struct EthereumContractCall {
@@ -263,7 +267,7 @@ impl EthereumLogFilter {
263
267
for neighbor in g. neighbors ( max_vertex) {
264
268
match neighbor {
265
269
LogFilterNode :: Contract ( address) => {
266
- if filter. contracts . len ( ) == ETH_GET_LOGS_MAX_CONTRACTS {
270
+ if filter. contracts . len ( ) == * ETH_GET_LOGS_MAX_CONTRACTS {
267
271
// The batch size was reached, register the filter and start a new one.
268
272
let event = filter. event_signatures [ 0 ] ;
269
273
push_filter ( filter) ;
@@ -818,7 +822,7 @@ fn complete_log_filter() {
818
822
819
823
// Assert that chunking works.
820
824
for filter in logs_filters {
821
- assert ! ( filter. contracts. len( ) <= 1000 ) ;
825
+ assert ! ( filter. contracts. len( ) <= * ETH_GET_LOGS_MAX_CONTRACTS ) ;
822
826
}
823
827
}
824
828
}
0 commit comments