Skip to content

Commit

Permalink
add illegal token check
Browse files Browse the repository at this point in the history
  • Loading branch information
welbon committed Mar 16, 2024
1 parent fafbe93 commit eaea2a5
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 20 deletions.
42 changes: 32 additions & 10 deletions integration-tests/on_chain_config/test_frozen_config_strategy.exp
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
processed 13 tasks
processed 15 tasks

task 4 'run'. lines 31-39:
task 4 'run'. lines 11-19:
{
"gas_used": 3102420,
"status": "Executed"
}

task 5 'run'. lines 42-51:
task 5 'run'. lines 22-31:
{
"gas_used": 190191,
"status": "Executed"
}

task 6 'run'. lines 54-60:
task 6 'run'. lines 34-38:
{
"gas_used": 0,
"status": {
Expand All @@ -23,25 +23,25 @@ task 6 'run'. lines 54-60:
}
}

task 7 'run'. lines 62-71:
task 7 'run'. lines 40-49:
{
"gas_used": 190193,
"status": "Executed"
}

task 8 'run'. lines 73-79:
task 8 'run'. lines 51-55:
{
"gas_used": 8439,
"status": "Executed"
}

task 9 'run'. lines 81-89:
task 9 'run'. lines 57-65:
{
"gas_used": 500823,
"status": "Executed"
}

task 10 'run'. lines 91-97:
task 10 'run'. lines 67-71:
{
"gas_used": 0,
"status": {
Expand All @@ -52,14 +52,36 @@ task 10 'run'. lines 91-97:
}
}

task 11 'run'. lines 99-107:
task 11 'run'. lines 73-81:
{
"gas_used": 497130,
"status": "Executed"
}

task 12 'run'. lines 109-164:
task 12 'run'. lines 83-87:
{
"gas_used": 8439,
"status": "Executed"
}

task 13 'run'. lines 89-100:
{
"gas_used": 74486,
"status": "Executed"
}

task 14 'run'. lines 102-112:
{
"gas_used": 20908,
"status": {
"MoveAbort": {
"location": {
"Module": {
"address": "0x00000000000000000000000000000001",
"name": "CoreAddresses"
}
},
"abort_code": "2818"
}
}
}
37 changes: 27 additions & 10 deletions integration-tests/on_chain_config/test_frozen_config_strategy.move
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ script {

//# run --signers alice
script {

fun execution_failed_set_global_frozen(_account: signer) {
}
fun execution_failed_set_global_frozen(_account: signer) {}
}
// check: UNEXPECTED_ERROR_FROM_KNOWN_MOVE_FUNCTION

Expand All @@ -52,9 +50,7 @@ script {

//# run --signers alice
script {

fun execution_succeed_after_open_frozen(_account: signer) {
}
fun execution_succeed_after_open_frozen(_account: signer) {}
}
// check: EXECUTED

Expand All @@ -70,9 +66,7 @@ script {

//# run --signers alice
script {

fun execution_failed_for_alice_add_to_frozen(_account: signer) {
}
fun execution_failed_for_alice_add_to_frozen(_account: signer) {}
}
// check: UNEXPECTED_ERROR_FROM_KNOWN_MOVE_FUNCTION

Expand All @@ -88,8 +82,31 @@ script {

//# run --signers alice
script {
fun execution_succeed_for_alice_remove_from_frozen(_account: signer) {}
}
// check: EXECUTED

fun execution_succeed_for_alice_remove_from_frozen(_account: signer) {
//# run --signers Genesis
script {
use StarcoinFramework::STC::{Self, STC};
use StarcoinFramework::Account;

fun burn_illegal_tokens(sender: signer) {
let illegal_token = Account::withdraw_illige_token<STC>(&sender, @alice);
STC::burn(illegal_token);
assert!(Account::balance<STC>(@alice) == 0, 10030);
}
}
// check: EXECUTED

//# run --signers bob
script {
use StarcoinFramework::STC::{Self, STC};
use StarcoinFramework::Account;

fun bob_call_withdraw_illegal_token_failed(sender: signer) {
let illegal_token = Account::withdraw_illige_token<STC>(&sender, @alice);
STC::burn(illegal_token);
}
}
// check: "abort_code": "2818"

0 comments on commit eaea2a5

Please sign in to comment.