Skip to content

Commit

Permalink
[verifier] Migrate id_leak tests (MystenLabs#2016)
Browse files Browse the repository at this point in the history
- Migrated to expected output tests
  • Loading branch information
tnowacki authored May 17, 2022
1 parent 9e8d407 commit 284c4e5
Show file tree
Hide file tree
Showing 13 changed files with 152 additions and 202 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
processed 1 task

task 0 'publish'. lines 4-25:
Error: Failed to verify the Move module, reason: "ID leak detected in function foo: ID leaked through function call.".
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright (c) 2022, Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

//# publish
module 0x0.M {
import 0x2.ID;

struct Foo has key {
id: ID.VersionedID,
}

transfer(id: ID.VersionedID) {
label l0:
abort 0;
}

foo(f: Self.Foo, v: &mut vector<ID.VersionedID>) {
let id: ID.VersionedID;
label l0:
Foo { id } = move(f);
Self.transfer(move(id));
return;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
processed 1 task

task 0 'publish'. lines 4-25:
Error: Failed to verify the Move module, reason: "ID leak detected in function foo: ID leaked through function call.".
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright (c) 2022, Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

//# publish
module 0x0.M {
import 0x2.ID;

struct Foo has key {
id: ID.VersionedID,
}

transfer(id: Self.Foo) {
label l0:
abort 0;
}

foo(f: Self.Foo, v: &mut vector<ID.VersionedID>) {
let id: ID.VersionedID;
label l0:
Foo { id } = move(f);
Self.transfer(Foo { id: move(id) });
return;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
processed 1 task

task 0 'publish'. lines 4-19:
Error: Failed to verify the Move module, reason: "ID leak detected in function foo: ID leaked through function return.".
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright (c) 2022, Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

//# publish
module 0x0.M {
import 0x2.ID;

struct Foo has key {
id: ID.VersionedID,
}

foo(f: Self.Foo): ID.VersionedID {
let id: ID.VersionedID;
label l0:
Foo { id } = move(f);
return move(id);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
processed 1 task

task 0 'publish'. lines 4-19:
Error: Failed to verify the Move module, reason: "ID leak detected in function foo: ID leaked through function return.".
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright (c) 2022, Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

//# publish
module 0x0.M {
import 0x2.ID;

struct Foo has key {
id: ID.VersionedID,
}

foo(f: Self.Foo): Self.Foo {
let id: ID.VersionedID;
label l0:
Foo { id } = move(f);
return Foo { id: move(id) };
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
processed 1 task

task 0 'publish'. lines 4-20:
Error: Failed to publish the Move module(s), reason: "VMError with status WRITEREF_WITHOUT_DROP_ABILITY at location Module ModuleId { address: _, name: Identifier(\"M\") } at index 0 for function definition at code offset 5 in function definition 0".
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright (c) 2022, Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

//# publish
module 0x0.M {
import 0x2.ID;

struct Foo has key {
id: ID.VersionedID,
}

foo(f: Self.Foo, ref: &mut ID.VersionedID) {
let id: ID.VersionedID;
label l0:
Foo { id } = move(f);
*move(ref) = move(id);
return;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
processed 1 task

task 0 'publish'. lines 4-20:
Error: Failed to verify the Move module, reason: "ID leak detected in function foo: ID is leaked into a vector".
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright (c) 2022, Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

//# publish
module 0x0.M {
import 0x2.ID;

struct Foo has key {
id: ID.VersionedID,
}

foo(f: Self.Foo, v: &mut vector<ID.VersionedID>) {
let id: ID.VersionedID;
label l0:
Foo { id } = move(f);
vec_push_back<ID.VersionedID>(move(v), move(id));
return;
}

}
202 changes: 0 additions & 202 deletions crates/sui-verifier/tests/id_leak_verification_test.rs

This file was deleted.

0 comments on commit 284c4e5

Please sign in to comment.