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

Optimize contract's graphql queries #3292

Closed
2 tasks
arboleya opened this issue Oct 9, 2024 · 1 comment
Closed
2 tasks

Optimize contract's graphql queries #3292

arboleya opened this issue Oct 9, 2024 · 1 comment
Assignees
Labels
chore Issue is a chore

Comments

@arboleya
Copy link
Member

arboleya commented Oct 9, 2024

During some load tests, we realized a couple of issues (#3279, #3277) that we're fixing and optimizing.

In keeping with this theme, we should continue the effort and review our predefined GQL queries and fragments.

Every field removal is a breaking change and can break things for apps, so we need to be extra careful here.

Taking from the providers/operations.graphql:

  • getContract
  • getContractBalance
@arboleya arboleya added the chore Issue is a chore label Oct 9, 2024
@nedsalk nedsalk self-assigned this Oct 9, 2024
@nedsalk
Copy link
Contributor

nedsalk commented Oct 9, 2024

Took a look at this and the queries don't look like they could be optimized further.

"""
from fuel-core-schema.gql
"""
type Contract {
  id: ContractId!
  bytecode: HexString!
  salt: Salt!
}

type ContractBalance {
  contract: ContractId!
  amount: U64!
  assetId: AssetId!
}

"""
from operations.graphql
"""
fragment contractBalanceFragment on ContractBalance {
  contract
  amount
  assetId
}

query getContract($contractId: ContractId!) {
  contract(id: $contractId) {
    bytecode
    id
  }
}

query getContractBalance($contract: ContractId!, $asset: AssetId!) {
  contractBalance(contract: $contract, asset: $asset) {
    ...contractBalanceFragment
  }
}

All the data queried via these queries is utilized in the places where the queries are used, so there's no place for more optimization.

@nedsalk nedsalk closed this as completed Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Issue is a chore
Projects
None yet
Development

No branches or pull requests

2 participants