Skip to content

feat: update registration to support horizon flow, add provisioning flow at startup #1120

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/indexer-agent/src/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ export class Agent {
try {
await operator.ensureGlobalIndexingRule()
await this.ensureAllSubgraphsIndexing(network)
await network.provision()
await network.register()
} catch (err) {
this.logger.critical(
Expand Down
15 changes: 15 additions & 0 deletions packages/indexer-agent/src/commands/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ export const start = {
required: true,
group: 'Ethereum',
})
.option('payments-destination', {
description:
'Address where payments are sent to. If not provided payments will be restaked.',
type: 'string',
group: 'Ethereum',
})
.option('public-indexer-url', {
description: 'Indexer endpoint for receiving requests from the network',
type: 'string',
Expand Down Expand Up @@ -272,6 +278,13 @@ export const start = {
default: true,
group: 'Protocol',
})
.option('max-provision-initial-size', {
description:
'The maximum number of tokens for the initial Subgraph Service provision',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we mention here the minimum provision size limit in the contracts?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah good idea. Ill add it to my current PR.

type: 'number',
default: 0,
group: 'Protocol',
})
.option('poi-disputable-epochs', {
description:
'The number of epochs in the past to look for potential POI disputes',
Expand Down Expand Up @@ -351,6 +364,7 @@ export async function createNetworkSpecification(

const indexerOptions = {
address: argv.indexerAddress,
paymentsDestination: argv.paymentsDestination,
mnemonic: argv.mnemonic,
url: argv.publicIndexerUrl,
geoCoordinates: argv.indexerGeoCoordinates,
Expand All @@ -368,6 +382,7 @@ export async function createNetworkSpecification(
autoAllocationMinBatchSize: argv.autoAllocationMinBatchSize,
allocateOnNetworkSubgraph: argv.allocateOnNetworkSubgraph,
register: argv.register,
maxProvisionInitialSize: argv.maxProvisionInitialSize,
finalityTime: argv.chainFinalizeTime,
}

Expand Down
2 changes: 1 addition & 1 deletion packages/indexer-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"dependencies": {
"@pinax/graph-networks-registry": "0.6.7",
"@graphprotocol/common-ts": "3.0.1",
"@graphprotocol/toolshed": "0.3.2",
"@graphprotocol/toolshed": "0.4.2",
"@semiotic-labs/tap-contracts-bindings": "2.0.0",
"@thi.ng/heaps": "1.2.38",
"@types/lodash.clonedeep": "^4.5.7",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
networkIdentifier: mainnet
gateway:
url: http://gateway
indexerOptions:
address: "0x4e8a4C63Df58bf59Fef513aB67a76319a9faf448"
paymentsDestination: "0xclearlynotanaddress"
mnemonic: word ivory whale diesel slab pelican voyage oxygen chat find tobacco sport
url: http://indexer
geoCoordinates: [25.1, -71.2]
restakeRewards: true
rebateClaimThreshold: 400
rebateClaimBatchThreshold: 5000
rebateClaimMaxBatchSize: 10
poiDisputeMonitoring: false
poiDisputableEpochs: 5
defaultAllocationAmount: 0.05
voucherRedemptionThreshold: 2
voucherRedemptionBatchThreshold: 2000
voucherRedemptionMaxBatchSize: 15
allocationManagementMode: "auto"
autoAllocationMinBatchSize: 20
maxProvisionInitialSize: 100000
transactionMonitoring:
gasIncreaseTimeout: 10
gasIncreaseFactor: 10
baseFeePerGasMax: 10
maxTransactionAttempts: 10
subgraphs:
networkSubgraph:
deployment: QmPK1s3pNYLi9ERiq3BDxKa4XosgWwFRQUydHUtz4YgpqB
epochSubgraph:
url: http://subgraph
tapSubgraph:
url: http://subgraph
networkProvider:
url: http://provider
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
networkIdentifier: mainnet
gateway:
url: http://gateway
indexerOptions:
address: "0x4e8a4C63Df58bf59Fef513aB67a76319a9faf448"
mnemonic: word ivory whale diesel slab pelican voyage oxygen chat find tobacco sport
url: http://indexer
geoCoordinates: [25.1, -71.2]
restakeRewards: true
rebateClaimThreshold: 400
rebateClaimBatchThreshold: 5000
rebateClaimMaxBatchSize: 10
poiDisputeMonitoring: false
poiDisputableEpochs: 5
defaultAllocationAmount: 0.05
voucherRedemptionThreshold: 2
voucherRedemptionBatchThreshold: 2000
voucherRedemptionMaxBatchSize: 15
allocationManagementMode: "auto"
autoAllocationMinBatchSize: 20
maxProvisionInitialSize: 99999
transactionMonitoring:
gasIncreaseTimeout: 10
gasIncreaseFactor: 10
baseFeePerGasMax: 10
maxTransactionAttempts: 10
subgraphs:
networkSubgraph:
deployment: QmPK1s3pNYLi9ERiq3BDxKa4XosgWwFRQUydHUtz4YgpqB
epochSubgraph:
url: http://subgraph
tapSubgraph:
url: http://subgraph
networkProvider:
url: http://provider
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ indexerOptions:
voucherRedemptionMaxBatchSize: 15
allocationManagementMode: "auto"
autoAllocationMinBatchSize: 20
maxProvisionInitialSize: 0
subgraphs:
networkSubgraph:
deployment: QmPK1s3pNYLi9ERiq3BDxKa4XosgWwFRQUydHUtz4YgpqB
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ indexerOptions:
voucherRedemptionMaxBatchSize: 15
allocationManagementMode: "auto"
autoAllocationMinBatchSize: 20
maxProvisionInitialSize: 100000
transactionMonitoring:
gasIncreaseTimeout: 10
gasIncreaseFactor: 10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ describe('Failed deserialization', () => {
path: ['subgraphs', 'maxBlockDistance'],
message: 'Number must be greater than or equal to 0',
},
{
file: 'invalid-provision-size.yml',
path: ['indexerOptions', 'maxProvisionInitialSize'],
message: 'Must be greater or equal than 100000 GRT',
},
{
file: 'invalid-payments-destination.yml',
path: ['indexerOptions', 'paymentsDestination'],
message: 'Invalid contract address',
},
]

test.each(failedTests)(
Expand Down
12 changes: 12 additions & 0 deletions packages/indexer-common/src/network-specification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ export const IndexerOptions = z
mnemonic: z.string(),
url: z.string().url(),
geoCoordinates: z.number().array().length(2).default([31.780715, -41.179504]),
paymentsDestination: z
.string()
.refine((val) => isAddress(val), {
message: 'Invalid contract address',
})
.transform(toAddress)
.optional(),
restakeRewards: z.boolean().default(true),
rebateClaimThreshold: GRT().default(1),
rebateClaimBatchThreshold: GRT().default(5),
Expand All @@ -56,6 +63,11 @@ export const IndexerOptions = z
autoAllocationMinBatchSize: positiveNumber().default(1),
allocateOnNetworkSubgraph: z.boolean().default(false),
register: z.boolean().default(true),
maxProvisionInitialSize: GRT()
.refine((x) => x >= parseGRT('100000') || x === 0n, {
message: 'Must be greater or equal than 100000 GRT',
})
.default(0),
finalityTime: positiveNumber().default(3600),
})
.strict()
Expand Down
Loading
Loading