Skip to content

graphql-alt: Epoch #21997

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

Merged
merged 0 commits into from
May 19, 2025
Merged

graphql-alt: Epoch #21997

merged 0 commits into from
May 19, 2025

Conversation

amnn
Copy link
Contributor

@amnn amnn commented Apr 28, 2025

Description

Add support for querying epochs (getting and multi-getting epochs by their IDs, and getting a checkpoint's epoch).

Test plan

sui$ cargo nextest run -p sui-indexer-alt-e2e-tests

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):
  • gRPC:
  • JSON-RPC:
  • GraphQL:
  • CLI:
  • Rust SDK:

@amnn amnn requested review from emmazzz, wlmyng and Copilot April 28, 2025 21:33
@amnn amnn self-assigned this Apr 28, 2025
Copy link

vercel bot commented Apr 28, 2025

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 May 19, 2025 2:04pm
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview May 19, 2025 2:04pm
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview May 19, 2025 2:04pm

@amnn amnn temporarily deployed to sui-typescript-aws-kms-test-env April 28, 2025 21:33 — with GitHub Actions Inactive
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for querying epochs by extending the schema, reader, and GraphQL API with new types and resolvers for single and multi-get epoch queries.

  • Added new Diesel schema and queryable types for epochs.
  • Implemented epoch data loaders in the reader and corresponding GraphQL types and resolvers.
  • Extended the API query to support fetching epochs and multiple epochs.

Reviewed Changes

Copilot reviewed 9 out of 17 changed files in this pull request and generated no comments.

Show a summary per file
File Description
crates/sui-indexer-alt-schema/src/epochs.rs Updated epoch schema types with Queryable derive to support queries.
crates/sui-indexer-alt-reader/src/lib.rs Exposed the new epochs module.
crates/sui-indexer-alt-reader/src/epochs.rs Added Loader implementations for EpochStartKey and EpochEndKey.
crates/sui-indexer-alt-graphql/src/api/types/mod.rs Included the new epoch module in the API types.
crates/sui-indexer-alt-graphql/src/api/types/epoch.rs Implemented GraphQL types and resolvers for epoch start and end details.
crates/sui-indexer-alt-graphql/src/api/types/checkpoint.rs Added a resolver for fetching the epoch related to a checkpoint.
crates/sui-indexer-alt-graphql/src/api/scalars/mod.rs Added the big_int scalar module required by the epoch types.
crates/sui-indexer-alt-graphql/src/api/scalars/big_int.rs Provided a BigInt scalar implementation used in the epoch GraphQL types.
crates/sui-indexer-alt-graphql/src/api/query.rs Introduced new query endpoints to fetch epochs, including multi-get epochs.
Files not reviewed (8)
  • crates/sui-indexer-alt-e2e-tests/tests/graphql/checkpoints/epoch.move: Language not supported
  • crates/sui-indexer-alt-e2e-tests/tests/graphql/checkpoints/epoch.snap: Language not supported
  • crates/sui-indexer-alt-e2e-tests/tests/graphql/epochs/query.move: Language not supported
  • crates/sui-indexer-alt-e2e-tests/tests/graphql/epochs/query.snap: Language not supported
  • crates/sui-indexer-alt-graphql/schema.graphql: Language not supported
  • crates/sui-indexer-alt-graphql/src/snapshots/sui_indexer_alt_graphql__tests__schema.graphql.snap: Language not supported
  • crates/sui-indexer-alt-graphql/src/snapshots/sui_indexer_alt_graphql__tests__staging.graphql.snap: Language not supported
  • crates/sui-indexer-alt-graphql/staging.graphql: Language not supported
Comments suppressed due to low confidence (1)

crates/sui-indexer-alt-graphql/src/api/query.rs:79

  • Typographical errors: 'guarnateed' should be 'guaranteed' and 'epocch' should be 'epoch'.
/// Returns a list of epochs that is guarnateed to be the same length as `keys`. If an epoch in `keys` could not be found in the store, its corresponding entry in the result will be `null'. This could be because the epocch does not exist yet, or because it was pruned.

Copy link
Contributor

@wlmyng wlmyng 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, lets advance this epoch

Comment on lines 4 to 16
//# init --protocol-version 70 --accounts A --simulator

//# create-checkpoint

//# advance-epoch

//# create-checkpoint

//# create-checkpoint

//# advance-epoch

//# create-checkpoint
Copy link
Contributor

Choose a reason for hiding this comment

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

wheres c7 coming from?

e0
c0: init
c1: L6
c2: L8 advance-epoch

e1
c3 L10
c4 L12
c5 L14 advance epoch

and then c6 from L16

Copy link
Contributor Author

Choose a reason for hiding this comment

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

c7 doesn't exist -- it's the proof that there are no more checkpoints (it returns null in the snapshot).

@amnn amnn force-pushed the amnn/gql-epoch branch from 200a6ba to 5d95cd4 Compare May 15, 2025 13:28
@amnn amnn temporarily deployed to sui-typescript-aws-kms-test-env May 15, 2025 13:28 — with GitHub Actions Inactive
@amnn amnn force-pushed the amnn/gql-epoch branch from 5d95cd4 to 81f0d27 Compare May 17, 2025 12:50
@amnn amnn temporarily deployed to sui-typescript-aws-kms-test-env May 17, 2025 12:50 — with GitHub Actions Inactive
@amnn amnn force-pushed the amnn/gql-epoch branch from 81f0d27 to 4e311d0 Compare May 19, 2025 13:45
@amnn amnn requested a review from mystenmark as a code owner May 19, 2025 13:45
@amnn amnn temporarily deployed to sui-typescript-aws-kms-test-env May 19, 2025 13:45 — with GitHub Actions Inactive
@amnn amnn merged commit 4e311d0 into amnn/gql-vis May 19, 2025
74 of 89 checks passed
@amnn amnn deleted the amnn/gql-epoch branch May 19, 2025 13:45
@amnn amnn temporarily deployed to sui-typescript-aws-kms-test-env May 19, 2025 13:45 — with GitHub Actions Inactive
@amnn amnn temporarily deployed to sui-typescript-aws-kms-test-env May 19, 2025 13:45 — with GitHub Actions Inactive
@amnn amnn temporarily deployed to sui-typescript-aws-kms-test-env May 19, 2025 13:46 — with GitHub Actions Inactive
@amnn amnn temporarily deployed to sui-typescript-aws-kms-test-env May 19, 2025 13:46 — with GitHub Actions Inactive
@amnn amnn temporarily deployed to sui-typescript-aws-kms-test-env May 19, 2025 13:46 — with GitHub Actions Inactive
@amnn amnn temporarily deployed to sui-typescript-aws-kms-test-env May 19, 2025 13:46 — with GitHub Actions Inactive
@amnn amnn temporarily deployed to sui-typescript-aws-kms-test-env May 19, 2025 13:46 — with GitHub Actions Inactive
@amnn amnn temporarily deployed to sui-typescript-aws-kms-test-env May 19, 2025 13:46 — with GitHub Actions Inactive
@amnn amnn temporarily deployed to sui-typescript-aws-kms-test-env May 19, 2025 13:46 — with GitHub Actions Inactive
@amnn amnn temporarily deployed to sui-typescript-aws-kms-test-env May 19, 2025 13:46 — with GitHub Actions Inactive
@amnn amnn temporarily deployed to sui-typescript-aws-kms-test-env May 19, 2025 13:47 — with GitHub Actions Inactive
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