Skip to content

Commit

Permalink
[GraphQL] Rework Event type (#19654)
Browse files Browse the repository at this point in the history
## Description 

Accessing the `bcs` field of an `Event` is rather confusing, as it is
not the whole event BCS encoded, but just the contents of it, more
specifically, the BCS bytes of a `MoveValue`.

This PR removes the #flatten in `Event`, adds a `contents` field to the
type, and adds the `bcs` field to the `Event` type which encodes the
whole `Event`.

## Test plan 

Existing tests

---

## 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: 
- [x] GraphQL: The `Event` type has a new field called `contents`, which
is the event's content value as a `MoveValue`. This replaces the
previous scheme that flattened the `MoveValue` type in the `Event` type.
A `bcs` field was also added, which represents the Base64 encoded BCS
serialized event.
- [ ] CLI: 
- [ ] Rust SDK:
- [ ] REST API:
  • Loading branch information
stefan-mysten authored Oct 8, 2024
1 parent 872af5a commit f780402
Show file tree
Hide file tree
Showing 34 changed files with 1,875 additions and 941 deletions.
7 changes: 6 additions & 1 deletion .github/actions/ts-e2e/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,10 @@ runs:
shell: bash

- name: Run TS SDK e2e tests
run: pnpm dlx concurrently --kill-others --success command-1 "$E2E_RUN_LOCAL_NET_CMD" 'pnpm --filter @mysten/sui --filter @mysten/graphql-transport test:e2e'
run: pnpm dlx concurrently --kill-others --success command-1 "$E2E_RUN_LOCAL_NET_CMD" 'pnpm --filter @mysten/sui'
shell: bash

- name: Run TS SDK GraphQL compatibility e2e tests
if: ${{ inputs.ref != "testnet" && inputs.ref != "devnet" }}
run: pnpm dlx concurrently --kill-others --success command-1 "$E2E_RUN_LOCAL_NET_CMD" 'pnpm --filter @mysten/graphql-transport test:e2e'
shell: bash
2 changes: 1 addition & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
run: pnpm dlx concurrently --kill-others --success command-1 "$E2E_RUN_LOCAL_NET_CMD" 'pnpm --filter @mysten/sui test:e2e'

- name: Run RPC/GrpahQL comaptability e2e tests
if: ${{ needs.diff.outputs.isGraphQlTransport == 'true' || needs.diff.outputs.isRust == 'true'}}
if: ${{ needs.diff.outputs.isGraphQlTransport == 'true' || needs.diff.outputs.isRust == 'true' }}
run: pnpm dlx concurrently --kill-others --success command-1 "$E2E_RUN_LOCAL_NET_CMD" 'pnpm --filter @mysten/graphql-transport test:e2e'

# - name: Run Local net
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ task 3, line 32:
//# create-checkpoint
Checkpoint created: 1

task 4, lines 34-51:
task 4, lines 34-53:
//# run-graphql
Response: {
"data": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,16 @@ module Test::M2 {
sendingModule {
name
}
type {
repr
}
sender {
address
}
json
bcs
contents {
type {
repr
}
bcs
json
}
}
}
}
Loading

0 comments on commit f780402

Please sign in to comment.