-
Notifications
You must be signed in to change notification settings - Fork 11.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[move][adapter] Add more detailed error location information (#6329)
- Adds module+function def+offset info for all execution errors - Aborts gain function def+offset info
- Loading branch information
Showing
14 changed files
with
181 additions
and
53 deletions.
There are no files selected for viewing
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
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
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
21 changes: 21 additions & 0 deletions
21
crates/sui-adapter-transactional-tests/tests/runtime_behavior/error_locations.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,21 @@ | ||
processed 6 tasks | ||
|
||
task 1 'publish'. lines 8-30: | ||
created: object(103) | ||
written: object(102) | ||
|
||
task 2 'run'. lines 32-32: | ||
Error: Transaction Effects Status: Move Runtime Abort. Location: test::m in function definition 0 at offset 1, Abort Code: 0 | ||
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: MoveAbort(MoveLocation { module: ModuleId { address: test, name: Identifier("m") }, function: 0, instruction: 1 }, 0), source: Some(VMError { major_status: ABORTED, sub_status: Some(0), message: Some("test::m::abort_ at offset 1"), exec_state: Some(ExecutionState { stack_trace: [] }), location: Module(ModuleId { address: test, name: Identifier("m") }), indices: [], offsets: [(FunctionDefinitionIndex(0), 1)] }) } } | ||
|
||
task 3 'run'. lines 34-34: | ||
Error: Transaction Effects Status: Insufficient Gas. | ||
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: InsufficientGas, source: Some(VMError { major_status: OUT_OF_GAS, sub_status: None, message: None, exec_state: Some(ExecutionState { stack_trace: [] }), location: Module(ModuleId { address: test, name: Identifier("m") }), indices: [], offsets: [(FunctionDefinitionIndex(1), 0)] }) } } | ||
|
||
task 4 'run'. lines 36-36: | ||
Error: Transaction Effects Status: Move Primitive Runtime Error. Location: test::m in function definition 2 at offset 2. Arithmetic error, stack overflow, max value depth, etc. | ||
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: MovePrimitiveRuntimeError(Some(MoveLocation { module: ModuleId { address: test, name: Identifier("m") }, function: 2, instruction: 2 })), source: Some(VMError { major_status: ARITHMETIC_ERROR, sub_status: None, message: None, exec_state: Some(ExecutionState { stack_trace: [] }), location: Module(ModuleId { address: test, name: Identifier("m") }), indices: [], offsets: [(FunctionDefinitionIndex(2), 2)] }) } } | ||
|
||
task 5 'run'. lines 38-38: | ||
Error: Transaction Effects Status: Move Primitive Runtime Error. Location: test::m in function definition 3 at offset 4. Arithmetic error, stack overflow, max value depth, etc. | ||
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: MovePrimitiveRuntimeError(Some(MoveLocation { module: ModuleId { address: test, name: Identifier("m") }, function: 3, instruction: 4 })), source: Some(VMError { major_status: VECTOR_OPERATION_ERROR, sub_status: Some(1), message: None, exec_state: Some(ExecutionState { stack_trace: [] }), location: Module(ModuleId { address: test, name: Identifier("m") }), indices: [], offsets: [(FunctionDefinitionIndex(3), 4)] }) } } |
38 changes: 38 additions & 0 deletions
38
crates/sui-adapter-transactional-tests/tests/runtime_behavior/error_locations.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,38 @@ | ||
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// test location for execution errors | ||
|
||
//# init --addresses test=0x0 | ||
|
||
//# publish | ||
|
||
module test::m { | ||
entry fun abort_() { | ||
// should be offset 1 | ||
abort 0 | ||
} | ||
|
||
entry fun loop_() { | ||
// should be offset 0 | ||
loop {} | ||
} | ||
|
||
entry fun math() { | ||
// should be offset 2 | ||
0 - 1; | ||
} | ||
|
||
entry fun vector_() { | ||
// should be offset 4 | ||
std::vector::borrow(&vector[0], 1); | ||
} | ||
} | ||
|
||
//# run test::m::abort_ | ||
|
||
//# run test::m::loop_ --gas-budget 100 | ||
|
||
//# run test::m::math | ||
|
||
//# run test::m::vector_ |
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
Oops, something went wrong.