forked from MystenLabs/sui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[gql] available range bounded point object lookup (MystenLabs#15506)
## Description With the introduction of the objects_snapshot and objects_history tables, we can now support object lookups at version and latest at checkpoint, provided they fall within the available range of the graphql server. We can also get information on wrapped or deleted objects. As such, refactor Object’s internal representation to contain a status: ObjectKind enum with variants Live, Historical, NotIndexed, and WrappedOrDeleted,. This minimizes changes to the current Object schema on graphql while allowing users to resolve fields of wrapped objects even if the objects themselves cannot be accessed. The PR also implements available-range-aware single-object lookups by constructing a union query on objects_snapshot and objects_history. We need to look up both tables when fetching an object at version. To illustrate, if an object was created or mutated at checkpoint 1, and the current available range is now 100-200, a query for the object at version 1 will not show up if we look strictly in the objects_history table, since it only tracks object changes per checkpoint. Instead, we also consult objects_snapshot, which will have snapshotted the object. ## Test Plan objects/historical.move To fully test this feature, I also need to extend transactional-test-runner and graphql's test infra to force objects_snapshot table to update. 1. MystenLabs#15677 (follows this) --- If your changes are not user-facing and not a breaking change, you can skip the following section. Otherwise, please indicate what changed, and then add to the Release Notes section as highlighted during the release process. ### Type of Change (Check all that apply) - [ ] protocol change - [ ] user-visible impact - [ ] breaking change for a client SDKs - [ ] breaking change for FNs (FN binary must upgrade) - [ ] breaking change for validators or node operators (must upgrade binaries) - [ ] breaking change for on-chain data layout - [ ] necessitate either a data wipe or data migration ### Release notes
- Loading branch information
Showing
18 changed files
with
1,126 additions
and
127 deletions.
There are no files selected for viewing
259 changes: 259 additions & 0 deletions
259
crates/sui-graphql-e2e-tests/tests/objects/historical.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,259 @@ | ||
processed 26 tasks | ||
|
||
init: | ||
A: object(0,0) | ||
|
||
task 1 'publish'. lines 13-54: | ||
created: object(1,0) | ||
mutated: object(0,1) | ||
gas summary: computation_cost: 1000000, storage_cost: 7014800, storage_rebate: 0, non_refundable_storage_fee: 0 | ||
|
||
task 2 'run'. lines 56-56: | ||
created: object(2,0) | ||
mutated: object(0,1) | ||
gas summary: computation_cost: 1000000, storage_cost: 2302800, storage_rebate: 978120, non_refundable_storage_fee: 9880 | ||
|
||
task 3 'create-checkpoint'. lines 58-58: | ||
Checkpoint created: 1 | ||
|
||
task 4 'run-graphql'. lines 60-73: | ||
Response: { | ||
"data": { | ||
"object": { | ||
"status": "LIVE", | ||
"version": 3, | ||
"asMoveObject": { | ||
"contents": { | ||
"json": { | ||
"id": "0x525878f17a6177aa29f6a385600344daf90c45b1c2d3f1c6e7e9dc5b07e9cab0", | ||
"value": "0" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
task 5 'run'. lines 75-75: | ||
mutated: object(0,0), object(2,0) | ||
gas summary: computation_cost: 1000000, storage_cost: 2302800, storage_rebate: 1301652, non_refundable_storage_fee: 13148 | ||
|
||
task 6 'create-checkpoint'. lines 77-77: | ||
Checkpoint created: 2 | ||
|
||
task 7 'run-graphql'. lines 79-92: | ||
Response: { | ||
"data": { | ||
"object": { | ||
"status": "LIVE", | ||
"version": 4, | ||
"asMoveObject": { | ||
"contents": { | ||
"json": { | ||
"id": "0x525878f17a6177aa29f6a385600344daf90c45b1c2d3f1c6e7e9dc5b07e9cab0", | ||
"value": "1" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
task 8 'run-graphql'. lines 94-108: | ||
Response: { | ||
"data": { | ||
"object": { | ||
"status": "HISTORICAL", | ||
"version": 3, | ||
"asMoveObject": { | ||
"contents": { | ||
"json": { | ||
"id": "0x525878f17a6177aa29f6a385600344daf90c45b1c2d3f1c6e7e9dc5b07e9cab0", | ||
"value": "0" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
task 9 'run'. lines 110-110: | ||
created: object(9,0) | ||
mutated: object(0,0) | ||
wrapped: object(2,0) | ||
gas summary: computation_cost: 1000000, storage_cost: 2553600, storage_rebate: 2279772, non_refundable_storage_fee: 23028 | ||
|
||
task 10 'create-checkpoint'. lines 112-112: | ||
Checkpoint created: 3 | ||
|
||
task 11 'run-graphql'. lines 114-127: | ||
Response: { | ||
"data": { | ||
"object": null | ||
} | ||
} | ||
|
||
task 12 'run-graphql'. lines 130-144: | ||
Response: { | ||
"data": { | ||
"object": { | ||
"status": "HISTORICAL", | ||
"version": 4, | ||
"asMoveObject": { | ||
"contents": { | ||
"json": { | ||
"id": "0x525878f17a6177aa29f6a385600344daf90c45b1c2d3f1c6e7e9dc5b07e9cab0", | ||
"value": "1" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
task 13 'run-graphql'. lines 146-160: | ||
Response: { | ||
"data": { | ||
"object": { | ||
"status": "HISTORICAL", | ||
"version": 3, | ||
"asMoveObject": { | ||
"contents": { | ||
"json": { | ||
"id": "0x525878f17a6177aa29f6a385600344daf90c45b1c2d3f1c6e7e9dc5b07e9cab0", | ||
"value": "0" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
task 14 'run'. lines 162-162: | ||
mutated: object(0,0) | ||
unwrapped: object(2,0) | ||
deleted: object(9,0) | ||
gas summary: computation_cost: 1000000, storage_cost: 2302800, storage_rebate: 2528064, non_refundable_storage_fee: 25536 | ||
|
||
task 15 'create-checkpoint'. lines 164-164: | ||
Checkpoint created: 4 | ||
|
||
task 16 'run-graphql'. lines 166-179: | ||
Response: { | ||
"data": { | ||
"object": { | ||
"status": "LIVE", | ||
"version": 6, | ||
"asMoveObject": { | ||
"contents": { | ||
"json": { | ||
"id": "0x525878f17a6177aa29f6a385600344daf90c45b1c2d3f1c6e7e9dc5b07e9cab0", | ||
"value": "1" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
task 17 'run-graphql'. lines 181-195: | ||
Response: { | ||
"data": { | ||
"object": { | ||
"status": "WRAPPED_OR_DELETED", | ||
"version": 5, | ||
"asMoveObject": null | ||
} | ||
} | ||
} | ||
|
||
task 18 'run-graphql'. lines 197-211: | ||
Response: { | ||
"data": { | ||
"object": { | ||
"status": "HISTORICAL", | ||
"version": 4, | ||
"asMoveObject": { | ||
"contents": { | ||
"json": { | ||
"id": "0x525878f17a6177aa29f6a385600344daf90c45b1c2d3f1c6e7e9dc5b07e9cab0", | ||
"value": "1" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
task 19 'run-graphql'. lines 213-227: | ||
Response: { | ||
"data": { | ||
"object": { | ||
"status": "HISTORICAL", | ||
"version": 3, | ||
"asMoveObject": { | ||
"contents": { | ||
"json": { | ||
"id": "0x525878f17a6177aa29f6a385600344daf90c45b1c2d3f1c6e7e9dc5b07e9cab0", | ||
"value": "0" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
task 20 'run'. lines 229-229: | ||
mutated: object(0,0) | ||
deleted: object(2,0) | ||
gas summary: computation_cost: 1000000, storage_cost: 988000, storage_rebate: 2279772, non_refundable_storage_fee: 23028 | ||
|
||
task 21 'create-checkpoint'. lines 231-231: | ||
Checkpoint created: 5 | ||
|
||
task 22 'run-graphql'. lines 233-246: | ||
Response: { | ||
"data": { | ||
"object": null | ||
} | ||
} | ||
|
||
task 23 'run-graphql'. lines 248-262: | ||
Response: { | ||
"data": { | ||
"object": { | ||
"status": "WRAPPED_OR_DELETED", | ||
"version": 7, | ||
"asMoveObject": null | ||
} | ||
} | ||
} | ||
|
||
task 24 'run-graphql'. lines 264-278: | ||
Response: { | ||
"data": { | ||
"object": { | ||
"status": "HISTORICAL", | ||
"version": 6, | ||
"asMoveObject": { | ||
"contents": { | ||
"json": { | ||
"id": "0x525878f17a6177aa29f6a385600344daf90c45b1c2d3f1c6e7e9dc5b07e9cab0", | ||
"value": "1" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
task 25 'run-graphql'. lines 280-294: | ||
Response: { | ||
"data": { | ||
"object": { | ||
"status": "WRAPPED_OR_DELETED", | ||
"version": 5, | ||
"asMoveObject": null | ||
} | ||
} | ||
} |
Oops, something went wrong.