-
Notifications
You must be signed in to change notification settings - Fork 11.5k
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
base: amnn/gql-vis
Are you sure you want to change the base?
graphql-alt: Epoch #21997
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
2 Skipped Deployments
|
There was a problem hiding this 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.
## Description Add support for query 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 ```
There was a problem hiding this 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
//# init --protocol-version 70 --accounts A --simulator | ||
|
||
//# create-checkpoint | ||
|
||
//# advance-epoch | ||
|
||
//# create-checkpoint | ||
|
||
//# create-checkpoint | ||
|
||
//# advance-epoch | ||
|
||
//# create-checkpoint |
There was a problem hiding this comment.
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
@@ -65,6 +74,22 @@ impl Query { | |||
.collect()) | |||
} | |||
|
|||
/// Fetch epochs by their IDs. | |||
/// | |||
/// 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// 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. | |
/// Returns a list of epochs that is guaranteed 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 epoch does not exist yet, or because it was pruned. |
let ids: Vec<_> = keys.iter().map(|e| e.0 as i64).collect(); | ||
let epochs: Vec<StoredEpochEnd> = conn | ||
.results(e::kv_epoch_ends.filter(e::epoch.eq_any(ids))) | ||
.await | ||
.map_err(Arc::new)?; | ||
|
||
Ok(epochs | ||
.into_iter() | ||
.map(|e| (EpochEndKey(e.epoch as u64), e)) | ||
.collect()) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
feels weird to see a relatively simple diesel query after all the jazz from previous prs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can make it more complicated ...
Description
Add support for querying epochs (getting and multi-getting epochs by their IDs, and getting a checkpoint's epoch).
Test plan
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.