Skip to content

Commit

Permalink
Only verified by metadata when the field of the struct is in another …
Browse files Browse the repository at this point in the history
…module.

add the data_struct_func tests

add more tests for data_struct_func

add more tests

add tests for special allowed types

add more mvir tests

add the missed exp file
  • Loading branch information
steelgeek091 committed May 29, 2024
1 parent 0947402 commit 0113d16
Show file tree
Hide file tree
Showing 53 changed files with 793 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
processed 1 task

task 0 'publish'. lines 1-12:
status ABORTED with code 10014 in 0000000000000000000000000000000000000000000000000000000000000002::move_module
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//# publish
module 0x1.TestModule1 {
struct S0<T> has copy, drop {x: T}
// error code 10014: INVALID_DATA_STRUCT_NOT_ALLOWED_TYPE
struct S1 has drop,copy {v: Self.S0<u32>}

metadata {
data_struct {
0x1::TestModule1::S1 -> true;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
processed 1 task

task 0 'publish'. lines 1-13:
status ABORTED with code 10014 in 0000000000000000000000000000000000000000000000000000000000000002::move_module
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//# publish
module 0x1.TestModule1 {
import 0x1.option;
struct S0<T> has copy, drop {x: T}
// error code 10014: INVALID_DATA_STRUCT_NOT_ALLOWED_TYPE
struct S1 has copy,drop {v: option.Option<Self.S0<u32>>}

metadata {
data_struct {
0x1::TestModule1::S1 -> true;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
processed 2 tasks

task 0 'publish'. lines 1-4:
status EXECUTED

task 1 'publish'. lines 6-18:
status ABORTED with code 10015 in 0000000000000000000000000000000000000000000000000000000000000002::move_module
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//# publish
module 0x1.TestModule0 {
struct S0 has drop,copy { x: address }
}

//# publish
module 0x1.TestModule1 {
import 0x1.TestModule0;

// error code 10015: INVALID_DATA_STRUCT_NOT_IN_MODULE_METADATA
struct S0 has drop,copy {v: TestModule0.S0}

metadata {
data_struct {
0x1::TestModule1::S0 -> true;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
processed 1 task

task 0 'publish'. lines 1-11:
status EXECUTED
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//# publish
module 0x1.TestModule1 {
import 0x1.ascii;
struct S0 has copy,drop {v: ascii.String}

metadata {
data_struct {
0x1::TestModule1::S0 -> true;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
processed 1 task

task 0 'publish'. lines 1-11:
status EXECUTED
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//# publish
module 0x1.TestModule1 {
import 0x1.option;
struct S0 has copy,drop {v: option.Option<u32>}

metadata {
data_struct {
0x1::TestModule1::S0 -> true;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
processed 2 tasks

task 0 'publish'. lines 1-10:
status EXECUTED

task 1 'publish'. lines 12-24:
status EXECUTED
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//# publish
module 0x123.TestModule0 {
struct S0 has copy, drop {x: u32}

metadata {
data_struct {
0x123::TestModule0::S0 -> true;
}
}
}

//# publish
module 0x1.TestModule1 {
import 0x123.TestModule0;
import 0x1.option;

struct S1 has copy,drop {v: option.Option<TestModule0.S0>}

metadata {
data_struct {
0x1::TestModule1::S1 -> true;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
processed 1 task

task 0 'publish'. lines 1-11:
status EXECUTED
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//# publish
module 0x1.TestModule1 {
import 0x1.string;
struct S0 has copy,drop {v: string.String}

metadata {
data_struct {
0x1::TestModule1::S0 -> true;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
processed 1 task

task 0 'publish'. lines 1-11:
status EXECUTED
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//# publish
module 0x1.TestModule1 {
import 0x2.object;
struct S0 has copy,drop {v: object.ObjectID}

metadata {
data_struct {
0x1::TestModule1::S0 -> true;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
processed 1 task

task 0 'publish'. lines 1-10:
status EXECUTED
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//# publish
module 0x1.TestModule1 {
struct S0 has copy,drop {v: u64}

metadata {
data_struct {
0x1::TestModule1::S0 -> true;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
processed 2 tasks

task 0 'publish'. lines 1-10:
status EXECUTED

task 1 'publish'. lines 12-23:
status EXECUTED
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//# publish
module 0x1.TestModule0 {
struct S0 has copy,drop {v: u64}

metadata {
data_struct {
0x1::TestModule0::S0 -> true;
}
}
}

//# publish
module 0x1.TestModule1 {
import 0x1.TestModule0;

struct S0 has copy,drop {v: TestModule0.S0}

metadata {
data_struct {
0x1::TestModule1::S0 -> true;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
processed 1 task

task 0 'publish'. lines 1-14:
status ABORTED with code 10001 in 0000000000000000000000000000000000000000000000000000000000000002::move_module
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//# publish
module 0x1.TestModule1 {
metadata {
data_struct_func {
// error code 10001: FUNCTION_NOT_EXITS
0x1::TestModule1::f111 -> true;
}
}

public f1() {
label b0:
return;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
processed 1 task

task 0 'publish'. lines 1-22:
status ABORTED with code 10008 in 0000000000000000000000000000000000000000000000000000000000000002::move_module
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//# publish
module 0x1.TestModule1 {
import 0x2.bcs;
import 0x1.vector;

struct S0 has copy,drop { x: u64 }

metadata {
data_struct {
// 0x1::TestModule1::S0 -> true;
}
}

public f2() {
let s1: vector<u8>;
label b0:
s1 = vector.empty<u8>();
// error code 10008: INVALID_DATA_STRUCT
_ = bcs.from_bytes<Self.S0>(move(s1));
return;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
processed 1 task

task 0 'publish'. lines 1-9:
status ABORTED with code 10010 in 0000000000000000000000000000000000000000000000000000000000000002::move_module
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//# publish
module 0x1.TestModule1 {
metadata {
data_struct_func {
// error code 10010: INVALID_MODULE_OWNER
0x123::SomeModule::f1 -> [0, 1];
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
processed 1 task

task 0 'publish'. lines 1-39:
status ABORTED with code 10009 in 0000000000000000000000000000000000000000000000000000000000000002::move_module
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//# publish
module 0x1.TestModule1 {
import 0x1.option;
import 0x1.vector;
struct S0 has copy,drop { x: u64 }

metadata {
data_struct {
0x1::TestModule1::S0 -> true;
}
data_struct_func {
0x1::TestModule1::f1 -> [0, 1];
}
}

public new(): Self.S0 {
label b0:
return S0{ x: 123 };
}

public f1<T1: drop, T2: drop>(arg1: T1, arg2: T2) {
label b0:
_ = move(arg1);
_ = move(arg2);
return;
}

public f2() {
let s0: Self.S0;
let s1: option.Option<u32>;

label b0:
s0 = Self.new();
s1 = option.some<u32>(123u32);
// error code 10009: INVALID_DATA_STRUCT_TYPE
Self.f1<Self.S0, option.Option<u32>>(move(s0), move(s1));
return;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
processed 1 task

task 0 'publish'. lines 1-34:
status ABORTED with code 10009 in 0000000000000000000000000000000000000000000000000000000000000002::move_module
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//# publish
module 0x1.TestModule1 {
struct S0 has copy,drop { x: u64 }

metadata {
data_struct {
0x1::TestModule1::S0 -> true;
}
data_struct_func {
0x1::TestModule1::f1 -> [0, 1];
}
}

public new(): Self.S0 {
label b0:
return S0{ x: 123 };
}

public f1<T1: drop, T2: drop>(arg1: T1, arg2: T2) {
label b0:
_ = move(arg1);
_ = move(arg2);
return;
}

public f2<T: drop+copy>(arg: T) {
let s0: Self.S0;
label b0:
s0 = Self.new();
// error code 10009: INVALID_DATA_STRUCT_TYPE
Self.f1<Self.S0, T>(move(s0), copy(arg));
return;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
processed 2 tasks

task 0 'publish'. lines 1-15:
status EXECUTED

task 1 'publish'. lines 17-41:
status ABORTED with code 10009 in 0000000000000000000000000000000000000000000000000000000000000002::move_module
Loading

0 comments on commit 0113d16

Please sign in to comment.