forked from aptos-labs/aptos-core
-
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.
[diem-framework] migrate block transactional tests
Closes: aptos-labs#10044
- Loading branch information
1 parent
0f6d7d2
commit 23d08cd
Showing
27 changed files
with
168 additions
and
214 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#[test_only] | ||
module DiemFramework::DiemBlockTests { | ||
use DiemFramework::Genesis; | ||
use DiemFramework::DiemBlock; | ||
|
||
// TODO: the error code doesn't seem correct, juding by the name of the test. | ||
#[test(tc = @TreasuryCompliance, dr = @DiemRoot, account = @0x100)] | ||
#[expected_failure(abort_code = 1)] | ||
fun invalid_initialization_address(account: signer, tc: signer, dr: signer) { | ||
Genesis::setup(&dr, &tc); | ||
DiemBlock::initialize_block_metadata(&account); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
diem-move/diem-framework/core/transactional-tests/block/block_prologue.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,8 @@ | ||
processed 5 tasks | ||
|
||
task 1 'block'. lines 3-3: | ||
Events: | ||
ContractEvent { key: EventKey(11000000000000000000000000000000000000000a550c18), index: 0, type: Struct(StructTag { address: 00000000000000000000000000000001, module: Identifier("DiemBlock"), name: Identifier("NewBlockEvent"), type_params: [] }), event_data: "0000000000000000c5e34b925cf6875fec02d4b77adbd2d60040420f0000000000" } | ||
|
||
task 4 'run'. lines 29-37: | ||
Error: Transaction discarded. VMStatus: status ABORTED of type Execution with sub status 514 |
37 changes: 37 additions & 0 deletions
37
diem-move/diem-framework/core/transactional-tests/block/block_prologue.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,37 @@ | ||
//# init --validators Vivian | ||
|
||
//# block --proposer Vivian --time 1000000 | ||
|
||
//# run --admin-script | ||
//# --signers DiemRoot | ||
script{ | ||
use DiemFramework::DiemTimestamp; | ||
use DiemFramework::DiemBlock; | ||
|
||
fun main() { | ||
assert!(DiemBlock::get_current_block_height() == 1, 73); | ||
assert!(DiemTimestamp::now_microseconds() == 1000000, 76); | ||
} | ||
} | ||
|
||
//# run --admin-script | ||
//# --signers DiemRoot | ||
script{ | ||
use DiemFramework::DiemTimestamp; | ||
|
||
fun main() { | ||
assert!(DiemTimestamp::now_microseconds() != 2000000, 77); | ||
} | ||
} | ||
|
||
// TODO: this transaction looks weird. We should figure out what the intention is and decide | ||
// what to do with it. | ||
//# run --admin-script | ||
//# --signers Vivian | ||
script{ | ||
use DiemFramework::DiemTimestamp; | ||
|
||
fun main(dr: signer, vv: signer) { | ||
DiemTimestamp::update_global_time(&vv, @Vivian, 20); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
diem-move/diem-framework/core/transactional-tests/block/expired_transaction.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,18 @@ | ||
processed 10 tasks | ||
|
||
task 1 'block'. lines 3-3: | ||
Events: | ||
ContractEvent { key: EventKey(11000000000000000000000000000000000000000a550c18), index: 0, type: Struct(StructTag { address: 00000000000000000000000000000001, module: Identifier("DiemBlock"), name: Identifier("NewBlockEvent"), type_params: [] }), event_data: "0000000000000000c5e34b925cf6875fec02d4b77adbd2d60000e1f50500000000" } | ||
|
||
task 2 'publish'. lines 5-6: | ||
Error: Transaction discarded. VMStatus: status TRANSACTION_EXPIRED of type Validation | ||
|
||
task 3 'publish'. lines 8-9: | ||
Error: Transaction discarded. VMStatus: status TRANSACTION_EXPIRED of type Validation | ||
|
||
task 6 'block'. lines 17-17: | ||
Events: | ||
ContractEvent { key: EventKey(11000000000000000000000000000000000000000a550c18), index: 1, type: Struct(StructTag { address: 00000000000000000000000000000001, module: Identifier("DiemBlock"), name: Identifier("NewBlockEvent"), type_params: [] }), event_data: "0000000000000000c5e34b925cf6875fec02d4b77adbd2d6004023050600000000" } | ||
|
||
task 8 'publish'. lines 22-23: | ||
Error: Transaction discarded. VMStatus: status TRANSACTION_EXPIRED of type Validation |
26 changes: 26 additions & 0 deletions
26
diem-move/diem-framework/core/transactional-tests/block/expired_transaction.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,26 @@ | ||
//# init --parent-vasps Alice --validators Vivian | ||
|
||
//# block --proposer Vivian --time 100000000 | ||
|
||
//# publish --expiration 99 | ||
module Alice::M1 {} | ||
|
||
//# publish --expiration 100 | ||
module Alice::M2 {} | ||
|
||
//# publish --expiration 101 | ||
module Alice::M3 {} | ||
|
||
//# publish --expiration 86500 | ||
module Alice::M4 {} | ||
|
||
//# block --proposer Vivian --time 101000000 | ||
|
||
//# publish --expiration 86500 | ||
module Alice::M5 {} | ||
|
||
//# publish --expiration 101 | ||
module Alice::M6 {} | ||
|
||
//# publish --expiration 18446744073710 | ||
module Alice::M7 {} |
9 changes: 9 additions & 0 deletions
9
diem-move/diem-framework/core/transactional-tests/block/get_block_height.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 6 tasks | ||
|
||
task 2 'block'. lines 12-12: | ||
Events: | ||
ContractEvent { key: EventKey(11000000000000000000000000000000000000000a550c18), index: 0, type: Struct(StructTag { address: 00000000000000000000000000000001, module: Identifier("DiemBlock"), name: Identifier("NewBlockEvent"), type_params: [] }), event_data: "0000000000000000c5e34b925cf6875fec02d4b77adbd2d60000e1f50500000000" } | ||
|
||
task 4 'block'. lines 25-25: | ||
Events: | ||
ContractEvent { key: EventKey(11000000000000000000000000000000000000000a550c18), index: 1, type: Struct(StructTag { address: 00000000000000000000000000000001, module: Identifier("DiemBlock"), name: Identifier("NewBlockEvent"), type_params: [] }), event_data: "0000000000000000c5e34b925cf6875fec02d4b77adbd2d6004023050600000000" } |
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
8 changes: 8 additions & 0 deletions
8
diem-move/diem-framework/core/transactional-tests/block/none_validator_propser.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,8 @@ | ||
processed 4 tasks | ||
|
||
task 1 'block'. lines 3-3: | ||
Events: | ||
ContractEvent { key: EventKey(11000000000000000000000000000000000000000a550c18), index: 0, type: Struct(StructTag { address: 00000000000000000000000000000001, module: Identifier("DiemBlock"), name: Identifier("NewBlockEvent"), type_params: [] }), event_data: "0000000000000000c5e34b925cf6875fec02d4b77adbd2d60040420f0000000000" } | ||
|
||
task 3 'block'. lines 16-16: | ||
Error: status UNEXPECTED_ERROR_FROM_KNOWN_MOVE_FUNCTION of type Invariant violation |
16 changes: 16 additions & 0 deletions
16
diem-move/diem-framework/core/transactional-tests/block/none_validator_propser.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,16 @@ | ||
//# init --parent-vasps Alice --validators Vivian | ||
|
||
//# block --proposer Vivian --time 1000000 | ||
|
||
//# run --signers DiemRoot --admin-script | ||
script{ | ||
use DiemFramework::DiemBlock; | ||
use DiemFramework::DiemTimestamp; | ||
|
||
fun main() { | ||
assert!(DiemBlock::get_current_block_height() == 1, 77); | ||
assert!(DiemTimestamp::now_microseconds() == 1000000, 78); | ||
} | ||
} | ||
|
||
//# block --proposer Alice --time 1000000 |
8 changes: 8 additions & 0 deletions
8
diem-move/diem-framework/core/transactional-tests/block/older_timestamp.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,8 @@ | ||
processed 4 tasks | ||
|
||
task 1 'block'. lines 3-3: | ||
Events: | ||
ContractEvent { key: EventKey(11000000000000000000000000000000000000000a550c18), index: 0, type: Struct(StructTag { address: 00000000000000000000000000000001, module: Identifier("DiemBlock"), name: Identifier("NewBlockEvent"), type_params: [] }), event_data: "0000000000000000c5e34b925cf6875fec02d4b77adbd2d60000e1f50500000000" } | ||
|
||
task 3 'block'. lines 16-16: | ||
Error: status UNEXPECTED_ERROR_FROM_KNOWN_MOVE_FUNCTION of type Invariant violation |
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
4 changes: 4 additions & 0 deletions
4
diem-move/diem-framework/core/transactional-tests/block/vm_proposer.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,4 @@ | ||
processed 1 task | ||
|
||
task 0 'block'. lines 1-1: | ||
Error: status UNEXPECTED_ERROR_FROM_KNOWN_MOVE_FUNCTION of type Invariant violation |
1 change: 1 addition & 0 deletions
1
diem-move/diem-framework/core/transactional-tests/block/vm_proposer.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 @@ | ||
//# block --proposer 0x0 --time 1000000 |
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,6 @@ | ||
// Copyright (c) The Diem Core Contributors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use diem_transactional_test_harness::run_test; | ||
|
||
datatest_stable::harness!(run_test, "core/transactional-tests", r".*\.(mvir|move)$"); |
11 changes: 0 additions & 11 deletions
11
language/move-compiler/functional-tests/tests/diem/block/block_prologue.exp
This file was deleted.
Oops, something went wrong.
40 changes: 0 additions & 40 deletions
40
language/move-compiler/functional-tests/tests/diem/block/block_prologue.move
This file was deleted.
Oops, something went wrong.
25 changes: 0 additions & 25 deletions
25
language/move-compiler/functional-tests/tests/diem/block/expired_transaction.exp
This file was deleted.
Oops, something went wrong.
58 changes: 0 additions & 58 deletions
58
language/move-compiler/functional-tests/tests/diem/block/expired_transaction.move
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
language/move-compiler/functional-tests/tests/diem/block/get_block_height.exp
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
language/move-compiler/functional-tests/tests/diem/block/invalid_initialization_address.exp
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
language/move-compiler/functional-tests/tests/diem/block/invalid_initialization_address.move
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.