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] Try to remove objectKeys #21032

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

//# init --protocol-version 51 --addresses Test=0x0 --accounts A B --simulator --objects-snapshot-min-checkpoint-lag 4


// cp | object_id | owner
// ----------------------
// 1 | obj_2_0 | A
// 1 | obj_3_0 | A
// 2 | obj_5_0 | A
// 2 | obj_6_0 | A
// All owned by B after checkpoint 3.

//# publish
module Test::M1 {
public struct Object has key, store {
id: UID,
value: u64,
}

public entry fun create(value: u64, recipient: address, ctx: &mut TxContext) {
transfer::public_transfer(
Object { id: object::new(ctx), value },
recipient
)
}
}

//# run Test::M1::create --args 0 @A

//# run Test::M1::create --args 1 @A

//# create-checkpoint

//# run Test::M1::create --args 2 @A

//# run Test::M1::create --args 3 @A

//# create-checkpoint


//# run-graphql
{
multiGetObjects(
keys: [
{objectId: "@{obj_2_0}", version: 3},
{objectId: "@{obj_3_0}", version: 4},
{objectId: "@{obj_5_0}", version: 5},
{objectId: "@{obj_6_0}", version: 6}
]
)
{
version
asMoveObject {
contents {
type {
repr
}
json
}
}
}
}

//# programmable --sender A --inputs object(2,0) object(3,0) object(5,0) object(6,0) @B
//> TransferObjects([Input(0), Input(1), Input(2), Input(3)], Input(4))

//# create-checkpoint

//# advance-clock --duration-ns 1

//# create-checkpoint

//# advance-clock --duration-ns 1

//# create-checkpoint

//# advance-clock --duration-ns 1

//# create-checkpoint

//# advance-clock --duration-ns 1

//# create-checkpoint

//# run-graphql
# Should have all the objects
{
owned_by_address_b_latest: address(address: "@{B}") {
objects(filter: {type: "@{Test}"}) {
nodes {
version
contents {
type {
repr
}
json
}
}
}
}
}

//# run-graphql
# Historical lookups will still return results at version.
{
multiGetObjects(
keys: [
{objectId: "@{obj_2_0}", version: 3},
{objectId: "@{obj_3_0}", version: 4},
{objectId: "@{obj_6_0}", version: 6},
{objectId: "@{obj_6_0}", version: 7}
]
)
{
version
asMoveObject {
contents {
type {
repr
}
json
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,262 @@
---
source: external-crates/move/crates/move-transactional-test-runner/src/framework.rs
---
processed 21 tasks

init:
A: object(0,0), B: object(0,1)

task 1, lines 15-28:
//# publish
created: object(1,0)
mutated: object(0,2)
gas summary: computation_cost: 1000000, storage_cost: 5175600, storage_rebate: 0, non_refundable_storage_fee: 0

task 2, line 30:
//# run Test::M1::create --args 0 @A
created: object(2,0)
mutated: object(0,2)
gas summary: computation_cost: 1000000, storage_cost: 2302800, storage_rebate: 978120, non_refundable_storage_fee: 9880

task 3, line 32:
//# run Test::M1::create --args 1 @A
created: object(3,0)
mutated: object(0,2)
gas summary: computation_cost: 1000000, storage_cost: 2302800, storage_rebate: 978120, non_refundable_storage_fee: 9880

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

task 5, line 36:
//# run Test::M1::create --args 2 @A
created: object(5,0)
mutated: object(0,2)
gas summary: computation_cost: 1000000, storage_cost: 2302800, storage_rebate: 978120, non_refundable_storage_fee: 9880

task 6, line 38:
//# run Test::M1::create --args 3 @A
created: object(6,0)
mutated: object(0,2)
gas summary: computation_cost: 1000000, storage_cost: 2302800, storage_rebate: 978120, non_refundable_storage_fee: 9880

task 7, line 40:
//# create-checkpoint
Checkpoint created: 2

task 8, lines 43-64:
//# run-graphql
Response: {
"data": {
"multiGetObjects": [
{
"version": 3,
"asMoveObject": {
"contents": {
"type": {
"repr": "0xf8ecbba416b85769db9b3425d240e9e350c2994bc68d944ac19ebecffb7e0c60::M1::Object"
},
"json": {
"id": "0xc4e6c824c72af97ed831b666173a96111e573e0162b205b51c23ae242757e8d2",
"value": "0"
}
}
}
},
{
"version": 4,
"asMoveObject": {
"contents": {
"type": {
"repr": "0xf8ecbba416b85769db9b3425d240e9e350c2994bc68d944ac19ebecffb7e0c60::M1::Object"
},
"json": {
"id": "0x0f2ff2731e04cef60e75403b02f31721406c99cb05eb3029f697de89a3d70a71",
"value": "1"
}
}
}
},
{
"version": 5,
"asMoveObject": {
"contents": {
"type": {
"repr": "0xf8ecbba416b85769db9b3425d240e9e350c2994bc68d944ac19ebecffb7e0c60::M1::Object"
},
"json": {
"id": "0xd0a70e7cf1fa823e6bf035f878cc33ee3d221d7f956da78e572bb52574482471",
"value": "2"
}
}
}
},
{
"version": 6,
"asMoveObject": {
"contents": {
"type": {
"repr": "0xf8ecbba416b85769db9b3425d240e9e350c2994bc68d944ac19ebecffb7e0c60::M1::Object"
},
"json": {
"id": "0x44864f8c6cad831f338516aa3ebeacf00c60a13fb4a5a4200b35f376af227cf3",
"value": "3"
}
}
}
}
]
}
}

task 9, lines 66-67:
//# programmable --sender A --inputs object(2,0) object(3,0) object(5,0) object(6,0) @B
//> TransferObjects([Input(0), Input(1), Input(2), Input(3)], Input(4))
mutated: object(0,0), object(2,0), object(3,0), object(5,0), object(6,0)
gas summary: computation_cost: 1000000, storage_cost: 6247200, storage_rebate: 5206608, non_refundable_storage_fee: 52592

task 10, line 69:
//# create-checkpoint
Checkpoint created: 3

task 12, line 73:
//# create-checkpoint
Checkpoint created: 4

task 14, line 77:
//# create-checkpoint
Checkpoint created: 5

task 16, line 81:
//# create-checkpoint
Checkpoint created: 6

task 18, line 85:
//# create-checkpoint
Checkpoint created: 7

task 19, lines 87-103:
//# run-graphql
Response: {
"data": {
"owned_by_address_b_latest": {
"objects": {
"nodes": [
{
"version": 7,
"contents": {
"type": {
"repr": "0xf8ecbba416b85769db9b3425d240e9e350c2994bc68d944ac19ebecffb7e0c60::M1::Object"
},
"json": {
"id": "0x0f2ff2731e04cef60e75403b02f31721406c99cb05eb3029f697de89a3d70a71",
"value": "1"
}
}
},
{
"version": 7,
"contents": {
"type": {
"repr": "0xf8ecbba416b85769db9b3425d240e9e350c2994bc68d944ac19ebecffb7e0c60::M1::Object"
},
"json": {
"id": "0x44864f8c6cad831f338516aa3ebeacf00c60a13fb4a5a4200b35f376af227cf3",
"value": "3"
}
}
},
{
"version": 7,
"contents": {
"type": {
"repr": "0xf8ecbba416b85769db9b3425d240e9e350c2994bc68d944ac19ebecffb7e0c60::M1::Object"
},
"json": {
"id": "0xc4e6c824c72af97ed831b666173a96111e573e0162b205b51c23ae242757e8d2",
"value": "0"
}
}
},
{
"version": 7,
"contents": {
"type": {
"repr": "0xf8ecbba416b85769db9b3425d240e9e350c2994bc68d944ac19ebecffb7e0c60::M1::Object"
},
"json": {
"id": "0xd0a70e7cf1fa823e6bf035f878cc33ee3d221d7f956da78e572bb52574482471",
"value": "2"
}
}
}
]
}
}
}
}

task 20, lines 105-127:
//# run-graphql
Response: {
"data": {
"multiGetObjects": [
{
"version": 3,
"asMoveObject": {
"contents": {
"type": {
"repr": "0xf8ecbba416b85769db9b3425d240e9e350c2994bc68d944ac19ebecffb7e0c60::M1::Object"
},
"json": {
"id": "0xc4e6c824c72af97ed831b666173a96111e573e0162b205b51c23ae242757e8d2",
"value": "0"
}
}
}
},
{
"version": 4,
"asMoveObject": {
"contents": {
"type": {
"repr": "0xf8ecbba416b85769db9b3425d240e9e350c2994bc68d944ac19ebecffb7e0c60::M1::Object"
},
"json": {
"id": "0x0f2ff2731e04cef60e75403b02f31721406c99cb05eb3029f697de89a3d70a71",
"value": "1"
}
}
}
},
{
"version": 6,
"asMoveObject": {
"contents": {
"type": {
"repr": "0xf8ecbba416b85769db9b3425d240e9e350c2994bc68d944ac19ebecffb7e0c60::M1::Object"
},
"json": {
"id": "0x44864f8c6cad831f338516aa3ebeacf00c60a13fb4a5a4200b35f376af227cf3",
"value": "3"
}
}
}
},
{
"version": 7,
"asMoveObject": {
"contents": {
"type": {
"repr": "0xf8ecbba416b85769db9b3425d240e9e350c2994bc68d944ac19ebecffb7e0c60::M1::Object"
},
"json": {
"id": "0x44864f8c6cad831f338516aa3ebeacf00c60a13fb4a5a4200b35f376af227cf3",
"value": "3"
}
}
}
}
]
}
}
Loading
Loading