Repository navigation
subgraph: Add template handlers to filters - #3277
Conversation
748913a to
40071e8
Compare
45fec9d to
ac6788d
Compare
leoyvens
left a comment
There was a problem hiding this comment.
If EthereumCallFilter::extend won't affect the wildcard filter, then it should assert that the filter is empty.
| schemas: &HashMap<SchemaReference, Arc<Schema>>, | ||
| ) -> Result<(), Vec<SchemaValidationError>> { | ||
| // Using this since std::array's .into_iter() doesn't work | ||
| // as expected (at least as of rustc 1.53) |
There was a problem hiding this comment.
This is a rebase artifact, this comment should be removed.
|
|
||
| /// Ideal number of triggers in a range. The range size will adapt to try to meet this. | ||
| static ref TARGET_TRIGGERS_PER_BLOCK_RANGE: u64 = env_var("GRAPH_ETHEREUM_TARGET_TRIGGERS_PER_BLOCK_RANGE", 100); | ||
| static ref TARGET_TRIGGERS_PER_BLOCK_RANGE: u64 = env_var("GRAPH_ETHEREUM_TARGET_TRIGGERS_PER_BLOCK_RANGE", 1000); |
There was a problem hiding this comment.
It seems safest to not change this value until we have enabled the overall change by default.
| (3, HashSet::from_iter(vec![[3u8; 4]])), | ||
| ), | ||
| ]), | ||
| ..Default::default() |
There was a problem hiding this comment.
I'd prefer to replace these ..Default with wildcard_matches: HashSet::new()
| None if self.wildcard_matches.is_empty() => return false, | ||
| // There are no signatures but there are wildcards. | ||
| None => None, | ||
| }; |
There was a problem hiding this comment.
On EthereumCallFilter::matches, first the correct_input_size check should be moved above to where we check call.input.0.len() < 4 (@otaviopace we missed this in #3219).
And then I'd refactor the correct_fn logic into the arms of this match, it would be more readable.
ac6788d to
a5cd2c2
Compare
| let block = EthereumBlockFilter::from_mapping(&data_source.mapping); | ||
| if !block.is_empty() { | ||
| self.block.extend(block); | ||
| } |
There was a problem hiding this comment.
Extending with an empty block is a noop. If the if is meant as an optimization, then it can be implemented within extend.
1ea6531 to
dc0eb76
Compare
20f2e0d to
3b1a92b
Compare
| let restart_on_dynamic_data_source = | ||
| !env::var_os("EXPERIMENTAL_DISABLE_RESTART_ON_DYNAMIC_DS") | ||
| .map(|_| true) | ||
| .unwrap_or(false); |
There was a problem hiding this comment.
What do you think of trying to give this change a more meaningful and shorter name. Perhaps "static filters"? This would mean renaming restart_on_dynamic_data_source to static_filters_enabled and flipping the conditionals since enabling static filters means restarts are disabled.
6e30907 to
076b495
Compare
b408048 to
830315b
Compare
Fixes #3257