Skip to content

Commit

Permalink
indexer-common: Fix bug in isDeploymentWorthAllocatingTowards()
Browse files Browse the repository at this point in the history
- The bug affected indexing-rules using `minSignal` thresholds without a
'maxSignal' threshold set
- Also made some minor updates to:
    - update error reference page url: use `main` branch
    - use consistent subgraph naming convention:
      `indexer-agent/${networkSubgraphDeployment.ipfsHash.slice(-10)}`
  • Loading branch information
fordN committed Sep 10, 2022
1 parent ea132db commit 0b6ed28
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
5 changes: 1 addition & 4 deletions packages/indexer-agent/src/commands/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -816,10 +816,7 @@ export default {
if (networkSubgraphDeployment !== undefined) {
// Make sure the network subgraph is being indexed
await indexer.ensure(
`${networkSubgraphDeployment.ipfsHash.slice(
0,
23,
)}/${networkSubgraphDeployment.ipfsHash.slice(23)}`,
`indexer-agent/${networkSubgraphDeployment.ipfsHash.slice(-10)}`,
networkSubgraphDeployment,
)
}
Expand Down
2 changes: 1 addition & 1 deletion packages/indexer-common/src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface IndexerErrorMetrics {

let indexerErrorMetrics: IndexerErrorMetrics | undefined

const ERROR_BASE_URL = `https://github.com/graphprotocol/indexer/blob/master/docs/errors.md`
const ERROR_BASE_URL = `https://github.com/graphprotocol/indexer/blob/main/docs/errors.md`

export enum IndexerErrorCode {
IE001 = 'IE001',
Expand Down
5 changes: 3 additions & 2 deletions packages/indexer-common/src/subgraphs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,9 @@ export function isDeploymentWorthAllocatingTowards(
} else if (
deploymentRule.minSignal &&
signalledTokens.gte(deploymentRule.minSignal) &&
deploymentRule.maxSignal &&
signalledTokens.lte(deploymentRule.maxSignal)
deploymentRule.maxSignal
? signalledTokens.lte(deploymentRule.maxSignal)
: true
) {
return new AllocationDecision(
deployment.id,
Expand Down

0 comments on commit 0b6ed28

Please sign in to comment.