Skip to content

Commit 8f810ba

Browse files
committed
all: remove auto-pausing in auto-graft mode
1 parent e166e74 commit 8f810ba

File tree

11 files changed

+34
-129
lines changed

11 files changed

+34
-129
lines changed

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ Tests require:
131131
```
132132

133133
## Current State
134-
- Version: v0.24.1
134+
- Version: v0.24.2
135135
- Active branch: release-v0.24
136136
- Main branch: main
137137
- Uncommitted changes in docs/ and config/

docs/auto-graft.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -163,16 +163,14 @@ Auto-graft will:
163163
3. Deploy Subgraph A and sync to block 15M
164164
4. Finally deploy your subgraph starting from block 15M
165165

166-
### Automatic Pausing
166+
### Dependency Syncing
167167

168-
After each dependency reaches its target block, it's automatically paused to:
169-
- Prevent unnecessary indexing beyond the graft point
170-
- Save computational resources
171-
- Ensure data consistency
168+
When a dependency reaches its target block, auto-graft will:
169+
- Log a warning that the graft dependency has reached the required block height
170+
- Continue indexing past the graft point to ensure the dependency remains available
171+
- Allow the main subgraph to successfully graft from this dependency
172172

173-
Auto-graft will check for active allocations before pausing a dependency. If a subgraph has an active allocation (meaning it's still serving queries), it will NOT be automatically paused to prevent service disruption. This ensures that customers can continue querying subgraphs that are actively allocated.
174-
175-
*Note: This allocation check was introduced in v0.24.1*
173+
*Note: Prior to v0.24.2, dependencies were automatically paused after reaching their target block. This behavior was removed to ensure better availability and prevent issues with allocations.*
176174

177175
## Monitoring Auto-Graft
178176

@@ -183,9 +181,9 @@ Monitor these log messages to track auto-graft progress:
183181
- `"Auto graft deploy subgraph dependencies"` - Process started
184182
- `"graft dep chain found"` - Dependencies identified
185183
- `"Dependency subgraph found, checking if it's healthy"` - Existing dependency detected
186-
- `"Dependency subgraph not found, creating, deploying and pausing..."` - New dependency being deployed
184+
- `"Dependency subgraph not found, creating, deploying..."` - New dependency being deployed
187185
- `"Begin syncing subgraph deployment to block"` - Syncing in progress
188-
- `"Successfully synced"` - Dependency ready
186+
- `"Graft dependency has reached target block height. Continuing to index past graft point."` - Dependency ready for grafting
189187

190188
### Checking Dependency Status
191189

docs/networks/arbitrum-sepolia.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ The Graph Network's testnet is on Arbitrum Sepolia (eip155:421614). Sepolia netw
77
| Component | Release |
88
| ------------------ | ------------------------------------------------------------------------------------ |
99
| contracts | [5.3.3](https://github.com/graphprotocol/contracts/releases/tag/v5.3.3) |
10-
| indexer-agent | [0.24.1](https://github.com/graphprotocol/indexer/releases/tag/v0.24.1) |
11-
| indexer-cli | [0.24.1](https://github.com/graphprotocol/indexer/releases/tag/v0.24.1) |
10+
| indexer-agent | [0.24.2](https://github.com/graphprotocol/indexer/releases/tag/v0.24.2) |
11+
| indexer-cli | [0.24.2](https://github.com/graphprotocol/indexer/releases/tag/v0.24.2) |
1212
| indexer-service-rs | [1.0.0](https://github.com/graphprotocol/indexer-rs/releases/tag/v1.0.0) |
1313
| tap-agent | [1.0.0](https://github.com/graphprotocol/indexer-rs/releases/tag/v1.0.0) |
1414
| graph-node | [0.35.1](https://github.com/graphprotocol/graph-node/releases/tag/v0.35.1) |

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
],
55
"npmClient": "yarn",
66
"useWorkspaces": true,
7-
"version": "0.24.1"
7+
"version": "0.24.2"
88
}

packages/indexer-agent/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@graphprotocol/indexer-agent",
3-
"version": "0.24.1",
3+
"version": "0.24.2",
44
"description": "Indexer agent",
55
"main": "./dist/index.js",
66
"types": "./dist/index.d.ts",
@@ -30,7 +30,7 @@
3030
},
3131
"dependencies": {
3232
"@graphprotocol/common-ts": "2.0.11",
33-
"@graphprotocol/indexer-common": "^0.24.1",
33+
"@graphprotocol/indexer-common": "^0.24.2",
3434
"@thi.ng/heaps": "^1.3.1",
3535
"axios": "0.26.1",
3636
"bs58": "5.0.0",

packages/indexer-agent/src/agent.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
Metrics,
77
SubgraphDeploymentID,
88
timer,
9-
NetworkContracts,
109
} from '@graphprotocol/common-ts'
1110
import {
1211
ActivationCriteria,
@@ -1257,19 +1256,13 @@ export class Agent {
12571256
}
12581257

12591258
// TODO: After indexer-service deprecation: Move to be an initialization check inside Network.create()
1260-
async ensureSubgraphIndexing(
1261-
deployment: string,
1262-
networkIdentifier: string,
1263-
contracts?: NetworkContracts,
1264-
) {
1259+
async ensureSubgraphIndexing(deployment: string, networkIdentifier: string) {
12651260
try {
12661261
// TODO: Check both the local deployment and the external subgraph endpoint
12671262
// Make sure the subgraph is being indexed
12681263
await this.graphNode.ensure(
12691264
`indexer-agent/${deployment.slice(-10)}`,
12701265
new SubgraphDeploymentID(deployment),
1271-
undefined, // currentAssignments
1272-
contracts,
12731266
)
12741267

12751268
// Validate if the Network Subgraph belongs to the current provider's network.
@@ -1295,7 +1288,6 @@ export class Agent {
12951288
await this.ensureSubgraphIndexing(
12961289
network.specification.subgraphs.networkSubgraph.deployment,
12971290
network.specification.networkIdentifier,
1298-
network.contracts,
12991291
)
13001292
}
13011293
// Epoch subgraph
@@ -1305,15 +1297,13 @@ export class Agent {
13051297
await this.ensureSubgraphIndexing(
13061298
network.specification.subgraphs.epochSubgraph.deployment,
13071299
network.specification.networkIdentifier,
1308-
network.contracts,
13091300
)
13101301
}
13111302
// TAP subgraph
13121303
if (network.specification.subgraphs.tapSubgraph?.deployment !== undefined) {
13131304
await this.ensureSubgraphIndexing(
13141305
network.specification.subgraphs.tapSubgraph.deployment,
13151306
network.specification.networkIdentifier,
1316-
network.contracts,
13171307
)
13181308
}
13191309
}

packages/indexer-cli/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@graphprotocol/indexer-cli",
3-
"version": "0.24.1",
3+
"version": "0.24.2",
44
"description": "Indexer CLI for The Graph Network",
55
"main": "./dist/cli.js",
66
"files": [
@@ -27,7 +27,7 @@
2727
},
2828
"dependencies": {
2929
"@graphprotocol/common-ts": "2.0.11",
30-
"@graphprotocol/indexer-common": "^0.24.1",
30+
"@graphprotocol/indexer-common": "^0.24.2",
3131
"@iarna/toml": "2.2.5",
3232
"@thi.ng/iterators": "5.1.74",
3333
"@urql/core": "3.1.0",

packages/indexer-common/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@graphprotocol/indexer-common",
3-
"version": "0.24.1",
3+
"version": "0.24.2",
44
"description": "Common library for Graph Protocol indexer components",
55
"main": "./dist/index.js",
66
"types": "./dist/index.d.ts",

packages/indexer-common/src/graph-node.ts

Lines changed: 16 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import gql from 'graphql-tag'
22
import jayson, { Client as RpcClient } from 'jayson/promise'
3-
import { Logger, SubgraphDeploymentID, NetworkContracts } from '@graphprotocol/common-ts'
3+
import { Logger, SubgraphDeploymentID } from '@graphprotocol/common-ts'
44
import { Client, createClient } from '@urql/core'
55
import {
66
INDEXER_ERROR_MESSAGES,
@@ -665,7 +665,6 @@ export class GraphNode {
665665
name: string,
666666
deployment: SubgraphDeploymentID,
667667
currentAssignments?: SubgraphDeploymentAssignment[],
668-
contracts?: NetworkContracts,
669668
): Promise<void> {
670669
this.logger.debug('Ensure subgraph deployment is syncing', {
671670
name,
@@ -694,12 +693,7 @@ export class GraphNode {
694693
await this.resume(deployment)
695694
} else {
696695
// Subgraph deployment not found
697-
await this.autoGraftDeployDependencies(
698-
deployment,
699-
deploymentAssignments,
700-
name,
701-
contracts,
702-
)
696+
await this.autoGraftDeployDependencies(deployment, deploymentAssignments, name)
703697

704698
// Create and deploy the subgraph
705699
this.logger.debug(
@@ -738,7 +732,6 @@ export class GraphNode {
738732
deployment: SubgraphDeploymentID,
739733
deploymentAssignments: SubgraphDeploymentAssignment[],
740734
name: string,
741-
contracts?: NetworkContracts,
742735
) {
743736
this.logger.debug('Auto graft deploy subgraph dependencies')
744737
const { network: subgraphChainName } = await this.subgraphFeatures(deployment)
@@ -795,25 +788,17 @@ export class GraphNode {
795788
)
796789
}
797790
} else if (!dependencyAssignment) {
798-
this.logger.debug(
799-
'Dependency subgraph not found, creating, deploying and pausing...',
800-
{
801-
name,
802-
deployment: dependency.base.display,
803-
block_required: dependency.block,
804-
},
805-
)
791+
this.logger.debug('Dependency subgraph not found, creating, deploying...', {
792+
name,
793+
deployment: dependency.base.display,
794+
block_required: dependency.block,
795+
})
806796
// are we paused at the block we wanted?
807797

808798
await this.create(name)
809799
await this.deploy(name, dependency.base)
810800
}
811-
await this.syncToBlockAndPause(
812-
dependency.block,
813-
dependency.base,
814-
subgraphChainName,
815-
contracts,
816-
)
801+
await this.syncToBlock(dependency.block, dependency.base, subgraphChainName)
817802
}
818803
}
819804
}
@@ -824,11 +809,10 @@ export class GraphNode {
824809
* This will resume a paused subgraph if the block height target is higher than the
825810
* current block height
826811
*/
827-
public async syncToBlockAndPause(
812+
public async syncToBlock(
828813
blockHeight: number,
829814
subgraphDeployment: SubgraphDeploymentID,
830815
chainName: string | null,
831-
contracts?: NetworkContracts,
832816
): Promise<void> {
833817
async function waitForMs(ms: number) {
834818
return new Promise((resolve) => setTimeout(resolve, ms))
@@ -920,78 +904,14 @@ export class GraphNode {
920904

921905
// Is the graftBaseBlock within the range of the earliest and head of the chain?
922906
if (chain.latestBlock && chain.latestBlock.number >= blockHeight) {
923-
if (!deployed[0].paused) {
924-
// Check if there's an active allocation before pausing
925-
let hasActiveAllocation = false
926-
let checkFailed = false
927-
928-
// If contracts are provided, check for active allocations
929-
if (contracts) {
930-
try {
931-
// Check if any allocations exist for this subgraph deployment
932-
const filter = contracts.staking.filters.AllocationCreated(
933-
null, // indexer (any)
934-
subgraphDeployment.bytes32, // subgraphDeploymentID
935-
)
936-
const events = await contracts.staking.queryFilter(filter)
937-
938-
// Check each allocation to see if it's still active
939-
for (const event of events) {
940-
const allocationId = event.args?.allocationID
941-
if (allocationId) {
942-
const state = await contracts.staking.getAllocationState(allocationId)
943-
// State 1 means Active allocation
944-
if (state === 1) {
945-
hasActiveAllocation = true
946-
break
947-
}
948-
}
949-
}
950-
951-
if (hasActiveAllocation) {
952-
this.logger.warn(`Subgraph has active allocation, not going to pause`, {
953-
subgraph: subgraphDeployment.ipfsHash,
954-
blockHeight,
955-
indexingStatus,
956-
})
957-
}
958-
} catch (error) {
959-
checkFailed = true
960-
this.logger.error(`Failed to check allocation state, not going to pause`, {
961-
subgraph: subgraphDeployment.ipfsHash,
962-
error,
963-
})
964-
}
965-
} else {
966-
// No contracts provided, skip pause for safety
967-
this.logger.warn(
968-
`No contracts provided to check allocation state, not going to pause`,
969-
{
970-
subgraph: subgraphDeployment.ipfsHash,
971-
blockHeight,
972-
},
973-
)
974-
checkFailed = true
975-
}
976-
977-
// Only pause if we successfully checked and found no active allocations
978-
if (!hasActiveAllocation && !checkFailed) {
979-
this.logger.debug(
980-
`Subgraph synced to block! Pausing as requirement is met.`,
981-
{
982-
subgraph: subgraphDeployment.ipfsHash,
983-
indexingStatus,
984-
},
985-
)
986-
// pause the subgraph to prevent further indexing
987-
await this.pause(subgraphDeployment)
988-
}
989-
} else {
990-
this.logger.debug(`Subgraph already paused and synced to block.`, {
907+
this.logger.warn(
908+
`Graft dependency has reached target block height. Continuing to index past graft point.`,
909+
{
991910
subgraph: subgraphDeployment.ipfsHash,
992-
indexingStatus,
993-
})
994-
}
911+
blockHeight,
912+
currentBlock: chain.latestBlock.number,
913+
},
914+
)
995915
break
996916
}
997917

packages/indexer-common/src/indexer-management/allocations.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,6 @@ export class AllocationManager {
433433
`indexer-agent/${action.deploymentID!.slice(-10)}`,
434434
new SubgraphDeploymentID(action.deploymentID!),
435435
currentAssignments,
436-
this.network.contracts,
437436
),
438437
{
439438
stopOnError: false,

0 commit comments

Comments
 (0)