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

[pick][gql-2024.1.0] fix dof queries #18390

Conversation

wlmyng
Copy link
Contributor

@wlmyng wlmyng commented Jun 24, 2024

Description

Cherry-pick #17934 to the legacy branch

Test plan

How did you test the new or updated feature?


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:
  • GraphQL:
  • CLI:
  • Rust SDK:

Copy link

vercel bot commented Jun 24, 2024

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 Jun 25, 2024 6:53pm
3 Ignored Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview Jun 25, 2024 6:53pm
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview Jun 25, 2024 6:53pm
sui-typescript-docs ⬜️ Ignored (Inspect) Visit Preview Jun 25, 2024 6:53pm

unmaykr-aftermath and others added 3 commits June 25, 2024 11:52
Adds the following attribute to
`sui_graphql_rpc::types::object::Object`:
```rust
    /// Optional root parent object version if this is a dynamic field.
    ///
    /// This enables consistent dynamic field reads in the case of chained dynamic object fields,
    /// e.g., `Parent -> DOF1 -> DOF2`. In such cases, the object versions may end up like
    /// `Parent >= DOF1, DOF2` but `DOF1 < DOF2`. Thus, database queries for dynamic fields must
    /// bound the object versions by the version of the root object of the tree.
    ///
    /// Essentially, lamport timestamps of objects are updated for all top-level mutable objects
    /// provided as inputs to a transaction as well as any mutated dynamic child objects. However,
    /// any dynamic child objects that were loaded but not actually mutated don't end up having
    /// their versions updated.
    root_version: Option<u64>,
```

I tried making sure that this attribute is set correctly wherever an
`Object` is created.

There's one scenario which still isn't covered: if the GQL query is
rooted at a DOF, something like
```graphql
query DynamicFields($parent: SuiAddress!, $version: Int, $after: String) {
  object(address: $parent, version: $version) {
    dynamicFields(/* ... */) {
        // ...
    }
  }
}
```
where `$parent` is a DOF's object id, then the server has no way to know
the root object's version. Instead, we will use the rooting object's version, even if it is a nested child object.

New tests `immutable_dof.move` and `nested_dof.move`.

---

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:
- [ ] CLI:
- [ ] Rust SDK:

---------

Co-authored-by: Ashok Menon <amenon94@gmail.com>
Co-authored-by: Will Yang <willyang@mystenlabs.com>
@wlmyng wlmyng force-pushed the wlmyng/unmaykr/fix-dof-queries-legacy branch from a144aa5 to 2b7f8a6 Compare June 25, 2024 18:52
@wlmyng wlmyng merged commit 82cf44b into releases/sui-graphql-rpc-v2024.1.0-release Jun 25, 2024
42 of 43 checks passed
@wlmyng wlmyng deleted the wlmyng/unmaykr/fix-dof-queries-legacy branch June 25, 2024 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants