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.
[bug fix][verifier] Fix bug in ID leak verifier (MystenLabs#6754)
* [bug fix][verifier] Fix bug in ID leak verifier - The ID leak verifier was more permissive than desired, leading to potential re-uses of object IDs
- Loading branch information
Showing
6 changed files
with
81 additions
and
13 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
9 changes: 9 additions & 0 deletions
9
crates/sui-verifier-transactional-tests/tests/id_leak/through_pack.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,9 @@ | ||
processed 2 tasks | ||
|
||
task 0 'publish'. lines 4-36: | ||
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: UNKNOWN_VERIFICATION_ERROR, sub_status: None, message: Some("Sui Move Bytecode Verification Error: ID is leaked into a struct."), exec_state: None, location: Module(ModuleId { address: _, name: Identifier("test") }), indices: [], offsets: [] }) } } | ||
|
||
task 1 'publish'. lines 38-60: | ||
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: UNKNOWN_VERIFICATION_ERROR, sub_status: None, message: Some("Sui Move Bytecode Verification Error: ID is leaked into a struct."), exec_state: None, location: Module(ModuleId { address: _, name: Identifier("m") }), indices: [], offsets: [] }) } } |
60 changes: 60 additions & 0 deletions
60
crates/sui-verifier-transactional-tests/tests/id_leak/through_pack.mvir
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,60 @@ | ||
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
//# publish | ||
module 0x0.test { | ||
import 0x2.object; | ||
import 0x2.transfer; | ||
import 0x2.tx_context; | ||
|
||
struct A has key { | ||
id: object.UID | ||
} | ||
|
||
struct C has key { | ||
id: object.UID | ||
} | ||
|
||
struct B { | ||
id: object.UID | ||
} | ||
|
||
public entry test(x: Self.A) { | ||
let id: object.UID; | ||
let b: Self.B; | ||
let c: Self.C; | ||
|
||
label l0: | ||
A { id } = move(x); | ||
b = B { id: move(id) }; | ||
B { id } = move(b); | ||
c = C { id: move(id) }; | ||
|
||
transfer.transfer<Self.C>(move(c), 0x1); | ||
return; | ||
} | ||
} | ||
|
||
//# publish | ||
module 0x0.m { | ||
import 0x2.object; | ||
|
||
struct Foo has key { | ||
id: object.UID, | ||
} | ||
|
||
struct Bar { | ||
v: u64, | ||
id: object.UID, | ||
} | ||
|
||
foo(f: Self.Foo) { | ||
let id: object.UID; | ||
let b: Self.Bar; | ||
label l0: | ||
Foo { id } = move(f); | ||
b = Bar { v: 0, id: move(id) }; | ||
abort 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