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

graphql: expose MovePackage as BCS (packageBcs) #19818

Merged
merged 2 commits into from
Oct 11, 2024
Merged

graphql: expose MovePackage as BCS (packageBcs) #19818

merged 2 commits into from
Oct 11, 2024

Conversation

amnn
Copy link
Member

@amnn amnn commented Oct 11, 2024

Description

Add a new field -- MovePackage.packageBcs -- that exposes the BCS representation of the MovePackage. This complements bcs (which is the BCS representation of its Object form), and moduleBcs (which is the BCS representation of its Vec<CompiledModule>s).

Test plan

New E2E test:

sui$ cargo nextest run -p sui-graphql-e2e-tests -- packages/bcs.move

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):
  • Indexer:
  • JSON-RPC:
  • GraphQL: Adds MovePackage.packageBcs to expose the BCS representation of the MovePackage struct (as opposed to the BCS representation of the outer Object struct).
  • CLI:
  • Rust SDK:
  • REST API:

amnn added 2 commits October 11, 2024 11:46
## Description

Spotted that MovePackage queries were still using `objects_history`,
which is not going to work after that table gets pruned to two epochs.

This PR replaces queries to `objects_history` with queries to
`full_objects_history`, with support from `objects_version` and
`packages` to fetch the checkpoint sequence number where necessary.

## Test plan

Existing tests:

```
sui$ cargo nextest run -p sui-graphql-e2e-tests
```

And ran the following queries on the mainnet DB:

```graphql
query AllPackages($after: String) {
  packages(first: 5 after: $after) {
    pageInfo {
      hasNextPage
      endCursor
      startCursor
    }
    nodes {
      address
      version
    }
  }
}

query AllPackagesBack($before: String) {
  packages(last: 5 before: $before) {
    pageInfo {
      hasNextPage
      endCursor
      startCursor
    }
    nodes {
      address
      version
    }
  }
}

query SystemPackages($after: String) {
  packageVersions(address: "0x2" first: 5 after: $after) {
    pageInfo {
      hasNextPage
      endCursor
      startCursor
    }

    nodes {
      address
      version
    }
  }
}

query SystemPackagesBack($before: String) {
  packageVersions(address: "0x2" last: 5 before: $before) {
    pageInfo {
      hasNextPage
      endCursor
    }

    nodes {
      address
      version
    }
  }
}

query UserPackage($after: String) {
  packageVersions(
    address: "0xbc3df36be17f27ac98e3c839b2589db8475fa07b20657b08e8891e3aaf5ee5f9"
		first: 5
    after: $after
  ) {
    pageInfo {
      hasNextPage
      endCursor
      startCursor
    }
    nodes {
      address
      version
    }
  }
}
```
## Description

Add a new field -- `MovePackage.packageBcs` -- that exposes the BCS
representation of the MovePackage. This complements `bcs` (which is the
BCS representation of its `Object` form), and `moduleBcs` (which is the
BCS representation of its `Vec<CompiledModule>`s).

## Test plan

New E2E test:

```
sui$ cargo nextest run -p sui-graphql-e2e-tests -- packages/bcs.move
```
@amnn amnn requested review from lxfind and bmwill October 11, 2024 12:08
@amnn amnn self-assigned this Oct 11, 2024
Copy link

vercel bot commented Oct 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Oct 11, 2024 0:08am
sui-kiosk ⬜️ Ignored (Inspect) Oct 11, 2024 0:08am
sui-typescript-docs ⬜️ Ignored (Inspect) Oct 11, 2024 0:08am

Base automatically changed from amnn/gql-pkg-full-obj to main October 11, 2024 14:26
@amnn amnn merged commit cc2a65f into main Oct 11, 2024
48 checks passed
@amnn amnn deleted the amnn/gql-pkg-bcs branch October 11, 2024 16:43
@stefan-mysten
Copy link
Contributor

Thanks @amnn !!! 🎉

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