-
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.
- Add support for Receiving arguments to the sui-verifier entrypoint checker.
- Loading branch information
Showing
140 changed files
with
5,929 additions
and
303 deletions.
There are no files selected for viewing
112 changes: 112 additions & 0 deletions
112
crates/sui-adapter-transactional-tests/tests/mvcc/receive_object_dof.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,112 @@ | ||
processed 24 tasks | ||
|
||
init: | ||
A: object(0,0) | ||
|
||
task 1 'publish'. lines 6-61: | ||
created: object(1,0) | ||
mutated: object(0,1) | ||
gas summary: computation_cost: 1000000, storage_cost: 10548800, storage_rebate: 0, non_refundable_storage_fee: 0 | ||
|
||
task 2 'run'. lines 63-63: | ||
created: object(2,0), object(2,1), object(2,2), object(2,3) | ||
mutated: object(0,0) | ||
gas summary: computation_cost: 1000000, storage_cost: 7273200, storage_rebate: 0, non_refundable_storage_fee: 0 | ||
|
||
task 3 'view-object'. lines 65-65: | ||
Owner: Object ID: ( fake(2,2) ) | ||
Version: 2 | ||
Contents: sui::dynamic_field::Field<sui::dynamic_object_field::Wrapper<u64>, sui::object::ID> {id: sui::object::UID {id: sui::object::ID {bytes: fake(2,0)}}, name: sui::dynamic_object_field::Wrapper<u64> {name: 0u64}, value: sui::object::ID {bytes: fake(2,1)}} | ||
|
||
task 4 'view-object'. lines 67-67: | ||
Owner: Object ID: ( fake(2,0) ) | ||
Version: 2 | ||
Contents: tto::M1::A {id: sui::object::UID {id: sui::object::ID {bytes: fake(2,1)}}, value: 0u64} | ||
|
||
task 5 'view-object'. lines 69-69: | ||
Owner: Account Address ( fake(2,3) ) | ||
Version: 2 | ||
Contents: tto::M1::A {id: sui::object::UID {id: sui::object::ID {bytes: fake(2,2)}}, value: 0u64} | ||
|
||
task 6 'view-object'. lines 71-71: | ||
Owner: Account Address ( A ) | ||
Version: 2 | ||
Contents: tto::M1::A {id: sui::object::UID {id: sui::object::ID {bytes: fake(2,3)}}, value: 0u64} | ||
|
||
task 7 'run'. lines 73-73: | ||
created: object(7,0) | ||
mutated: object(0,0), object(2,2), object(2,3) | ||
gas summary: computation_cost: 1000000, storage_cost: 5996400, storage_rebate: 3506184, non_refundable_storage_fee: 35416 | ||
|
||
task 8 'view-object'. lines 75-77: | ||
Owner: Object ID: ( fake(2,2) ) | ||
Version: 2 | ||
Contents: sui::dynamic_field::Field<sui::dynamic_object_field::Wrapper<u64>, sui::object::ID> {id: sui::object::UID {id: sui::object::ID {bytes: fake(2,0)}}, name: sui::dynamic_object_field::Wrapper<u64> {name: 0u64}, value: sui::object::ID {bytes: fake(2,1)}} | ||
|
||
task 9 'view-object'. lines 78-78: | ||
Owner: Object ID: ( fake(2,0) ) | ||
Version: 2 | ||
Contents: tto::M1::A {id: sui::object::UID {id: sui::object::ID {bytes: fake(2,1)}}, value: 0u64} | ||
|
||
task 10 'view-object'. lines 80-80: | ||
Owner: Object ID: ( fake(7,0) ) | ||
Version: 3 | ||
Contents: tto::M1::A {id: sui::object::UID {id: sui::object::ID {bytes: fake(2,2)}}, value: 0u64} | ||
|
||
task 11 'view-object'. lines 82-82: | ||
Owner: Account Address ( A ) | ||
Version: 3 | ||
Contents: tto::M1::A {id: sui::object::UID {id: sui::object::ID {bytes: fake(2,3)}}, value: 0u64} | ||
|
||
task 12 'programmable'. lines 84-85: | ||
mutated: object(0,0), object(2,1), object(2,2), object(2,3) | ||
gas summary: computation_cost: 1000000, storage_cost: 4818400, storage_rebate: 4770216, non_refundable_storage_fee: 48184 | ||
|
||
task 13 'view-object'. lines 87-89: | ||
Owner: Object ID: ( fake(2,2) ) | ||
Version: 2 | ||
Contents: sui::dynamic_field::Field<sui::dynamic_object_field::Wrapper<u64>, sui::object::ID> {id: sui::object::UID {id: sui::object::ID {bytes: fake(2,0)}}, name: sui::dynamic_object_field::Wrapper<u64> {name: 0u64}, value: sui::object::ID {bytes: fake(2,1)}} | ||
|
||
task 14 'view-object'. lines 90-90: | ||
Owner: Object ID: ( fake(2,0) ) | ||
Version: 4 | ||
Contents: tto::M1::A {id: sui::object::UID {id: sui::object::ID {bytes: fake(2,1)}}, value: 3u64} | ||
|
||
task 15 'view-object'. lines 92-92: | ||
Owner: Object ID: ( fake(7,0) ) | ||
Version: 4 | ||
Contents: tto::M1::A {id: sui::object::UID {id: sui::object::ID {bytes: fake(2,2)}}, value: 2u64} | ||
|
||
task 16 'view-object'. lines 94-94: | ||
Owner: Account Address ( A ) | ||
Version: 4 | ||
Contents: tto::M1::A {id: sui::object::UID {id: sui::object::ID {bytes: fake(2,3)}}, value: 1u64} | ||
|
||
task 17 'programmable'. lines 96-99: | ||
mutated: object(0,0), object(2,3) | ||
deleted: object(2,0), object(2,1) | ||
gas summary: computation_cost: 1000000, storage_cost: 2264800, storage_rebate: 5936436, non_refundable_storage_fee: 59964 | ||
|
||
task 18 'programmable'. lines 101-102: | ||
mutated: object(_), object(2,3) | ||
gas summary: computation_cost: 500000, storage_cost: 2264800, storage_rebate: 1264032, non_refundable_storage_fee: 12768 | ||
|
||
task 19 'programmable'. lines 104-105: | ||
mutated: object(_), object(2,3) | ||
gas summary: computation_cost: 500000, storage_cost: 2264800, storage_rebate: 1264032, non_refundable_storage_fee: 12768 | ||
|
||
task 20 'programmable'. lines 107-110: | ||
mutated: object(_), object(2,3) | ||
gas summary: computation_cost: 500000, storage_cost: 2264800, storage_rebate: 1264032, non_refundable_storage_fee: 12768 | ||
|
||
task 21 'programmable'. lines 112-113: | ||
Error: Transaction Effects Status: MoveAbort(MoveLocation { module: ModuleId { address: tto, name: Identifier("M1") }, function: 4, instruction: 10, function_name: Some("check") }, 0) in command 0 | ||
Execution Error: MoveAbort(MoveLocation { module: ModuleId { address: tto, name: Identifier("M1") }, function: 4, instruction: 10, function_name: Some("check") }, 0) in command 0 | ||
|
||
task 22 'programmable'. lines 115-116: | ||
Error: Transaction Effects Status: MoveAbort(MoveLocation { module: ModuleId { address: sui, name: Identifier("dynamic_field") }, function: 11, instruction: 0, function_name: Some("borrow_child_object") }, 1) in command 0 | ||
Execution Error: MoveAbort(MoveLocation { module: ModuleId { address: sui, name: Identifier("dynamic_field") }, function: 11, instruction: 0, function_name: Some("borrow_child_object") }, 1) in command 0 | ||
|
||
task 23 'programmable'. lines 118-119: | ||
Error: Transaction Effects Status: MoveAbort(MoveLocation { module: ModuleId { address: tto, name: Identifier("M1") }, function: 4, instruction: 10, function_name: Some("check") }, 0) in command 0 | ||
Execution Error: MoveAbort(MoveLocation { module: ModuleId { address: tto, name: Identifier("M1") }, function: 4, instruction: 10, function_name: Some("check") }, 0) in command 0 |
119 changes: 119 additions & 0 deletions
119
crates/sui-adapter-transactional-tests/tests/mvcc/receive_object_dof.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,119 @@ | ||
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
//# init --addresses tto=0x0 --accounts A | ||
|
||
//# publish | ||
module tto::M1 { | ||
use std::option::{Self, Option}; | ||
use sui::object::{Self, UID}; | ||
use sui::tx_context::{Self, TxContext}; | ||
use sui::transfer::{Self, Receiving}; | ||
use sui::dynamic_object_field as dof; | ||
|
||
const KEY: u64 = 0; | ||
|
||
struct A has key, store { | ||
id: UID, | ||
value: u64, | ||
} | ||
|
||
|
||
public fun start(ctx: &mut TxContext) { | ||
let a = A { id: object::new(ctx), value: 0 }; | ||
let a_address = object::id_address(&a); | ||
let b = A { id: object::new(ctx), value: 0 }; | ||
dof::add(&mut b.id, KEY, A { id: object::new(ctx), value: 0 }); | ||
transfer::public_transfer(a, tx_context::sender(ctx)); | ||
transfer::public_transfer(b, a_address); | ||
} | ||
|
||
public entry fun receive(parent: &mut A, x: Receiving<A>) { | ||
let b = transfer::receive(&mut parent.id, x); | ||
dof::add(&mut parent.id, KEY, b); | ||
} | ||
|
||
public fun set(grand: &mut A, v1: u64, v2: u64, v3: u64) { | ||
grand.value = v1; | ||
let parent: &mut A = dof::borrow_mut(&mut grand.id, KEY); | ||
parent.value = v2; | ||
let child: &mut A = dof::borrow_mut(&mut parent.id, KEY); | ||
child.value = v3; | ||
} | ||
|
||
public fun remove(grand: &mut A) { | ||
let parent: &mut A = dof::borrow_mut(&mut grand.id, KEY); | ||
let A { id, value: _ } = dof::remove(&mut parent.id, KEY); | ||
object::delete(id); | ||
} | ||
|
||
public fun check(grand: &A, v1: u64, v2: u64, v3: Option<u64>) { | ||
assert!(grand.value == v1, 0); | ||
let parent: &A = dof::borrow(&grand.id, KEY); | ||
assert!(parent.value == v2, 0); | ||
if (option::is_some(&v3)) { | ||
let child: &A = dof::borrow(&parent.id, KEY); | ||
assert!(&child.value == option::borrow(&v3), 0); | ||
} else { | ||
assert!(!dof::exists_<u64>(&parent.id, KEY), 0); | ||
} | ||
} | ||
} | ||
|
||
//# run tto::M1::start --sender A | ||
|
||
//# view-object 2,0 | ||
|
||
//# view-object 2,1 | ||
|
||
//# view-object 2,2 | ||
|
||
//# view-object 2,3 | ||
|
||
//# run tto::M1::receive --args object(2,3) receiving(2,2) --sender A | ||
|
||
//# view-object 2,0 | ||
|
||
// The grand parent | ||
//# view-object 2,1 | ||
|
||
//# view-object 2,2 | ||
|
||
//# view-object 2,3 | ||
|
||
//# programmable --sender A --inputs object(2,3) 1 2 3 | ||
//> tto::M1::set(Input(0), Input(1), Input(2), Input(3)) | ||
|
||
//# view-object 2,0 | ||
|
||
// The grand parent | ||
//# view-object 2,1 | ||
|
||
//# view-object 2,2 | ||
|
||
//# view-object 2,3 | ||
|
||
//# programmable --sender A --inputs object(2,3) | ||
//> tto::M1::remove(Input(0)) | ||
|
||
// dev-inspect with 'check' and correct values | ||
|
||
//# programmable --sender A --inputs object(2,3)@3 0 0 vector[0] --dev-inspect | ||
//> tto::M1::check(Input(0), Input(1), Input(2), Input(3)) | ||
|
||
//# programmable --sender A --inputs object(2,3)@4 1 2 vector[3] --dev-inspect | ||
//> tto::M1::check(Input(0), Input(1), Input(2), Input(3)) | ||
|
||
//# programmable --sender A --inputs object(2,3)@5 1 2 vector[] --dev-inspect | ||
//> tto::M1::check(Input(0), Input(1), Input(2), Input(3)) | ||
|
||
// dev-inspect with 'check' and _incorrect_ values | ||
|
||
//# programmable --sender A --inputs object(2,3)@4 0 0 vector[0] --dev-inspect | ||
//> tto::M1::check(Input(0), Input(1), Input(2), Input(3)) | ||
|
||
//# programmable --sender A --inputs object(2,3)@5 1 2 vector[3] --dev-inspect | ||
//> tto::M1::check(Input(0), Input(1), Input(2), Input(3)) | ||
|
||
//# programmable --sender A --inputs object(2,3)@3 1 2 vector[] --dev-inspect | ||
//> tto::M1::check(Input(0), Input(1), Input(2), Input(3)) |
83 changes: 83 additions & 0 deletions
83
crates/sui-adapter-transactional-tests/tests/mvcc/receive_object_split_changes_dof.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,83 @@ | ||
processed 17 tasks | ||
|
||
init: | ||
A: object(0,0) | ||
|
||
task 1 'publish'. lines 6-54: | ||
created: object(1,0) | ||
mutated: object(0,1) | ||
gas summary: computation_cost: 1000000, storage_cost: 9606400, storage_rebate: 0, non_refundable_storage_fee: 0 | ||
|
||
task 2 'run'. lines 56-56: | ||
created: object(2,0), object(2,1), object(2,2), object(2,3), object(2,4), object(2,5) | ||
mutated: object(0,0) | ||
gas summary: computation_cost: 1000000, storage_cost: 11004800, storage_rebate: 0, non_refundable_storage_fee: 0 | ||
|
||
task 3 'view-object'. lines 58-58: | ||
Owner: Object ID: ( fake(2,5) ) | ||
Version: 2 | ||
Contents: sui::dynamic_field::Field<sui::dynamic_object_field::Wrapper<u64>, sui::object::ID> {id: sui::object::UID {id: sui::object::ID {bytes: fake(2,0)}}, name: sui::dynamic_object_field::Wrapper<u64> {name: 0u64}, value: sui::object::ID {bytes: fake(2,2)}} | ||
|
||
task 4 'view-object'. lines 60-60: | ||
Owner: Object ID: ( fake(2,3) ) | ||
Version: 2 | ||
Contents: sui::dynamic_field::Field<sui::dynamic_object_field::Wrapper<u64>, sui::object::ID> {id: sui::object::UID {id: sui::object::ID {bytes: fake(2,1)}}, name: sui::dynamic_object_field::Wrapper<u64> {name: 0u64}, value: sui::object::ID {bytes: fake(2,4)}} | ||
|
||
task 5 'view-object'. lines 62-62: | ||
Owner: Object ID: ( fake(2,0) ) | ||
Version: 2 | ||
Contents: tto::M1::A {id: sui::object::UID {id: sui::object::ID {bytes: fake(2,2)}}, value: 0u64} | ||
|
||
task 6 'view-object'. lines 64-64: | ||
Owner: Account Address ( A ) | ||
Version: 2 | ||
Contents: tto::M1::A {id: sui::object::UID {id: sui::object::ID {bytes: fake(2,3)}}, value: 0u64} | ||
|
||
task 7 'view-object'. lines 66-66: | ||
Owner: Object ID: ( fake(2,1) ) | ||
Version: 2 | ||
Contents: tto::M1::A {id: sui::object::UID {id: sui::object::ID {bytes: fake(2,4)}}, value: 0u64} | ||
|
||
task 8 'view-object'. lines 68-68: | ||
Owner: Account Address ( A ) | ||
Version: 2 | ||
Contents: tto::M1::A {id: sui::object::UID {id: sui::object::ID {bytes: fake(2,5)}}, value: 0u64} | ||
|
||
task 9 'run'. lines 70-70: | ||
mutated: object(0,0), object(2,3), object(2,4), object(2,5) | ||
gas summary: computation_cost: 1000000, storage_cost: 4818400, storage_rebate: 4770216, non_refundable_storage_fee: 48184 | ||
|
||
task 10 'view-object'. lines 72-72: | ||
Owner: Object ID: ( fake(2,5) ) | ||
Version: 2 | ||
Contents: sui::dynamic_field::Field<sui::dynamic_object_field::Wrapper<u64>, sui::object::ID> {id: sui::object::UID {id: sui::object::ID {bytes: fake(2,0)}}, name: sui::dynamic_object_field::Wrapper<u64> {name: 0u64}, value: sui::object::ID {bytes: fake(2,2)}} | ||
|
||
task 11 'view-object'. lines 74-74: | ||
Owner: Object ID: ( fake(2,3) ) | ||
Version: 2 | ||
Contents: sui::dynamic_field::Field<sui::dynamic_object_field::Wrapper<u64>, sui::object::ID> {id: sui::object::UID {id: sui::object::ID {bytes: fake(2,1)}}, name: sui::dynamic_object_field::Wrapper<u64> {name: 0u64}, value: sui::object::ID {bytes: fake(2,4)}} | ||
|
||
task 12 'view-object'. lines 76-76: | ||
Owner: Object ID: ( fake(2,0) ) | ||
Version: 2 | ||
Contents: tto::M1::A {id: sui::object::UID {id: sui::object::ID {bytes: fake(2,2)}}, value: 0u64} | ||
|
||
task 13 'view-object'. lines 78-78: | ||
Owner: Account Address ( fake(2,5) ) | ||
Version: 3 | ||
Contents: tto::M1::A {id: sui::object::UID {id: sui::object::ID {bytes: fake(2,3)}}, value: 40u64} | ||
|
||
task 14 'view-object'. lines 80-80: | ||
Owner: Object ID: ( fake(2,1) ) | ||
Version: 3 | ||
Contents: tto::M1::A {id: sui::object::UID {id: sui::object::ID {bytes: fake(2,4)}}, value: 40u64} | ||
|
||
task 15 'view-object'. lines 82-82: | ||
Owner: Account Address ( A ) | ||
Version: 3 | ||
Contents: tto::M1::A {id: sui::object::UID {id: sui::object::ID {bytes: fake(2,5)}}, value: 0u64} | ||
|
||
task 16 'run'. lines 84-84: | ||
created: object(16,0) | ||
mutated: object(0,0), object(2,3), object(2,5) | ||
gas summary: computation_cost: 1000000, storage_cost: 5996400, storage_rebate: 3506184, non_refundable_storage_fee: 35416 |
Oops, something went wrong.