-
Notifications
You must be signed in to change notification settings - Fork 11.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Description This adds an optional `root_version` argument to `Query.owner` as discussed in PR #17934. In summary: ``` `root_version` represents the version of the root object in some nested chain of dynamic fields. It allows historical queries for the case of wrapped objects, which don't have a version. For example, if querying the dynamic fields of a table wrapped in a parent object, passing the parent object's version here will ensure we get the dynamic fields' state at the moment that parent's version was created. If `root_version` is left null, the dynamic fields will be from a consistent snapshot of the Sui state at the latest checkpoint known to the GraphQL RPC. ``` ## Test plan Introduced new E2E tests: ``` sui-graphql-e2e-tests$ cargo nextest run --features pg_integration ``` --- ## 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: Introduces an optional `rootVersion` parameter to `Query.owner`. This can be used to do versioned lookups when reading dynamic fields rooted on a wrapped object or another dynamic object field. - [ ] CLI: - [ ] Rust SDK: --------- Co-authored-by: Ashok Menon <[email protected]>
- Loading branch information
1 parent
ffd3231
commit bbbd374
Showing
9 changed files
with
569 additions
and
9 deletions.
There are no files selected for viewing
292 changes: 292 additions & 0 deletions
292
crates/sui-graphql-e2e-tests/tests/owner/root_version.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,292 @@ | ||
processed 17 tasks | ||
|
||
init: | ||
A: object(0,0) | ||
|
||
task 1 'publish'. lines 6-86: | ||
created: object(1,0) | ||
mutated: object(0,1) | ||
gas summary: computation_cost: 1000000, storage_cost: 10586800, storage_rebate: 0, non_refundable_storage_fee: 0 | ||
|
||
task 2 'run'. lines 88-89: | ||
created: object(2,0) | ||
mutated: object(0,1) | ||
gas summary: computation_cost: 1000000, storage_cost: 2264800, storage_rebate: 978120, non_refundable_storage_fee: 9880 | ||
|
||
task 3 'run'. lines 91-92: | ||
created: object(3,0) | ||
mutated: object(0,1) | ||
gas summary: computation_cost: 1000000, storage_cost: 2257200, storage_rebate: 978120, non_refundable_storage_fee: 9880 | ||
|
||
task 4 'run'. lines 94-95: | ||
created: object(4,0) | ||
mutated: object(0,1) | ||
gas summary: computation_cost: 1000000, storage_cost: 2272400, storage_rebate: 978120, non_refundable_storage_fee: 9880 | ||
|
||
task 5 'run'. lines 97-98: | ||
created: object(5,0) | ||
mutated: object(0,1) | ||
gas summary: computation_cost: 1000000, storage_cost: 2272400, storage_rebate: 978120, non_refundable_storage_fee: 9880 | ||
|
||
task 6 'run'. lines 101-104: | ||
created: object(6,0), object(6,1) | ||
mutated: object(0,1), object(2,0), object(4,0), object(5,0) | ||
wrapped: object(3,0) | ||
gas summary: computation_cost: 1000000, storage_cost: 9940800, storage_rebate: 6041772, non_refundable_storage_fee: 61028 | ||
|
||
task 7 'view-object'. lines 106-108: | ||
Owner: Account Address ( _ ) | ||
Version: 7 | ||
Contents: P0::M::O { | ||
id: sui::object::UID { | ||
id: sui::object::ID { | ||
bytes: fake(2,0), | ||
}, | ||
}, | ||
count: 0u64, | ||
wrapped: std::option::Option<P0::M::W> { | ||
vec: vector[ | ||
P0::M::W { | ||
id: sui::object::UID { | ||
id: sui::object::ID { | ||
bytes: fake(3,0), | ||
}, | ||
}, | ||
count: 0u64, | ||
}, | ||
], | ||
}, | ||
} | ||
|
||
task 8 'run'. lines 110-111: | ||
mutated: object(0,1), object(2,0) | ||
gas summary: computation_cost: 1000000, storage_cost: 2568800, storage_rebate: 2543112, non_refundable_storage_fee: 25688 | ||
|
||
task 9 'run'. lines 113-114: | ||
mutated: object(0,1), object(2,0) | ||
gas summary: computation_cost: 1000000, storage_cost: 2568800, storage_rebate: 2543112, non_refundable_storage_fee: 25688 | ||
|
||
task 10 'run'. lines 116-117: | ||
mutated: object(0,1), object(2,0), object(4,0) | ||
gas summary: computation_cost: 1000000, storage_cost: 3853200, storage_rebate: 3814668, non_refundable_storage_fee: 38532 | ||
|
||
task 11 'run'. lines 119-120: | ||
mutated: object(0,1), object(2,0), object(5,0) | ||
gas summary: computation_cost: 1000000, storage_cost: 3853200, storage_rebate: 3814668, non_refundable_storage_fee: 38532 | ||
|
||
task 12 'view-object'. lines 122-122: | ||
Owner: Account Address ( _ ) | ||
Version: 11 | ||
Contents: P0::M::O { | ||
id: sui::object::UID { | ||
id: sui::object::ID { | ||
bytes: fake(2,0), | ||
}, | ||
}, | ||
count: 1u64, | ||
wrapped: std::option::Option<P0::M::W> { | ||
vec: vector[ | ||
P0::M::W { | ||
id: sui::object::UID { | ||
id: sui::object::ID { | ||
bytes: fake(3,0), | ||
}, | ||
}, | ||
count: 1u64, | ||
}, | ||
], | ||
}, | ||
} | ||
|
||
task 13 'create-checkpoint'. lines 124-124: | ||
Checkpoint created: 1 | ||
|
||
task 14 'run-graphql'. lines 126-141: | ||
Response: { | ||
"data": { | ||
"latest": { | ||
"asObject": { | ||
"asMoveObject": { | ||
"version": 11, | ||
"contents": { | ||
"json": { | ||
"id": "0x90dc651cc4aef34057af8c944f0ab8a0150295ad088edd4407a1bd4c225e18b8", | ||
"count": "1", | ||
"wrapped": { | ||
"id": "0x3330add01caca066f647d3a3df92917d0191ba9b9aaaa8d2da4d726bb3c330cf", | ||
"count": "1" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"versioned": { | ||
"asObject": { | ||
"asMoveObject": { | ||
"version": 10, | ||
"contents": { | ||
"json": { | ||
"id": "0x90dc651cc4aef34057af8c944f0ab8a0150295ad088edd4407a1bd4c225e18b8", | ||
"count": "1", | ||
"wrapped": { | ||
"id": "0x3330add01caca066f647d3a3df92917d0191ba9b9aaaa8d2da4d726bb3c330cf", | ||
"count": "1" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"beforeWrappedBump": { | ||
"asObject": { | ||
"asMoveObject": { | ||
"version": 8, | ||
"contents": { | ||
"json": { | ||
"id": "0x90dc651cc4aef34057af8c944f0ab8a0150295ad088edd4407a1bd4c225e18b8", | ||
"count": "1", | ||
"wrapped": { | ||
"id": "0x3330add01caca066f647d3a3df92917d0191ba9b9aaaa8d2da4d726bb3c330cf", | ||
"count": "0" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"beforeBump": { | ||
"asObject": { | ||
"asMoveObject": { | ||
"version": 7, | ||
"contents": { | ||
"json": { | ||
"id": "0x90dc651cc4aef34057af8c944f0ab8a0150295ad088edd4407a1bd4c225e18b8", | ||
"count": "0", | ||
"wrapped": { | ||
"id": "0x3330add01caca066f647d3a3df92917d0191ba9b9aaaa8d2da4d726bb3c330cf", | ||
"count": "0" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
task 15 'run-graphql'. lines 143-171: | ||
Response: { | ||
"data": { | ||
"unversioned": { | ||
"dynamicObjectField": { | ||
"value": { | ||
"version": 7, | ||
"contents": { | ||
"json": { | ||
"id": "0xd38f2f2e8c369c5ec08b8852fac5834c2bcc25308f0205763528364354dc0369", | ||
"count": "0" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"latest": { | ||
"dynamicObjectField": { | ||
"value": { | ||
"version": 10, | ||
"contents": { | ||
"json": { | ||
"id": "0xd38f2f2e8c369c5ec08b8852fac5834c2bcc25308f0205763528364354dc0369", | ||
"count": "1" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"afterFirstInnerBump": { | ||
"dynamicObjectField": { | ||
"value": { | ||
"version": 10, | ||
"contents": { | ||
"json": { | ||
"id": "0xd38f2f2e8c369c5ec08b8852fac5834c2bcc25308f0205763528364354dc0369", | ||
"count": "1" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"beforeFirstInnerBump": { | ||
"dynamicObjectField": { | ||
"value": { | ||
"version": 7, | ||
"contents": { | ||
"json": { | ||
"id": "0xd38f2f2e8c369c5ec08b8852fac5834c2bcc25308f0205763528364354dc0369", | ||
"count": "0" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"beforeBumps": { | ||
"dynamicObjectField": { | ||
"value": { | ||
"version": 7, | ||
"contents": { | ||
"json": { | ||
"id": "0xd38f2f2e8c369c5ec08b8852fac5834c2bcc25308f0205763528364354dc0369", | ||
"count": "0" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
task 16 'run-graphql'. lines 173-194: | ||
Response: { | ||
"data": { | ||
"unversioned": { | ||
"dynamicObjectField": { | ||
"value": { | ||
"version": 7, | ||
"contents": { | ||
"json": { | ||
"id": "0xab491044d75a8be613bd6fdc2215a0847c740b8774bc6feb9188f4b7233a37d5", | ||
"count": "0" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"latest": { | ||
"dynamicObjectField": { | ||
"value": { | ||
"version": 11, | ||
"contents": { | ||
"json": { | ||
"id": "0xab491044d75a8be613bd6fdc2215a0847c740b8774bc6feb9188f4b7233a37d5", | ||
"count": "1" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"beforeInnerBump": { | ||
"dynamicObjectField": { | ||
"value": { | ||
"version": 7, | ||
"contents": { | ||
"json": { | ||
"id": "0xab491044d75a8be613bd6fdc2215a0847c740b8774bc6feb9188f4b7233a37d5", | ||
"count": "0" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.