diff --git a/README.md b/README.md index 1f02734ff..d58424fc9 100644 --- a/README.md +++ b/README.md @@ -44,107 +44,145 @@ $ graph-indexer-agent start --help Start the agent -Ethereum - --ethereum Ethereum node or provider URL [string] [required] - --ethereum-network Ethereum network [string] [default: "mainnet"] - --ethereum-polling-interval Polling interval for the Ethereum provider (ms) - [number] [default: 4000] - --gas-increase-timeout Time (in seconds) after which transactions will - be resubmitted with a higher gas price - [number] [default: 240] - --gas-increase-factor Factor by which gas prices are increased when - resubmitting transactions [number] [default: 1.2] - --gas-price-max The maximum gas price (gwei) to use for - transactions [deprecated] [number] [default: 100] - --base-fee-per-gas-max The maximum base fee per gas (gwei) to use for - transactions, for legacy transactions this will - be treated as the max gas price [number] - --transaction-attempts The maximum number of transaction attempts (Use 0 - for unlimited) [number] [default: 0] - --mnemonic Mnemonic for the operator wallet +Indexer Infrastructure + --indexer-management-port Port to serve the indexer management API at + [number] [default: 8000] + --metrics-port Port to serve Prometheus metrics at + [number] [default: 7300] + --syncing-port Port to serve the network subgraph and other + syncing data for indexer service at + [number] [default: 8002] + --log-level Log level [string] [default: "debug"] + --polling-interval Polling interval for data collection + [number] [default: 120000] + --ipfs-endpoint IPFS endpoint for querying manifests. + [string] [required] [default: "https://ipfs.network.thegraph.com"] + --graph-node-query-endpoint Graph Node endpoint for querying subgraphs [string] [required] - --indexer-address Ethereum address of the indexer + --graph-node-status-endpoint Graph Node endpoint for indexing statuses + etc. [string] [required] + --graph-node-admin-endpoint Graph Node endpoint for applying and + updating subgraph deployments [string] [required] + --enable-auto-migration-support Auto migrate allocations from L1 to L2 + (multi-network mode must be enabled) + [boolean] [default: false] + --deployment-management Subgraph deployments management mode + [choices: "auto", "manual"] [default: "auto"] + --public-indexer-url Indexer endpoint for receiving requests from + the network [string] [required] + --indexer-geo-coordinates Coordinates describing the Indexer's + location using latitude and longitude + [string] [default: ["31.780715","-41.179504"]] + --restake-rewards Restake claimed indexer rewards, if set to + 'false' rewards will be returned to the + wallet [boolean] [default: true] + --allocation-management Indexer agent allocation management + automation mode (auto|manual) + [string] [default: "auto"] + --auto-allocation-min-batch-size Minimum number of allocation transactions + inside a batch for auto allocation + management. No obvious upperbound, with + default of 1 [number] [default: 1] -Indexer Infrastructure - --graph-node-query-endpoint Graph Node endpoint for querying - subgraphs [string] [required] - --graph-node-status-endpoint Graph Node endpoint for indexing - statuses etc. [string] [required] - --graph-node-admin-endpoint Graph Node endpoint for applying and - updating subgraph deployments +Postgres + --postgres-host Postgres host [string] [required] + --postgres-port Postgres port [number] [default: 5432] + --postgres-username Postgres username [string] [default: "postgres"] + --postgres-password Postgres password [string] [default: ""] + --postgres-sslenabled Postgres SSL Enabled [boolean] [default: "false"] + --postgres-database Postgres database name [string] [required] + --postgres-pool-size Postgres maximum connection pool size + [number] [default: 50] + +Ethereum + --network-provider, --ethereum Ethereum node or provider URL [string] [required] - --public-indexer-url Indexer endpoint for receiving requests - from the network [string] [required] - --indexer-geo-coordinates Coordinates describing the Indexer's - location using latitude and longitude - [array] [default: ["31.780715","-41.179504"]] - --index-node-ids Node IDs of Graph nodes to use for - indexing (separated by commas) - [array] [required] - --indexer-management-port Port to serve the indexer management API - at [number] [default: 8000] - --metrics-port Port to serve Prometheus metrics at - [number] - --syncing-port Port to serve the network subgraph and - other syncing data for indexer service - at [number] [default: 8002] - --restake-rewards Restake claimed indexer rewards, if set - to 'false' rewards will be returned to - the wallet [boolean] [default: true] - --rebate-claim-threshold Minimum value of rebate for a single - allocation (in GRT) in order for it to - be included in a batch rebate claim - on-chain [string] [default: "1"] - --rebate-claim-batch-threshold Minimum total value of all rebates in an - batch (in GRT) before the batch is - claimed on-chain - [string] [default: "5"] - --rebate-claim-max-batch-size Maximum number of rebates inside a - batch. Upper bound is constrained by - available system memory, and by the - block gas limit [number] [default: 100] - --voucher-redemption-threshold Minimum value of rebate for a single - allocation (in GRT) in order for it to - be included in a batch rebate claim - on-chain [string] [default: "1"] - --voucher-redemption-batch-threshold Minimum total value of all rebates in an - batch (in GRT) before the batch is - claimed on-chain - [string] [default: "5"] - --voucher-redemption-max-batch-size Maximum number of rebates inside a - batch. Upper bound is constrained by - available system memory, and by the - block gas limit [number] [default: 100] - --log-level Log level [string] [default: "debug"] - --allocation-management Indexer agent allocation management - automation mode (auto|manual|oversight) - [string] [default: "auto"] - --auto-allocation-min-batch-size Minimum number of allocation - transactions inside a batch for AUTO - management mode [number] [default: 1] + --ethereum-polling-interval Polling interval for the Ethereum provider + (ms) [number] [default: 4000] + --gas-increase-timeout Time (in seconds) after which transactions + will be resubmitted with a higher gas price + [number] [default: 240] + --gas-increase-factor Factor by which gas prices are increased when + resubmitting transactions + [number] [default: 1.2] + --gas-price-max The maximum gas price (gwei) to use for + transactions + [deprecated] [number] [default: 100] + --base-fee-per-gas-max The maximum base fee per gas (gwei) to use for + transactions, for legacy transactions this + will be treated as the max gas price [number] + --transaction-attempts The maximum number of transaction attempts + (Use 0 for unlimited) [number] [default: 0] + --mnemonic Mnemonic for the operator wallet + [string] [required] + --indexer-address Ethereum address of the indexer + [string] [required] + --payments-destination Address where payments are sent to. If not + provided payments will be restaked. [string] Network Subgraph - --network-subgraph-deployment Network subgraph deployment [string] + --network-subgraph-deployment Network subgraph deployment (for local + hosting) [string] --network-subgraph-endpoint Endpoint to query the network subgraph from [string] --allocate-on-network-subgraph Whether to allocate to the network subgraph [boolean] [default: false] + --epoch-subgraph-deployment Epoch subgraph deployment (for local hosting) + [string] + +TAP Subgraph + --tap-subgraph-deployment TAP subgraph deployment (for local hosting)[string] + --tap-subgraph-endpoint Endpoint to query the tap subgraph from [string] Protocol - --default-allocation-amount Default amount of GRT to allocate to a subgraph - deployment [string] [default: "0.01"] - --register Whether to register the indexer on chain - [boolean] [default: true] - --epoch-subgraph-endpoint Endpoint to query epoch start blocks from + --epoch-subgraph-endpoint Endpoint to query the epoch block + oracle subgraph from [string] [required] + --subgraph-max-block-distance How many blocks subgraphs are allowed + to stay behind chain head + [number] [default: 1000] + --subgraph-freshness-sleep-milliseconds How long to wait before retrying + subgraph query if it is not fresh + [number] [default: 5000] + --default-allocation-amount Default amount of GRT to allocate to + a subgraph deployment + [number] [default: 0.01] + --register Whether to register the indexer on + chain [boolean] [default: true] + --max-provision-initial-size The maximum number of tokens for the + initial Subgraph Service provision + [number] [default: 0] -Postgres - --postgres-host Postgres host [string] [required] - --postgres-port Postgres port [number] [default: 5432] - --postgres-username Postgres username [string] [default: "postgres"] - --postgres-password Postgres password [string] [default: ""] - --postgres-database Postgres database name [string] [required] +Query Fees + --rebate-claim-threshold Minimum value of rebate for a single + allocation (in GRT) in order for it + to be included in a batch rebate + claim on-chain [number] [default: 1] + --rebate-claim-batch-threshold Minimum total value of all rebates + in an batch (in GRT) before the + batch is claimed on-chain + [number] [default: 5] + --rebate-claim-max-batch-size Maximum number of rebates inside a + batch. Upper bound is constrained by + available system memory, and by the + block gas limit + [number] [default: 100] + --voucher-redemption-threshold Minimum value of rebate for a single + allocation (in GRT) in order for it + to be included in a batch rebate + claim on-chain [number] [default: 1] + --voucher-redemption-batch-threshold Minimum total value of all rebates + in an batch (in GRT) before the + batch is claimed on-chain + [number] [default: 5] + --voucher-redemption-max-batch-size Maximum number of rebates inside a + batch. Upper bound is constrained by + available system memory, and by the + block gas limit + [number] [default: 100] + --gateway-endpoint, Gateway endpoint base URL + --collect-receipts-endpoint [string] [required] Disputes --poi-disputable-epochs The number of epochs in the past to look for @@ -152,23 +190,18 @@ Disputes --poi-dispute-monitoring Monitor the network for potential POI disputes [boolean] [default: false] -Query Fees - --vector-node URL of a vector node [string] - --vector-router Public identifier of the vector router[string] - --vector-transfer-definition Address of the Graph transfer definition - contract [string] [default: "auto"] - --vector-event-server External URL of the vector event server of the - agent [string] - --vector-event-server-port Port to serve the vector event server at - [number] [default: 8001] - --collect-receipts-endpoint Client endpoint for collecting receipts - [string] - Options: - --version Show version number [boolean] - --help Show help [boolean] - --offchain-subgraphs Subgraphs to index that are not on chain - (comma-separated) [array] [default: []] + --version Show version number [boolean] + --help Show help [boolean] + --offchain-subgraphs Subgraphs to index that are not on chain + (comma-separated) [array] [default: []] + --horizon-address-book Graph Horizon contracts address book file + path [string] + --subgraph-service-address-book Subgraph Service contracts address book file + path [string] + --tap-address-book TAP contracts address book file path [string] + --chain-finalize-time The time in seconds that the chain finalizes + blocks [number] [default: 3600] ``` ### Indexer CLI diff --git a/packages/indexer-agent/src/commands/start.ts b/packages/indexer-agent/src/commands/start.ts index ff79e783a..a80dd317e 100644 --- a/packages/indexer-agent/src/commands/start.ts +++ b/packages/indexer-agent/src/commands/start.ts @@ -99,6 +99,12 @@ export const start = { default: 0, group: 'Ethereum', }) + .option('confirmation-blocks', { + description: 'The number of blocks to wait for a transaction to be confirmed', + type: 'number', + default: 3, + group: 'Ethereum', + }) .option('mnemonic', { description: 'Mnemonic for the operator wallet', type: 'string', @@ -392,6 +398,7 @@ export async function createNetworkSpecification( gasPriceMax: argv.gasPriceMax, baseFeePerGasMax: argv.baseFeeGasMax, maxTransactionAttempts: argv.maxTransactionAttempts, + confirmationBlocks: argv.confirmationBlocks, } const subgraphs = { diff --git a/packages/indexer-common/package.json b/packages/indexer-common/package.json index c145e0802..8e92904c8 100644 --- a/packages/indexer-common/package.json +++ b/packages/indexer-common/package.json @@ -24,7 +24,7 @@ "dependencies": { "@pinax/graph-networks-registry": "0.6.7", "@graphprotocol/common-ts": "3.0.1", - "@graphprotocol/toolshed": "0.4.2", + "@graphprotocol/toolshed": "0.5.0", "@semiotic-labs/tap-contracts-bindings": "2.0.0", "@thi.ng/heaps": "1.2.38", "@types/lodash.clonedeep": "^4.5.7", diff --git a/packages/indexer-common/src/indexer-management/models/cost-model.ts b/packages/indexer-common/src/indexer-management/models/cost-model.ts index df2a71e4b..ce255fc78 100644 --- a/packages/indexer-common/src/indexer-management/models/cost-model.ts +++ b/packages/indexer-common/src/indexer-management/models/cost-model.ts @@ -39,13 +39,13 @@ export class CostModel extends Model implements CostModelAttributes { - public id!: number - public deployment!: string - public model!: string | null + declare id: number + declare deployment: string + declare model: string | null public variables!: CostModelVariables | null - public createdAt!: Date - public updatedAt!: Date + declare createdAt: Date + declare updatedAt: Date // eslint-disable-next-line @typescript-eslint/ban-types public toGraphQL(): object { diff --git a/packages/indexer-common/src/indexer-management/models/indexing-rule.ts b/packages/indexer-common/src/indexer-management/models/indexing-rule.ts index 76ee2b265..594191537 100644 --- a/packages/indexer-common/src/indexer-management/models/indexing-rule.ts +++ b/packages/indexer-common/src/indexer-management/models/indexing-rule.ts @@ -66,26 +66,26 @@ export class IndexingRule extends Model implements IndexingRuleAttributes { - public id!: number - public identifier!: string - public identifierType!: SubgraphIdentifierType - public allocationAmount!: string | null - public allocationLifetime!: number | null - public autoRenewal!: boolean - public parallelAllocations!: number | null - public maxAllocationPercentage!: number | null - public minSignal!: string | null - public maxSignal!: string | null - public minStake!: string | null - public minAverageQueryFees!: string | null - public custom!: string | null - public decisionBasis!: IndexingDecisionBasis - public requireSupported!: boolean - public safety!: boolean - public protocolNetwork!: string + declare id: number + declare identifier: string + declare identifierType: SubgraphIdentifierType + declare allocationAmount: string | null + declare allocationLifetime: number | null + declare autoRenewal: boolean + declare parallelAllocations: number | null + declare maxAllocationPercentage: number | null + declare minSignal: string | null + declare maxSignal: string | null + declare minStake: string | null + declare minAverageQueryFees: string | null + declare custom: string | null + declare decisionBasis: IndexingDecisionBasis + declare requireSupported: boolean + declare safety: boolean + declare protocolNetwork: string - public createdAt!: Date - public updatedAt!: Date + declare createdAt: Date + declare updatedAt: Date // eslint-disable-next-line @typescript-eslint/ban-types public toGraphQL(): object { diff --git a/packages/indexer-common/src/indexer-management/models/poi-dispute.ts b/packages/indexer-common/src/indexer-management/models/poi-dispute.ts index 8f7e1bb99..a4cd1e862 100644 --- a/packages/indexer-common/src/indexer-management/models/poi-dispute.ts +++ b/packages/indexer-common/src/indexer-management/models/poi-dispute.ts @@ -51,23 +51,23 @@ export class POIDispute extends Model implements POIDisputeAttributes { - public allocationID!: string - public subgraphDeploymentID!: string - public allocationIndexer!: string - public allocationAmount!: string - public allocationProof!: string - public closedEpoch!: number - public closedEpochReferenceProof!: string | null - public closedEpochStartBlockHash!: string - public closedEpochStartBlockNumber!: number - public previousEpochReferenceProof!: string | null - public previousEpochStartBlockHash!: string - public previousEpochStartBlockNumber!: number - public status!: string - public protocolNetwork!: string + declare allocationID: string + declare subgraphDeploymentID: string + declare allocationIndexer: string + declare allocationAmount: string + declare allocationProof: string + declare closedEpoch: number + declare closedEpochReferenceProof: string | null + declare closedEpochStartBlockHash: string + declare closedEpochStartBlockNumber: number + declare previousEpochReferenceProof: string | null + declare previousEpochStartBlockHash: string + declare previousEpochStartBlockNumber: number + declare status: string + declare protocolNetwork: string - public createdAt!: Date - public updatedAt!: Date + declare createdAt: Date + declare updatedAt: Date // eslint-disable-next-line @typescript-eslint/ban-types public toGraphQL(): object { diff --git a/packages/indexer-common/src/network-specification.ts b/packages/indexer-common/src/network-specification.ts index c3c01d4f0..cfcad72d1 100644 --- a/packages/indexer-common/src/network-specification.ts +++ b/packages/indexer-common/src/network-specification.ts @@ -88,6 +88,7 @@ export const TransactionMonitoring = z .transform((x) => x * 10 ** 9) .optional(), maxTransactionAttempts: z.number().nonnegative().finite().default(0), + confirmationBlocks: positiveNumber().default(3), }) .strict() .default({}) // defaults will be used for instantiation when the TransactionMonitoring group is absent. diff --git a/packages/indexer-common/src/network.ts b/packages/indexer-common/src/network.ts index d588e73f5..bb629df1b 100644 --- a/packages/indexer-common/src/network.ts +++ b/packages/indexer-common/src/network.ts @@ -136,9 +136,9 @@ export class Network { deployment: networkSubgraphDeploymentId !== undefined ? { - graphNode, - deployment: networkSubgraphDeploymentId, - } + graphNode, + deployment: networkSubgraphDeploymentId, + } : undefined, subgraphFreshnessChecker: networkSubgraphFreshnessChecker, }) @@ -162,9 +162,9 @@ export class Network { deployment: tapSubgraphDeploymentId !== undefined ? { - graphNode, - deployment: tapSubgraphDeploymentId, - } + graphNode, + deployment: tapSubgraphDeploymentId, + } : undefined, endpoint: specification.subgraphs.tapSubgraph!.url, subgraphFreshnessChecker: tapSubgraphFreshnessChecker, @@ -218,9 +218,9 @@ export class Network { deployment: epochSubgraphDeploymentId !== undefined ? { - graphNode, - deployment: epochSubgraphDeploymentId, - } + graphNode, + deployment: epochSubgraphDeploymentId, + } : undefined, endpoint: specification.subgraphs.epochSubgraph.url, subgraphFreshnessChecker: epochSubgraphFreshnessChecker, diff --git a/packages/indexer-common/src/transactions.ts b/packages/indexer-common/src/transactions.ts index 52866935c..6d0691591 100644 --- a/packages/indexer-common/src/transactions.ts +++ b/packages/indexer-common/src/transactions.ts @@ -124,11 +124,11 @@ export class TransactionManager { tx = await this.wallet.sendTransaction(txRequest) } - logger.info(`Transaction pending`, { tx: tx }) + logger.info(`Transaction pending`, { tx: tx, confirmationBlocks: this.specification.confirmationBlocks }) const receipt = await this.ethereum.waitForTransaction( tx.hash, - 3, + this.specification.confirmationBlocks, this.specification.gasIncreaseTimeout, ) diff --git a/yarn.lock b/yarn.lock index cb4678457..2e2f8412b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -593,10 +593,10 @@ resolved "https://registry.yarnpkg.com/@graphprotocol/subgraph-service/-/subgraph-service-0.3.4.tgz#38929c04d03ad06823f9a867c8a4aef4c7f581e7" integrity sha512-POepREau0ExCz4ZJrlhzIS3RigEuzlbp/xlurpHkgaOn97cFAv3x9ZaE5a9uwh1azRm3Djz8RUBmXpqmwoK9NA== -"@graphprotocol/toolshed@0.4.2": - version "0.4.2" - resolved "https://registry.yarnpkg.com/@graphprotocol/toolshed/-/toolshed-0.4.2.tgz#511b2c7e1b6fbe229c01de0e5de484877534982b" - integrity sha512-qdIalumrmrh7+X0nVr+v/1ZFD0G0dgtE0W47tKZugiw7YKmwnBFkp9MnpYrNzm9NDbs2lk0hn8WBg3W980+hEw== +"@graphprotocol/toolshed@0.5.0": + version "0.5.0" + resolved "https://registry.yarnpkg.com/@graphprotocol/toolshed/-/toolshed-0.5.0.tgz#e1937d59a3d34bc5bacbc825827d6345ba662711" + integrity sha512-8KlLbee8TAhibUGpdSI04iOnI9gkfErchSqrp/SHU1V5RDuATNCuVe3MVmOt+Jdjc747bTU+OLU+7YxLcAa5Aw== dependencies: "@graphprotocol/contracts" "^7.1.2" "@graphprotocol/horizon" "^0.3.2"