Skip to content

Commit da8f53d

Browse files
authored
Horizon fixes (#1121)
1 parent 70490e0 commit da8f53d

File tree

10 files changed

+200
-159
lines changed

10 files changed

+200
-159
lines changed

README.md

Lines changed: 136 additions & 103 deletions
Large diffs are not rendered by default.

packages/indexer-agent/src/commands/start.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,12 @@ export const start = {
9999
default: 0,
100100
group: 'Ethereum',
101101
})
102+
.option('confirmation-blocks', {
103+
description: 'The number of blocks to wait for a transaction to be confirmed',
104+
type: 'number',
105+
default: 3,
106+
group: 'Ethereum',
107+
})
102108
.option('mnemonic', {
103109
description: 'Mnemonic for the operator wallet',
104110
type: 'string',
@@ -392,6 +398,7 @@ export async function createNetworkSpecification(
392398
gasPriceMax: argv.gasPriceMax,
393399
baseFeePerGasMax: argv.baseFeeGasMax,
394400
maxTransactionAttempts: argv.maxTransactionAttempts,
401+
confirmationBlocks: argv.confirmationBlocks,
395402
}
396403

397404
const subgraphs = {

packages/indexer-common/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"dependencies": {
2525
"@pinax/graph-networks-registry": "0.6.7",
2626
"@graphprotocol/common-ts": "3.0.1",
27-
"@graphprotocol/toolshed": "0.4.2",
27+
"@graphprotocol/toolshed": "0.5.0",
2828
"@semiotic-labs/tap-contracts-bindings": "2.0.0",
2929
"@thi.ng/heaps": "1.2.38",
3030
"@types/lodash.clonedeep": "^4.5.7",

packages/indexer-common/src/indexer-management/models/cost-model.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ export class CostModel
3939
extends Model<CostModelAttributes, CostModelCreationAttributes>
4040
implements CostModelAttributes
4141
{
42-
public id!: number
43-
public deployment!: string
44-
public model!: string | null
42+
declare id: number
43+
declare deployment: string
44+
declare model: string | null
4545
public variables!: CostModelVariables | null
4646

47-
public createdAt!: Date
48-
public updatedAt!: Date
47+
declare createdAt: Date
48+
declare updatedAt: Date
4949

5050
// eslint-disable-next-line @typescript-eslint/ban-types
5151
public toGraphQL(): object {

packages/indexer-common/src/indexer-management/models/indexing-rule.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -66,26 +66,26 @@ export class IndexingRule
6666
extends Model<IndexingRuleAttributes, IndexingRuleCreationAttributes>
6767
implements IndexingRuleAttributes
6868
{
69-
public id!: number
70-
public identifier!: string
71-
public identifierType!: SubgraphIdentifierType
72-
public allocationAmount!: string | null
73-
public allocationLifetime!: number | null
74-
public autoRenewal!: boolean
75-
public parallelAllocations!: number | null
76-
public maxAllocationPercentage!: number | null
77-
public minSignal!: string | null
78-
public maxSignal!: string | null
79-
public minStake!: string | null
80-
public minAverageQueryFees!: string | null
81-
public custom!: string | null
82-
public decisionBasis!: IndexingDecisionBasis
83-
public requireSupported!: boolean
84-
public safety!: boolean
85-
public protocolNetwork!: string
69+
declare id: number
70+
declare identifier: string
71+
declare identifierType: SubgraphIdentifierType
72+
declare allocationAmount: string | null
73+
declare allocationLifetime: number | null
74+
declare autoRenewal: boolean
75+
declare parallelAllocations: number | null
76+
declare maxAllocationPercentage: number | null
77+
declare minSignal: string | null
78+
declare maxSignal: string | null
79+
declare minStake: string | null
80+
declare minAverageQueryFees: string | null
81+
declare custom: string | null
82+
declare decisionBasis: IndexingDecisionBasis
83+
declare requireSupported: boolean
84+
declare safety: boolean
85+
declare protocolNetwork: string
8686

87-
public createdAt!: Date
88-
public updatedAt!: Date
87+
declare createdAt: Date
88+
declare updatedAt: Date
8989

9090
// eslint-disable-next-line @typescript-eslint/ban-types
9191
public toGraphQL(): object {

packages/indexer-common/src/indexer-management/models/poi-dispute.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -51,23 +51,23 @@ export class POIDispute
5151
extends Model<POIDisputeAttributes, POIDisputeCreationAttributes>
5252
implements POIDisputeAttributes
5353
{
54-
public allocationID!: string
55-
public subgraphDeploymentID!: string
56-
public allocationIndexer!: string
57-
public allocationAmount!: string
58-
public allocationProof!: string
59-
public closedEpoch!: number
60-
public closedEpochReferenceProof!: string | null
61-
public closedEpochStartBlockHash!: string
62-
public closedEpochStartBlockNumber!: number
63-
public previousEpochReferenceProof!: string | null
64-
public previousEpochStartBlockHash!: string
65-
public previousEpochStartBlockNumber!: number
66-
public status!: string
67-
public protocolNetwork!: string
54+
declare allocationID: string
55+
declare subgraphDeploymentID: string
56+
declare allocationIndexer: string
57+
declare allocationAmount: string
58+
declare allocationProof: string
59+
declare closedEpoch: number
60+
declare closedEpochReferenceProof: string | null
61+
declare closedEpochStartBlockHash: string
62+
declare closedEpochStartBlockNumber: number
63+
declare previousEpochReferenceProof: string | null
64+
declare previousEpochStartBlockHash: string
65+
declare previousEpochStartBlockNumber: number
66+
declare status: string
67+
declare protocolNetwork: string
6868

69-
public createdAt!: Date
70-
public updatedAt!: Date
69+
declare createdAt: Date
70+
declare updatedAt: Date
7171

7272
// eslint-disable-next-line @typescript-eslint/ban-types
7373
public toGraphQL(): object {

packages/indexer-common/src/network-specification.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ export const TransactionMonitoring = z
8888
.transform((x) => x * 10 ** 9)
8989
.optional(),
9090
maxTransactionAttempts: z.number().nonnegative().finite().default(0),
91+
confirmationBlocks: positiveNumber().default(3),
9192
})
9293
.strict()
9394
.default({}) // defaults will be used for instantiation when the TransactionMonitoring group is absent.

packages/indexer-common/src/network.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,9 @@ export class Network {
136136
deployment:
137137
networkSubgraphDeploymentId !== undefined
138138
? {
139-
graphNode,
140-
deployment: networkSubgraphDeploymentId,
141-
}
139+
graphNode,
140+
deployment: networkSubgraphDeploymentId,
141+
}
142142
: undefined,
143143
subgraphFreshnessChecker: networkSubgraphFreshnessChecker,
144144
})
@@ -162,9 +162,9 @@ export class Network {
162162
deployment:
163163
tapSubgraphDeploymentId !== undefined
164164
? {
165-
graphNode,
166-
deployment: tapSubgraphDeploymentId,
167-
}
165+
graphNode,
166+
deployment: tapSubgraphDeploymentId,
167+
}
168168
: undefined,
169169
endpoint: specification.subgraphs.tapSubgraph!.url,
170170
subgraphFreshnessChecker: tapSubgraphFreshnessChecker,
@@ -218,9 +218,9 @@ export class Network {
218218
deployment:
219219
epochSubgraphDeploymentId !== undefined
220220
? {
221-
graphNode,
222-
deployment: epochSubgraphDeploymentId,
223-
}
221+
graphNode,
222+
deployment: epochSubgraphDeploymentId,
223+
}
224224
: undefined,
225225
endpoint: specification.subgraphs.epochSubgraph.url,
226226
subgraphFreshnessChecker: epochSubgraphFreshnessChecker,

packages/indexer-common/src/transactions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,11 @@ export class TransactionManager {
124124
tx = await this.wallet.sendTransaction(txRequest)
125125
}
126126

127-
logger.info(`Transaction pending`, { tx: tx })
127+
logger.info(`Transaction pending`, { tx: tx, confirmationBlocks: this.specification.confirmationBlocks })
128128

129129
const receipt = await this.ethereum.waitForTransaction(
130130
tx.hash,
131-
3,
131+
this.specification.confirmationBlocks,
132132
this.specification.gasIncreaseTimeout,
133133
)
134134

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -593,10 +593,10 @@
593593
resolved "https://registry.yarnpkg.com/@graphprotocol/subgraph-service/-/subgraph-service-0.3.4.tgz#38929c04d03ad06823f9a867c8a4aef4c7f581e7"
594594
integrity sha512-POepREau0ExCz4ZJrlhzIS3RigEuzlbp/xlurpHkgaOn97cFAv3x9ZaE5a9uwh1azRm3Djz8RUBmXpqmwoK9NA==
595595

596-
"@graphprotocol/toolshed@0.4.2":
597-
version "0.4.2"
598-
resolved "https://registry.yarnpkg.com/@graphprotocol/toolshed/-/toolshed-0.4.2.tgz#511b2c7e1b6fbe229c01de0e5de484877534982b"
599-
integrity sha512-qdIalumrmrh7+X0nVr+v/1ZFD0G0dgtE0W47tKZugiw7YKmwnBFkp9MnpYrNzm9NDbs2lk0hn8WBg3W980+hEw==
596+
"@graphprotocol/toolshed@0.5.0":
597+
version "0.5.0"
598+
resolved "https://registry.yarnpkg.com/@graphprotocol/toolshed/-/toolshed-0.5.0.tgz#e1937d59a3d34bc5bacbc825827d6345ba662711"
599+
integrity sha512-8KlLbee8TAhibUGpdSI04iOnI9gkfErchSqrp/SHU1V5RDuATNCuVe3MVmOt+Jdjc747bTU+OLU+7YxLcAa5Aw==
600600
dependencies:
601601
"@graphprotocol/contracts" "^7.1.2"
602602
"@graphprotocol/horizon" "^0.3.2"

0 commit comments

Comments
 (0)