diff --git a/build/StarcoinFramework/BuildInfo.yaml b/build/StarcoinFramework/BuildInfo.yaml index 9c03b74b..6a6b333c 100644 --- a/build/StarcoinFramework/BuildInfo.yaml +++ b/build/StarcoinFramework/BuildInfo.yaml @@ -318,7 +318,7 @@ compiled_package_info: ? address: "0x00000000000000000000000000000001" name: YieldFarmingV2 : StarcoinFramework - source_digest: 2AD2AE7E71652A66A26833D40AE407B8999CCA28FA16FF7FBBC34E73A73FA704 + source_digest: A155383ABA4B2CECDADAD666C4E012F372A73E64B9B0EA9CA977261219D8ED8E build_flags: dev_mode: false test_mode: false diff --git a/build/StarcoinFramework/bytecode_modules/PackageTxnManager.mv b/build/StarcoinFramework/bytecode_modules/PackageTxnManager.mv index 5889f769..de91a6bd 100644 Binary files a/build/StarcoinFramework/bytecode_modules/PackageTxnManager.mv and b/build/StarcoinFramework/bytecode_modules/PackageTxnManager.mv differ diff --git a/build/StarcoinFramework/docs/PackageTxnManager.md b/build/StarcoinFramework/docs/PackageTxnManager.md index a1a7bc84..2e9bafae 100644 --- a/build/StarcoinFramework/docs/PackageTxnManager.md +++ b/build/StarcoinFramework/docs/PackageTxnManager.md @@ -40,6 +40,7 @@ The module provides strategies for module upgrading. - [Function `package_txn_prologue`](#0x1_PackageTxnManager_package_txn_prologue) - [Function `package_txn_prologue_v2`](#0x1_PackageTxnManager_package_txn_prologue_v2) - [Function `package_txn_epilogue`](#0x1_PackageTxnManager_package_txn_epilogue) +- [Function `exists_upgrade_plan_cap`](#0x1_PackageTxnManager_exists_upgrade_plan_cap) - [Module Specification](#@Module_Specification_1) @@ -1540,6 +1541,42 @@ Package txn finished, and clean UpgradePlan + + + + +## Function `exists_upgrade_plan_cap` + + + +
public fun exists_upgrade_plan_cap(addr: address): bool
+
+ + + +
+Implementation + + +
public fun exists_upgrade_plan_cap(addr :address):bool{
+    exists<UpgradePlanCapability>(addr)
+}
+
+ + + +
+ +
+Specification + + + +
aborts_if false;
+
+ + +
diff --git a/build/StarcoinFramework/source_maps/PackageTxnManager.mvsm b/build/StarcoinFramework/source_maps/PackageTxnManager.mvsm index 7eadbe64..17c79436 100644 Binary files a/build/StarcoinFramework/source_maps/PackageTxnManager.mvsm and b/build/StarcoinFramework/source_maps/PackageTxnManager.mvsm differ diff --git a/integration-tests/daospace/dao_upgrade.exp b/integration-tests/daospace/dao_upgrade.exp index 3737f75b..035927ef 100644 --- a/integration-tests/daospace/dao_upgrade.exp +++ b/integration-tests/daospace/dao_upgrade.exp @@ -20,7 +20,7 @@ task 9 'run'. lines 130-144: task 10 'run'. lines 145-154: { - "gas_used": 1047820, + "gas_used": 1051127, "status": "Executed" } diff --git a/integration-tests/daospace/dao_upgrade_incompatible.exp b/integration-tests/daospace/dao_upgrade_incompatible.exp index 402d27b7..912b8c38 100644 --- a/integration-tests/daospace/dao_upgrade_incompatible.exp +++ b/integration-tests/daospace/dao_upgrade_incompatible.exp @@ -14,7 +14,7 @@ task 8 'run'. lines 121-136: task 9 'run'. lines 138-147: { - "gas_used": 1047820, + "gas_used": 1051127, "status": "Executed" } diff --git a/sources/PackageTxnManager.move b/sources/PackageTxnManager.move index 0ea6a5b3..e0036d40 100644 --- a/sources/PackageTxnManager.move +++ b/sources/PackageTxnManager.move @@ -510,5 +510,13 @@ address StarcoinFramework { && success && Option::is_some(global(package_address).plan) && !exists>(global(package_address).version_cap.account_address); } + + public fun exists_upgrade_plan_cap(addr :address):bool{ + exists(addr) + } + + spec exists_upgrade_plan_cap { + aborts_if false; + } } } \ No newline at end of file diff --git a/sources/daospace/DAOAccount.move b/sources/daospace/DAOAccount.move index e985a07e..b297dfa0 100644 --- a/sources/daospace/DAOAccount.move +++ b/sources/daospace/DAOAccount.move @@ -16,7 +16,8 @@ module StarcoinFramework::DAOAccount{ const ERR_ACCOUNT_CAP_NOT_EXISTS:u64 = 100; const ERR_ACCOUNT_CAP_EXISTS: u64 = 101; - const ERR_ACCOUNT_IS_NOT_SAME:u64 = 102; + const ERR_ACCOUNT_IS_NOT_SAME: u64 = 102; + const ERR_UPGARDE_PLAN_CAP_NOT_EXISTS: u64 = 103; /// DAOAccount struct DAOAccount has key{ @@ -70,7 +71,7 @@ module StarcoinFramework::DAOAccount{ let dao_address = Signer::address_of(&dao_signer); let upgrade_plan_cap = if(Config::config_exist_by_address(dao_address)){ - //TODO if the account has extract the upgrade plan cap + assert!(PackageTxnManager::exists_upgrade_plan_cap(dao_address), Errors::not_published(ERR_UPGARDE_PLAN_CAP_NOT_EXISTS)); PackageTxnManager::extract_submit_upgrade_plan_cap(&dao_signer) }else{ Config::publish_new_config(&dao_signer, Version::new_version(1));