Skip to content

Commit

Permalink
[gql][2/n] output nodes estimation (MystenLabs#15497)
Browse files Browse the repository at this point in the history
## Description 

Implements output nodes estimation. A node adds a cost of 1, unless it
is a connection field, where it would then have a cost of
default_page_size, or min(first, last) if so provided. This is
multiplicative - at the next child connection, that child's estimated
output will be multiplied with its parent's to yield the cumulative
result. A connection's pageInfo field does not multiplicatively increase the current count, as there is only one node for the entire connection.

## Test Plan 

1. check that we get this back in the headers when showUsage is provided
4. output_node_estimation.move

---
If your changes are not user-facing and not a breaking change, you can
skip the following section. Otherwise, please indicate what changed, and
then add to the Release Notes section as highlighted during the release
process.

### Type of Change (Check all that apply)

- [ ] protocol change
- [ ] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [ ] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration

### Release notes
  • Loading branch information
wlmyng authored Jan 8, 2024
1 parent 44d4b7a commit 59331bd
Show file tree
Hide file tree
Showing 14 changed files with 856 additions and 68 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ arc-swap = { version = "1.5.1", features = ["serde"] }
assert_cmd = "2.0.6"
async-graphql = "6.0.7"
async-graphql-axum = "6.0.7"
async-graphql-value = "6.0.7"
async-recursion = "1.0.4"
async-trait = "0.1.61"
atomic_float = "0.1"
Expand Down
5 changes: 3 additions & 2 deletions crates/sui-graphql-e2e-tests/tests/call/simple.exp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Response: {
task 15 'run-graphql'. lines 68-74:
Headers: {
"content-type": "application/json",
"content-length": "136",
"content-length": "157",
"x-sui-rpc-version": "0.1.0",
}
Service version: 0.1.0
Expand All @@ -87,7 +87,8 @@ Response: {
},
"extensions": {
"usage": {
"nodes": 2,
"inputNodes": 2,
"outputNodes": 2,
"depth": 2,
"variables": 0,
"fragments": 0,
Expand Down
Loading

0 comments on commit 59331bd

Please sign in to comment.