Skip to content

graphql-alt: Epoch.coinDenyList #22005

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

Open
wants to merge 1 commit into
base: amnn/gql-protocol
Choose a base branch
from
Open

Conversation

amnn
Copy link
Contributor

@amnn amnn commented Apr 29, 2025

Description

Fetch the state of 0x403 at the start of the epoch. This object can be modified during the epoch, but reads in that epoch will not be affected by writes in the same epoch, so it is always safe to treat all reads in an epoch as coming from this version of the object.

Test plan

New E2E tests:

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

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:

## Description

Fetch the state of `0x403` at the start of the epoch. This object can be
modified during the epoch, but reads in that epoch will not be affected
by writes in the same epoch, so it is always safe to treat all reads in
an epoch as coming from this version of the object.

## Test plan

New E2E tests:

```
sui$ cargo nextest run         \
  -p sui-indexer-alt-e2e-tests \
  -- graphql/epochs/coin_deny_list
```
@amnn amnn requested review from emmazzz, wlmyng and Copilot April 29, 2025 16:12
@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 ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Apr 29, 2025 4:12pm
sui-kiosk ⬜️ Ignored (Inspect) Apr 29, 2025 4:12pm

@amnn amnn temporarily deployed to sui-typescript-aws-kms-test-env April 29, 2025 16:12 — 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 the ability to fetch the state of the Coin DenyList object (0x403) at the start of an epoch, ensuring that reads within the epoch are consistent with the checkpoint's state. Key changes include:

  • Introducing a new GraphQL field (coin_deny_list) on EpochStart to return the object state.
  • Refactoring the storage of the scope by moving it from Epoch to EpochStart.
  • Updating related fetch functions to use the new scope structure and SUI_DENY_LIST_OBJECT_ID.
Files not reviewed (6)
  • crates/sui-indexer-alt-e2e-tests/tests/graphql/epochs/coin_deny_list.move: Language not supported
  • crates/sui-indexer-alt-e2e-tests/tests/graphql/epochs/coin_deny_list.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

@@ -61,6 +61,12 @@ type Epoch {
"""
epochId: UInt53!
"""
State of the Coin DenyList object (0x403) at the start of this epoch.

The DenyList controls access to Regulated Coins. Writes to the DenyList are accumulated and only take effect on the next epoch boundary. Subsequently, it's possible to determine the state of the DenyList for a transaction by reading it at the start of the epoch the transaction is in.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
The DenyList controls access to Regulated Coins. Writes to the DenyList are accumulated and only take effect on the next epoch boundary. Subsequently, it's possible to determine the state of the DenyList for a transaction by reading it at the start of the epoch the transaction is in.
The DenyList controls access to Regulated Coins. Writes to the DenyList are accumulated and only take effect on the next epoch boundary. Consequently, it's possible to determine the state of the DenyList for a transaction by reading it at the start of the epoch the transaction is in.


pub(crate) struct Epoch {
pub(crate) epoch_id: u64,
pub(crate) scope: Scope,
Copy link
Contributor

Choose a reason for hiding this comment

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

Now that I'm revisiting this, why not have

Epoch {
epoch_id
scope
}

fn start -> EpochStart::fetch
fn end -> EpochEnd::fetch

Not sure if we need the EpochStart because it's basically the scope and epoch_id before fetching contents, and the contents from db are only used on EpochStart

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