Skip to content

Commit

Permalink
[GraphQL/MovePackage] Query by ID and version (#17692)
Browse files Browse the repository at this point in the history
## Description

Implement `Query.package` and `MovePackage.atVersion` to query a package
at a specific version, using the new fields added to the `packages`
table, exposed via some new data loaders.

## Test plan

New transactional tests:

```
sui$ cargo nextest run -p sui-graphql-e2e-tests \
  --features pg_integration                     \
  -- packages/versioning
```

## Stack

- #17686 
- #17687 
- #17688 
- #17689 
- #17691
- #17694 
- #17695 
- #17542 
- #17726
- #17543
- #17692

---

## 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: Introduce `Query.package` and `MovePackage.atVersion` to
query packages at specific versions.
- [ ] CLI: 
- [ ] Rust SDK:
  • Loading branch information
amnn committed Aug 20, 2024
1 parent 56a05c8 commit fd0fe51
Show file tree
Hide file tree
Showing 9 changed files with 726 additions and 30 deletions.
318 changes: 318 additions & 0 deletions crates/sui-graphql-e2e-tests/tests/packages/versioning.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,318 @@
processed 9 tasks

init:
A: object(0,0)

task 1, lines 6-9:
//# publish --upgradeable --sender A
created: object(1,0), object(1,1)
mutated: object(0,0)
gas summary: computation_cost: 1000000, storage_cost: 5076800, storage_rebate: 0, non_refundable_storage_fee: 0

task 2, lines 11-15:
//# upgrade --package P0 --upgrade-capability 1,1 --sender A
created: object(2,0)
mutated: object(0,0), object(1,1)
gas summary: computation_cost: 1000000, storage_cost: 5251600, storage_rebate: 2595780, non_refundable_storage_fee: 26220

task 3, lines 17-22:
//# upgrade --package P1 --upgrade-capability 1,1 --sender A
created: object(3,0)
mutated: object(0,0), object(1,1)
gas summary: computation_cost: 1000000, storage_cost: 5426400, storage_rebate: 2595780, non_refundable_storage_fee: 26220

task 4, line 24:
//# create-checkpoint
Checkpoint created: 1

task 5, lines 26-45:
//# run-graphql
Response: {
"data": {
"v1": {
"module": {
"functions": {
"nodes": [
{
"name": "f"
}
]
}
}
},
"v2": {
"module": {
"functions": {
"nodes": [
{
"name": "f"
},
{
"name": "g"
}
]
}
}
},
"v3": {
"module": {
"functions": {
"nodes": [
{
"name": "f"
},
{
"name": "g"
},
{
"name": "h"
}
]
}
}
}
}
}

task 6, lines 47-84:
//# run-graphql
Response: {
"data": {
"v1_from_p1": {
"module": {
"functions": {
"nodes": [
{
"name": "f"
}
]
}
}
},
"v1_from_p2": {
"module": {
"functions": {
"nodes": [
{
"name": "f"
}
]
}
}
},
"v2_from_p0": {
"module": {
"functions": {
"nodes": [
{
"name": "f"
},
{
"name": "g"
}
]
}
}
},
"v2_from_p2": {
"module": {
"functions": {
"nodes": [
{
"name": "f"
},
{
"name": "g"
}
]
}
}
},
"v3_from_p0": {
"module": {
"functions": {
"nodes": [
{
"name": "f"
},
{
"name": "g"
},
{
"name": "h"
}
]
}
}
},
"v3_from_p1": {
"module": {
"functions": {
"nodes": [
{
"name": "f"
},
{
"name": "g"
},
{
"name": "h"
}
]
}
}
}
}
}

task 7, lines 86-141:
//# run-graphql
Response: {
"data": {
"v1": {
"v1": {
"module": {
"functions": {
"nodes": [
{
"name": "f"
}
]
}
}
},
"v2": {
"module": {
"functions": {
"nodes": [
{
"name": "f"
},
{
"name": "g"
}
]
}
}
},
"v3": {
"module": {
"functions": {
"nodes": [
{
"name": "f"
},
{
"name": "g"
},
{
"name": "h"
}
]
}
}
}
},
"v2": {
"v1": {
"module": {
"functions": {
"nodes": [
{
"name": "f"
}
]
}
}
},
"v2": {
"module": {
"functions": {
"nodes": [
{
"name": "f"
},
{
"name": "g"
}
]
}
}
},
"v3": {
"module": {
"functions": {
"nodes": [
{
"name": "f"
},
{
"name": "g"
},
{
"name": "h"
}
]
}
}
}
},
"v3": {
"v1": {
"module": {
"functions": {
"nodes": [
{
"name": "f"
}
]
}
}
},
"v2": {
"module": {
"functions": {
"nodes": [
{
"name": "f"
},
{
"name": "g"
}
]
}
}
},
"v3": {
"module": {
"functions": {
"nodes": [
{
"name": "f"
},
{
"name": "g"
},
{
"name": "h"
}
]
}
}
}
}
}
}

task 8, lines 143-171:
//# run-graphql
Response: {
"data": {
"v0": null,
"v1": {
"v0": null,
"v4": null
},
"v4": null
}
}
Loading

0 comments on commit fd0fe51

Please sign in to comment.