diff --git a/core/src/subgraph/runner.rs b/core/src/subgraph/runner.rs index b6f3cf10c5a..14277de4e0e 100644 --- a/core/src/subgraph/runner.rs +++ b/core/src/subgraph/runner.rs @@ -119,42 +119,41 @@ where None => true, }; + // if static_filters is not enabled we just stick to the filter based on all the data sources. + if !static_filters { + return C::TriggerFilter::from_data_sources( + self.ctx + .instance() + .hosts() + .iter() + .filter_map(|h| h.data_source().as_onchain()) + // Filter out data sources that have reached their end block if the block is final. + .filter(end_block_filter), + ); + } + // if static_filters is enabled, build a minimal filter with the static data sources and // add the necessary filters based on templates. - // if not enabled we just stick to the filter based on all the data sources. // This specifically removes dynamic data sources based filters because these can be derived // from templates AND this reduces the cost of egress traffic by making the payloads smaller. - let filter = if static_filters { - if !self.inputs.static_filters { - info!(self.logger, "forcing subgraph to use static filters.") - } - let data_sources = self.ctx.instance().data_sources.clone(); + if !self.inputs.static_filters { + info!(self.logger, "forcing subgraph to use static filters.") + } - let mut filter = C::TriggerFilter::from_data_sources( - data_sources - .iter() - .filter_map(|ds| ds.as_onchain()) - // Filter out data sources that have reached their end block if the block is final. - .filter(end_block_filter), - ); + let data_sources = self.ctx.instance().data_sources.clone(); - let templates = self.ctx.instance().templates.clone(); + let mut filter = C::TriggerFilter::from_data_sources( + data_sources + .iter() + .filter_map(|ds| ds.as_onchain()) + // Filter out data sources that have reached their end block if the block is final. + .filter(end_block_filter), + ); - filter.extend_with_template(templates.iter().filter_map(|ds| ds.as_onchain()).cloned()); + let templates = self.ctx.instance().templates.clone(); - filter - } else { - C::TriggerFilter::from_data_sources( - self.ctx - .instance() - .hosts() - .iter() - .filter_map(|h| h.data_source().as_onchain()) - // Filter out data sources that have reached their end block if the block is final. - .filter(end_block_filter), - ) - }; + filter.extend_with_template(templates.iter().filter_map(|ds| ds.as_onchain()).cloned()); filter } diff --git a/tests/runner-tests/api-version/subgraph.yaml b/tests/runner-tests/api-version/subgraph.yaml deleted file mode 100644 index 39d6a73190c..00000000000 --- a/tests/runner-tests/api-version/subgraph.yaml +++ /dev/null @@ -1,23 +0,0 @@ -specVersion: 0.0.4 -schema: - file: ./schema.graphql -dataSources: - - kind: ethereum/contract - name: Contract - network: test - source: - address: "0x0000000000000000000000000000000000000000" - abi: Contract - mapping: - kind: ethereum/events - apiVersion: 0.0.7 - language: wasm/assemblyscript - abis: - - name: Contract - file: ./abis/Contract.abi - entities: - - Call - eventHandlers: - - event: TestEvent(string) - handler: handleTestEvent - file: ./src/mapping.ts \ No newline at end of file diff --git a/tests/runner-tests/yarn.lock b/tests/runner-tests/yarn.lock index 945a4ce31d1..e484370f844 100644 --- a/tests/runner-tests/yarn.lock +++ b/tests/runner-tests/yarn.lock @@ -249,6 +249,38 @@ which "2.0.2" yaml "1.10.2" +"@graphprotocol/graph-cli@0.54.0-alpha-20230727052453-1e0e6e5": + version "0.54.0-alpha-20230727052453-1e0e6e5" + resolved "https://registry.yarnpkg.com/@graphprotocol/graph-cli/-/graph-cli-0.54.0-alpha-20230727052453-1e0e6e5.tgz#7c36225484d503ab410ea03861d701dc30bc8b1e" + integrity sha512-pxZAJvUXHRMtPIoMTSvVyIjqrfMGCtaqWG9qdRDrLMxUKrIuGWniMKntxaFnHPlgz6OQznN9Zt8wV6uScD/4Sg== + dependencies: + "@float-capital/float-subgraph-uncrashable" "^0.0.0-alpha.4" + "@oclif/core" "2.8.6" + "@whatwg-node/fetch" "^0.8.4" + assemblyscript "0.19.23" + binary-install-raw "0.0.13" + chalk "3.0.0" + chokidar "3.5.3" + debug "4.3.4" + docker-compose "0.23.19" + dockerode "2.5.8" + fs-extra "9.1.0" + glob "9.3.5" + gluegun "5.1.2" + graphql "15.5.0" + immutable "4.2.1" + ipfs-http-client "55.0.0" + jayson "4.0.0" + js-yaml "3.14.1" + prettier "1.19.1" + request "2.88.2" + semver "7.4.0" + sync-request "6.1.0" + tmp-promise "3.0.3" + web3-eth-abi "1.7.0" + which "2.0.2" + yaml "1.10.2" + "@graphprotocol/graph-cli@0.60.0": version "0.60.0" resolved "https://registry.yarnpkg.com/@graphprotocol/graph-cli/-/graph-cli-0.60.0.tgz#afcae7a966ad348886f49372d36c4ca6c35b9434"