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 general graphql queries #3288

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

Optimize general graphql queries #3288

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:

  • getVersion
  • getNodeInfo
  • getChain
  • getLatestGasPrice
  • estimateGasPrice
  • estimatePredicates
@arboleya arboleya added the chore Issue is a chore label Oct 9, 2024
@maschad maschad self-assigned this Oct 9, 2024
@maschad
Copy link
Member

maschad commented Oct 9, 2024

Took a look at this and the queries don't look like they could be optimized further. Most of these are relatively simple queries.

"""
from fuel-core-schema.gql
"""

type NodeInfo {
  utxoValidation: Boolean!
  vmBacktrace: Boolean!
  maxTx: U64!
  maxDepth: U64!
  nodeVersion: String!
  peers: [PeerInfo!]!
}

"""
  Estimate the predicate gas for the provided transaction
  """
  estimatePredicates(tx: HexString!): Transaction!

"""
from operations.graphql
"""
# Queries and Mutations
query getVersion {
  nodeInfo {
    nodeVersion
  }
}

fragment nodeInfoFragment on NodeInfo {
  utxoValidation
  vmBacktrace
  maxTx
  maxDepth
  nodeVersion
}

query getNodeInfo {
  nodeInfo {
    ...nodeInfoFragment
  }
}

fragment chainInfoFragment on ChainInfo {
  name
  latestBlock {
    ...blockFragment
  }
  daHeight
  consensusParameters {
    ...consensusParametersFragment
  }
}

query getChain {
  chain {
    ...chainInfoFragment
  }
}

query getLatestGasPrice {
  latestGasPrice {
    gasPrice
  }
}

query estimateGasPrice($blockHorizon: U32!) {
  estimateGasPrice(blockHorizon: $blockHorizon) {
    gasPrice
  }
}


query estimatePredicates($encodedTransaction: HexString!) {
  estimatePredicates(tx: $encodedTransaction) {
    ...transactionEstimatePredicatesFragment
  }
}


fragment transactionEstimatePredicatesFragment on Transaction {
  inputs {
    ...inputEstimatePredicatesFragment
  }
}


fragment inputEstimatePredicatesFragment on Input {
  ... on InputCoin {
    predicateGasUsed
  }
  ... on InputMessage {
    predicateGasUsed
  }
}

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.

@maschad maschad 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