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

Add bcs field to Checkpoint #20340

Merged
merged 7 commits into from
Nov 22, 2024

Conversation

stefan-mysten
Copy link
Contributor

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

Description

This PR adds the bcs for Checkpoint to enable GraphQL Client to correctly handle CheckpointSummary data.

Test plan

Added the field to two existing tests and updated the snapshots. A bit uncertain why some things have changed, so would need some help to figure out if it's correct or not. @wlmyng


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: Checkpoint now has a bcs field that represents the Base64 encoded BCS serialization of the CheckpointSummary data.
  • CLI:
  • Rust SDK:
  • REST API:

Copy link

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

@stefan-mysten stefan-mysten temporarily deployed to sui-typescript-aws-kms-test-env November 20, 2024 00:45 — 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.

This implementation is changing things it doesn't need to, which is why I think you're getting in trouble with the pagination of regular checkpoints, it would be better to implement it as follows:

  • Implement a DataLoader for raw checkpoint information (keyed by sequence number).
  • Implement the bcs field as a load_one for that data loader.
  • Delete everything else because you don't need it.

crates/sui-graphql-rpc/schema.graphql Outdated Show resolved Hide resolved
crates/sui-graphql-rpc/src/types/checkpoint.rs Outdated Show resolved Hide resolved
@stefan-mysten
Copy link
Contributor Author

This implementation is changing things it doesn't need to, which is why I think you're getting in trouble with the pagination of regular checkpoints, it would be better to implement it as follows:

* Implement a DataLoader for raw checkpoint information (keyed by sequence number).

* Implement the `bcs` field as a `load_one` for that data loader.

* Delete everything else because you don't need it.

That makes total sense, thanks so much. @wlmyng was hinting at that yesterday but I did not get it at the time. Much nicer to write!

@stefan-mysten stefan-mysten temporarily deployed to sui-typescript-aws-kms-test-env November 20, 2024 23:48 — with GitHub Actions Inactive
@stefan-mysten stefan-mysten changed the title Add checkpointSummaryBcs field to Checkpoint Add bcs field to Checkpoint Nov 21, 2024
@stefan-mysten stefan-mysten requested a review from amnn November 21, 2024 00:02
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.

Implementation looks great modulo some nits! I did have a question about whether it implies we should be returning the CertifiedCheckpointSummary in the BCS field, rather than just the CheckpointSummary. Maybe @lxfind and @bmwill have thoughts on that as well.

crates/sui-graphql-rpc/src/types/checkpoint.rs Outdated Show resolved Hide resolved
crates/sui-graphql-rpc/src/types/checkpoint.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.

Accepting modulo the nits! Thanks @stefan-mysten

Copy link
Contributor

@bmwill bmwill left a comment

Choose a reason for hiding this comment

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

lgtm as well, module Ashok's comments

@stefan-mysten
Copy link
Contributor Author

Addressed all the nits, thanks @amnn and @bmwill!

@stefan-mysten stefan-mysten merged commit fa52d46 into MystenLabs:main Nov 22, 2024
50 checks passed
@stefan-mysten stefan-mysten deleted the gql_checkpoint_bcs branch November 22, 2024 19:37
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