diff --git a/packages/indexer-common/src/actions.ts b/packages/indexer-common/src/actions.ts index a6f920ab8..9aec66814 100644 --- a/packages/indexer-common/src/actions.ts +++ b/packages/indexer-common/src/actions.ts @@ -1,5 +1,6 @@ import { NetworkMonitor } from './indexer-management' import { AllocationStatus } from './allocations' +import { Logger } from '@graphprotocol/common-ts' import { WhereOperators, WhereOptions } from 'sequelize' import { Op } from 'sequelize' import { WhereAttributeHashValue } from 'sequelize/types/model' @@ -81,6 +82,7 @@ export const isValidActionInput = ( export const validateActionInputs = async ( actions: ActionInput[], networkMonitor: NetworkMonitor, + logger: Logger, ): Promise => { // Validate actions before adding to queue // TODO: Perform all checks simultaneously and throw combined error if 1 or more fail @@ -125,7 +127,7 @@ export const validateActionInputs = async ( action.deploymentID, ) if (!subgraphDeployment) { - throw new Error( + logger.warn( `No subgraphDeployment with ipfsHash = '${action.deploymentID}' found on the network`, ) } diff --git a/packages/indexer-common/src/indexer-management/__tests__/resolvers/actions.test.ts b/packages/indexer-common/src/indexer-management/__tests__/resolvers/actions.test.ts index dc7df5ef4..245d46dc1 100644 --- a/packages/indexer-common/src/indexer-management/__tests__/resolvers/actions.test.ts +++ b/packages/indexer-common/src/indexer-management/__tests__/resolvers/actions.test.ts @@ -28,7 +28,6 @@ import { import { CombinedError } from '@urql/core' import { GraphQLError } from 'graphql' import { - allocateToNotPublishedDeployment, createTestManagementClient, invalidReallocateAction, invalidUnallocateAction, @@ -36,7 +35,6 @@ import { subgraphDeployment1, subgraphDeployment2, subgraphDeployment3, - notPublishedSubgraphDeployment, } from '../util' const QUEUE_ACTIONS_MUTATION = gql` @@ -632,23 +630,6 @@ describe('Actions', () => { ).resolves.toHaveProperty('data.actions', [expectedUpdated]) }) - test('Reject action with deployment not on network', async () => { - const inputActions = [allocateToNotPublishedDeployment] - - await expect( - client.mutation(QUEUE_ACTIONS_MUTATION, { actions: inputActions }).toPromise(), - ).resolves.toHaveProperty( - 'error', - new CombinedError({ - graphQLErrors: [ - new GraphQLError( - `No subgraphDeployment with ipfsHash = '${notPublishedSubgraphDeployment}' found on the network`, - ), - ], - }), - ) - }) - test('Reject unallocate action with inactive allocationID', async () => { // This allocation has been closed on chain const closedAllocation = '0x0001572b5fde192fc1c65630fabb5e13d3ad173e' diff --git a/packages/indexer-common/src/indexer-management/__tests__/util.ts b/packages/indexer-common/src/indexer-management/__tests__/util.ts index b697558d8..4a46b72c9 100644 --- a/packages/indexer-common/src/indexer-management/__tests__/util.ts +++ b/packages/indexer-common/src/indexer-management/__tests__/util.ts @@ -132,8 +132,6 @@ export const defaults: IndexerManagementDefaults = { export const subgraphDeployment1 = 'Qmew9PZUJCoDzXqqU6vGyTENTKHrrN4dy5h94kertfudqy' export const subgraphDeployment2 = 'QmWq1pmnhEvx25qxpYYj9Yp6E1xMKMVoUjXVQBxUJmreSe' export const subgraphDeployment3 = 'QmRhH2nhNibDVPZmYqq3TUZZARZ77vgjYCvPNiGBCogtgM' -export const notPublishedSubgraphDeployment = - 'QmeqJ6hsdyk9dVbo1tvRgAxWrVS3rkERiEMsxzPShKLco6' export const queuedAllocateAction = { status: ActionStatus.QUEUED, @@ -147,18 +145,6 @@ export const queuedAllocateAction = { protocolNetwork: 'goerli', } as ActionInput -export const allocateToNotPublishedDeployment = { - status: ActionStatus.QUEUED, - type: ActionType.ALLOCATE, - deploymentID: notPublishedSubgraphDeployment, - amount: '10000', - force: false, - source: 'indexerAgent', - reason: 'indexingRule', - priority: 0, - protocolNetwork: 'goerli', -} as ActionInput - export const invalidUnallocateAction = { status: ActionStatus.QUEUED, type: ActionType.UNALLOCATE, diff --git a/packages/indexer-common/src/indexer-management/resolvers/actions.ts b/packages/indexer-common/src/indexer-management/resolvers/actions.ts index 7baa422bc..d82b70800 100644 --- a/packages/indexer-common/src/indexer-management/resolvers/actions.ts +++ b/packages/indexer-common/src/indexer-management/resolvers/actions.ts @@ -173,7 +173,7 @@ export default { await multiNetworks.mapNetworkMapped( groupBy(actions, (action) => action.protocolNetwork), (network: Network, actions: ActionInput[]) => - validateActionInputs(actions, network.networkMonitor), + validateActionInputs(actions, network.networkMonitor, logger), ) const alreadyQueuedActions = await ActionManager.fetchActions(models, {