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.4] fix nested dof implementation #18389

Conversation

wlmyng
Copy link
Contributor

@wlmyng wlmyng commented Jun 24, 2024

Description

Cherry-pick #17934 which fixes dof implementation of nested dof

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:

unmaykr-aftermath and others added 2 commits June 24, 2024 12:06
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>
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 24, 2024 7:16pm
3 Ignored Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Jun 24, 2024 7:16pm
sui-kiosk ⬜️ Ignored (Inspect) Jun 24, 2024 7:16pm
sui-typescript-docs ⬜️ Ignored (Inspect) Jun 24, 2024 7:16pm

@wlmyng wlmyng changed the title [pick][gql] fix nested dof implementation [pick][gql-2024.4] fix nested dof implementation Jun 24, 2024
@wlmyng wlmyng merged commit 6bc9ea5 into releases/sui-graphql-rpc-v2024.4.0-release Jun 24, 2024
47 of 48 checks passed
@wlmyng wlmyng deleted the wlmyng/unmaykr/fix-dof-queries branch June 24, 2024 20: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