Skip to content

Commit

Permalink
Revert "update_module_upgrade_strategy support set min_time_limit (#127
Browse files Browse the repository at this point in the history
…)"

This reverts commit c8c9ba7.
  • Loading branch information
nkysg committed Mar 3, 2023
1 parent 98e6799 commit 8e51979
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 77 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: 5E08A2774FAADBD05F5E98290A4B05E6D4D5AA4DB5123B79F6015AC8574B75F8
source_digest: E084083B9449F396039B8495E0E69BE4F2537E6F6E63F8187394FFDA78F1A9B2
build_flags:
dev_mode: false
test_mode: false
Expand Down
Binary file modified build/StarcoinFramework/bytecode_modules/ModuleUpgradeScripts.mv
Binary file not shown.
58 changes: 2 additions & 56 deletions build/StarcoinFramework/docs/ModuleUpgradeScripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,16 @@



- [Constants](#@Constants_0)
- [Function `propose_module_upgrade_v2`](#0x1_ModuleUpgradeScripts_propose_module_upgrade_v2)
- [Function `update_module_upgrade_strategy`](#0x1_ModuleUpgradeScripts_update_module_upgrade_strategy)
- [Function `update_module_upgrade_strategy_with_min_time`](#0x1_ModuleUpgradeScripts_update_module_upgrade_strategy_with_min_time)
- [Function `submit_module_upgrade_plan`](#0x1_ModuleUpgradeScripts_submit_module_upgrade_plan)
- [Function `execute_module_upgrade_plan_propose`](#0x1_ModuleUpgradeScripts_execute_module_upgrade_plan_propose)
- [Function `submit_upgrade_plan`](#0x1_ModuleUpgradeScripts_submit_upgrade_plan)
- [Function `cancel_upgrade_plan`](#0x1_ModuleUpgradeScripts_cancel_upgrade_plan)
- [Module Specification](#@Module_Specification_1)
- [Module Specification](#@Module_Specification_0)


<pre><code><b>use</b> <a href="Config.md#0x1_Config">0x1::Config</a>;
<b>use</b> <a href="Errors.md#0x1_Errors">0x1::Errors</a>;
<b>use</b> <a href="Option.md#0x1_Option">0x1::Option</a>;
<b>use</b> <a href="PackageTxnManager.md#0x1_PackageTxnManager">0x1::PackageTxnManager</a>;
<b>use</b> <a href="Signer.md#0x1_Signer">0x1::Signer</a>;
Expand All @@ -27,20 +24,6 @@



<a name="@Constants_0"></a>

## Constants


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



<pre><code><b>const</b> <a href="ModuleUpgradeScripts.md#0x1_ModuleUpgradeScripts_ERR_WRONG_UPGRADE_STRATEGY">ERR_WRONG_UPGRADE_STRATEGY</a>: u64 = 100;
</code></pre>



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

## Function `propose_module_upgrade_v2`
Expand Down Expand Up @@ -117,43 +100,6 @@ Update <code>sender</code>'s module upgrade strategy to <code>strategy</code>



</details>

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

## Function `update_module_upgrade_strategy_with_min_time`

Update <code>sender</code>'s module upgrade strategy to <code>strategy</code> with min_time_limit.
This can only be invoked when strategy is STRATEGY_TWO_PHASE.


<pre><code><b>public</b>(<b>script</b>) <b>fun</b> <a href="ModuleUpgradeScripts.md#0x1_ModuleUpgradeScripts_update_module_upgrade_strategy_with_min_time">update_module_upgrade_strategy_with_min_time</a>(sender: signer, strategy: u8, min_time_limit: u64)
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>public</b>(<b>script</b>) <b>fun</b> <a href="ModuleUpgradeScripts.md#0x1_ModuleUpgradeScripts_update_module_upgrade_strategy_with_min_time">update_module_upgrade_strategy_with_min_time</a>(
sender: signer,
strategy: u8,
min_time_limit: u64,
){
// 1. check version
<b>assert</b>!(strategy == <a href="PackageTxnManager.md#0x1_PackageTxnManager_get_strategy_two_phase">PackageTxnManager::get_strategy_two_phase</a>(), <a href="Errors.md#0x1_Errors_invalid_argument">Errors::invalid_argument</a>(<a href="ModuleUpgradeScripts.md#0x1_ModuleUpgradeScripts_ERR_WRONG_UPGRADE_STRATEGY">ERR_WRONG_UPGRADE_STRATEGY</a>));
// 2. <b>update</b> strategy
<a href="PackageTxnManager.md#0x1_PackageTxnManager_update_module_upgrade_strategy">PackageTxnManager::update_module_upgrade_strategy</a>(
&sender,
strategy,
<a href="Option.md#0x1_Option_some">Option::some</a>&lt;u64&gt;(min_time_limit),
);
}
</code></pre>



</details>

<a name="0x1_ModuleUpgradeScripts_submit_module_upgrade_plan"></a>
Expand Down Expand Up @@ -302,7 +248,7 @@ Cancel current upgrade plan, the <code>sender</code> must have <code>UpgradePlan

</details>

<a name="@Module_Specification_1"></a>
<a name="@Module_Specification_0"></a>

## Module Specification

Expand Down
Binary file modified build/StarcoinFramework/source_maps/ModuleUpgradeScripts.mvsm
Binary file not shown.
20 changes: 0 additions & 20 deletions sources/ModuleUpgradeScripts.move
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ module ModuleUpgradeScripts {
use StarcoinFramework::Version;
use StarcoinFramework::Option;
use StarcoinFramework::UpgradeModuleDaoProposal;
use StarcoinFramework::Errors;

const ERR_WRONG_UPGRADE_STRATEGY: u64 = 100;

spec module {
pragma verify = false; // break after enabling v2 compilation scheme
Expand Down Expand Up @@ -54,23 +51,6 @@ module ModuleUpgradeScripts {
);
}

/// Update `sender`'s module upgrade strategy to `strategy` with min_time_limit.
/// This can only be invoked when strategy is STRATEGY_TWO_PHASE.
public(script) fun update_module_upgrade_strategy_with_min_time(
sender: signer,
strategy: u8,
min_time_limit: u64,
){
// 1. check version
assert!(strategy == PackageTxnManager::get_strategy_two_phase(), Errors::invalid_argument(ERR_WRONG_UPGRADE_STRATEGY));
// 2. update strategy
PackageTxnManager::update_module_upgrade_strategy(
&sender,
strategy,
Option::some<u64>(min_time_limit),
);
}

/// a alias of execute_module_upgrade_plan_propose, will deprecated in the future.
public(script) fun submit_module_upgrade_plan<Token: copy + drop + store>(
sender: signer,
Expand Down

0 comments on commit 8e51979

Please sign in to comment.