Skip to content

graphql-alt: latest Epochs and Protocol Configs #22006

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

Conversation

amnn
Copy link
Contributor

@amnn amnn commented Apr 29, 2025

Description

Support calling Query.epoch without an ID to fetch the latest epoch and fetch the latest protocol config in scope if no protocol version is provided.

Test plan

Updated E2E tests:

sui$ cargo nextest run         \
  -p sui-indexer-alt-e2e-tests \
  -- graphql/epochs

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 wlmyng, chris-gorham and Copilot April 29, 2025 16:14
@amnn amnn self-assigned this Apr 29, 2025
Copy link

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

@amnn amnn temporarily deployed to sui-typescript-aws-kms-test-env April 29, 2025 16:14 — 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 implements support for fetching the latest epoch and protocol configuration when no explicit identifiers are provided. Key changes include:

  • Adding the QueryableByName derive for StoredEpochStart in the schema.
  • Implementing a new DataLoader for CheckpointBoundedEpochStartKey to support fetching epochs based on checkpoint.
  • Updating GraphQL resolvers and associated types to handle optional epoch IDs and protocol config version parameters.

Reviewed Changes

Copilot reviewed 5 out of 13 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 Added new derive for query operations on StoredEpochStart.
crates/sui-indexer-alt-reader/src/epochs.rs Introduced a new DataLoader implementation for checkpoint-bound epoch fetching.
crates/sui-indexer-alt-graphql/src/api/types/protocol_configs.rs Added a function to fetch the latest protocol config based on scope.
crates/sui-indexer-alt-graphql/src/api/types/epoch.rs Updated epoch fetching logic to support optional epoch IDs.
crates/sui-indexer-alt-graphql/src/api/query.rs Adjusted query endpoints for epochs and protocol configs to use optional parameters.
Files not reviewed (8)
  • crates/sui-indexer-alt-e2e-tests/tests/graphql/epochs/protocol_configs.move: Language not supported
  • crates/sui-indexer-alt-e2e-tests/tests/graphql/epochs/protocol_configs.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/types/epoch.rs:189

  • [nitpick] Consider renaming the variable 'load' to a more descriptive name such as 'stored_epoch_result' to improve readability.
let load = if let Some(id) = epoch_id {

@amnn amnn force-pushed the amnn/gql-deny branch from 226cc7f to e16bf12 Compare May 8, 2025 11:03
@amnn amnn force-pushed the amnn/gql-latest-epoch branch from da60754 to 8ec89a9 Compare May 8, 2025 11:04
@amnn amnn temporarily deployed to sui-typescript-aws-kms-test-env May 8, 2025 11:04 — with GitHub Actions Inactive
@amnn amnn force-pushed the amnn/gql-deny branch from e16bf12 to ef79db0 Compare May 9, 2025 14:07
@amnn amnn force-pushed the amnn/gql-latest-epoch branch from 8ec89a9 to d2e0262 Compare May 9, 2025 14:07
@amnn amnn temporarily deployed to sui-typescript-aws-kms-test-env May 9, 2025 14:07 — with GitHub Actions Inactive
@amnn amnn force-pushed the amnn/gql-deny branch from ef79db0 to 91c0f40 Compare May 9, 2025 17:24
@amnn amnn force-pushed the amnn/gql-latest-epoch branch from d2e0262 to ad91f3f Compare May 9, 2025 17:24
@amnn amnn temporarily deployed to sui-typescript-aws-kms-test-env May 9, 2025 17:24 — with GitHub Actions Inactive
@amnn amnn force-pushed the amnn/gql-deny branch from 91c0f40 to 8f889f1 Compare May 15, 2025 13:28
@amnn amnn force-pushed the amnn/gql-latest-epoch branch from ad91f3f to b150a41 Compare May 15, 2025 13:28
@amnn amnn temporarily deployed to sui-typescript-aws-kms-test-env May 15, 2025 13:29 — with GitHub Actions Inactive
@amnn amnn force-pushed the amnn/gql-deny branch from 8f889f1 to 1f9734e Compare May 15, 2025 14:50
@amnn amnn force-pushed the amnn/gql-latest-epoch branch from b150a41 to da6e940 Compare May 15, 2025 14:50
@amnn amnn temporarily deployed to sui-typescript-aws-kms-test-env May 15, 2025 14:50 — with GitHub Actions Inactive
@amnn amnn force-pushed the amnn/gql-deny branch from 1f9734e to 305d1c8 Compare May 17, 2025 12:50
@amnn amnn force-pushed the amnn/gql-latest-epoch branch from da6e940 to 7dde784 Compare May 17, 2025 12:50
@amnn amnn temporarily deployed to sui-typescript-aws-kms-test-env May 17, 2025 12:51 — with GitHub Actions Inactive
@amnn amnn force-pushed the amnn/gql-latest-epoch branch from 7dde784 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 merged commit 4e311d0 into amnn/gql-deny May 19, 2025
49 of 60 checks passed
@amnn amnn force-pushed the amnn/gql-deny branch from 305d1c8 to 4e311d0 Compare May 19, 2025 13:45
@amnn amnn deleted the amnn/gql-latest-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: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