Skip to content

Commit

Permalink
[programmable transactions] Add command index to errors (MystenLabs#8653
Browse files Browse the repository at this point in the history
)

## Description 

- Added command to ExecutionError, unused for non programmable
transactions

## Test Plan 

Updated tests

---
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)

- [X] 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

Added an index to ExecutionErrors to track which programmable
transaction command produced the error (if applicable)
  • Loading branch information
tnowacki authored Feb 26, 2023
1 parent 8152b27 commit 4cfb99c
Show file tree
Hide file tree
Showing 101 changed files with 226 additions and 182 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ written: object(110), object(111)

task 6 'run'. lines 89-89:
Error: Transaction Effects Status: Invalid Object Owned Argument. Object fake(112) is owned by object fake(113). Objects owned by other objects cannot be used as input arguments.
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: InvalidChildObjectArgument(InvalidChildObjectArgument { child: fake(112), parent: fake(113) }), source: None } }
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: InvalidChildObjectArgument(InvalidChildObjectArgument { child: fake(112), parent: fake(113) }), source: None, command: None } }

task 7 'run'. lines 91-91:
Error: Transaction Effects Status: Invalid Object Owned Argument. Object fake(112) is owned by object fake(113). Objects owned by other objects cannot be used as input arguments.
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: InvalidChildObjectArgument(InvalidChildObjectArgument { child: fake(112), parent: fake(113) }), source: None } }
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: InvalidChildObjectArgument(InvalidChildObjectArgument { child: fake(112), parent: fake(113) }), source: None, command: None } }
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ written: object(106)

task 3 'run'. lines 34-34:
Error: Transaction Effects Status: Move Runtime Abort. Location: sui::dynamic_field::add (function index 0) at offset 15, Abort Code: 0
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: MoveAbort(MoveLocation { module: ModuleId { address: sui, name: Identifier("dynamic_field") }, function: 0, instruction: 15, function_name: Some("add") }, 0), source: Some(VMError { major_status: ABORTED, sub_status: Some(0), message: Some("sui::dynamic_field::add at offset 15"), exec_state: Some(ExecutionState { stack_trace: [(Some(ModuleId { address: a, name: Identifier("m") }), FunctionDefinitionIndex(1), 4)] }), location: Module(ModuleId { address: sui, name: Identifier("dynamic_field") }), indices: [], offsets: [(FunctionDefinitionIndex(0), 15)] }) } }
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: MoveAbort(MoveLocation { module: ModuleId { address: sui, name: Identifier("dynamic_field") }, function: 0, instruction: 15, function_name: Some("add") }, 0), source: Some(VMError { major_status: ABORTED, sub_status: Some(0), message: Some("sui::dynamic_field::add at offset 15"), exec_state: Some(ExecutionState { stack_trace: [(Some(ModuleId { address: a, name: Identifier("m") }), FunctionDefinitionIndex(1), 4)] }), location: Module(ModuleId { address: sui, name: Identifier("dynamic_field") }), indices: [], offsets: [(FunctionDefinitionIndex(0), 15)] }), command: None } }
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ written: object(106)

task 3 'run'. lines 35-35:
Error: Transaction Effects Status: Move Runtime Abort. Location: sui::dynamic_field::add (function index 0) at offset 15, Abort Code: 0
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: MoveAbort(MoveLocation { module: ModuleId { address: sui, name: Identifier("dynamic_field") }, function: 0, instruction: 15, function_name: Some("add") }, 0), source: Some(VMError { major_status: ABORTED, sub_status: Some(0), message: Some("sui::dynamic_field::add at offset 15"), exec_state: Some(ExecutionState { stack_trace: [(Some(ModuleId { address: sui, name: Identifier("dynamic_object_field") }), FunctionDefinitionIndex(0), 9), (Some(ModuleId { address: a, name: Identifier("m") }), FunctionDefinitionIndex(1), 6)] }), location: Module(ModuleId { address: sui, name: Identifier("dynamic_field") }), indices: [], offsets: [(FunctionDefinitionIndex(0), 15)] }) } }
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: MoveAbort(MoveLocation { module: ModuleId { address: sui, name: Identifier("dynamic_field") }, function: 0, instruction: 15, function_name: Some("add") }, 0), source: Some(VMError { major_status: ABORTED, sub_status: Some(0), message: Some("sui::dynamic_field::add at offset 15"), exec_state: Some(ExecutionState { stack_trace: [(Some(ModuleId { address: sui, name: Identifier("dynamic_object_field") }), FunctionDefinitionIndex(0), 9), (Some(ModuleId { address: a, name: Identifier("m") }), FunctionDefinitionIndex(1), 6)] }), location: Module(ModuleId { address: sui, name: Identifier("dynamic_field") }), indices: [], offsets: [(FunctionDefinitionIndex(0), 15)] }), command: None } }
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ written: object(106)

task 3 'run'. lines 38-38:
Error: Transaction Effects Status: Move Runtime Abort. Location: sui::dynamic_field::borrow_child_object (function index 10) at offset 0, Abort Code: 2
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: MoveAbort(MoveLocation { module: ModuleId { address: sui, name: Identifier("dynamic_field") }, function: 10, instruction: 0, function_name: Some("borrow_child_object") }, 2), source: Some(VMError { major_status: ABORTED, sub_status: Some(2), message: None, exec_state: None, location: Module(ModuleId { address: sui, name: Identifier("dynamic_field") }), indices: [], offsets: [(FunctionDefinitionIndex(10), 0)] }) } }
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: MoveAbort(MoveLocation { module: ModuleId { address: sui, name: Identifier("dynamic_field") }, function: 10, instruction: 0, function_name: Some("borrow_child_object") }, 2), source: Some(VMError { major_status: ABORTED, sub_status: Some(2), message: None, exec_state: None, location: Module(ModuleId { address: sui, name: Identifier("dynamic_field") }), indices: [], offsets: [(FunctionDefinitionIndex(10), 0)] }), command: None } }

task 4 'run'. lines 40-40:
Error: Transaction Effects Status: Move Runtime Abort. Location: sui::dynamic_field::borrow_child_object_mut (function index 11) at offset 0, Abort Code: 2
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: MoveAbort(MoveLocation { module: ModuleId { address: sui, name: Identifier("dynamic_field") }, function: 11, instruction: 0, function_name: Some("borrow_child_object_mut") }, 2), source: Some(VMError { major_status: ABORTED, sub_status: Some(2), message: None, exec_state: None, location: Module(ModuleId { address: sui, name: Identifier("dynamic_field") }), indices: [], offsets: [(FunctionDefinitionIndex(11), 0)] }) } }
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: MoveAbort(MoveLocation { module: ModuleId { address: sui, name: Identifier("dynamic_field") }, function: 11, instruction: 0, function_name: Some("borrow_child_object_mut") }, 2), source: Some(VMError { major_status: ABORTED, sub_status: Some(2), message: None, exec_state: None, location: Module(ModuleId { address: sui, name: Identifier("dynamic_field") }), indices: [], offsets: [(FunctionDefinitionIndex(11), 0)] }), command: None } }
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ written: object(106)

task 3 'run'. lines 43-43:
Error: Transaction Effects Status: Move Runtime Abort. Location: sui::dynamic_field::borrow_child_object (function index 10) at offset 0, Abort Code: 2
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: MoveAbort(MoveLocation { module: ModuleId { address: sui, name: Identifier("dynamic_field") }, function: 10, instruction: 0, function_name: Some("borrow_child_object") }, 2), source: Some(VMError { major_status: ABORTED, sub_status: Some(2), message: None, exec_state: None, location: Module(ModuleId { address: sui, name: Identifier("dynamic_field") }), indices: [], offsets: [(FunctionDefinitionIndex(10), 0)] }) } }
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: MoveAbort(MoveLocation { module: ModuleId { address: sui, name: Identifier("dynamic_field") }, function: 10, instruction: 0, function_name: Some("borrow_child_object") }, 2), source: Some(VMError { major_status: ABORTED, sub_status: Some(2), message: None, exec_state: None, location: Module(ModuleId { address: sui, name: Identifier("dynamic_field") }), indices: [], offsets: [(FunctionDefinitionIndex(10), 0)] }), command: None } }

task 4 'run'. lines 45-45:
Error: Transaction Effects Status: Move Runtime Abort. Location: sui::dynamic_field::borrow_child_object_mut (function index 11) at offset 0, Abort Code: 2
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: MoveAbort(MoveLocation { module: ModuleId { address: sui, name: Identifier("dynamic_field") }, function: 11, instruction: 0, function_name: Some("borrow_child_object_mut") }, 2), source: Some(VMError { major_status: ABORTED, sub_status: Some(2), message: None, exec_state: None, location: Module(ModuleId { address: sui, name: Identifier("dynamic_field") }), indices: [], offsets: [(FunctionDefinitionIndex(11), 0)] }) } }
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: MoveAbort(MoveLocation { module: ModuleId { address: sui, name: Identifier("dynamic_field") }, function: 11, instruction: 0, function_name: Some("borrow_child_object_mut") }, 2), source: Some(VMError { major_status: ABORTED, sub_status: Some(2), message: None, exec_state: None, location: Module(ModuleId { address: sui, name: Identifier("dynamic_field") }), indices: [], offsets: [(FunctionDefinitionIndex(11), 0)] }), command: None } }
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ written: object(106)

task 3 'run'. lines 35-35:
Error: Transaction Effects Status: Move Runtime Abort. Location: sui::dynamic_field::remove_child_object (function index 12) at offset 0, Abort Code: 2
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: MoveAbort(MoveLocation { module: ModuleId { address: sui, name: Identifier("dynamic_field") }, function: 12, instruction: 0, function_name: Some("remove_child_object") }, 2), source: Some(VMError { major_status: ABORTED, sub_status: Some(2), message: None, exec_state: None, location: Module(ModuleId { address: sui, name: Identifier("dynamic_field") }), indices: [], offsets: [(FunctionDefinitionIndex(12), 0)] }) } }
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: MoveAbort(MoveLocation { module: ModuleId { address: sui, name: Identifier("dynamic_field") }, function: 12, instruction: 0, function_name: Some("remove_child_object") }, 2), source: Some(VMError { major_status: ABORTED, sub_status: Some(2), message: None, exec_state: None, location: Module(ModuleId { address: sui, name: Identifier("dynamic_field") }), indices: [], offsets: [(FunctionDefinitionIndex(12), 0)] }), command: None } }
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ written: object(106)

task 3 'run'. lines 40-40:
Error: Transaction Effects Status: Move Runtime Abort. Location: sui::dynamic_field::remove_child_object (function index 12) at offset 0, Abort Code: 2
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: MoveAbort(MoveLocation { module: ModuleId { address: sui, name: Identifier("dynamic_field") }, function: 12, instruction: 0, function_name: Some("remove_child_object") }, 2), source: Some(VMError { major_status: ABORTED, sub_status: Some(2), message: None, exec_state: None, location: Module(ModuleId { address: sui, name: Identifier("dynamic_field") }), indices: [], offsets: [(FunctionDefinitionIndex(12), 0)] }) } }
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: MoveAbort(MoveLocation { module: ModuleId { address: sui, name: Identifier("dynamic_field") }, function: 12, instruction: 0, function_name: Some("remove_child_object") }, 2), source: Some(VMError { major_status: ABORTED, sub_status: Some(2), message: None, exec_state: None, location: Module(ModuleId { address: sui, name: Identifier("dynamic_field") }), indices: [], offsets: [(FunctionDefinitionIndex(12), 0)] }), command: None } }
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ written: object(109), object(118)

task 10 'run'. lines 85-85:
Error: Transaction Effects Status: Move Runtime Abort. Location: sui::dynamic_field::borrow_child_object_mut (function index 11) at offset 0, Abort Code: 1
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: MoveAbort(MoveLocation { module: ModuleId { address: sui, name: Identifier("dynamic_field") }, function: 11, instruction: 0, function_name: Some("borrow_child_object_mut") }, 1), source: Some(VMError { major_status: ABORTED, sub_status: Some(1), message: None, exec_state: None, location: Module(ModuleId { address: sui, name: Identifier("dynamic_field") }), indices: [], offsets: [(FunctionDefinitionIndex(11), 0)] }) } }
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: MoveAbort(MoveLocation { module: ModuleId { address: sui, name: Identifier("dynamic_field") }, function: 11, instruction: 0, function_name: Some("borrow_child_object_mut") }, 1), source: Some(VMError { major_status: ABORTED, sub_status: Some(1), message: None, exec_state: None, location: Module(ModuleId { address: sui, name: Identifier("dynamic_field") }), indices: [], offsets: [(FunctionDefinitionIndex(11), 0)] }), command: None } }
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ written: object(108)

task 5 'run'. lines 49-49:
Error: Transaction Effects Status: Entry Argument Error. Error for argument at index 0: Type mismatch.
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: EntryArgumentError(EntryArgumentError { argument_idx: 0, kind: TypeMismatch }), source: Some("Unexpected non-ASCII value (outside of ASCII character range) in argument 0") } }
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: EntryArgumentError(EntryArgumentError { argument_idx: 0, kind: TypeMismatch }), source: Some("Unexpected non-ASCII value (outside of ASCII character range) in argument 0"), command: None } }
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ written: object(104)

task 2 'run'. lines 17-17:
Error: Transaction Effects Status: Move Bytecode Verification Error. Please run the Bytecode Verifier for more information.
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: VMVerificationOrDeserializationError, source: Some(VMError { major_status: LINKER_ERROR, sub_status: None, message: Some("Cannot find ModuleId { address: test, name: Identifier(\"x\") } in data cache"), exec_state: None, location: Undefined, indices: [], offsets: [] }) } }
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: VMVerificationOrDeserializationError, source: Some(VMError { major_status: LINKER_ERROR, sub_status: None, message: Some("Cannot find ModuleId { address: test, name: Identifier(\"x\") } in data cache"), exec_state: None, location: Undefined, indices: [], offsets: [] }), command: None } }

task 3 'run'. lines 19-19:
Error: Transaction Effects Status: Entry Type Argument Error. Error for type argument at index 0: A type was not found in the module specified
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: EntryTypeArgumentError(EntryTypeArgumentError { argument_idx: 0, kind: TypeNotFound }), source: None } }
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: EntryTypeArgumentError(EntryTypeArgumentError { argument_idx: 0, kind: TypeNotFound }), source: None, command: None } }

task 4 'run'. lines 21-21:
Error: Transaction Effects Status: Entry Type Argument Error. Error for type argument at index 0: Mismatch between the number of actual versus expected type arguments.
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: EntryTypeArgumentError(EntryTypeArgumentError { argument_idx: 0, kind: ArityMismatch }), source: None } }
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: EntryTypeArgumentError(EntryTypeArgumentError { argument_idx: 0, kind: ArityMismatch }), source: None, command: None } }

task 5 'run'. lines 23-23:
Error: Transaction Effects Status: Entry Type Argument Error. Error for type argument at index 0: Mismatch between the number of actual versus expected type arguments.
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: EntryTypeArgumentError(EntryTypeArgumentError { argument_idx: 0, kind: ArityMismatch }), source: None } }
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: EntryTypeArgumentError(EntryTypeArgumentError { argument_idx: 0, kind: ArityMismatch }), source: None, command: None } }

task 6 'run'. lines 25-25:
Error: Transaction Effects Status: Entry Type Argument Error. Error for type argument at index 0: A type provided did not match the specified constraints.
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: EntryTypeArgumentError(EntryTypeArgumentError { argument_idx: 0, kind: ConstraintNotSatisfied }), source: None } }
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: EntryTypeArgumentError(EntryTypeArgumentError { argument_idx: 0, kind: ConstraintNotSatisfied }), source: None, command: None } }
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ written: object(111), object(112)

task 7 'run'. lines 132-136:
Error: Transaction Effects Status: Invalid Object Owned Argument. Object fake(113) is owned by object fake(114). Objects owned by other objects cannot be used as input arguments.
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: InvalidChildObjectArgument(InvalidChildObjectArgument { child: fake(113), parent: fake(114) }), source: None } }
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: InvalidChildObjectArgument(InvalidChildObjectArgument { child: fake(113), parent: fake(114) }), source: None, command: None } }

task 8 'run'. lines 138-138:
created: object(117)
written: object(116)

task 9 'run'. lines 140-143:
Error: Transaction Effects Status: Entry Argument Error. Error for argument at index 0: Type mismatch.
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: EntryArgumentError(EntryArgumentError { argument_idx: 0, kind: TypeMismatch }), source: Some("Expected argument of type Test::M::Obj, but found type Test::M::AnotherObj") } }
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: EntryArgumentError(EntryArgumentError { argument_idx: 0, kind: TypeMismatch }), source: Some("Expected argument of type Test::M::Obj, but found type Test::M::AnotherObj"), command: None } }

task 10 'run'. lines 145-145:
created: object(120)
Expand All @@ -48,15 +48,15 @@ written: object(121)

task 12 'run'. lines 149-152:
Error: Transaction Effects Status: Entry Argument Error. Error for argument at index 0: Type mismatch.
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: EntryArgumentError(EntryArgumentError { argument_idx: 0, kind: TypeMismatch }), source: Some("Expected argument of type Test::M::Obj, but found type Test::M::AnotherObj") } }
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: EntryArgumentError(EntryArgumentError { argument_idx: 0, kind: TypeMismatch }), source: Some("Expected argument of type Test::M::Obj, but found type Test::M::AnotherObj"), command: None } }

task 13 'run'. lines 154-154:
created: object(125)
written: object(124)

task 14 'run'. lines 156-159:
Error: Transaction Effects Status: Entry Argument Error. Error for argument at index 0: Immutable and shared objects cannot be passed by-value.
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: EntryArgumentError(EntryArgumentError { argument_idx: 0, kind: InvalidObjectByValue }), source: Some("Immutable and shared objects cannot be passed by-value, violation found in argument 0") } }
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: EntryArgumentError(EntryArgumentError { argument_idx: 0, kind: InvalidObjectByValue }), source: Some("Immutable and shared objects cannot be passed by-value, violation found in argument 0"), command: None } }

task 15 'run'. lines 161-161:
created: object(128)
Expand Down
Loading

0 comments on commit 4cfb99c

Please sign in to comment.