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

[GraphQL] Add a new multiGetObjects query on Query. #20300

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

stefan-mysten
Copy link
Contributor

@stefan-mysten stefan-mysten commented Nov 18, 2024

Description

This PR adds a new query for fetching multiple objects by their ids and versions.

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: added a multiGetObjects top level query, which will replace the objectFilter in objects.
  • CLI:
  • Rust SDK:
  • REST API:

@stefan-mysten stefan-mysten marked this pull request as draft November 18, 2024 03:04
Copy link

vercel bot commented Nov 18, 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 Dec 20, 2024 8:56pm
3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview Dec 20, 2024 8:56pm
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview Dec 20, 2024 8:56pm
sui-typescript-docs ⬜️ Ignored (Inspect) Visit Preview Dec 20, 2024 8:56pm

@stefan-mysten stefan-mysten temporarily deployed to sui-typescript-aws-kms-test-env November 18, 2024 03:09 — with GitHub Actions Inactive
Copy link
Member

@amnn amnn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes for the query limit checker stuff mainly!

crates/sui-graphql-rpc/schema.graphql Outdated Show resolved Hide resolved
crates/sui-graphql-rpc/schema.graphql Outdated Show resolved Hide resolved
crates/sui-graphql-rpc/src/config.rs Outdated Show resolved Hide resolved
crates/sui-graphql-rpc/src/types/object.rs Outdated Show resolved Hide resolved
crates/sui-graphql-rpc/src/types/query.rs Outdated Show resolved Hide resolved
Copy link
Member

@amnn amnn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just the changes and tests related to query limits checker left, everything else is looking good here!

Copy link
Member

@amnn amnn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Can you also add some E2E tests for the happy path (not hitting the limit) before landing?

Comment on lines +805 to +816
let objects = data
.into_iter()
.filter_map(|(lookup_key, bcs)| {
Object::new_serialized(
lookup_key.id,
lookup_key.version,
bcs,
checkpoint_viewed_at,
lookup_key.version,
)
})
.collect::<Vec<_>>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let objects = data
.into_iter()
.filter_map(|(lookup_key, bcs)| {
Object::new_serialized(
lookup_key.id,
lookup_key.version,
bcs,
checkpoint_viewed_at,
lookup_key.version,
)
})
.collect::<Vec<_>>();
let objects: Vec<_> = data
.into_iter()
.filter_map(|(lookup_key, bcs)| {
Object::new_serialized(
lookup_key.id,
lookup_key.version,
bcs,
checkpoint_viewed_at,
lookup_key.version,
)
})
.collect();

return Ok(None);
}

let keys = f.node.get_argument(MULTI_GET_OBJECT_KEYS);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name of this constant seems to imply that it's specific to multiGetObject but it's not/shouldn't be -- all multiGets now need to use keys as their parameter name for holding the keys.

Suggested change
let keys = f.node.get_argument(MULTI_GET_OBJECT_KEYS);
let keys = f.node.get_argument(MULTI_GET_KEYS);

Comment on lines +824 to +835
let objects = data
.into_iter()
.filter_map(|(lookup_key, bcs)| {
Object::new_serialized(
lookup_key.id,
lookup_key.version,
bcs,
checkpoint_viewed_at,
lookup_key.version,
)
})
.collect::<Vec<_>>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let objects = data
.into_iter()
.filter_map(|(lookup_key, bcs)| {
Object::new_serialized(
lookup_key.id,
lookup_key.version,
bcs,
checkpoint_viewed_at,
lookup_key.version,
)
})
.collect::<Vec<_>>();
let objects: Vec<_> = data
.into_iter()
.filter_map(|(lookup_key, bcs)| {
Object::new_serialized(
lookup_key.id,
lookup_key.version,
bcs,
checkpoint_viewed_at,
lookup_key.version,
)
})
.collect();

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