From eaea2a502983126b09a2d6b0017cb369efbcd5cd Mon Sep 17 00:00:00 2001 From: welbon Date: Sat, 16 Mar 2024 16:51:12 +0800 Subject: [PATCH] add illegal token check --- .../test_frozen_config_strategy.exp | 42 ++++++++++++++----- .../test_frozen_config_strategy.move | 37 +++++++++++----- 2 files changed, 59 insertions(+), 20 deletions(-) diff --git a/integration-tests/on_chain_config/test_frozen_config_strategy.exp b/integration-tests/on_chain_config/test_frozen_config_strategy.exp index 4732efaf..c206c935 100644 --- a/integration-tests/on_chain_config/test_frozen_config_strategy.exp +++ b/integration-tests/on_chain_config/test_frozen_config_strategy.exp @@ -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": { @@ -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": { @@ -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" + } + } +} diff --git a/integration-tests/on_chain_config/test_frozen_config_strategy.move b/integration-tests/on_chain_config/test_frozen_config_strategy.move index 3a5a2be8..f0446ba8 100644 --- a/integration-tests/on_chain_config/test_frozen_config_strategy.move +++ b/integration-tests/on_chain_config/test_frozen_config_strategy.move @@ -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 @@ -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 @@ -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 @@ -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(&sender, @alice); + STC::burn(illegal_token); + assert!(Account::balance(@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(&sender, @alice); + STC::burn(illegal_token); + } +} +// check: "abort_code": "2818" \ No newline at end of file