Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dao integration test and upgrade mpm #95

Merged
merged 14 commits into from
Aug 29, 2022
Merged
3 changes: 2 additions & 1 deletion build/StarcoinFramework/BuildInfo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
compiled_package_info:
package_name: StarcoinFramework
address_alias_instantiation:
SFT: "0x6bfb460477adf9dd0455d3de2fc7f211"
StarcoinAssociation: "0x0000000000000000000000000a550c18"
StarcoinFramework: "0x00000000000000000000000000000001"
VMReserved: "0x00000000000000000000000000000000"
Expand Down Expand Up @@ -300,7 +301,7 @@ compiled_package_info:
? address: "0x00000000000000000000000000000001"
name: YieldFarmingV2
: StarcoinFramework
source_digest: FD04C9A39DFAD60C3FA7B7566327BD66B28ABC554C15691EFA399D36AA8EAE4B
source_digest: B0B62580A35E2CB07BE96F89832DC7400CA1938CCE83D38B548DFA8199239BCF
build_flags:
dev_mode: false
test_mode: false
Expand Down
Binary file modified build/StarcoinFramework/source_maps/Block.mvsm
Binary file not shown.
Binary file modified build/StarcoinFramework/source_maps/CheckpointScript.mvsm
Binary file not shown.
35 changes: 35 additions & 0 deletions integration-tests/block/checkpoints_test.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
processed 13 tasks

task 4 'run'. lines 9-27:
{
"gas_used": 114532,
"status": "Executed"
}

task 7 'run'. lines 33-46:
{
"gas_used": 532278,
"status": {
"MoveAbort": {
"location": {
"Module": {
"address": "0x00000000000000000000000000000001",
"name": "Block"
}
},
"abort_code": "4609"
}
}
}

task 10 'run'. lines 53-64:
{
"gas_used": 577624,
"status": "Executed"
}

task 12 'run'. lines 68-81:
{
"gas_used": 103932,
"status": "Executed"
}
81 changes: 81 additions & 0 deletions integration-tests/block/checkpoints_test.move
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
//# init -n dev --debug

//# faucet --addr alice

//# block --author=0x2 --timestamp 86420000

//# call-api chain.info

//# run --signers alice --args {{$.call-api[0].head.parent_hash}} --args {{$.call-api[0].head.state_root}}
script {
use StarcoinFramework::Block;
use StarcoinFramework::Debug;

fun checkpoint(_account: signer, parent_hash: vector<u8>, state_root: vector<u8>) {
let expect_parent_hash = Block::get_parent_hash();
Debug::print(&expect_parent_hash);
Debug::print(&parent_hash);
Debug::print(&state_root);
assert!( expect_parent_hash == parent_hash, 1001);

let current_block_number = Block::get_current_block_number();
Debug::print(&current_block_number);

Block::checkpoint();
}
}
// check: EXECUTED

//# block --author=0x2 --timestamp 86430000

//# call-api chain.get_block_by_hash ["{{$.call-api[0].head.block_hash}}",{"raw":true}]

//# run --signers alice --args {{$.call-api[1].raw.header}}

script {
use StarcoinFramework::Block;
use StarcoinFramework::Debug;

fun update(_account: signer, raw_header: vector<u8>) {
let current_block_number = Block::get_current_block_number();
Debug::print(&current_block_number);
Debug::print(&raw_header);
Block::update_state_root(raw_header);
}
}
// check: ABORT. reason: Block from call-api[0] is not in checkpoint, its parent is in.


//# block --author=0x3

//# call-api chain.get_block_by_hash ["{{$.call-api[0].head.parent_hash}}",{"raw":true}]

//# run --signers alice --args {{$.call-api[2].raw.header}}

script {
use StarcoinFramework::Block;
use StarcoinFramework::Debug;

fun update(_account: signer, raw_header: vector<u8>) {
Debug::print(&raw_header);
Block::update_state_root(raw_header);
}
}
// check: EXECUTED

//# call-api chain.get_block_by_hash ["{{$.call-api[0].head.parent_hash}}"]

//# run --signers alice --args {{$.call-api[3].header.state_root}}
script {
use StarcoinFramework::Block;
use StarcoinFramework::Debug;

fun latest(_account: signer, expect_state_root: vector<u8>) {
let (number, state_root) = Block::latest_state_root();
Debug::print(&number);
Debug::print(&state_root);
Debug::print(&expect_state_root);
assert!(state_root == expect_state_root, 1002)
}
}
// check: EXECUTED
105 changes: 0 additions & 105 deletions integration-tests/daospace/dao_proposal.exp

This file was deleted.

126 changes: 126 additions & 0 deletions integration-tests/daospace/daospace_proposal.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
processed 42 tasks

task 7 'run'. lines 149-158:
{
"gas_used": 1155077,
"status": "Executed"
}

task 8 'run'. lines 162-176:
{
"gas_used": 109239,
"status": "Executed"
}

task 9 'run'. lines 178-203:
{
"gas_used": 306386,
"status": "Executed"
}

task 11 'run'. lines 208-224:
{
"gas_used": 221171,
"status": "Executed"
}

task 12 'run'. lines 226-242:
{
"gas_used": 221171,
"status": "Executed"
}

task 16 'run'. lines 250-264:
{
"gas_used": 104944,
"status": "Executed"
}

task 19 'run'. lines 271-284:
{
"gas_used": 532278,
"status": {
"MoveAbort": {
"location": {
"Module": {
"address": "0x00000000000000000000000000000001",
"name": "Block"
}
},
"abort_code": "4609"
}
}
}

task 22 'run'. lines 291-302:
{
"gas_used": 577624,
"status": "Executed"
}

task 23 'run'. lines 305-324:
{
"gas_used": 458326,
"status": "Executed"
}

task 25 'run'. lines 328-337:
{
"gas_used": 11943,
"status": "Executed"
}

task 26 'call'. lines 339-339:
"0xb5d577dc9ce59725e29886632e69ecdf/1/0x00000000000000000000000000000001::IdentifierNFT::IdentifierNFT<0x00000000000000000000000000000001::DAOSpace::DAOMember<0x662ba5a1a1da0f1c70a9762c7eeb7aaf::DAOHelper::X>,0x00000000000000000000000000000001::DAOSpace::DAOMemberBody<0x662ba5a1a1da0f1c70a9762c7eeb7aaf::DAOHelper::X>>"

task 28 'run'. lines 343-362:
{
"gas_used": 6591445,
"status": "Executed"
}

task 29 'call'. lines 365-365:
"0xa7dcef9aef26202fce82a7c7d6672afb/1/0x00000000000000000000000000000001::IdentifierNFT::IdentifierNFT<0x00000000000000000000000000000001::DAOSpace::DAOMember<0x662ba5a1a1da0f1c70a9762c7eeb7aaf::DAOHelper::X>,0x00000000000000000000000000000001::DAOSpace::DAOMemberBody<0x662ba5a1a1da0f1c70a9762c7eeb7aaf::DAOHelper::X>>"

task 31 'run'. lines 369-382:
{
"gas_used": 6264148,
"status": "Executed"
}

task 32 'call'. lines 385-385:
"0x3d4926eeda5b14b0ac979269ee79e40e/1/0x00000000000000000000000000000001::IdentifierNFT::IdentifierNFT<0x00000000000000000000000000000001::DAOSpace::DAOMember<0x662ba5a1a1da0f1c70a9762c7eeb7aaf::DAOHelper::X>,0x00000000000000000000000000000001::DAOSpace::DAOMemberBody<0x662ba5a1a1da0f1c70a9762c7eeb7aaf::DAOHelper::X>>"

task 34 'run'. lines 389-402:
{
"gas_used": 35135,
"status": {
"MoveAbort": {
"location": {
"Module": {
"address": "0x00000000000000000000000000000001",
"name": "DAOSpace"
}
},
"abort_code": "51201"
}
}
}

task 36 'run'. lines 407-431:
{
"gas_used": 134382,
"status": "Executed"
}

task 39 'run'. lines 437-447:
{
"gas_used": 115663,
"status": "Executed"
}

task 41 'run'. lines 452-464:
{
"gas_used": 450922,
"status": "Executed"
}
Loading