-
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 was another part of #20962, now added back accounting for the changes to errors and data loaders. This change also: - Imposes a max limit on the number of objects that can be fetched in one go. - Uses the same architecture as `queryTransactionBlock`, where the multi-get works by calling the function that loads data from a data loader and generates a response concurrently. ## Test plan New E2E tests: ``` sui$ cargo nextest run -p sui-indexer-alt-e2e-tests -- objects ```
- Loading branch information
Showing
6 changed files
with
435 additions
and
7 deletions.
There are no files selected for viewing
242 changes: 242 additions & 0 deletions
242
crates/sui-indexer-alt-e2e-tests/tests/jsonrpc/objects/try_multi_get_past_objects.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,242 @@ | ||
processed 11 tasks | ||
|
||
init: | ||
A: object(0,0), B: object(0,1) | ||
|
||
task 1, lines 9-11: | ||
//# programmable --sender A --inputs 42 @A | ||
//> 0: SplitCoins(Gas, [Input(0)]); | ||
//> 1: TransferObjects([Result(0)], Input(1)) | ||
created: object(1,0) | ||
mutated: object(0,0) | ||
gas summary: computation_cost: 1000000, storage_cost: 1976000, storage_rebate: 0, non_refundable_storage_fee: 0 | ||
|
||
task 2, lines 13-15: | ||
//# programmable --sender A --inputs 43 @B | ||
//> 0: SplitCoins(Gas, [Input(0)]); | ||
//> 1: TransferObjects([Result(0)], Input(1)) | ||
created: object(2,0) | ||
mutated: object(0,0) | ||
gas summary: computation_cost: 1000000, storage_cost: 1976000, storage_rebate: 978120, non_refundable_storage_fee: 9880 | ||
|
||
task 3, lines 17-19: | ||
//# programmable --sender A --inputs 44 | ||
//> 0: SplitCoins(Gas, [Input(0)]); | ||
//> 1: sui::transfer::public_share_object<sui::coin::Coin<sui::sui::SUI>>(Result(0)) | ||
created: object(3,0) | ||
mutated: object(0,0) | ||
gas summary: computation_cost: 1000000, storage_cost: 1976000, storage_rebate: 978120, non_refundable_storage_fee: 9880 | ||
|
||
task 4, lines 21-23: | ||
//# programmable --sender A --inputs 45 | ||
//> 0: SplitCoins(Gas, [Input(0)]); | ||
//> 1: sui::transfer::public_freeze_object<sui::coin::Coin<sui::sui::SUI>>(Result(0)) | ||
created: object(4,0) | ||
mutated: object(0,0) | ||
gas summary: computation_cost: 1000000, storage_cost: 1976000, storage_rebate: 978120, non_refundable_storage_fee: 9880 | ||
|
||
task 5, lines 25-27: | ||
//# programmable --sender A --inputs @A | ||
//> 0: sui::table::new<u64, u64>(); | ||
//> 1: TransferObjects([Result(0)], Input(0)) | ||
created: object(5,0) | ||
mutated: object(0,0) | ||
gas summary: computation_cost: 1000000, storage_cost: 2333200, storage_rebate: 978120, non_refundable_storage_fee: 9880 | ||
|
||
task 6, lines 29-30: | ||
//# programmable --sender A --inputs object(5,0) 46 47 | ||
//> 0: sui::table::add<u64, u64>(Input(0), Input(1), Input(2)) | ||
created: object(6,0) | ||
mutated: object(0,0), object(5,0) | ||
gas summary: computation_cost: 1000000, storage_cost: 3800000, storage_rebate: 2309868, non_refundable_storage_fee: 23332 | ||
|
||
task 7, lines 32-33: | ||
//# programmable --sender A --inputs object(5,0) 46 | ||
//> 0: sui::table::remove<u64, u64>(Input(0), Input(1)) | ||
mutated: object(0,0), object(5,0) | ||
deleted: object(6,0) | ||
gas summary: computation_cost: 1000000, storage_cost: 2333200, storage_rebate: 3762000, non_refundable_storage_fee: 38000 | ||
|
||
task 8, line 35: | ||
//# create-checkpoint | ||
Checkpoint created: 1 | ||
|
||
task 9, lines 37-52: | ||
//# run-jsonrpc | ||
Response: { | ||
"jsonrpc": "2.0", | ||
"id": 0, | ||
"result": [ | ||
{ | ||
"status": "VersionFound", | ||
"details": { | ||
"objectId": "0xc442f9431f789a6c80078a63e707de84c7815c3150e08f1e44be256bd05a2b81", | ||
"version": "2", | ||
"digest": "4wV3VBJGNaMCv9zfjSna8c4as6EkuYoqTHHjueS6S745" | ||
} | ||
}, | ||
{ | ||
"status": "VersionFound", | ||
"details": { | ||
"objectId": "0xf2945213c986e35d59aae258ef1b094e81ead5cc982b0d1519625bf3f81bee68", | ||
"version": "3", | ||
"digest": "9wMLcUMLvkbqNFyoPtUJ1GPuVuXVqpLA3GP2DHL2SyL6" | ||
} | ||
}, | ||
{ | ||
"status": "VersionFound", | ||
"details": { | ||
"objectId": "0x0918a1917bda4d05f1cb4db824532a63476c57d65c548930406fe02051f22819", | ||
"version": "4", | ||
"digest": "8pirmp97ym3pzSCabaPsoPYVPbKYQHfnPqEbCyk32Au2" | ||
} | ||
}, | ||
{ | ||
"status": "VersionFound", | ||
"details": { | ||
"objectId": "0xf079987ab8a34791ae4dd8b2d2a9af3485496a49b382b22239c4ca43902fe18a", | ||
"version": "5", | ||
"digest": "EEF6GF5DCZRZ4zxsubwzaQhYWysCdGJ63sLRLE15d9F" | ||
} | ||
}, | ||
{ | ||
"status": "VersionFound", | ||
"details": { | ||
"objectId": "0x2867eee076a7f41efb3dc507f27531c26319dfbf0c9a6d92f6d1fd0f8d9bdeeb", | ||
"version": "6", | ||
"digest": "EtpqCkaW8jrLkvbeL9Mgy3REUMX73FrGxEjGiFCz8TSm" | ||
} | ||
}, | ||
{ | ||
"status": "VersionFound", | ||
"details": { | ||
"objectId": "0x0dfe3bf8505600c374ecc59e9580d3504a37a14f65b53084ef86c5861f39cc3f", | ||
"version": "7", | ||
"digest": "9rcnz8P9Eie7KZPUjTWnmTzyUxsBMaJcb9G3ncuG4BiC" | ||
} | ||
}, | ||
{ | ||
"status": "ObjectDeleted", | ||
"details": { | ||
"objectId": "0x0dfe3bf8505600c374ecc59e9580d3504a37a14f65b53084ef86c5861f39cc3f", | ||
"version": 8, | ||
"digest": "7gyGAp71YXQRoxmFBaHxofQXAipvgHyBKPyxmdSJxyvz" | ||
} | ||
}, | ||
{ | ||
"status": "VersionNotFound", | ||
"details": [ | ||
"0x0dfe3bf8505600c374ecc59e9580d3504a37a14f65b53084ef86c5861f39cc3f", | ||
9 | ||
] | ||
} | ||
] | ||
} | ||
|
||
task 10, lines 54-75: | ||
//# run-jsonrpc | ||
Response: { | ||
"jsonrpc": "2.0", | ||
"id": 1, | ||
"result": [ | ||
{ | ||
"status": "VersionFound", | ||
"details": { | ||
"objectId": "0xc442f9431f789a6c80078a63e707de84c7815c3150e08f1e44be256bd05a2b81", | ||
"version": "2", | ||
"digest": "4wV3VBJGNaMCv9zfjSna8c4as6EkuYoqTHHjueS6S745", | ||
"type": "0x2::coin::Coin<0x2::sui::SUI>", | ||
"owner": { | ||
"AddressOwner": "0xfccc9a421bbb13c1a66a1aa98f0ad75029ede94857779c6915b44f94068b921e" | ||
}, | ||
"previousTransaction": "ABo3jemYqdBWMRYqsaCYUKnGDp64tR7jK2fH1mKCoJLk", | ||
"storageRebate": "988000" | ||
} | ||
}, | ||
{ | ||
"status": "VersionFound", | ||
"details": { | ||
"objectId": "0xf2945213c986e35d59aae258ef1b094e81ead5cc982b0d1519625bf3f81bee68", | ||
"version": "3", | ||
"digest": "9wMLcUMLvkbqNFyoPtUJ1GPuVuXVqpLA3GP2DHL2SyL6", | ||
"type": "0x2::coin::Coin<0x2::sui::SUI>", | ||
"owner": { | ||
"AddressOwner": "0xa7b032703878aa74c3126935789fd1d4d7e111d5911b09247d6963061c312b5a" | ||
}, | ||
"previousTransaction": "DHGGkfgVSyMV4vZqbHe5jPcJLX5Wrp3m7d5mdLUn62dX", | ||
"storageRebate": "988000" | ||
} | ||
}, | ||
{ | ||
"status": "VersionFound", | ||
"details": { | ||
"objectId": "0x0918a1917bda4d05f1cb4db824532a63476c57d65c548930406fe02051f22819", | ||
"version": "4", | ||
"digest": "8pirmp97ym3pzSCabaPsoPYVPbKYQHfnPqEbCyk32Au2", | ||
"type": "0x2::coin::Coin<0x2::sui::SUI>", | ||
"owner": { | ||
"Shared": { | ||
"initial_shared_version": 4 | ||
} | ||
}, | ||
"previousTransaction": "FDCEMiaPqGUUFjB4sV1EMCFisw7W7WMJJ6nWTBwnoHcc", | ||
"storageRebate": "988000" | ||
} | ||
}, | ||
{ | ||
"status": "VersionFound", | ||
"details": { | ||
"objectId": "0xf079987ab8a34791ae4dd8b2d2a9af3485496a49b382b22239c4ca43902fe18a", | ||
"version": "5", | ||
"digest": "EEF6GF5DCZRZ4zxsubwzaQhYWysCdGJ63sLRLE15d9F", | ||
"type": "0x2::coin::Coin<0x2::sui::SUI>", | ||
"owner": "Immutable", | ||
"previousTransaction": "4ZmQdHopY1d8eg5zsTVciezKwhTbuQGaybXXBMWjs7ax", | ||
"storageRebate": "988000" | ||
} | ||
}, | ||
{ | ||
"status": "VersionFound", | ||
"details": { | ||
"objectId": "0x2867eee076a7f41efb3dc507f27531c26319dfbf0c9a6d92f6d1fd0f8d9bdeeb", | ||
"version": "6", | ||
"digest": "EtpqCkaW8jrLkvbeL9Mgy3REUMX73FrGxEjGiFCz8TSm", | ||
"type": "0x2::table::Table<u64, u64>", | ||
"owner": { | ||
"AddressOwner": "0xfccc9a421bbb13c1a66a1aa98f0ad75029ede94857779c6915b44f94068b921e" | ||
}, | ||
"previousTransaction": "7DxXXvjVgFuqLXPRaZKAVm12cQWopxbVySBdNqmUCRVJ", | ||
"storageRebate": "1345200" | ||
} | ||
}, | ||
{ | ||
"status": "VersionFound", | ||
"details": { | ||
"objectId": "0x0dfe3bf8505600c374ecc59e9580d3504a37a14f65b53084ef86c5861f39cc3f", | ||
"version": "7", | ||
"digest": "9rcnz8P9Eie7KZPUjTWnmTzyUxsBMaJcb9G3ncuG4BiC", | ||
"type": "0x2::dynamic_field::Field<u64, u64>", | ||
"owner": { | ||
"ObjectOwner": "0x2867eee076a7f41efb3dc507f27531c26319dfbf0c9a6d92f6d1fd0f8d9bdeeb" | ||
}, | ||
"previousTransaction": "6mXaEAhjYrN5QF4mBX1bLK2T8h4XtmYqqi3FNvtsd3TY", | ||
"storageRebate": "1466800" | ||
} | ||
}, | ||
{ | ||
"status": "ObjectDeleted", | ||
"details": { | ||
"objectId": "0x0dfe3bf8505600c374ecc59e9580d3504a37a14f65b53084ef86c5861f39cc3f", | ||
"version": 8, | ||
"digest": "7gyGAp71YXQRoxmFBaHxofQXAipvgHyBKPyxmdSJxyvz" | ||
} | ||
}, | ||
{ | ||
"status": "VersionNotFound", | ||
"details": [ | ||
"0x0dfe3bf8505600c374ecc59e9580d3504a37a14f65b53084ef86c5861f39cc3f", | ||
9 | ||
] | ||
} | ||
] | ||
} |
75 changes: 75 additions & 0 deletions
75
crates/sui-indexer-alt-e2e-tests/tests/jsonrpc/objects/try_multi_get_past_objects.move
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,75 @@ | ||
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
//# init --protocol-version 70 --accounts A B --addresses test=0x0 --simulator | ||
|
||
// 1. Multi-get objects (with found object, with non-existent object, with deleted object) | ||
// 2. Multi-get objects with options | ||
|
||
//# programmable --sender A --inputs 42 @A | ||
//> 0: SplitCoins(Gas, [Input(0)]); | ||
//> 1: TransferObjects([Result(0)], Input(1)) | ||
|
||
//# programmable --sender A --inputs 43 @B | ||
//> 0: SplitCoins(Gas, [Input(0)]); | ||
//> 1: TransferObjects([Result(0)], Input(1)) | ||
|
||
//# programmable --sender A --inputs 44 | ||
//> 0: SplitCoins(Gas, [Input(0)]); | ||
//> 1: sui::transfer::public_share_object<sui::coin::Coin<sui::sui::SUI>>(Result(0)) | ||
|
||
//# programmable --sender A --inputs 45 | ||
//> 0: SplitCoins(Gas, [Input(0)]); | ||
//> 1: sui::transfer::public_freeze_object<sui::coin::Coin<sui::sui::SUI>>(Result(0)) | ||
|
||
//# programmable --sender A --inputs @A | ||
//> 0: sui::table::new<u64, u64>(); | ||
//> 1: TransferObjects([Result(0)], Input(0)) | ||
|
||
//# programmable --sender A --inputs object(5,0) 46 47 | ||
//> 0: sui::table::add<u64, u64>(Input(0), Input(1), Input(2)) | ||
|
||
//# programmable --sender A --inputs object(5,0) 46 | ||
//> 0: sui::table::remove<u64, u64>(Input(0), Input(1)) | ||
|
||
//# create-checkpoint | ||
|
||
//# run-jsonrpc | ||
{ | ||
"method": "sui_tryMultiGetPastObjects", | ||
"params": [ | ||
[ | ||
{ "objectId": "@{obj_1_0}", "version": "2" }, | ||
{ "objectId": "@{obj_2_0}", "version": "3" }, | ||
{ "objectId": "@{obj_3_0}", "version": "4" }, | ||
{ "objectId": "@{obj_4_0}", "version": "5" }, | ||
{ "objectId": "@{obj_5_0}", "version": "6" }, | ||
{ "objectId": "@{obj_6_0}", "version": "7" }, | ||
{ "objectId": "@{obj_6_0}", "version": "8" }, | ||
{ "objectId": "@{obj_6_0}", "version": "9" } | ||
] | ||
] | ||
} | ||
|
||
//# run-jsonrpc | ||
{ | ||
"method": "sui_tryMultiGetPastObjects", | ||
"params": [ | ||
[ | ||
{ "objectId": "@{obj_1_0}", "version": "2" }, | ||
{ "objectId": "@{obj_2_0}", "version": "3" }, | ||
{ "objectId": "@{obj_3_0}", "version": "4" }, | ||
{ "objectId": "@{obj_4_0}", "version": "5" }, | ||
{ "objectId": "@{obj_5_0}", "version": "6" }, | ||
{ "objectId": "@{obj_6_0}", "version": "7" }, | ||
{ "objectId": "@{obj_6_0}", "version": "8" }, | ||
{ "objectId": "@{obj_6_0}", "version": "9" } | ||
], | ||
{ | ||
"showType": true, | ||
"showOwner": true, | ||
"showPreviousTransaction": true, | ||
"showStorageRebate": true | ||
} | ||
] | ||
} |
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,8 @@ | ||
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#[derive(thiserror::Error, Debug)] | ||
pub(super) enum Error { | ||
#[error("Requested {requested} keys, exceeding maximum {max}")] | ||
TooManyKeys { requested: usize, max: usize }, | ||
} |
Oops, something went wrong.