Skip to content

Commit

Permalink
Revert "[Feature]DAOAccount Todo : add exists_upgrade_plan_cap (#160)"
Browse files Browse the repository at this point in the history
This reverts commit 1fb3b8a.
  • Loading branch information
nkysg committed Mar 2, 2023
1 parent 5d28295 commit 73ea9ea
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 51 deletions.
2 changes: 1 addition & 1 deletion build/StarcoinFramework/BuildInfo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ compiled_package_info:
? address: "0x00000000000000000000000000000001"
name: YieldFarmingV2
: StarcoinFramework
source_digest: A155383ABA4B2CECDADAD666C4E012F372A73E64B9B0EA9CA977261219D8ED8E
source_digest: 2AD2AE7E71652A66A26833D40AE407B8999CCA28FA16FF7FBBC34E73A73FA704
build_flags:
dev_mode: false
test_mode: false
Expand Down
Binary file modified build/StarcoinFramework/bytecode_modules/PackageTxnManager.mv
Binary file not shown.
37 changes: 0 additions & 37 deletions build/StarcoinFramework/docs/PackageTxnManager.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ 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)


Expand Down Expand Up @@ -1541,42 +1540,6 @@ Package txn finished, and clean UpgradePlan



</details>

<a name="0x1_PackageTxnManager_exists_upgrade_plan_cap"></a>

## Function `exists_upgrade_plan_cap`



<pre><code><b>public</b> <b>fun</b> <a href="PackageTxnManager.md#0x1_PackageTxnManager_exists_upgrade_plan_cap">exists_upgrade_plan_cap</a>(addr: <b>address</b>): bool
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>public</b> <b>fun</b> <a href="PackageTxnManager.md#0x1_PackageTxnManager_exists_upgrade_plan_cap">exists_upgrade_plan_cap</a>(addr :<b>address</b>):bool{
<b>exists</b>&lt;<a href="PackageTxnManager.md#0x1_PackageTxnManager_UpgradePlanCapability">UpgradePlanCapability</a>&gt;(addr)
}
</code></pre>



</details>

<details>
<summary>Specification</summary>



<pre><code><b>aborts_if</b> <b>false</b>;
</code></pre>



</details>

<a name="@Module_Specification_1"></a>
Expand Down
Binary file modified build/StarcoinFramework/source_maps/PackageTxnManager.mvsm
Binary file not shown.
2 changes: 1 addition & 1 deletion integration-tests/daospace/dao_upgrade.exp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ task 9 'run'. lines 130-144:

task 10 'run'. lines 145-154:
{
"gas_used": 1051127,
"gas_used": 1047820,
"status": "Executed"
}

Expand Down
2 changes: 1 addition & 1 deletion integration-tests/daospace/dao_upgrade_incompatible.exp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ task 8 'run'. lines 121-136:

task 9 'run'. lines 138-147:
{
"gas_used": 1051127,
"gas_used": 1047820,
"status": "Executed"
}

Expand Down
8 changes: 0 additions & 8 deletions sources/PackageTxnManager.move
Original file line number Diff line number Diff line change
Expand Up @@ -510,13 +510,5 @@ address StarcoinFramework {
&& success && Option::is_some(global<TwoPhaseUpgrade>(package_address).plan)
&& !exists<Config::Config<Version::Version>>(global<TwoPhaseUpgrade>(package_address).version_cap.account_address);
}

public fun exists_upgrade_plan_cap(addr :address):bool{
exists<UpgradePlanCapability>(addr)
}

spec exists_upgrade_plan_cap {
aborts_if false;
}
}
}
5 changes: 2 additions & 3 deletions sources/daospace/DAOAccount.move
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ 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_UPGARDE_PLAN_CAP_NOT_EXISTS: u64 = 103;
const ERR_ACCOUNT_IS_NOT_SAME:u64 = 102;

/// DAOAccount
struct DAOAccount has key{
Expand Down Expand Up @@ -71,7 +70,7 @@ module StarcoinFramework::DAOAccount{
let dao_address = Signer::address_of(&dao_signer);

let upgrade_plan_cap = if(Config::config_exist_by_address<Version::Version>(dao_address)){
assert!(PackageTxnManager::exists_upgrade_plan_cap(dao_address), Errors::not_published(ERR_UPGARDE_PLAN_CAP_NOT_EXISTS));
//TODO if the account has extract the upgrade plan cap
PackageTxnManager::extract_submit_upgrade_plan_cap(&dao_signer)
}else{
Config::publish_new_config<Version::Version>(&dao_signer, Version::new_version(1));
Expand Down

0 comments on commit 73ea9ea

Please sign in to comment.