Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,7 @@ yalc.lock
.idea/
.envrc
.vscode

# local-network override mode files
tap-contracts.json
config/config.yaml
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
29 changes: 25 additions & 4 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 @@ -246,8 +252,13 @@ export const start = {
default: 100,
group: 'Query Fees',
})
.option('address-book', {
description: 'Graph contracts address book file path',
.option('horizon-address-book', {
description: 'Graph Horizon contracts address book file path',
type: 'string',
required: false,
})
.option('subgraph-service-address-book', {
description: 'Subgraph Service contracts address book file path',
type: 'string',
required: false,
})
Expand All @@ -267,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
Copy Markdown
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
Copy Markdown
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 @@ -346,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 @@ -363,6 +382,7 @@ export async function createNetworkSpecification(
autoAllocationMinBatchSize: argv.autoAllocationMinBatchSize,
allocateOnNetworkSubgraph: argv.allocateOnNetworkSubgraph,
register: argv.register,
maxProvisionInitialSize: argv.maxProvisionInitialSize,
finalityTime: argv.chainFinalizeTime,
}

Expand Down Expand Up @@ -443,8 +463,9 @@ export async function createNetworkSpecification(
transactionMonitoring,
subgraphs,
networkProvider,
addressBook: argv.addressBook,
tapAddressBook,
horizonAddressBook: argv.horizonAddressBook,
subgraphServiceAddressBook: argv.subgraphServiceAddressBook,
tapAddressBook: tapAddressBook,
})
} catch (parsingError) {
displayZodParsingError(parsingError)
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
15 changes: 14 additions & 1 deletion 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 Expand Up @@ -175,7 +187,8 @@ export const NetworkSpecification = z
transactionMonitoring: TransactionMonitoring,
subgraphs: ProtocolSubgraphs,
networkProvider: NetworkProvider,
addressBook: z.string().optional(),
horizonAddressBook: z.string().optional(),
subgraphServiceAddressBook: z.string().optional(),
tapAddressBook: TapContracts.optional(),
allocationSyncInterval: positiveNumber().default(120000),
})
Expand Down
Loading
Loading