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][DotMove][2/n] Introduce typeByName #18797

Merged
merged 1 commit into from
Aug 29, 2024

Conversation

manolisliolios
Copy link
Contributor

@manolisliolios manolisliolios commented Jul 25, 2024

Description

Introduces typeByName that resolves a given type using the equivalent dot move name.

Test plan

You can run cargo test for unit tests (parsing of types).

For e2e tests:

cargo nextest run --package sui-graphql-rpc --test dot_move_e2e --features pg_integration

Stack


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:
  • REST API:

Copy link

vercel bot commented Jul 25, 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 Aug 29, 2024 11:45am
3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview Aug 29, 2024 11:45am
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview Aug 29, 2024 11:45am
sui-typescript-docs ⬜️ Ignored (Inspect) Visit Preview Aug 29, 2024 11:45am

Copy link
Contributor

@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.

Really good start on this one as well @manolisliolios, thank you! Themes on this PR:

  • We may be able to simplify things by exposing a multi_query API for NamedMovePackage (also maybe not because it probably delegates to other data loaders).
  • NamedType::query should return a TypeTag, and it should produce an error if we end up missing out a named address binding, so we can craft a legible error in that case.

crates/sui-graphql-rpc/src/types/dot_move/named_type.rs Outdated Show resolved Hide resolved
crates/sui-graphql-rpc/src/types/dot_move/named_type.rs Outdated Show resolved Hide resolved
crates/sui-graphql-rpc/src/types/dot_move/named_type.rs Outdated Show resolved Hide resolved
crates/sui-graphql-rpc/src/types/dot_move/named_type.rs Outdated Show resolved Hide resolved
crates/sui-graphql-rpc/src/types/dot_move/named_type.rs Outdated Show resolved Hide resolved
crates/sui-graphql-rpc/src/types/dot_move/named_type.rs Outdated Show resolved Hide resolved
@manolisliolios
Copy link
Contributor Author

manolisliolios commented Jul 26, 2024

Thanks a lot @amnn!

(also maybe not because it probably delegates to other data loaders).

That was my concern and why I didn't try to jump towards that route fwiw (It uses one to two dataloaders internally, one for the external resolution (optional, only on external), and the package loader.

Copy link
Contributor

@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.

Nice! Main comment here pertains to parsing error messages for TypeTag, and whether they are affected by this substitution with 0x0 -- everything else is nits.

I'm not certain that TypeTag's parsing errors mention the offsets that it found the problematic tokens at, so do check that. If it does not, then I don't think it's urgent to make the change I suggested (making the substituted address as long as the name it's replacing), but otherwise we should.

@manolisliolios manolisliolios merged commit 2a75f36 into ml/dot-move-1-n Aug 29, 2024
44 of 45 checks passed
@manolisliolios manolisliolios deleted the ml/dot-move-2-n branch August 29, 2024 12:03
manolisliolios added a commit that referenced this pull request Aug 29, 2024
## Description 

Introduces the external resolution, which requests "names" from a
different graphql node.

In reality, that'll be a mainnet RPC endpoint being used. 

## Test plan 

e2e tests updated to start a secondary service that utilizes external
resolution, and depend on that:

```
cargo nextest run --package sui-graphql-rpc --test dot_move_e2e --features pg_integration
```

## Stack

- #18797 
- #18774 
- #18770 


---

## 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:
- [ ] REST API:
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.

2 participants