Skip to content
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

release-0.21.4 perf fixup #1018

Merged
merged 6 commits into from
Oct 8, 2024
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
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"release": "./scripts/release.sh",
"test": "lerna --concurrency 1 run test --stream --ignore @graphprotocol/indexer-service",
"test:ci": "lerna --concurrency 1 run test:ci --stream --ignore @graphprotocol/indexer-service",
"update-common-ts": "./scripts/update-common-ts.sh 1.8.3",
"clean": "lerna run clean && rm -rf ./node_modules",
"compile": "lerna run compile"
},
Expand All @@ -29,8 +28,8 @@
"sequelize": "6.33.0",
"@ethersproject/bignumber": "5.7.0",
"@ethersproject/providers": "5.7.0",
"@urql/core": "2.4.4",
"@urql/exchange-execute": "1.2.2",
"@urql/core": "3.1.0",
"@urql/exchange-execute": "2.1.0",
"punycode": "2.3.1",
"uri-js": "4.2.2"
},
Expand All @@ -39,8 +38,8 @@
"sequelize": "6.33.0",
"@ethersproject/bignumber": "5.7.0",
"@ethersproject/providers": "5.7.0",
"@urql/core": "2.4.4",
"@urql/exchange-execute": "1.2.2",
"@urql/core": "3.1.0",
"@urql/exchange-execute": "2.1.0",
"graphql": "16.8.0"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion packages/indexer-agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"graph-indexer-agent": "bin/graph-indexer-agent"
},
"dependencies": {
"@graphprotocol/common-ts": "2.0.9",
"@graphprotocol/common-ts": "2.0.10",
"@graphprotocol/indexer-common": "^0.21.4",
"@thi.ng/heaps": "^1.3.1",
"@uniswap/sdk": "3.0.3",
Expand Down
4 changes: 2 additions & 2 deletions packages/indexer-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
"test:watch": "jest --watch --detectOpenHandles --verbose"
},
"dependencies": {
"@graphprotocol/common-ts": "2.0.9",
"@graphprotocol/common-ts": "2.0.10",
"@graphprotocol/indexer-common": "^0.21.4",
"@iarna/toml": "2.2.5",
"@thi.ng/iterators": "5.1.74",
"@urql/core": "2.4.4",
"@urql/core": "3.1.0",
"chalk": "4.1.2",
"env-paths": "2.2.1",
"ethers": "5.7.0",
Expand Down
40 changes: 22 additions & 18 deletions packages/indexer-cli/src/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,25 +236,29 @@ export async function executeApprovedActions(
client: IndexerManagementClient,
): Promise<ActionResult[]> {
const result = await client
.mutation(gql`
mutation executeApprovedActions {
executeApprovedActions {
id
protocolNetwork
status
type
deploymentID
allocationID
amount
poi
force
source
reason
transaction
failureReason
.mutation(
gql`
mutation executeApprovedActions {
executeApprovedActions {
id
protocolNetwork
status
type
deploymentID
allocationID
amount
poi
force
source
reason
transaction
failureReason
}
}
}
`)
`,
[],
[],
)
.toPromise()

if (result.error) {
Expand Down
20 changes: 12 additions & 8 deletions packages/indexer-cli/src/cost.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,19 @@ export const costModels = async (
client: IndexerManagementClient,
): Promise<Partial<CostModelAttributes>[]> => {
const result = await client
.query(gql`
{
costModels {
deployment
model
variables
.query(
gql`
{
costModels {
deployment
model
variables
}
}
}
`)
`,
[],
[],
)
.toPromise()

if (result.error) {
Expand Down
8 changes: 4 additions & 4 deletions packages/indexer-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
"clean": "rm -rf ./node_modules ./dist ./tsconfig.tsbuildinfo"
},
"dependencies": {
"@graphprotocol/common-ts": "2.0.9",
"@graphprotocol/common-ts": "2.0.10",
"@graphprotocol/cost-model": "0.1.18",
"@semiotic-labs/tap-contracts-bindings": "^1.2.1",
"@thi.ng/heaps": "1.2.38",
"@types/lodash.clonedeep": "^4.5.7",
"@types/lodash.intersection": "^4.4.7",
"@types/lodash.xor": "^4.5.7",
"@urql/core": "2.4.4",
"@urql/exchange-execute": "1.2.2",
"@urql/core": "3.1.0",
"@urql/exchange-execute": "2.1.0",
"axios": "1.6.2",
"body-parser": "1.20.2",
"cors": "2.8.5",
Expand Down Expand Up @@ -84,7 +84,7 @@
"ethers": "5.7.0",
"sequelize": "6.33.0",
"@ethersproject/bignumber": "5.7.0",
"@urql/exchange-execute/@urql/core": "2.4.4"
"@urql/exchange-execute/@urql/core": "3.1.0"
},
"babel": {
"presets": [],
Expand Down
51 changes: 15 additions & 36 deletions packages/indexer-common/src/graph-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,44 +153,19 @@ export class GraphNode {
): Promise<SubgraphDeploymentAssignment[]> {
try {
this.logger.debug('Fetch subgraph deployment assignments')

// FIXME: remove this initial check for just node when graph-node releases
// https://github.com/graphprotocol/graph-node/pull/5551
const nodeOnlyResult = await this.status
.query(gql`
{
indexingStatuses {
subgraphDeployment: subgraph
node
}
}
`)
.toPromise()

if (nodeOnlyResult.error) {
throw nodeOnlyResult.error
}

const withAssignments: string[] = nodeOnlyResult.data.indexingStatuses
.filter((result: QueryResult) => {
return result.node !== null && result.node !== undefined
})
.map((result: QueryResult) => {
return result.subgraphDeployment
})

const result = await this.status
.query(
gql`
query indexingStatuses($subgraphs: [String!]!) {
indexingStatuses(subgraphs: $subgraphs) {
query indexingStatuses {
indexingStatuses {
subgraphDeployment: subgraph
node
paused
}
}
`,
{ subgraphs: withAssignments },
[],
[],
)
.toPromise()

Expand Down Expand Up @@ -242,14 +217,18 @@ export class GraphNode {
try {
this.logger.trace(`Querying indexing statuses`)
const result = await this.status
.query(gql`
{
indexingStatuses {
subgraphDeployment: subgraph
node
.query(
gql`
{
indexingStatuses {
subgraphDeployment: subgraph
node
}
}
}
`)
`,
[],
[],
)
.toPromise()

if (result.error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -395,10 +395,9 @@ describe('Cost models', () => {
await client.mutation(SET_COST_MODEL_MUTATION, { costModel: input }).toPromise()
}

await expect(client.query(GET_COST_MODELS_QUERY).toPromise()).resolves.toHaveProperty(
'data.costModels',
inputs,
)
await expect(
client.query(GET_COST_MODELS_QUERY, [], []).toPromise(),
).resolves.toHaveProperty('data.costModels', inputs)
})

test('Get cost models with defined global models', async () => {
Expand Down Expand Up @@ -478,10 +477,9 @@ describe('Cost models', () => {

await client.mutation(SET_COST_MODEL_MUTATION, { costModel: input }).toPromise()

await expect(client.query(GET_COST_MODELS_QUERY).toPromise()).resolves.toHaveProperty(
'data.costModels',
[expected],
)
await expect(
client.query(GET_COST_MODELS_QUERY, [], []).toPromise(),
).resolves.toHaveProperty('data.costModels', [expected])
})

test('Delete one cost model', async () => {
Expand Down Expand Up @@ -597,10 +595,9 @@ describe('Feature: Inject $DAI variable', () => {
}
await client.mutation(SET_COST_MODEL_MUTATION, { costModel: update }).toPromise()

await expect(client.query(GET_COST_MODELS_QUERY).toPromise()).resolves.toHaveProperty(
'data.costModels',
[initial],
)
await expect(
client.query(GET_COST_MODELS_QUERY, [], []).toPromise(),
).resolves.toHaveProperty('data.costModels', [initial])
})

test('$DAI variable can be overwritten', async () => {
Expand All @@ -616,10 +613,9 @@ describe('Feature: Inject $DAI variable', () => {
variables: JSON.stringify({ DAI: '15.0' }),
}
await client.mutation(SET_COST_MODEL_MUTATION, { costModel: update }).toPromise()
await expect(client.query(GET_COST_MODELS_QUERY).toPromise()).resolves.toHaveProperty(
'data.costModels',
[update],
)
await expect(
client.query(GET_COST_MODELS_QUERY, [], []).toPromise(),
).resolves.toHaveProperty('data.costModels', [update])
})

test('$DAI updates are applied to all cost models', async () => {
Expand All @@ -642,21 +638,20 @@ describe('Feature: Inject $DAI variable', () => {

await client.setDai('15.3')

await expect(client.query(GET_COST_MODELS_QUERY).toPromise()).resolves.toHaveProperty(
'data.costModels',
[
{
...inputs[0],
// DAI was replaced here
variables: JSON.stringify({ n: 100, DAI: '15.3' }),
},
{
...inputs[1],
// DAI was added here
variables: JSON.stringify({ n: 10, DAI: '15.3' }),
},
],
)
await expect(
client.query(GET_COST_MODELS_QUERY, [], []).toPromise(),
).resolves.toHaveProperty('data.costModels', [
{
...inputs[0],
// DAI was replaced here
variables: JSON.stringify({ n: 100, DAI: '15.3' }),
},
{
...inputs[1],
// DAI was added here
variables: JSON.stringify({ n: 10, DAI: '15.3' }),
},
])
})

test('$DAI is added to new models', async () => {
Expand All @@ -681,21 +676,20 @@ describe('Feature: Inject $DAI variable', () => {
await client.mutation(SET_COST_MODEL_MUTATION, { costModel: input }).toPromise()
}

await expect(client.query(GET_COST_MODELS_QUERY).toPromise()).resolves.toHaveProperty(
'data.costModels',
[
{
...inputs[0],
// DAI was replaced here
variables: JSON.stringify({ n: 100, DAI: '15.3' }),
},
{
...inputs[1],
// DAI was added here
variables: JSON.stringify({ n: 10, DAI: '15.3' }),
},
],
)
await expect(
client.query(GET_COST_MODELS_QUERY, [], []).toPromise(),
).resolves.toHaveProperty('data.costModels', [
{
...inputs[0],
// DAI was replaced here
variables: JSON.stringify({ n: 100, DAI: '15.3' }),
},
{
...inputs[1],
// DAI was added here
variables: JSON.stringify({ n: 10, DAI: '15.3' }),
},
])
})

test('$DAI is preserved when cost model is updated', async () => {
Expand All @@ -712,15 +706,14 @@ describe('Feature: Inject $DAI variable', () => {
variables: null,
}
await client.mutation(SET_COST_MODEL_MUTATION, { costModel: update }).toPromise()
await expect(client.query(GET_COST_MODELS_QUERY).toPromise()).resolves.toHaveProperty(
'data.costModels',
[
{
...update,
variables: initial.variables,
},
],
)
await expect(
client.query(GET_COST_MODELS_QUERY, [], []).toPromise(),
).resolves.toHaveProperty('data.costModels', [
{
...update,
variables: initial.variables,
},
])
})

test('If feature is disabled, $DAI variable is not preserved', async () => {
Expand Down Expand Up @@ -749,7 +742,7 @@ describe('Feature: Inject $DAI variable', () => {
.mutation(SET_COST_MODEL_MUTATION, { costModel: update })
.toPromise()
await expect(
clientNoInjectDai.query(GET_COST_MODELS_QUERY).toPromise(),
clientNoInjectDai.query(GET_COST_MODELS_QUERY, [], []).toPromise(),
).resolves.toHaveProperty('data.costModels', [update])
})
})
Expand Down
Loading
Loading