[GraphQL] Leverage `objects_version` table.
Description
Use the objects_version table to speed up point look-ups (via data loaders) for historical objects (ID + version), and dynamic fields (object look-up bounding version by parent ID).
With this change, the restriction of accessing dynamic fields only within the available range is dropped.
Test plan
sui$ cargo nextest run -p sui-graphql-rpc
sui$ cargo nextest run -p sui-graphql-e2e-tests --features pg_integration.
Perform a query that involves fetching a large number of dynamic fields, which should now be fast. The following example, fetching dynamic fields on a deepbook pool loads 50 dynamic fields in about 5s from cold (which also requires loading packages for resolution), and then 2s from there:
query {
owner(
address: "0x029170bfa0a1677054263424fe4f9960c7cf05d359f6241333994c8830772bdb"
) {
dynamicFields {
pageInfo {
hasNextPage
endCursor
}
nodes {
name {
type {
repr
}
json
}
value {
... on MoveValue {
type {
repr
}
json
}
... on MoveObject {
contents {
json
type {
repr
}
}
}
}
}
}
}
}
Stack
- #17686
- #17687
- #17688
- #17689
- #17691
- #17694
- #17695
- #17542
- #17726
Release notes
Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.
For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.
- [ ] Protocol:
- [ ] Nodes (Validators and Full nodes):
- [ ] Indexer:
- [ ] JSON-RPC:
- [x] GraphQL: Dynamic fields can now be looked up on any historical object (not just objects in the available range).
- [ ] CLI:
- [ ] Rust SDK:
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| sui-docs | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Aug 20, 2024 0:24am |
3 Skipped Deployments
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| multisig-toolkit | ⬜️ Ignored (Inspect) | Visit Preview | Aug 20, 2024 0:24am | |
| sui-kiosk | ⬜️ Ignored (Inspect) | Visit Preview | Aug 20, 2024 0:24am | |
| sui-typescript-docs | ⬜️ Ignored (Inspect) | Visit Preview | Aug 20, 2024 0:24am |
⚠️ 🦋 Changesets Warning: This PR has changes to public npm packages, but does not contain a changeset. You can create a changeset easily by running pnpm changeset in the root of the Sui repo, and following the prompts. If your change does not need a changeset (e.g. a documentation-only change), you can ignore this message. This warning will be removed when a changeset is added to this pull request.
Thanks for the review @ronny-mysten ! I'll put up a separate PR to address these because this PR is now a stack, being prepared to land as-is.
PR with docs fixes: https://github.com/MystenLabs/sui/pull/19046
Thanks for the review. I'll put up a separate PR to address these because this PR is now a stack, being prepared to land as-is.
Oops. Apologies. I'll start separate PRs after merge instead going forward.
Oops. Apologies. I'll start separate PRs after merge instead going forward.
@ronny-mysten, no you're all good! This was a special case because I was landing all the other PRs in the stack into this one so I could then land them all together (it's faster to do it this way -- need to wait for fewer CI runs on the critical path).
I think it's fine to leave the feedback on this PR, I just wanted to explain that I was going to address it in a separate PR, so it wasn't confusing when I resolved the conversation but then landed this PR without you seeing the comments addressed here.