From 3f5e5bf06233fa0d7b55b4959fbc35fb5c0279f5 Mon Sep 17 00:00:00 2001 From: WGB5445 <919603023@qq.com> Date: Mon, 19 Sep 2022 13:01:21 +0800 Subject: [PATCH] #131 Add only_new_module --- .../package_txn_manager/only_new_module.exp | 16 ++++++ .../package_txn_manager/only_new_module.move | 49 +++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 integration-tests/package_txn_manager/only_new_module.exp create mode 100644 integration-tests/package_txn_manager/only_new_module.move diff --git a/integration-tests/package_txn_manager/only_new_module.exp b/integration-tests/package_txn_manager/only_new_module.exp new file mode 100644 index 00000000..8a991150 --- /dev/null +++ b/integration-tests/package_txn_manager/only_new_module.exp @@ -0,0 +1,16 @@ +processed 11 tasks + +task 3 'run'. lines 7-18: +{ + "gas_used": 97932, + "status": "Executed" +} + +task 6 'run'. lines 26-34: +{ + "gas_used": 11344, + "status": "Executed" +} + +task 8 'deploy'. lines 42-42: +Publish failure: Discard { status_code: StrView(21), status_code_name: "INVALID_MODULE_PUBLISHER" } diff --git a/integration-tests/package_txn_manager/only_new_module.move b/integration-tests/package_txn_manager/only_new_module.move new file mode 100644 index 00000000..bbd13e6c --- /dev/null +++ b/integration-tests/package_txn_manager/only_new_module.move @@ -0,0 +1,49 @@ +//# init -n dev + +//# faucet --addr alice --amount 100000000000000000 + +//# faucet --addr bob + +//# run --signers alice +script { + use StarcoinFramework::Config; + use StarcoinFramework::Version; + use StarcoinFramework::PackageTxnManager; + use StarcoinFramework::Option; + fun main(account: signer) { + Config::publish_new_config(&account, Version::new_version(1)); + PackageTxnManager::update_module_upgrade_strategy(&account, PackageTxnManager::get_strategy_new_module(), Option::some(2)); + } +} +// check: EXECUTED + +//# package +module alice::hello { + public fun hello() {} +} +//# deploy {{$.package[0].file}} --signers alice + +//# run --signers alice +script { + use alice::hello; + + fun main(_account: signer) { + hello::hello(); + } +} +// check: EXECUTED + +//# package +module alice::hello { + public fun hello() {} + public fun hello_bob() {} +} + +//# deploy {{$.package[1].file}} --signers alice + +//# package +module alice::say { + public fun hello() {} +} + +//# deploy {{$.package[2].file}} --signers alice \ No newline at end of file