-
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.
[tests] create dry run helper for sui transactional test runner frame…
…work (#20920) ## Description motivation: #20109 Mirroring the existing `--dev-inspect` flag, this change adds `--dry-run` for sui transactional test runner framework. Pulls out common code into `tx_summary_from_effects`. ## Test plan Added new tests for reference return types. Dev inspect flag allows reference return while dry run does not. --- ## 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): - [ ] gRPC: - [ ] JSON-RPC: - [ ] GraphQL: - [ ] CLI: - [ ] Rust SDK:
- Loading branch information
1 parent
8a72297
commit 8ba733e
Showing
7 changed files
with
183 additions
and
39 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
crates/sui-adapter-transactional-tests/tests/dev_inspect/reference_return_value.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,16 @@ | ||
processed 3 tasks | ||
|
||
init: | ||
A: object(0,0) | ||
|
||
task 1, lines 8-14: | ||
//# publish | ||
created: object(1,0) | ||
mutated: object(0,1) | ||
gas summary: computation_cost: 1000000, storage_cost: 3465600, storage_rebate: 0, non_refundable_storage_fee: 0 | ||
|
||
task 2, lines 16-17: | ||
//# programmable --sender A --inputs 0 --dev-inspect | ||
//> 0: test::m::return_ref(Input(0)); | ||
mutated: object(_) | ||
gas summary: computation_cost: 500000, storage_cost: 988000, storage_rebate: 0, non_refundable_storage_fee: 0 |
17 changes: 17 additions & 0 deletions
17
crates/sui-adapter-transactional-tests/tests/dev_inspect/reference_return_value.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,17 @@ | ||
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// attempt to return a reference from a function | ||
|
||
//# init --addresses test=0x0 --accounts A | ||
|
||
//# publish | ||
|
||
module test::m { | ||
public fun return_ref(n: &u64): &u64 { | ||
n | ||
} | ||
} | ||
|
||
//# programmable --sender A --inputs 0 --dev-inspect | ||
//> 0: test::m::return_ref(Input(0)); |
16 changes: 16 additions & 0 deletions
16
crates/sui-adapter-transactional-tests/tests/dry_run/reference_return_value.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,16 @@ | ||
processed 3 tasks | ||
|
||
init: | ||
A: object(0,0) | ||
|
||
task 1, lines 8-14: | ||
//# publish | ||
created: object(1,0) | ||
mutated: object(0,1) | ||
gas summary: computation_cost: 1000000, storage_cost: 3465600, storage_rebate: 0, non_refundable_storage_fee: 0 | ||
|
||
task 2, lines 16-17: | ||
//# programmable --sender A --inputs 0 --dry-run | ||
//> 0: test::m::return_ref(Input(0)); | ||
Error: Transaction Effects Status: InvalidPublicFunctionReturnType { idx: 0 } in command 0 | ||
Execution Error: InvalidPublicFunctionReturnType { idx: 0 } in command 0 |
17 changes: 17 additions & 0 deletions
17
crates/sui-adapter-transactional-tests/tests/dry_run/reference_return_value.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,17 @@ | ||
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// attempt to return a reference from a function | ||
|
||
//# init --addresses test=0x0 --accounts A | ||
|
||
//# publish | ||
|
||
module test::m { | ||
public fun return_ref(n: &u64): &u64 { | ||
n | ||
} | ||
} | ||
|
||
//# programmable --sender A --inputs 0 --dry-run | ||
//> 0: test::m::return_ref(Input(0)); |
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
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
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