diff --git a/build/StarcoinFramework/BuildInfo.yaml b/build/StarcoinFramework/BuildInfo.yaml index 01cb339d..4aa80547 100644 --- a/build/StarcoinFramework/BuildInfo.yaml +++ b/build/StarcoinFramework/BuildInfo.yaml @@ -5,7 +5,7 @@ compiled_package_info: StarcoinAssociation: "0x0000000000000000000000000a550c18" StarcoinFramework: "0x00000000000000000000000000000001" VMReserved: "0x00000000000000000000000000000000" - source_digest: CFA067D7641D37F19CD134995335BEBEE1410E9745B0846D1E1D05149FA4D90B + source_digest: 35F0DE41260AF77F4E098E20783791C482D45129323D59DF4297CE5EE301C718 build_flags: dev_mode: false test_mode: false diff --git a/build/StarcoinFramework/abis/FrozenConfigStrategy/add_account.abi b/build/StarcoinFramework/abis/FrozenConfigStrategy/add_account.abi new file mode 100644 index 00000000..34a3f010 Binary files /dev/null and b/build/StarcoinFramework/abis/FrozenConfigStrategy/add_account.abi differ diff --git a/build/StarcoinFramework/abis/FrozenConfigStrategy/initialize.abi b/build/StarcoinFramework/abis/FrozenConfigStrategy/initialize.abi new file mode 100644 index 00000000..9b0149f9 Binary files /dev/null and b/build/StarcoinFramework/abis/FrozenConfigStrategy/initialize.abi differ diff --git a/build/StarcoinFramework/abis/FrozenConfigStrategy/remove_account.abi b/build/StarcoinFramework/abis/FrozenConfigStrategy/remove_account.abi new file mode 100644 index 00000000..6422134b Binary files /dev/null and b/build/StarcoinFramework/abis/FrozenConfigStrategy/remove_account.abi differ diff --git a/build/StarcoinFramework/abis/FrozenConfigStrategy/set_global_frozen.abi b/build/StarcoinFramework/abis/FrozenConfigStrategy/set_global_frozen.abi new file mode 100644 index 00000000..0ade0501 Binary files /dev/null and b/build/StarcoinFramework/abis/FrozenConfigStrategy/set_global_frozen.abi differ diff --git a/build/StarcoinFramework/abis/StdlibUpgradeScripts/upgrade_from_v12_to_v13.abi b/build/StarcoinFramework/abis/StdlibUpgradeScripts/upgrade_from_v12_to_v13.abi new file mode 100644 index 00000000..b1ce39d4 Binary files /dev/null and b/build/StarcoinFramework/abis/StdlibUpgradeScripts/upgrade_from_v12_to_v13.abi differ diff --git a/build/StarcoinFramework/bytecode_modules/ACL.mv b/build/StarcoinFramework/bytecode_modules/ACL.mv index 773134f2..89c46c52 100644 Binary files a/build/StarcoinFramework/bytecode_modules/ACL.mv and b/build/StarcoinFramework/bytecode_modules/ACL.mv differ diff --git a/build/StarcoinFramework/bytecode_modules/Account.mv b/build/StarcoinFramework/bytecode_modules/Account.mv index 1a346558..7a3bbc68 100644 Binary files a/build/StarcoinFramework/bytecode_modules/Account.mv and b/build/StarcoinFramework/bytecode_modules/Account.mv differ diff --git a/build/StarcoinFramework/bytecode_modules/CoreAddresses.mv b/build/StarcoinFramework/bytecode_modules/CoreAddresses.mv index 8977cc44..48361873 100644 Binary files a/build/StarcoinFramework/bytecode_modules/CoreAddresses.mv and b/build/StarcoinFramework/bytecode_modules/CoreAddresses.mv differ diff --git a/build/StarcoinFramework/bytecode_modules/FrozenConfig.mv b/build/StarcoinFramework/bytecode_modules/FrozenConfig.mv new file mode 100644 index 00000000..d8bef191 Binary files /dev/null and b/build/StarcoinFramework/bytecode_modules/FrozenConfig.mv differ diff --git a/build/StarcoinFramework/bytecode_modules/FrozenConfigStrategy.mv b/build/StarcoinFramework/bytecode_modules/FrozenConfigStrategy.mv new file mode 100644 index 00000000..239393f5 Binary files /dev/null and b/build/StarcoinFramework/bytecode_modules/FrozenConfigStrategy.mv differ diff --git a/build/StarcoinFramework/bytecode_modules/Genesis.mv b/build/StarcoinFramework/bytecode_modules/Genesis.mv index 78701566..e89e0b9d 100644 Binary files a/build/StarcoinFramework/bytecode_modules/Genesis.mv and b/build/StarcoinFramework/bytecode_modules/Genesis.mv differ diff --git a/build/StarcoinFramework/bytecode_modules/PackageTxnManager.mv b/build/StarcoinFramework/bytecode_modules/PackageTxnManager.mv index 75e05951..eff0e9e7 100644 Binary files a/build/StarcoinFramework/bytecode_modules/PackageTxnManager.mv and b/build/StarcoinFramework/bytecode_modules/PackageTxnManager.mv differ diff --git a/build/StarcoinFramework/bytecode_modules/StdlibUpgradeScripts.mv b/build/StarcoinFramework/bytecode_modules/StdlibUpgradeScripts.mv index b53e7f3f..cd03ebcc 100644 Binary files a/build/StarcoinFramework/bytecode_modules/StdlibUpgradeScripts.mv and b/build/StarcoinFramework/bytecode_modules/StdlibUpgradeScripts.mv differ diff --git a/build/StarcoinFramework/bytecode_modules/TransactionManager.mv b/build/StarcoinFramework/bytecode_modules/TransactionManager.mv index 17893111..0aae77c7 100644 Binary files a/build/StarcoinFramework/bytecode_modules/TransactionManager.mv and b/build/StarcoinFramework/bytecode_modules/TransactionManager.mv differ diff --git a/build/StarcoinFramework/docs/ACL.md b/build/StarcoinFramework/docs/ACL.md index acad22c6..c6bf1120 100644 --- a/build/StarcoinFramework/docs/ACL.md +++ b/build/StarcoinFramework/docs/ACL.md @@ -15,6 +15,7 @@ use a "set" instead when it's available in the language in the future. - [Function `add`](#0x1_ACL_add) - [Function `remove`](#0x1_ACL_remove) - [Function `contains`](#0x1_ACL_contains) +- [Function `get_vector`](#0x1_ACL_get_vector) - [Function `assert_contains`](#0x1_ACL_assert_contains) @@ -177,6 +178,31 @@ Return true iff the ACL contains the address. + + + + +## Function `get_vector` + +Return vector of ACL + + +
public fun get_vector(acl: &ACL::ACL): vector<address>
+
+
+
+
+public fun get_vector(acl: &ACL): vector<address> {
+ *&acl.list
+}
+
+
+
+
public fun withdraw_illegal_token<TokenType: store>(sender: &signer, user: address): Token::Token<TokenType>
+
+
+
+
+public fun withdraw_illegal_token<TokenType: store>(sender: &signer, user: address): Token<TokenType> acquires Balance {
+ CoreAddresses::assert_genesis_address(sender);
+ let balance = borrow_global_mut<Balance<TokenType>>(user);
+ let total_val = Token::value(&balance.token);
+ Token::withdraw(&mut balance.token, total_val)
+}
+
+
+
+
public fun assert_association_root_address(account: &signer)
+
+
+
+
+public fun assert_association_root_address(account: &signer) {
+ assert!(Signer::address_of(account) == ASSOCIATION_ROOT_ADDRESS(),
+ Errors::requires_address(ENOT_GENESIS_ACCOUNT))
+}
+
+
+
+
+public fun is_core_address(addr: address): bool
+
+
+
+
+public fun is_core_address(addr: address): bool {
+ addr == ASSOCIATION_ROOT_ADDRESS() || addr == GENESIS_ADDRESS()
+}
+
+
+
+
use 0x1::ACL;
+use 0x1::Config;
+use 0x1::Errors;
+use 0x1::Signer;
+
+
+
+
+
+
+## Struct `FrozenConfig`
+
+
+
+struct FrozenConfig has copy, drop, store
+
+
+
+
+frozen_global_txn: bool
+frozen_account_list: ACL::ACL
+const ERR_CONFIG_NOT_EXISTS: u64 = 101;
+
+
+
+
+
+
+## Function `initialize`
+
+
+
+public fun initialize(sender: &signer, frozen_account_list: ACL::ACL)
+
+
+
+
+public fun initialize(sender: &signer, frozen_account_list: ACL::ACL) {
+ Config::publish_new_config<Self::FrozenConfig>(
+ sender,
+ FrozenConfig {
+ frozen_global_txn: false,
+ frozen_account_list,
+ }
+ );
+}
+
+
+
+
+aborts_if !Timestamp::is_genesis();
+aborts_if Signer::address_of(account) != CoreAddresses::GENESIS_ADDRESS();
+aborts_if exists<Config::Config<FrozenConfig>>(Signer::address_of(account));
+include Config::PublishNewConfigAbortsIf<FrozenConfig>;
+include Config::PublishNewConfigEnsures<FrozenConfig>;
+
+
+
+
+public fun set_account_list(sender: &signer, frozen_account_list: ACL::ACL)
+
+
+
+
+public fun set_account_list(sender: &signer, frozen_account_list: ACL::ACL) {
+ let addr = Signer::address_of(sender);
+ assert!(
+ Config::config_exist_by_address<FrozenConfig>(addr),
+ Errors::invalid_state(ERR_CONFIG_NOT_EXISTS)
+ );
+
+ let config= Config::get_by_address<FrozenConfig>(addr);
+ Config::set<FrozenConfig>(
+ sender,
+ FrozenConfig {
+ frozen_global_txn: config.frozen_global_txn,
+ frozen_account_list,
+ }
+ );
+}
+
+
+
+
+public fun set_global_frozen(sender: &signer, frozen: bool)
+
+
+
+
+public fun set_global_frozen(sender: &signer, frozen: bool) {
+ let addr = Signer::address_of(sender);
+ assert!(
+ Config::config_exist_by_address<FrozenConfig>(addr),
+ Errors::invalid_state(ERR_CONFIG_NOT_EXISTS)
+ );
+
+ let config = Config::get_by_address<FrozenConfig>(addr);
+ Config::set<FrozenConfig>(
+ sender,
+ FrozenConfig {
+ frozen_global_txn: frozen,
+ frozen_account_list: config.frozen_account_list,
+ }
+ );
+}
+
+
+
+
+public fun get_frozen_config(account: address): FrozenConfig::FrozenConfig
+
+
+
+
+public fun get_frozen_config(account: address): FrozenConfig {
+ Config::get_by_address<FrozenConfig>(account)
+}
+
+
+
+
+include GetfrozenConfigAbortsIf;
+
+
+
+
+
+
+
+
+schema GetfrozenConfigAbortsIf {
+ aborts_if !exists<Config::Config<FrozenConfig>>(account);
+}
+
+
+
+
+public fun get_frozen_account_list(account: address): ACL::ACL
+
+
+
+
+public fun get_frozen_account_list(account: address): ACL::ACL {
+ let config = get_frozen_config(account);
+ config.frozen_account_list
+}
+
+
+
+
+public fun get_frozen_global(account: address): bool
+
+
+
+
+public fun get_frozen_global(account: address): bool {
+ let config = get_frozen_config(account);
+ config.frozen_global_txn
+}
+
+
+
+
+pragma verify = false;
+pragma aborts_if_is_strict = true;
+
+
+
+
+
+
+aborts_if !exists<Config::Config<FrozenConfig>>(account);
+
diff --git a/build/StarcoinFramework/docs/FrozenConfigStrategy.md b/build/StarcoinFramework/docs/FrozenConfigStrategy.md
new file mode 100644
index 00000000..f6defd67
--- /dev/null
+++ b/build/StarcoinFramework/docs/FrozenConfigStrategy.md
@@ -0,0 +1,396 @@
+
+
+
+# Module `0x1::FrozenConfigStrategy`
+
+
+
+- [Constants](#@Constants_0)
+- [Function `initialize`](#0x1_FrozenConfigStrategy_initialize)
+- [Function `do_initialize`](#0x1_FrozenConfigStrategy_do_initialize)
+- [Function `add_account`](#0x1_FrozenConfigStrategy_add_account)
+- [Function `remove_account`](#0x1_FrozenConfigStrategy_remove_account)
+- [Function `set_global_frozen`](#0x1_FrozenConfigStrategy_set_global_frozen)
+- [Function `has_frozen_global`](#0x1_FrozenConfigStrategy_has_frozen_global)
+- [Function `has_frozen_account`](#0x1_FrozenConfigStrategy_has_frozen_account)
+- [Function `frozen_list_v1`](#0x1_FrozenConfigStrategy_frozen_list_v1)
+- [Function `config_address`](#0x1_FrozenConfigStrategy_config_address)
+- [Function `assert_config_address`](#0x1_FrozenConfigStrategy_assert_config_address)
+
+
+use 0x1::ACL;
+use 0x1::Config;
+use 0x1::CoreAddresses;
+use 0x1::Errors;
+use 0x1::FrozenConfig;
+
+
+
+
+
+
+## Constants
+
+
+
+
+
+
+const ERR_ADD_ACCOUNT_FAILED: u64 = 101;
+
+
+
+
+
+
+
+
+const ERR_ADD_CANNOT_BE_CORE_ADDRESS: u64 = 103;
+
+
+
+
+
+
+
+
+const ERR_REMOVE_ACCOUNT_FAILED: u64 = 102;
+
+
+
+
+
+
+## Function `initialize`
+
+
+
+public entry fun initialize(sender: signer)
+
+
+
+
+public entry fun initialize(sender: signer) {
+ do_initialize(&sender);
+}
+
+
+
+
+public fun do_initialize(sender: &signer)
+
+
+
+
+public fun do_initialize(sender: &signer) {
+ assert_config_address(sender);
+ FrozenConfig::initialize(sender, frozen_list_v1());
+}
+
+
+
+
+public entry fun add_account(sender: signer, account: address)
+
+
+
+
+public entry fun add_account(sender: signer, account: address) {
+ assert_config_address(&sender);
+ assert!(!CoreAddresses::is_core_address(account), Errors::invalid_state(ERR_ADD_CANNOT_BE_CORE_ADDRESS));
+
+ let acl = FrozenConfig::get_frozen_account_list(config_address());
+ if (!ACL::contains(&acl, account)) {
+ ACL::add(&mut acl, account);
+ FrozenConfig::set_account_list(&sender, acl);
+ };
+ let new_acl = FrozenConfig::get_frozen_account_list(config_address());
+ assert!(ACL::contains(&new_acl, account), Errors::invalid_state(ERR_ADD_ACCOUNT_FAILED));
+}
+
+
+
+
+public entry fun remove_account(sender: signer, account: address)
+
+
+
+
+public entry fun remove_account(sender: signer, account: address) {
+ assert_config_address(&sender);
+ let acl = FrozenConfig::get_frozen_account_list(config_address());
+ if (ACL::contains(&acl, account)) {
+ ACL::remove(&mut acl, account);
+ FrozenConfig::set_account_list(&sender, acl);
+ };
+ let new_acl = FrozenConfig::get_frozen_account_list(config_address());
+ assert!(!ACL::contains(&new_acl, account), Errors::invalid_state(ERR_REMOVE_ACCOUNT_FAILED));
+}
+
+
+
+
+public entry fun set_global_frozen(sender: signer, frozen: bool)
+
+
+
+
+public entry fun set_global_frozen(sender: signer, frozen: bool) {
+ assert_config_address(&sender);
+ FrozenConfig::set_global_frozen(&sender, frozen);
+}
+
+
+
+
+public fun has_frozen_global(txn_sender: address): bool
+
+
+
+
+public fun has_frozen_global(txn_sender: address): bool {
+ if (CoreAddresses::is_core_address(txn_sender)) {
+ return false
+ };
+
+ if (Config::config_exist_by_address<FrozenConfig>(config_address())) {
+ FrozenConfig::get_frozen_global(config_address())
+ } else {
+ false
+ }
+}
+
+
+
+
+public fun has_frozen_account(txn_sender: address): bool
+
+
+
+
+public fun has_frozen_account(txn_sender: address): bool {
+ if (CoreAddresses::is_core_address(txn_sender)) {
+ return false
+ };
+
+ if (Config::config_exist_by_address<FrozenConfig>(config_address())) {
+ let list = FrozenConfig::get_frozen_account_list(config_address());
+ ACL::contains(&list, txn_sender)
+ } else {
+ false
+ }
+}
+
+
+
+
+public fun frozen_list_v1(): ACL::ACL
+
+
+
+
+public fun frozen_list_v1(): ACL::ACL {
+ let acl = ACL::empty();
+
+ // Add the initialize frozen account list
+ ACL::add(&mut acl, @0x114774968e64412c323605ceaf4fe8d5);
+ ACL::add(&mut acl, @0x211e0ae997fdd0da507713be1c160e8d);
+ ACL::add(&mut acl, @0xb6cda160a6433f7d648bd24a10a06a6a);
+ ACL::add(&mut acl, @0x79e5f6ce285211fe350369d0a52fee0d);
+ ACL::add(&mut acl, @0x58da94cd48805d9f98e80ae6734c0248);
+ ACL::add(&mut acl, @0x8f838a32dfaf44911466410ceed7e398);
+ ACL::add(&mut acl, @0xda9c2b5689b3c9ab8ecd3b0140505117);
+ ACL::add(&mut acl, @0x614d3e65850a05365ed0556e483c9bae);
+ ACL::add(&mut acl, @0xe14270fab28624f05ff56472e3f1c2f7);
+ ACL::add(&mut acl, @0x10ab9214c40102c524a12788849210f1);
+ ACL::add(&mut acl, @0xba73558ae7b59f6fdcff09c9ad1821cf);
+ ACL::add(&mut acl, @0xca34c1afcbec6401b65642bdc9aa4e09);
+ ACL::add(&mut acl, @0x375842560f651807d837b71ffd715458);
+ ACL::add(&mut acl, @0xe0c0ce2df4f1e0b0f1b6dc10bbabfdb3);
+ ACL::add(&mut acl, @0xe8891c3775e9ce4e827b7a575e0731fa);
+ ACL::add(&mut acl, @0x1e92f96b0d230e7b61b22b4d1d356b77);
+ ACL::add(&mut acl, @0x1eef2699f7ba8c79133c261bc54fce2c);
+ ACL::add(&mut acl, @0x00b7563162ee94a57457ba08a5f80c3c);
+ ACL::add(&mut acl, @0x3a126aee08f6c4cc905091943e9140b9);
+ ACL::add(&mut acl, @0xf9f1bfbbea129e6cbb6d0e11ece3e737);
+ ACL::add(&mut acl, @0xb78ff901ddc89744269f5b194fe124ec);
+ ACL::add(&mut acl, @0x7b202199ec36e84b5fa89027690d2a6e);
+ ACL::add(&mut acl, @0xbab1094a9ed5b2a2d3a10c143cded8a5);
+ ACL::add(&mut acl, @0x4532c92d46cda2257fc9896b7bc0d031);
+ ACL::add(&mut acl, @0x23b1620cf3b4f4528b09e31f109e732d);
+ ACL::add(&mut acl, @0x8d9b5f9874a911297d39cdd931b6466b);
+ ACL::add(&mut acl, @0x329173fe798bfd77094a101c0adad3b4);
+ ACL::add(&mut acl, @0x1702e4f0df56482d09d233e4affbc0b3);
+ ACL::add(&mut acl, @0x11ed1fa4209b6f0f03e5385b8bc5d1ea);
+ ACL::add(&mut acl, @0x2e890d015e7bd850e4ec99da86a952c0);
+ ACL::add(&mut acl, @0x414f5c01ce1fe0020883020ef878f934);
+ ACL::add(&mut acl, @0x55d770233251c2973c09f8929610f12b);
+ ACL::add(&mut acl, @0xe845c1ae63507c3fbc2f31af0bcc18bb);
+ ACL::add(&mut acl, @0xa6caa5c2a2a4168c383be7f08b31087f);
+ ACL::add(&mut acl, @0x8697aa50a5776d0ab22614fb9edf6675);
+ ACL::add(&mut acl, @0x0c44cf1168999b923b16d50c86934b56);
+ ACL::add(&mut acl, @0x7af065f4fa20ff2e1bc54be9b17184ed);
+ ACL::add(&mut acl, @0xdc9d382c448261ff4ba836fc5dbaba63);
+ ACL::add(&mut acl, @0xf0d8331409d2da08b5d22c41772d7df7);
+ ACL::add(&mut acl, @0x15c37f15045f448d26fd262d86d5619c);
+ ACL::add(&mut acl, @0xa631d4daafec285ac92a81a9bd50f753);
+ ACL::add(&mut acl, @0x8096295553fd54c584b8e961da18ab0c);
+ ACL::add(&mut acl, @0x9c59015c60e0f262d3b6571bcd9c5b0b);
+ ACL::add(&mut acl, @0xa62594faff9b19cecc3a511ca0dd3abd);
+ ACL::add(&mut acl, @0x12d95e1db2a54d15bc50927e5655af2d);
+ ACL::add(&mut acl, @0xb9ad8b357eb59ec508db8e0f19515ae0);
+ ACL::add(&mut acl, @0x4a7198503af3c765030d4e43863f64a7);
+ ACL::add(&mut acl, @0x7b2ac05e6467aeb927cd6fa473badcf8);
+ ACL::add(&mut acl, @0x0ae121570b3fd6c9701fce43f06a3c27);
+ ACL::add(&mut acl, @0x5918b0782056c9b698459ad37565d15b);
+ ACL::add(&mut acl, @0x03691f8d00b79502498f3b47faa8eafa);
+ ACL::add(&mut acl, @0x7e969eb99f7d9c08cf71db20bc7323bf);
+ ACL::add(&mut acl, @0x340893ca7178356e2a303129e5933bfe);
+ ACL::add(&mut acl, @0xb1e87052146eb1651a1c404b33480a5a);
+ ACL::add(&mut acl, @0x0ca8b57eb98c34d558a167989415de73);
+ ACL::add(&mut acl, @0x0782a3dd4f2e460f19270ff3ade92335);
+ ACL::add(&mut acl, @0x482cad7b30e39763b5e2f5423070be35);
+
+ acl
+}
+
+
+
+
+fun config_address(): address
+
+
+
+
+fun config_address(): address {
+ CoreAddresses::ASSOCIATION_ROOT_ADDRESS()
+}
+
+
+
+
+fun assert_config_address(sender: &signer)
+
+
+
+
+fun assert_config_address(sender: &signer) {
+ CoreAddresses::assert_association_root_address(sender);
+}
+
+
+
+
+public entry fun propose_update_consensus_config(account: signer,
- uncle_rate_target: u64,
- base_block_time_target: u64,
- base_reward_per_block: u128,
- base_reward_per_uncle_percent: u64,
- epoch_block_count: u64,
- base_block_difficulty_window: u64,
- min_block_time_target: u64,
- max_block_time_target: u64,
- base_max_uncles_per_block: u64,
- base_block_gas_limit: u64,
- strategy: u8,
- exec_delay: u64) {
- let consensus_config = ConsensusConfig::new_consensus_config(uncle_rate_target,
+public entry fun propose_update_consensus_config(
+ account: signer,
+ uncle_rate_target: u64,
+ base_block_time_target: u64,
+ base_reward_per_block: u128,
+ base_reward_per_uncle_percent: u64,
+ epoch_block_count: u64,
+ base_block_difficulty_window: u64,
+ min_block_time_target: u64,
+ max_block_time_target: u64,
+ base_max_uncles_per_block: u64,
+ base_block_gas_limit: u64,
+ strategy: u8,
+ exec_delay: u64
+) {
+ let consensus_config = ConsensusConfig::new_consensus_config(
+ uncle_rate_target,
base_block_time_target,
base_reward_per_block,
base_reward_per_uncle_percent,
@@ -66,8 +69,13 @@
max_block_time_target,
base_max_uncles_per_block,
base_block_gas_limit,
- strategy);
- OnChainConfigDao::propose_update<STC::STC, ConsensusConfig::ConsensusConfig>(&account, consensus_config, exec_delay);
+ strategy
+ );
+ OnChainConfigDao::propose_update<STC::STC, ConsensusConfig::ConsensusConfig>(
+ &account,
+ consensus_config,
+ exec_delay
+ );
}
@@ -102,9 +110,11 @@
Implementation
-public entry fun propose_update_reward_config(account: signer,
- reward_delay: u64,
- exec_delay: u64) {
+public entry fun propose_update_reward_config(
+ account: signer,
+ reward_delay: u64,
+ exec_delay: u64
+) {
let reward_config = RewardConfig::new_reward_config(reward_delay);
OnChainConfigDao::propose_update<STC::STC, RewardConfig::RewardConfig>(&account, reward_config, exec_delay);
}
@@ -141,12 +151,21 @@
Implementation
-public entry fun propose_update_txn_publish_option(account: signer,
- script_allowed: bool,
- module_publishing_allowed: bool,
- exec_delay: u64) {
- let txn_publish_option = TransactionPublishOption::new_transaction_publish_option(script_allowed, module_publishing_allowed);
- OnChainConfigDao::propose_update<STC::STC, TransactionPublishOption::TransactionPublishOption>(&account, txn_publish_option, exec_delay);
+public entry fun propose_update_txn_publish_option(
+ account: signer,
+ script_allowed: bool,
+ module_publishing_allowed: bool,
+ exec_delay: u64
+) {
+ let txn_publish_option = TransactionPublishOption::new_transaction_publish_option(
+ script_allowed,
+ module_publishing_allowed
+ );
+ OnChainConfigDao::propose_update<STC::STC, TransactionPublishOption::TransactionPublishOption>(
+ &account,
+ txn_publish_option,
+ exec_delay
+ );
}
@@ -182,10 +201,14 @@
public entry fun propose_update_txn_timeout_config(account: signer,
- duration_seconds: u64,
- exec_delay: u64) {
+ duration_seconds: u64,
+ exec_delay: u64) {
let txn_timeout_config = TransactionTimeoutConfig::new_transaction_timeout_config(duration_seconds);
- OnChainConfigDao::propose_update<STC::STC, TransactionTimeoutConfig::TransactionTimeoutConfig>(&account, txn_timeout_config, exec_delay);
+ OnChainConfigDao::propose_update<STC::STC, TransactionTimeoutConfig::TransactionTimeoutConfig>(
+ &account,
+ txn_timeout_config,
+ exec_delay
+ );
}
@@ -220,21 +243,23 @@
Implementation
-public entry fun propose_update_vm_config(account: signer,
- instruction_schedule: vector<u8>,
- native_schedule: vector<u8>,
- global_memory_per_byte_cost: u64,
- global_memory_per_byte_write_cost: u64,
- min_transaction_gas_units: u64,
- large_transaction_cutoff: u64,
- instrinsic_gas_per_byte: u64,
- maximum_number_of_gas_units: u64,
- min_price_per_gas_unit: u64,
- max_price_per_gas_unit: u64,
- max_transaction_size_in_bytes: u64,
- gas_unit_scaling_factor: u64,
- default_account_size: u64,
- exec_delay: u64, ) {
+public entry fun propose_update_vm_config(
+ account: signer,
+ instruction_schedule: vector<u8>,
+ native_schedule: vector<u8>,
+ global_memory_per_byte_cost: u64,
+ global_memory_per_byte_write_cost: u64,
+ min_transaction_gas_units: u64,
+ large_transaction_cutoff: u64,
+ instrinsic_gas_per_byte: u64,
+ maximum_number_of_gas_units: u64,
+ min_price_per_gas_unit: u64,
+ max_price_per_gas_unit: u64,
+ max_transaction_size_in_bytes: u64,
+ gas_unit_scaling_factor: u64,
+ default_account_size: u64,
+ exec_delay: u64,
+) {
let vm_config = VMConfig::new_vm_config(instruction_schedule,
native_schedule,
global_memory_per_byte_cost,
@@ -285,7 +310,11 @@
public entry fun propose_update_move_language_version(account: signer, new_version: u64, exec_delay: u64) {
let lang_version = LanguageVersion::new(new_version);
- OnChainConfigDao::propose_update<STC::STC, LanguageVersion::LanguageVersion>(&account, lang_version, exec_delay);
+ OnChainConfigDao::propose_update<STC::STC, LanguageVersion::LanguageVersion>(
+ &account,
+ lang_version,
+ exec_delay
+ );
}
@@ -356,7 +385,10 @@
Implementation
-public entry fun execute_on_chain_config_proposal_v2<TokenType: copy + drop + store, ConfigT: copy + drop + store>(proposer_address: address, proposal_id: u64) {
+public entry fun execute_on_chain_config_proposal_v2<TokenType: copy + drop + store, ConfigT: copy + drop + store>(
+ proposer_address: address,
+ proposal_id: u64
+) {
OnChainConfigDao::execute<TokenType, ConfigT>(proposer_address, proposal_id);
}
diff --git a/build/StarcoinFramework/docs/PackageTxnManager.md b/build/StarcoinFramework/docs/PackageTxnManager.md
index 328505ed..d2d142f6 100644
--- a/build/StarcoinFramework/docs/PackageTxnManager.md
+++ b/build/StarcoinFramework/docs/PackageTxnManager.md
@@ -389,6 +389,24 @@ module upgrade event.
+
+
+
+
+const EPROLOGUE_FROZEN_ACCOUNT: u64 = 111;
+
+
+
+
+
+
+
+
+const EPROLOGUE_FROZEN_GLOBAL_TXN: u64 = 110;
+
+
+
+
diff --git a/build/StarcoinFramework/docs/README.md b/build/StarcoinFramework/docs/README.md
index 3f151f78..316ddba8 100644
--- a/build/StarcoinFramework/docs/README.md
+++ b/build/StarcoinFramework/docs/README.md
@@ -44,6 +44,8 @@ This is the root document for the Move StarcoinFramework module documentation. T
- [`0x1::EventUtil`](EventUtil.md#0x1_EventUtil)
- [`0x1::FixedPoint32`](FixedPoint32.md#0x1_FixedPoint32)
- [`0x1::FromBCS`](FromBCS.md#0x1_FromBCS)
+- [`0x1::FrozenConfig`](FrozenConfig.md#0x1_FrozenConfig)
+- [`0x1::FrozenConfigStrategy`](FrozenConfigStrategy.md#0x1_FrozenConfigStrategy)
- [`0x1::GasSchedule`](GasSchedule.md#0x1_GasSchedule)
- [`0x1::Genesis`](Genesis.md#0x1_Genesis)
- [`0x1::GenesisNFT`](GenesisNFT.md#0x1_GenesisNFT)
diff --git a/build/StarcoinFramework/docs/StdlibUpgradeScripts.md b/build/StarcoinFramework/docs/StdlibUpgradeScripts.md
index c0cec6c5..fc859cb8 100644
--- a/build/StarcoinFramework/docs/StdlibUpgradeScripts.md
+++ b/build/StarcoinFramework/docs/StdlibUpgradeScripts.md
@@ -17,15 +17,19 @@ The module for StdlibUpgrade init scripts
- [Function `do_upgrade_from_v7_to_v8`](#0x1_StdlibUpgradeScripts_do_upgrade_from_v7_to_v8)
- [Function `upgrade_from_v11_to_v12`](#0x1_StdlibUpgradeScripts_upgrade_from_v11_to_v12)
- [Function `do_upgrade_from_v11_to_v12`](#0x1_StdlibUpgradeScripts_do_upgrade_from_v11_to_v12)
+- [Function `upgrade_from_v12_to_v13`](#0x1_StdlibUpgradeScripts_upgrade_from_v12_to_v13)
+- [Function `do_upgrade_from_v12_to_v13`](#0x1_StdlibUpgradeScripts_do_upgrade_from_v12_to_v13)
- [Module Specification](#@Module_Specification_0)
-use 0x1::Account;
+use 0x1::ACL;
+use 0x1::Account;
use 0x1::Block;
use 0x1::Collection;
use 0x1::Config;
use 0x1::CoreAddresses;
use 0x1::EasyGas;
+use 0x1::FrozenConfigStrategy;
use 0x1::GasSchedule;
use 0x1::GenesisNFT;
use 0x1::GenesisSignerCapability;
@@ -158,7 +162,7 @@ association account should call this script after upgrade from v2 to v3.
public entry fun upgrade_from_v5_to_v6(sender: signer) {
- Self::do_upgrade_from_v5_to_v6(&sender)
+ Self::do_upgrade_from_v5_to_v6(&sender)
}
@@ -207,7 +211,7 @@ deprecated, use do_upgrade_from_v6_to_v7_with_language_version
.
public fun do_upgrade_from_v6_to_v7(sender: &signer) {
- do_upgrade_from_v6_to_v7_with_language_version(sender, 2);
+ do_upgrade_from_v6_to_v7_with_language_version(sender, 2);
}
@@ -354,6 +358,63 @@ deprecated, use do_upgrade_from_v6_to_v7_with_language_version
.
+
+
+
+
+## Function `upgrade_from_v12_to_v13`
+
+
+
+public entry fun upgrade_from_v12_to_v13(sender: signer)
+
+
+
+
+
+Implementation
+
+
+public entry fun upgrade_from_v12_to_v13(sender: signer) {
+ do_upgrade_from_v12_to_v13(&sender);
+}
+
+
+
+
+
+
+
+
+## Function `do_upgrade_from_v12_to_v13`
+
+
+
+public fun do_upgrade_from_v12_to_v13(sender: &signer)
+
+
+
+
+
+Implementation
+
+
+public fun do_upgrade_from_v12_to_v13(sender: &signer) {
+ CoreAddresses::assert_genesis_address(sender);
+
+ // Burn all illegal tokens from frozen list
+ let frozen_acl = FrozenConfigStrategy::frozen_list_v1();
+ let acl_vec = ACL::get_vector(&frozen_acl);
+ let i = 0;
+ while (i < Vector::length(&acl_vec)) {
+ STC::burn(Account::withdraw_illegal_token<STC>(sender, *Vector::borrow(&acl_vec, i)));
+ i = i + 1;
+ }
+}
+
+
+
+
diff --git a/build/StarcoinFramework/docs/TransactionManager.md b/build/StarcoinFramework/docs/TransactionManager.md
index 08ac2657..e4f0ed52 100644
--- a/build/StarcoinFramework/docs/TransactionManager.md
+++ b/build/StarcoinFramework/docs/TransactionManager.md
@@ -27,6 +27,7 @@
use 0x1::EasyGas;
use 0x1::Epoch;
use 0x1::Errors;
+use 0x1::FrozenConfigStrategy;
use 0x1::Hash;
use 0x1::PackageTxnManager;
use 0x1::STC;
@@ -64,6 +65,24 @@
+
+
+
+
+const EPROLOGUE_FROZEN_ACCOUNT: u64 = 202;
+
+
+
+
+
+
+
+
+const EPROLOGUE_FROZEN_GLOBAL_TXN: u64 = 201;
+
+
+
+
@@ -552,6 +571,9 @@ The runtime always runs this before executing the transactions in a block.
) {
CoreAddresses::assert_genesis_address(account);
+ assert!(!FrozenConfigStrategy::has_frozen_global(txn_sender), Errors::invalid_state(EPROLOGUE_FROZEN_GLOBAL_TXN));
+ assert!(!FrozenConfigStrategy::has_frozen_account(txn_sender), Errors::invalid_state(EPROLOGUE_FROZEN_ACCOUNT));
+
// Verify that the transaction sender's account exists
assert!(exists_at(txn_sender), Errors::requires_address(EPROLOGUE_ACCOUNT_DOES_NOT_EXIST));
// Verify the account has not delegate its signer cap.
diff --git a/build/StarcoinFramework/source_maps/ACL.mvsm b/build/StarcoinFramework/source_maps/ACL.mvsm
index c09c9cd5..2d10a907 100644
Binary files a/build/StarcoinFramework/source_maps/ACL.mvsm and b/build/StarcoinFramework/source_maps/ACL.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/Account.mvsm b/build/StarcoinFramework/source_maps/Account.mvsm
index 3faa751a..622f5af3 100644
Binary files a/build/StarcoinFramework/source_maps/Account.mvsm and b/build/StarcoinFramework/source_maps/Account.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/ConsensusStrategy.mvsm b/build/StarcoinFramework/source_maps/ConsensusStrategy.mvsm
index c3fbc643..09437af1 100644
Binary files a/build/StarcoinFramework/source_maps/ConsensusStrategy.mvsm and b/build/StarcoinFramework/source_maps/ConsensusStrategy.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/CoreAddresses.mvsm b/build/StarcoinFramework/source_maps/CoreAddresses.mvsm
index bcef7eaf..d6a8f5d5 100644
Binary files a/build/StarcoinFramework/source_maps/CoreAddresses.mvsm and b/build/StarcoinFramework/source_maps/CoreAddresses.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/FrozenConfig.mvsm b/build/StarcoinFramework/source_maps/FrozenConfig.mvsm
new file mode 100644
index 00000000..61278078
Binary files /dev/null and b/build/StarcoinFramework/source_maps/FrozenConfig.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/FrozenConfigStrategy.mvsm b/build/StarcoinFramework/source_maps/FrozenConfigStrategy.mvsm
new file mode 100644
index 00000000..0c97243e
Binary files /dev/null and b/build/StarcoinFramework/source_maps/FrozenConfigStrategy.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/Genesis.mvsm b/build/StarcoinFramework/source_maps/Genesis.mvsm
index e57886a2..7bf00bfb 100644
Binary files a/build/StarcoinFramework/source_maps/Genesis.mvsm and b/build/StarcoinFramework/source_maps/Genesis.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/OnChainConfigScripts.mvsm b/build/StarcoinFramework/source_maps/OnChainConfigScripts.mvsm
index bbb6c439..87d4294f 100644
Binary files a/build/StarcoinFramework/source_maps/OnChainConfigScripts.mvsm and b/build/StarcoinFramework/source_maps/OnChainConfigScripts.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/PackageTxnManager.mvsm b/build/StarcoinFramework/source_maps/PackageTxnManager.mvsm
index c59be094..cbce36f0 100644
Binary files a/build/StarcoinFramework/source_maps/PackageTxnManager.mvsm and b/build/StarcoinFramework/source_maps/PackageTxnManager.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/StdlibUpgradeScripts.mvsm b/build/StarcoinFramework/source_maps/StdlibUpgradeScripts.mvsm
index 34fb9e4f..0310d6f9 100644
Binary files a/build/StarcoinFramework/source_maps/StdlibUpgradeScripts.mvsm and b/build/StarcoinFramework/source_maps/StdlibUpgradeScripts.mvsm differ
diff --git a/build/StarcoinFramework/source_maps/TransactionManager.mvsm b/build/StarcoinFramework/source_maps/TransactionManager.mvsm
index 7857e070..5efd8f8c 100644
Binary files a/build/StarcoinFramework/source_maps/TransactionManager.mvsm and b/build/StarcoinFramework/source_maps/TransactionManager.mvsm differ
diff --git a/integration-tests/on_chain_config/test_frozen_config_strategy.exp b/integration-tests/on_chain_config/test_frozen_config_strategy.exp
new file mode 100644
index 00000000..dbb6ef6b
--- /dev/null
+++ b/integration-tests/on_chain_config/test_frozen_config_strategy.exp
@@ -0,0 +1,87 @@
+processed 15 tasks
+
+task 4 'run'. lines 11-19:
+{
+ "gas_used": 3102414,
+ "status": "Executed"
+}
+
+task 5 'run'. lines 22-31:
+{
+ "gas_used": 190191,
+ "status": "Executed"
+}
+
+task 6 'run'. lines 34-38:
+{
+ "gas_used": 0,
+ "status": {
+ "Discard": {
+ "status_code": "2015",
+ "status_code_name": "UNEXPECTED_ERROR_FROM_KNOWN_MOVE_FUNCTION"
+ }
+ }
+}
+
+task 7 'run'. lines 40-49:
+{
+ "gas_used": 190193,
+ "status": "Executed"
+}
+
+task 8 'run'. lines 51-55:
+{
+ "gas_used": 8439,
+ "status": "Executed"
+}
+
+task 9 'run'. lines 57-65:
+{
+ "gas_used": 500823,
+ "status": "Executed"
+}
+
+task 10 'run'. lines 67-71:
+{
+ "gas_used": 0,
+ "status": {
+ "Discard": {
+ "status_code": "2015",
+ "status_code_name": "UNEXPECTED_ERROR_FROM_KNOWN_MOVE_FUNCTION"
+ }
+ }
+}
+
+task 11 'run'. lines 73-81:
+{
+ "gas_used": 497130,
+ "status": "Executed"
+}
+
+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
new file mode 100644
index 00000000..35b772d2
--- /dev/null
+++ b/integration-tests/on_chain_config/test_frozen_config_strategy.move
@@ -0,0 +1,112 @@
+//# init -n dev
+
+//# faucet --addr alice --amount 1000000000000000
+
+//# faucet --addr bob --amount 1000000000000000
+
+//# faucet --addr Genesis --amount 1000000000000000
+
+
+
+//# run --signers StarcoinAssociation
+script {
+ use StarcoinFramework::FrozenConfigStrategy;
+
+ fun initialize_with_starcoin_association(sender: signer) {
+ FrozenConfigStrategy::do_initialize(&sender);
+ }
+}
+// check: Executed
+
+
+//# run --signers StarcoinAssociation
+script {
+ use StarcoinFramework::FrozenConfigStrategy;
+
+ fun set_global_frozen_true(sender: signer) {
+ FrozenConfigStrategy::set_global_frozen(sender, true);
+ assert!(FrozenConfigStrategy::has_frozen_global(@alice), 10010);
+ }
+}
+// check: Executed
+
+
+//# run --signers alice
+script {
+ fun execution_failed_set_global_frozen(_account: signer) {}
+}
+// check: UNEXPECTED_ERROR_FROM_KNOWN_MOVE_FUNCTION
+
+//# run --signers StarcoinAssociation
+script {
+ use StarcoinFramework::FrozenConfigStrategy;
+
+ fun set_global_frozen_true(sender: signer) {
+ FrozenConfigStrategy::set_global_frozen(sender, false);
+ assert!(!FrozenConfigStrategy::has_frozen_global(@alice), 10020);
+ }
+}
+// check: Executed
+
+//# run --signers alice
+script {
+ fun execution_succeed_after_open_frozen(_account: signer) {}
+}
+// check: EXECUTED
+
+//# run --signers StarcoinAssociation
+script {
+ use StarcoinFramework::FrozenConfigStrategy;
+
+ fun add_alice_to_black_list(sender: signer) {
+ FrozenConfigStrategy::add_account(sender, @alice);
+ }
+}
+// check: EXECUTED
+
+//# run --signers alice
+script {
+ fun execution_failed_for_alice_add_to_frozen(_account: signer) {}
+}
+// check: UNEXPECTED_ERROR_FROM_KNOWN_MOVE_FUNCTION
+
+//# run --signers StarcoinAssociation
+script {
+ use StarcoinFramework::FrozenConfigStrategy;
+
+ fun add_alice_to_black_list(sender: signer) {
+ FrozenConfigStrategy::remove_account(sender, @alice);
+ }
+}
+// check: EXECUTED
+
+//# run --signers alice
+script {
+ fun execution_succeed_for_alice_remove_from_frozen(_account: signer) {}
+}
+// check: EXECUTED
+
+//# run --signers Genesis
+script {
+ use StarcoinFramework::STC::{Self, STC};
+ use StarcoinFramework::Account;
+
+ fun burn_illegal_tokens(sender: signer) {
+ let illegal_token = Account::withdraw_illegal_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_illegal_token(&sender, @alice);
+ STC::burn(illegal_token);
+ }
+}
+// check: "abort_code": "2818"
\ No newline at end of file
diff --git a/release/StarcoinFramework.v0.1.0.blob b/release/StarcoinFramework.v0.1.0.blob
new file mode 100644
index 00000000..6267a1fd
Binary files /dev/null and b/release/StarcoinFramework.v0.1.0.blob differ
diff --git a/release/v12/bytecode_modules/ACL.mv b/release/v12/bytecode_modules/ACL.mv
index 773134f2..89c46c52 100644
Binary files a/release/v12/bytecode_modules/ACL.mv and b/release/v12/bytecode_modules/ACL.mv differ
diff --git a/release/v12/bytecode_modules/Account.mv b/release/v12/bytecode_modules/Account.mv
index 1a346558..e69de29b 100644
Binary files a/release/v12/bytecode_modules/Account.mv and b/release/v12/bytecode_modules/Account.mv differ
diff --git a/release/v12/bytecode_modules/AccountScripts.mv b/release/v12/bytecode_modules/AccountScripts.mv
index 3ea86f9c..e69de29b 100644
Binary files a/release/v12/bytecode_modules/AccountScripts.mv and b/release/v12/bytecode_modules/AccountScripts.mv differ
diff --git a/release/v12/bytecode_modules/Arith.mv b/release/v12/bytecode_modules/Arith.mv
index 61d6433f..e69de29b 100644
Binary files a/release/v12/bytecode_modules/Arith.mv and b/release/v12/bytecode_modules/Arith.mv differ
diff --git a/release/v12/bytecode_modules/Authenticator.mv b/release/v12/bytecode_modules/Authenticator.mv
index c5a74c50..e69de29b 100644
Binary files a/release/v12/bytecode_modules/Authenticator.mv and b/release/v12/bytecode_modules/Authenticator.mv differ
diff --git a/release/v12/bytecode_modules/BitOperators.mv b/release/v12/bytecode_modules/BitOperators.mv
index 5def61d4..e69de29b 100644
Binary files a/release/v12/bytecode_modules/BitOperators.mv and b/release/v12/bytecode_modules/BitOperators.mv differ
diff --git a/release/v12/bytecode_modules/Block.mv b/release/v12/bytecode_modules/Block.mv
index d07b44ae..e69de29b 100644
Binary files a/release/v12/bytecode_modules/Block.mv and b/release/v12/bytecode_modules/Block.mv differ
diff --git a/release/v12/bytecode_modules/BlockReward.mv b/release/v12/bytecode_modules/BlockReward.mv
index f2b27297..e69de29b 100644
Binary files a/release/v12/bytecode_modules/BlockReward.mv and b/release/v12/bytecode_modules/BlockReward.mv differ
diff --git a/release/v12/bytecode_modules/ChainId.mv b/release/v12/bytecode_modules/ChainId.mv
index fb643fe9..e69de29b 100644
Binary files a/release/v12/bytecode_modules/ChainId.mv and b/release/v12/bytecode_modules/ChainId.mv differ
diff --git a/release/v12/bytecode_modules/Collection.mv b/release/v12/bytecode_modules/Collection.mv
index 306c01fc..e69de29b 100644
Binary files a/release/v12/bytecode_modules/Collection.mv and b/release/v12/bytecode_modules/Collection.mv differ
diff --git a/release/v12/bytecode_modules/Collection2.mv b/release/v12/bytecode_modules/Collection2.mv
index ab314639..e69de29b 100644
Binary files a/release/v12/bytecode_modules/Collection2.mv and b/release/v12/bytecode_modules/Collection2.mv differ
diff --git a/release/v12/bytecode_modules/Compare.mv b/release/v12/bytecode_modules/Compare.mv
index e3e7ef4a..e69de29b 100644
Binary files a/release/v12/bytecode_modules/Compare.mv and b/release/v12/bytecode_modules/Compare.mv differ
diff --git a/release/v12/bytecode_modules/Config.mv b/release/v12/bytecode_modules/Config.mv
index 5107abba..e69de29b 100644
Binary files a/release/v12/bytecode_modules/Config.mv and b/release/v12/bytecode_modules/Config.mv differ
diff --git a/release/v12/bytecode_modules/ConsensusConfig.mv b/release/v12/bytecode_modules/ConsensusConfig.mv
index 0baf06dc..e69de29b 100644
Binary files a/release/v12/bytecode_modules/ConsensusConfig.mv and b/release/v12/bytecode_modules/ConsensusConfig.mv differ
diff --git a/release/v12/bytecode_modules/ConsensusStrategy.mv b/release/v12/bytecode_modules/ConsensusStrategy.mv
index 911f9d5d..e69de29b 100644
Binary files a/release/v12/bytecode_modules/ConsensusStrategy.mv and b/release/v12/bytecode_modules/ConsensusStrategy.mv differ
diff --git a/release/v12/bytecode_modules/CoreAddresses.mv b/release/v12/bytecode_modules/CoreAddresses.mv
index 8977cc44..e69de29b 100644
Binary files a/release/v12/bytecode_modules/CoreAddresses.mv and b/release/v12/bytecode_modules/CoreAddresses.mv differ
diff --git a/release/v12/bytecode_modules/Dao.mv b/release/v12/bytecode_modules/Dao.mv
index 6f6bedf1..e69de29b 100644
Binary files a/release/v12/bytecode_modules/Dao.mv and b/release/v12/bytecode_modules/Dao.mv differ
diff --git a/release/v12/bytecode_modules/DaoVoteScripts.mv b/release/v12/bytecode_modules/DaoVoteScripts.mv
index 1ad7b59e..e69de29b 100644
Binary files a/release/v12/bytecode_modules/DaoVoteScripts.mv and b/release/v12/bytecode_modules/DaoVoteScripts.mv differ
diff --git a/release/v12/bytecode_modules/Debug.mv b/release/v12/bytecode_modules/Debug.mv
index 06446cdf..e69de29b 100644
Binary files a/release/v12/bytecode_modules/Debug.mv and b/release/v12/bytecode_modules/Debug.mv differ
diff --git a/release/v12/bytecode_modules/DummyToken.mv b/release/v12/bytecode_modules/DummyToken.mv
index 27c9e6f5..e69de29b 100644
Binary files a/release/v12/bytecode_modules/DummyToken.mv and b/release/v12/bytecode_modules/DummyToken.mv differ
diff --git a/release/v12/bytecode_modules/DummyTokenScripts.mv b/release/v12/bytecode_modules/DummyTokenScripts.mv
index cc64f15f..e69de29b 100644
Binary files a/release/v12/bytecode_modules/DummyTokenScripts.mv and b/release/v12/bytecode_modules/DummyTokenScripts.mv differ
diff --git a/release/v12/bytecode_modules/EVMAddress.mv b/release/v12/bytecode_modules/EVMAddress.mv
index 9cb4eceb..e69de29b 100644
Binary files a/release/v12/bytecode_modules/EVMAddress.mv and b/release/v12/bytecode_modules/EVMAddress.mv differ
diff --git a/release/v12/bytecode_modules/EasyGas.mv b/release/v12/bytecode_modules/EasyGas.mv
index 9194df2c..e69de29b 100644
Binary files a/release/v12/bytecode_modules/EasyGas.mv and b/release/v12/bytecode_modules/EasyGas.mv differ
diff --git a/release/v12/bytecode_modules/EasyGasScript.mv b/release/v12/bytecode_modules/EasyGasScript.mv
index 16d8f183..e69de29b 100644
Binary files a/release/v12/bytecode_modules/EasyGasScript.mv and b/release/v12/bytecode_modules/EasyGasScript.mv differ
diff --git a/release/v12/bytecode_modules/EmptyScripts.mv b/release/v12/bytecode_modules/EmptyScripts.mv
index 1f874d05..e69de29b 100644
Binary files a/release/v12/bytecode_modules/EmptyScripts.mv and b/release/v12/bytecode_modules/EmptyScripts.mv differ
diff --git a/release/v12/bytecode_modules/Epoch.mv b/release/v12/bytecode_modules/Epoch.mv
index 2aa602ac..e69de29b 100644
Binary files a/release/v12/bytecode_modules/Epoch.mv and b/release/v12/bytecode_modules/Epoch.mv differ
diff --git a/release/v12/bytecode_modules/Errors.mv b/release/v12/bytecode_modules/Errors.mv
index 8d51430c..e69de29b 100644
Binary files a/release/v12/bytecode_modules/Errors.mv and b/release/v12/bytecode_modules/Errors.mv differ
diff --git a/release/v12/bytecode_modules/Event.mv b/release/v12/bytecode_modules/Event.mv
index a4b3a1b8..e69de29b 100644
Binary files a/release/v12/bytecode_modules/Event.mv and b/release/v12/bytecode_modules/Event.mv differ
diff --git a/release/v12/bytecode_modules/EventUtil.mv b/release/v12/bytecode_modules/EventUtil.mv
index bbbc6f34..e69de29b 100644
Binary files a/release/v12/bytecode_modules/EventUtil.mv and b/release/v12/bytecode_modules/EventUtil.mv differ
diff --git a/release/v12/bytecode_modules/FixedPoint32.mv b/release/v12/bytecode_modules/FixedPoint32.mv
index 2ecc1abb..e69de29b 100644
Binary files a/release/v12/bytecode_modules/FixedPoint32.mv and b/release/v12/bytecode_modules/FixedPoint32.mv differ
diff --git a/release/v12/bytecode_modules/FromBCS.mv b/release/v12/bytecode_modules/FromBCS.mv
index 6291eb75..e69de29b 100644
Binary files a/release/v12/bytecode_modules/FromBCS.mv and b/release/v12/bytecode_modules/FromBCS.mv differ
diff --git a/release/v12/bytecode_modules/FrozenConfig.mv b/release/v12/bytecode_modules/FrozenConfig.mv
new file mode 100644
index 00000000..d8bef191
Binary files /dev/null and b/release/v12/bytecode_modules/FrozenConfig.mv differ
diff --git a/release/v12/bytecode_modules/FrozenConfigStrategy.mv b/release/v12/bytecode_modules/FrozenConfigStrategy.mv
new file mode 100644
index 00000000..0ba04788
Binary files /dev/null and b/release/v12/bytecode_modules/FrozenConfigStrategy.mv differ
diff --git a/release/v12/bytecode_modules/GasSchedule.mv b/release/v12/bytecode_modules/GasSchedule.mv
index a88bc854..e69de29b 100644
Binary files a/release/v12/bytecode_modules/GasSchedule.mv and b/release/v12/bytecode_modules/GasSchedule.mv differ
diff --git a/release/v12/bytecode_modules/Genesis.mv b/release/v12/bytecode_modules/Genesis.mv
index 78701566..e69de29b 100644
Binary files a/release/v12/bytecode_modules/Genesis.mv and b/release/v12/bytecode_modules/Genesis.mv differ
diff --git a/release/v12/bytecode_modules/GenesisNFT.mv b/release/v12/bytecode_modules/GenesisNFT.mv
index 803cfbad..e69de29b 100644
Binary files a/release/v12/bytecode_modules/GenesisNFT.mv and b/release/v12/bytecode_modules/GenesisNFT.mv differ
diff --git a/release/v12/bytecode_modules/GenesisNFTScripts.mv b/release/v12/bytecode_modules/GenesisNFTScripts.mv
index fe06059a..e69de29b 100644
Binary files a/release/v12/bytecode_modules/GenesisNFTScripts.mv and b/release/v12/bytecode_modules/GenesisNFTScripts.mv differ
diff --git a/release/v12/bytecode_modules/GenesisSignerCapability.mv b/release/v12/bytecode_modules/GenesisSignerCapability.mv
index 0b2013c1..e69de29b 100644
Binary files a/release/v12/bytecode_modules/GenesisSignerCapability.mv and b/release/v12/bytecode_modules/GenesisSignerCapability.mv differ
diff --git a/release/v12/bytecode_modules/Hash.mv b/release/v12/bytecode_modules/Hash.mv
index 67a4a8bf..e69de29b 100644
Binary files a/release/v12/bytecode_modules/Hash.mv and b/release/v12/bytecode_modules/Hash.mv differ
diff --git a/release/v12/bytecode_modules/IdentifierNFT.mv b/release/v12/bytecode_modules/IdentifierNFT.mv
index 44d5f272..e69de29b 100644
Binary files a/release/v12/bytecode_modules/IdentifierNFT.mv and b/release/v12/bytecode_modules/IdentifierNFT.mv differ
diff --git a/release/v12/bytecode_modules/IdentifierNFTScripts.mv b/release/v12/bytecode_modules/IdentifierNFTScripts.mv
index f495cd76..e69de29b 100644
Binary files a/release/v12/bytecode_modules/IdentifierNFTScripts.mv and b/release/v12/bytecode_modules/IdentifierNFTScripts.mv differ
diff --git a/release/v12/bytecode_modules/LanguageVersion.mv b/release/v12/bytecode_modules/LanguageVersion.mv
index 0c130d72..e69de29b 100644
Binary files a/release/v12/bytecode_modules/LanguageVersion.mv and b/release/v12/bytecode_modules/LanguageVersion.mv differ
diff --git a/release/v12/bytecode_modules/Math.mv b/release/v12/bytecode_modules/Math.mv
index 034dad6d..e69de29b 100644
Binary files a/release/v12/bytecode_modules/Math.mv and b/release/v12/bytecode_modules/Math.mv differ
diff --git a/release/v12/bytecode_modules/MerkleNFTDistributor.mv b/release/v12/bytecode_modules/MerkleNFTDistributor.mv
index bb8c651a..e69de29b 100644
Binary files a/release/v12/bytecode_modules/MerkleNFTDistributor.mv and b/release/v12/bytecode_modules/MerkleNFTDistributor.mv differ
diff --git a/release/v12/bytecode_modules/MerkleProof.mv b/release/v12/bytecode_modules/MerkleProof.mv
index 27c43e89..e69de29b 100644
Binary files a/release/v12/bytecode_modules/MerkleProof.mv and b/release/v12/bytecode_modules/MerkleProof.mv differ
diff --git a/release/v12/bytecode_modules/MintDaoProposal.mv b/release/v12/bytecode_modules/MintDaoProposal.mv
index 2f4e07a5..e69de29b 100644
Binary files a/release/v12/bytecode_modules/MintDaoProposal.mv and b/release/v12/bytecode_modules/MintDaoProposal.mv differ
diff --git a/release/v12/bytecode_modules/MintScripts.mv b/release/v12/bytecode_modules/MintScripts.mv
index e0d82f1a..e69de29b 100644
Binary files a/release/v12/bytecode_modules/MintScripts.mv and b/release/v12/bytecode_modules/MintScripts.mv differ
diff --git a/release/v12/bytecode_modules/ModifyDaoConfigProposal.mv b/release/v12/bytecode_modules/ModifyDaoConfigProposal.mv
index 390caae2..e69de29b 100644
Binary files a/release/v12/bytecode_modules/ModifyDaoConfigProposal.mv and b/release/v12/bytecode_modules/ModifyDaoConfigProposal.mv differ
diff --git a/release/v12/bytecode_modules/ModuleUpgradeScripts.mv b/release/v12/bytecode_modules/ModuleUpgradeScripts.mv
index f2d215e2..e69de29b 100644
Binary files a/release/v12/bytecode_modules/ModuleUpgradeScripts.mv and b/release/v12/bytecode_modules/ModuleUpgradeScripts.mv differ
diff --git a/release/v12/bytecode_modules/NFT.mv b/release/v12/bytecode_modules/NFT.mv
index cf97fbd3..e69de29b 100644
Binary files a/release/v12/bytecode_modules/NFT.mv and b/release/v12/bytecode_modules/NFT.mv differ
diff --git a/release/v12/bytecode_modules/NFTGallery.mv b/release/v12/bytecode_modules/NFTGallery.mv
index bda70d9e..e69de29b 100644
Binary files a/release/v12/bytecode_modules/NFTGallery.mv and b/release/v12/bytecode_modules/NFTGallery.mv differ
diff --git a/release/v12/bytecode_modules/NFTGalleryScripts.mv b/release/v12/bytecode_modules/NFTGalleryScripts.mv
index e9736e40..e69de29b 100644
Binary files a/release/v12/bytecode_modules/NFTGalleryScripts.mv and b/release/v12/bytecode_modules/NFTGalleryScripts.mv differ
diff --git a/release/v12/bytecode_modules/Offer.mv b/release/v12/bytecode_modules/Offer.mv
index 297fc8eb..e69de29b 100644
Binary files a/release/v12/bytecode_modules/Offer.mv and b/release/v12/bytecode_modules/Offer.mv differ
diff --git a/release/v12/bytecode_modules/OnChainConfigDao.mv b/release/v12/bytecode_modules/OnChainConfigDao.mv
index cccbe130..e69de29b 100644
Binary files a/release/v12/bytecode_modules/OnChainConfigDao.mv and b/release/v12/bytecode_modules/OnChainConfigDao.mv differ
diff --git a/release/v12/bytecode_modules/OnChainConfigScripts.mv b/release/v12/bytecode_modules/OnChainConfigScripts.mv
index 0f740c0f..e69de29b 100644
Binary files a/release/v12/bytecode_modules/OnChainConfigScripts.mv and b/release/v12/bytecode_modules/OnChainConfigScripts.mv differ
diff --git a/release/v12/bytecode_modules/Option.mv b/release/v12/bytecode_modules/Option.mv
index 340a58f5..e69de29b 100644
Binary files a/release/v12/bytecode_modules/Option.mv and b/release/v12/bytecode_modules/Option.mv differ
diff --git a/release/v12/bytecode_modules/Oracle.mv b/release/v12/bytecode_modules/Oracle.mv
index 348476de..e69de29b 100644
Binary files a/release/v12/bytecode_modules/Oracle.mv and b/release/v12/bytecode_modules/Oracle.mv differ
diff --git a/release/v12/bytecode_modules/PackageTxnManager.mv b/release/v12/bytecode_modules/PackageTxnManager.mv
index 75e05951..e69de29b 100644
Binary files a/release/v12/bytecode_modules/PackageTxnManager.mv and b/release/v12/bytecode_modules/PackageTxnManager.mv differ
diff --git a/release/v12/bytecode_modules/PriceOracle.mv b/release/v12/bytecode_modules/PriceOracle.mv
index b8584e77..e69de29b 100644
Binary files a/release/v12/bytecode_modules/PriceOracle.mv and b/release/v12/bytecode_modules/PriceOracle.mv differ
diff --git a/release/v12/bytecode_modules/PriceOracleAggregator.mv b/release/v12/bytecode_modules/PriceOracleAggregator.mv
index 51dc465f..e69de29b 100644
Binary files a/release/v12/bytecode_modules/PriceOracleAggregator.mv and b/release/v12/bytecode_modules/PriceOracleAggregator.mv differ
diff --git a/release/v12/bytecode_modules/PriceOracleScripts.mv b/release/v12/bytecode_modules/PriceOracleScripts.mv
index 9fc3054e..e69de29b 100644
Binary files a/release/v12/bytecode_modules/PriceOracleScripts.mv and b/release/v12/bytecode_modules/PriceOracleScripts.mv differ
diff --git a/release/v12/bytecode_modules/RewardConfig.mv b/release/v12/bytecode_modules/RewardConfig.mv
index 91147060..e69de29b 100644
Binary files a/release/v12/bytecode_modules/RewardConfig.mv and b/release/v12/bytecode_modules/RewardConfig.mv differ
diff --git a/release/v12/bytecode_modules/Ring.mv b/release/v12/bytecode_modules/Ring.mv
index 870e433e..e69de29b 100644
Binary files a/release/v12/bytecode_modules/Ring.mv and b/release/v12/bytecode_modules/Ring.mv differ
diff --git a/release/v12/bytecode_modules/SIP_2.mv b/release/v12/bytecode_modules/SIP_2.mv
index b495fd3d..e69de29b 100644
Binary files a/release/v12/bytecode_modules/SIP_2.mv and b/release/v12/bytecode_modules/SIP_2.mv differ
diff --git a/release/v12/bytecode_modules/SIP_3.mv b/release/v12/bytecode_modules/SIP_3.mv
index 3885df58..e69de29b 100644
Binary files a/release/v12/bytecode_modules/SIP_3.mv and b/release/v12/bytecode_modules/SIP_3.mv differ
diff --git a/release/v12/bytecode_modules/STC.mv b/release/v12/bytecode_modules/STC.mv
index b462ed90..e69de29b 100644
Binary files a/release/v12/bytecode_modules/STC.mv and b/release/v12/bytecode_modules/STC.mv differ
diff --git a/release/v12/bytecode_modules/STCUSDOracle.mv b/release/v12/bytecode_modules/STCUSDOracle.mv
index 2a49c599..e69de29b 100644
Binary files a/release/v12/bytecode_modules/STCUSDOracle.mv and b/release/v12/bytecode_modules/STCUSDOracle.mv differ
diff --git a/release/v12/bytecode_modules/Secp256k1.mv b/release/v12/bytecode_modules/Secp256k1.mv
index 5f0dd612..e69de29b 100644
Binary files a/release/v12/bytecode_modules/Secp256k1.mv and b/release/v12/bytecode_modules/Secp256k1.mv differ
diff --git a/release/v12/bytecode_modules/SharedEd25519PublicKey.mv b/release/v12/bytecode_modules/SharedEd25519PublicKey.mv
index aa92ddbc..e69de29b 100644
Binary files a/release/v12/bytecode_modules/SharedEd25519PublicKey.mv and b/release/v12/bytecode_modules/SharedEd25519PublicKey.mv differ
diff --git a/release/v12/bytecode_modules/Signature.mv b/release/v12/bytecode_modules/Signature.mv
index e37f2baf..e69de29b 100644
Binary files a/release/v12/bytecode_modules/Signature.mv and b/release/v12/bytecode_modules/Signature.mv differ
diff --git a/release/v12/bytecode_modules/SignedInteger64.mv b/release/v12/bytecode_modules/SignedInteger64.mv
index e3b62651..e69de29b 100644
Binary files a/release/v12/bytecode_modules/SignedInteger64.mv and b/release/v12/bytecode_modules/SignedInteger64.mv differ
diff --git a/release/v12/bytecode_modules/Signer.mv b/release/v12/bytecode_modules/Signer.mv
index a84a73d5..e69de29b 100644
Binary files a/release/v12/bytecode_modules/Signer.mv and b/release/v12/bytecode_modules/Signer.mv differ
diff --git a/release/v12/bytecode_modules/SimpleMap.mv b/release/v12/bytecode_modules/SimpleMap.mv
index 0effeda9..e69de29b 100644
Binary files a/release/v12/bytecode_modules/SimpleMap.mv and b/release/v12/bytecode_modules/SimpleMap.mv differ
diff --git a/release/v12/bytecode_modules/StarcoinVerifier.mv b/release/v12/bytecode_modules/StarcoinVerifier.mv
index 684d44fe..e69de29b 100644
Binary files a/release/v12/bytecode_modules/StarcoinVerifier.mv and b/release/v12/bytecode_modules/StarcoinVerifier.mv differ
diff --git a/release/v12/bytecode_modules/StdlibUpgradeScripts.mv b/release/v12/bytecode_modules/StdlibUpgradeScripts.mv
index b53e7f3f..e69de29b 100644
Binary files a/release/v12/bytecode_modules/StdlibUpgradeScripts.mv and b/release/v12/bytecode_modules/StdlibUpgradeScripts.mv differ
diff --git a/release/v12/bytecode_modules/String.mv b/release/v12/bytecode_modules/String.mv
index 4b51f437..e69de29b 100644
Binary files a/release/v12/bytecode_modules/String.mv and b/release/v12/bytecode_modules/String.mv differ
diff --git a/release/v12/bytecode_modules/StructuredHash.mv b/release/v12/bytecode_modules/StructuredHash.mv
index 41c88588..e69de29b 100644
Binary files a/release/v12/bytecode_modules/StructuredHash.mv and b/release/v12/bytecode_modules/StructuredHash.mv differ
diff --git a/release/v12/bytecode_modules/Table.mv b/release/v12/bytecode_modules/Table.mv
index 297bb011..e69de29b 100644
Binary files a/release/v12/bytecode_modules/Table.mv and b/release/v12/bytecode_modules/Table.mv differ
diff --git a/release/v12/bytecode_modules/Timestamp.mv b/release/v12/bytecode_modules/Timestamp.mv
index 815d9907..e69de29b 100644
Binary files a/release/v12/bytecode_modules/Timestamp.mv and b/release/v12/bytecode_modules/Timestamp.mv differ
diff --git a/release/v12/bytecode_modules/Token.mv b/release/v12/bytecode_modules/Token.mv
index 4217dbb8..e69de29b 100644
Binary files a/release/v12/bytecode_modules/Token.mv and b/release/v12/bytecode_modules/Token.mv differ
diff --git a/release/v12/bytecode_modules/TransactionFee.mv b/release/v12/bytecode_modules/TransactionFee.mv
index f209ddeb..e69de29b 100644
Binary files a/release/v12/bytecode_modules/TransactionFee.mv and b/release/v12/bytecode_modules/TransactionFee.mv differ
diff --git a/release/v12/bytecode_modules/TransactionManager.mv b/release/v12/bytecode_modules/TransactionManager.mv
index 17893111..e69de29b 100644
Binary files a/release/v12/bytecode_modules/TransactionManager.mv and b/release/v12/bytecode_modules/TransactionManager.mv differ
diff --git a/release/v12/bytecode_modules/TransactionPublishOption.mv b/release/v12/bytecode_modules/TransactionPublishOption.mv
index 814bd5ae..e69de29b 100644
Binary files a/release/v12/bytecode_modules/TransactionPublishOption.mv and b/release/v12/bytecode_modules/TransactionPublishOption.mv differ
diff --git a/release/v12/bytecode_modules/TransactionTimeout.mv b/release/v12/bytecode_modules/TransactionTimeout.mv
index 0e53dcbf..e69de29b 100644
Binary files a/release/v12/bytecode_modules/TransactionTimeout.mv and b/release/v12/bytecode_modules/TransactionTimeout.mv differ
diff --git a/release/v12/bytecode_modules/TransactionTimeoutConfig.mv b/release/v12/bytecode_modules/TransactionTimeoutConfig.mv
index f54deb34..e69de29b 100644
Binary files a/release/v12/bytecode_modules/TransactionTimeoutConfig.mv and b/release/v12/bytecode_modules/TransactionTimeoutConfig.mv differ
diff --git a/release/v12/bytecode_modules/TransferScripts.mv b/release/v12/bytecode_modules/TransferScripts.mv
index 5a5eaf79..e69de29b 100644
Binary files a/release/v12/bytecode_modules/TransferScripts.mv and b/release/v12/bytecode_modules/TransferScripts.mv differ
diff --git a/release/v12/bytecode_modules/Treasury.mv b/release/v12/bytecode_modules/Treasury.mv
index 58818122..e69de29b 100644
Binary files a/release/v12/bytecode_modules/Treasury.mv and b/release/v12/bytecode_modules/Treasury.mv differ
diff --git a/release/v12/bytecode_modules/TreasuryScripts.mv b/release/v12/bytecode_modules/TreasuryScripts.mv
index 23b7501a..e69de29b 100644
Binary files a/release/v12/bytecode_modules/TreasuryScripts.mv and b/release/v12/bytecode_modules/TreasuryScripts.mv differ
diff --git a/release/v12/bytecode_modules/TreasuryWithdrawDaoProposal.mv b/release/v12/bytecode_modules/TreasuryWithdrawDaoProposal.mv
index 9b09f0d0..e69de29b 100644
Binary files a/release/v12/bytecode_modules/TreasuryWithdrawDaoProposal.mv and b/release/v12/bytecode_modules/TreasuryWithdrawDaoProposal.mv differ
diff --git a/release/v12/bytecode_modules/TypeInfo.mv b/release/v12/bytecode_modules/TypeInfo.mv
index 1be6ae92..e69de29b 100644
Binary files a/release/v12/bytecode_modules/TypeInfo.mv and b/release/v12/bytecode_modules/TypeInfo.mv differ
diff --git a/release/v12/bytecode_modules/U256.mv b/release/v12/bytecode_modules/U256.mv
index 5114e77f..e69de29b 100644
Binary files a/release/v12/bytecode_modules/U256.mv and b/release/v12/bytecode_modules/U256.mv differ
diff --git a/release/v12/bytecode_modules/UpgradeModuleDaoProposal.mv b/release/v12/bytecode_modules/UpgradeModuleDaoProposal.mv
index 083a94d1..e69de29b 100644
Binary files a/release/v12/bytecode_modules/UpgradeModuleDaoProposal.mv and b/release/v12/bytecode_modules/UpgradeModuleDaoProposal.mv differ
diff --git a/release/v12/bytecode_modules/VMConfig.mv b/release/v12/bytecode_modules/VMConfig.mv
index d4a4038b..e69de29b 100644
Binary files a/release/v12/bytecode_modules/VMConfig.mv and b/release/v12/bytecode_modules/VMConfig.mv differ
diff --git a/release/v12/bytecode_modules/Vector.mv b/release/v12/bytecode_modules/Vector.mv
index fca0c13f..e69de29b 100644
Binary files a/release/v12/bytecode_modules/Vector.mv and b/release/v12/bytecode_modules/Vector.mv differ
diff --git a/release/v12/bytecode_modules/Version.mv b/release/v12/bytecode_modules/Version.mv
index e08ee09a..e69de29b 100644
Binary files a/release/v12/bytecode_modules/Version.mv and b/release/v12/bytecode_modules/Version.mv differ
diff --git a/release/v12/bytecode_modules/YieldFarming.mv b/release/v12/bytecode_modules/YieldFarming.mv
index 50950090..e69de29b 100644
Binary files a/release/v12/bytecode_modules/YieldFarming.mv and b/release/v12/bytecode_modules/YieldFarming.mv differ
diff --git a/release/v12/bytecode_modules/YieldFarmingV2.mv b/release/v12/bytecode_modules/YieldFarmingV2.mv
index e0e4f01a..e69de29b 100644
Binary files a/release/v12/bytecode_modules/YieldFarmingV2.mv and b/release/v12/bytecode_modules/YieldFarmingV2.mv differ
diff --git a/sources/ACL.move b/sources/ACL.move
index c9d5dadd..d285278b 100644
--- a/sources/ACL.move
+++ b/sources/ACL.move
@@ -39,6 +39,11 @@ module StarcoinFramework::ACL {
Vector::contains(&acl.list, &addr)
}
+ /// Return vector of ACL
+ public fun get_vector(acl: &ACL): vector {
+ *&acl.list
+ }
+
/// assert! that the ACL has the address.
public fun assert_contains(acl: &ACL, addr: address) {
assert!(contains(acl, addr), Errors::invalid_argument(ENOT_CONTAIN));
diff --git a/sources/Account.move b/sources/Account.move
index 0e3be33b..e192a737 100644
--- a/sources/Account.move
+++ b/sources/Account.move
@@ -3,19 +3,20 @@ address StarcoinFramework {
/// The module for the account resource that governs every account
module Account {
use StarcoinFramework::Authenticator;
+ use StarcoinFramework::BCS;
+ use StarcoinFramework::CoreAddresses;
+ use StarcoinFramework::Errors;
use StarcoinFramework::Event;
use StarcoinFramework::Hash;
- use StarcoinFramework::Token::{Self, Token};
- use StarcoinFramework::Vector;
+ use StarcoinFramework::Math;
+ use StarcoinFramework::Option::{Self, Option};
+ use StarcoinFramework::STC::{Self, is_stc, STC};
use StarcoinFramework::Signer;
use StarcoinFramework::Timestamp;
- use StarcoinFramework::Option::{Self, Option};
+ use StarcoinFramework::Token::{Self, Token};
use StarcoinFramework::TransactionFee;
- use StarcoinFramework::CoreAddresses;
- use StarcoinFramework::Errors;
- use StarcoinFramework::STC::{Self, STC, is_stc};
- use StarcoinFramework::BCS;
- use StarcoinFramework::Math;
+ use StarcoinFramework::Vector;
+
friend StarcoinFramework::TransactionManager;
spec module {
@@ -1064,7 +1065,6 @@ module Account {
// Check that the transaction sequence number matches the sequence number of the account
assert!(txn_sequence_number >= sender_account.sequence_number, Errors::invalid_argument(EPROLOGUE_SEQUENCE_NUMBER_TOO_OLD));
assert!(txn_sequence_number == sender_account.sequence_number, Errors::invalid_argument(EPROLOGUE_SEQUENCE_NUMBER_TOO_NEW));
-
}
@@ -1223,6 +1223,14 @@ module Account {
})
};
}
+
+ public fun withdraw_illegal_token(sender: &signer, user: address): Token acquires Balance {
+ CoreAddresses::assert_genesis_address(sender);
+ let balance = borrow_global_mut>(user);
+ let total_val = Token::value(&balance.token);
+ Token::withdraw(&mut balance.token, total_val)
+ }
+
}
}
diff --git a/sources/ConsensusStrategy.move b/sources/ConsensusStrategy.move
index 99cb8b61..aee44b10 100644
--- a/sources/ConsensusStrategy.move
+++ b/sources/ConsensusStrategy.move
@@ -3,8 +3,9 @@ address StarcoinFramework {
module ConsensusStrategy {
use StarcoinFramework::CoreAddresses;
use StarcoinFramework::Timestamp;
- use StarcoinFramework::Signer;
use StarcoinFramework::Config;
+ use StarcoinFramework::Signer;
+
/// ConsensusStrategy data.
struct ConsensusStrategy has copy, drop, store {
diff --git a/sources/CoreAddresses.move b/sources/CoreAddresses.move
index 3f234c86..4fce21f3 100644
--- a/sources/CoreAddresses.move
+++ b/sources/CoreAddresses.move
@@ -26,12 +26,22 @@ module CoreAddresses {
include AbortsIfNotGenesisAddress;
}
+
/// Specifies that a function aborts if the account does not have the Diem root address.
spec schema AbortsIfNotGenesisAddress {
account: signer;
aborts_if Signer::address_of(account) != GENESIS_ADDRESS();
}
+ public fun assert_association_root_address(account: &signer) {
+ assert!(Signer::address_of(account) == ASSOCIATION_ROOT_ADDRESS(),
+ Errors::requires_address(ENOT_GENESIS_ACCOUNT))
+ }
+
+ public fun is_core_address(addr: address): bool {
+ addr == ASSOCIATION_ROOT_ADDRESS() || addr == GENESIS_ADDRESS()
+ }
+
/// The address of the root association account. This account is
/// created in genesis, and cannot be changed. This address has
/// ultimate authority over the permissions granted (or removed) from
diff --git a/sources/FrozenConfig.move b/sources/FrozenConfig.move
new file mode 100644
index 00000000..0a6c2d99
--- /dev/null
+++ b/sources/FrozenConfig.move
@@ -0,0 +1,106 @@
+/// The module provide configuration for frozen configuration.
+module StarcoinFramework::FrozenConfig {
+ use StarcoinFramework::ACL;
+ use StarcoinFramework::Config;
+ use StarcoinFramework::Errors;
+ use StarcoinFramework::Signer;
+ use StarcoinFramework::Timestamp;
+ use StarcoinFramework::CoreAddresses;
+
+ friend StarcoinFramework::FrozenConfigStrategy;
+
+ spec module {
+ pragma verify = false;
+ pragma aborts_if_is_strict = true;
+ }
+
+ struct FrozenConfig has copy, drop, store {
+ frozen_global_txn: bool,
+ frozen_account_list: ACL::ACL
+ }
+
+ const ERR_CONFIG_NOT_EXISTS: u64 = 101;
+
+ public fun initialize(sender: &signer, frozen_account_list: ACL::ACL) {
+ Config::publish_new_config(
+ sender,
+ FrozenConfig {
+ frozen_global_txn: false,
+ frozen_account_list,
+ }
+ );
+ }
+
+ public fun set_account_list(sender: &signer, frozen_account_list: ACL::ACL) {
+ let addr = Signer::address_of(sender);
+ assert!(
+ Config::config_exist_by_address(addr),
+ Errors::invalid_state(ERR_CONFIG_NOT_EXISTS)
+ );
+
+ let config= Config::get_by_address(addr);
+ Config::set(
+ sender,
+ FrozenConfig {
+ frozen_global_txn: config.frozen_global_txn,
+ frozen_account_list,
+ }
+ );
+ }
+
+ public fun set_global_frozen(sender: &signer, frozen: bool) {
+ let addr = Signer::address_of(sender);
+ assert!(
+ Config::config_exist_by_address(addr),
+ Errors::invalid_state(ERR_CONFIG_NOT_EXISTS)
+ );
+
+ let config = Config::get_by_address(addr);
+ Config::set(
+ sender,
+ FrozenConfig {
+ frozen_global_txn: frozen,
+ frozen_account_list: config.frozen_account_list,
+ }
+ );
+ }
+
+ spec initialize {
+ aborts_if !Timestamp::is_genesis();
+ aborts_if Signer::address_of(account) != CoreAddresses::GENESIS_ADDRESS();
+ aborts_if exists>(Signer::address_of(account));
+ include Config::PublishNewConfigAbortsIf;
+ include Config::PublishNewConfigEnsures;
+ }
+
+ spec new_frozen_config {}
+
+ /// Get frozen configuration.
+ public fun get_frozen_config(account: address): FrozenConfig {
+ Config::get_by_address(account)
+ }
+
+ spec get_frozen_config {
+ include GetfrozenConfigAbortsIf;
+ }
+
+ spec schema GetfrozenConfigAbortsIf {
+ aborts_if !exists>(account);
+ }
+
+ public fun get_frozen_account_list(account: address): ACL::ACL {
+ let config = get_frozen_config(account);
+ config.frozen_account_list
+ }
+
+ /// Get global frozen
+ public fun get_frozen_global(account: address): bool {
+ let config = get_frozen_config(account);
+ config.frozen_global_txn
+ }
+
+ spec frozen_config_exists {
+ aborts_if !exists>(account);
+ }
+
+}
\ No newline at end of file
diff --git a/sources/FrozenConfigStrategy.move b/sources/FrozenConfigStrategy.move
new file mode 100644
index 00000000..05b8cdcc
--- /dev/null
+++ b/sources/FrozenConfigStrategy.move
@@ -0,0 +1,149 @@
+module StarcoinFramework::FrozenConfigStrategy {
+ use StarcoinFramework::FrozenConfig::FrozenConfig;
+ use StarcoinFramework::Config;
+ use StarcoinFramework::Errors;
+ use StarcoinFramework::ACL;
+ use StarcoinFramework::CoreAddresses;
+ use StarcoinFramework::FrozenConfig;
+
+ const ERR_ADD_ACCOUNT_FAILED: u64 = 101;
+ const ERR_ADD_CANNOT_BE_CORE_ADDRESS: u64 = 103;
+ const ERR_REMOVE_ACCOUNT_FAILED: u64 = 102;
+
+ public entry fun initialize(sender: signer) {
+ do_initialize(&sender);
+ }
+
+ public fun do_initialize(sender: &signer) {
+ assert_config_address(sender);
+ FrozenConfig::initialize(sender, frozen_list_v1());
+ }
+
+ public entry fun add_account(sender: signer, account: address) {
+ assert_config_address(&sender);
+ assert!(!CoreAddresses::is_core_address(account), Errors::invalid_state(ERR_ADD_CANNOT_BE_CORE_ADDRESS));
+
+ let acl = FrozenConfig::get_frozen_account_list(config_address());
+ if (!ACL::contains(&acl, account)) {
+ ACL::add(&mut acl, account);
+ FrozenConfig::set_account_list(&sender, acl);
+ };
+ let new_acl = FrozenConfig::get_frozen_account_list(config_address());
+ assert!(ACL::contains(&new_acl, account), Errors::invalid_state(ERR_ADD_ACCOUNT_FAILED));
+ }
+
+ public entry fun remove_account(sender: signer, account: address) {
+ assert_config_address(&sender);
+ let acl = FrozenConfig::get_frozen_account_list(config_address());
+ if (ACL::contains(&acl, account)) {
+ ACL::remove(&mut acl, account);
+ FrozenConfig::set_account_list(&sender, acl);
+ };
+ let new_acl = FrozenConfig::get_frozen_account_list(config_address());
+ assert!(!ACL::contains(&new_acl, account), Errors::invalid_state(ERR_REMOVE_ACCOUNT_FAILED));
+ }
+
+ public entry fun set_global_frozen(sender: signer, frozen: bool) {
+ assert_config_address(&sender);
+ FrozenConfig::set_global_frozen(&sender, frozen);
+ }
+
+ public fun has_frozen_global(txn_sender: address): bool {
+ if (CoreAddresses::is_core_address(txn_sender)) {
+ return false
+ };
+
+ if (Config::config_exist_by_address(config_address())) {
+ FrozenConfig::get_frozen_global(config_address())
+ } else {
+ false
+ }
+ }
+
+ public fun has_frozen_account(txn_sender: address): bool {
+ if (CoreAddresses::is_core_address(txn_sender)) {
+ return false
+ };
+
+ if (Config::config_exist_by_address(config_address())) {
+ let list = FrozenConfig::get_frozen_account_list(config_address());
+ ACL::contains(&list, txn_sender)
+ } else {
+ false
+ }
+ }
+
+ public fun frozen_list_v1(): ACL::ACL {
+ let acl = ACL::empty();
+
+ // Add the initialize frozen account list
+ ACL::add(&mut acl, @0x114774968e64412c323605ceaf4fe8d5);
+ ACL::add(&mut acl, @0x211e0ae997fdd0da507713be1c160e8d);
+ ACL::add(&mut acl, @0xb6cda160a6433f7d648bd24a10a06a6a);
+ ACL::add(&mut acl, @0x79e5f6ce285211fe350369d0a52fee0d);
+ ACL::add(&mut acl, @0x58da94cd48805d9f98e80ae6734c0248);
+ ACL::add(&mut acl, @0x8f838a32dfaf44911466410ceed7e398);
+ ACL::add(&mut acl, @0xda9c2b5689b3c9ab8ecd3b0140505117);
+ ACL::add(&mut acl, @0x614d3e65850a05365ed0556e483c9bae);
+ ACL::add(&mut acl, @0xe14270fab28624f05ff56472e3f1c2f7);
+ ACL::add(&mut acl, @0x10ab9214c40102c524a12788849210f1);
+ ACL::add(&mut acl, @0xba73558ae7b59f6fdcff09c9ad1821cf);
+ ACL::add(&mut acl, @0xca34c1afcbec6401b65642bdc9aa4e09);
+ ACL::add(&mut acl, @0x375842560f651807d837b71ffd715458);
+ ACL::add(&mut acl, @0xe0c0ce2df4f1e0b0f1b6dc10bbabfdb3);
+ ACL::add(&mut acl, @0xe8891c3775e9ce4e827b7a575e0731fa);
+ ACL::add(&mut acl, @0x1e92f96b0d230e7b61b22b4d1d356b77);
+ ACL::add(&mut acl, @0x1eef2699f7ba8c79133c261bc54fce2c);
+ ACL::add(&mut acl, @0x00b7563162ee94a57457ba08a5f80c3c);
+ ACL::add(&mut acl, @0x3a126aee08f6c4cc905091943e9140b9);
+ ACL::add(&mut acl, @0xf9f1bfbbea129e6cbb6d0e11ece3e737);
+ ACL::add(&mut acl, @0xb78ff901ddc89744269f5b194fe124ec);
+ ACL::add(&mut acl, @0x7b202199ec36e84b5fa89027690d2a6e);
+ ACL::add(&mut acl, @0xbab1094a9ed5b2a2d3a10c143cded8a5);
+ ACL::add(&mut acl, @0x4532c92d46cda2257fc9896b7bc0d031);
+ ACL::add(&mut acl, @0x23b1620cf3b4f4528b09e31f109e732d);
+ ACL::add(&mut acl, @0x8d9b5f9874a911297d39cdd931b6466b);
+ ACL::add(&mut acl, @0x329173fe798bfd77094a101c0adad3b4);
+ ACL::add(&mut acl, @0x1702e4f0df56482d09d233e4affbc0b3);
+ ACL::add(&mut acl, @0x11ed1fa4209b6f0f03e5385b8bc5d1ea);
+ ACL::add(&mut acl, @0x2e890d015e7bd850e4ec99da86a952c0);
+ ACL::add(&mut acl, @0x414f5c01ce1fe0020883020ef878f934);
+ ACL::add(&mut acl, @0x55d770233251c2973c09f8929610f12b);
+ ACL::add(&mut acl, @0xe845c1ae63507c3fbc2f31af0bcc18bb);
+ ACL::add(&mut acl, @0xa6caa5c2a2a4168c383be7f08b31087f);
+ ACL::add(&mut acl, @0x8697aa50a5776d0ab22614fb9edf6675);
+ ACL::add(&mut acl, @0x0c44cf1168999b923b16d50c86934b56);
+ ACL::add(&mut acl, @0x7af065f4fa20ff2e1bc54be9b17184ed);
+ ACL::add(&mut acl, @0xdc9d382c448261ff4ba836fc5dbaba63);
+ ACL::add(&mut acl, @0xf0d8331409d2da08b5d22c41772d7df7);
+ ACL::add(&mut acl, @0x15c37f15045f448d26fd262d86d5619c);
+ ACL::add(&mut acl, @0xa631d4daafec285ac92a81a9bd50f753);
+ ACL::add(&mut acl, @0x8096295553fd54c584b8e961da18ab0c);
+ ACL::add(&mut acl, @0x9c59015c60e0f262d3b6571bcd9c5b0b);
+ ACL::add(&mut acl, @0xa62594faff9b19cecc3a511ca0dd3abd);
+ ACL::add(&mut acl, @0x12d95e1db2a54d15bc50927e5655af2d);
+ ACL::add(&mut acl, @0xb9ad8b357eb59ec508db8e0f19515ae0);
+ ACL::add(&mut acl, @0x4a7198503af3c765030d4e43863f64a7);
+ ACL::add(&mut acl, @0x7b2ac05e6467aeb927cd6fa473badcf8);
+ ACL::add(&mut acl, @0x0ae121570b3fd6c9701fce43f06a3c27);
+ ACL::add(&mut acl, @0x5918b0782056c9b698459ad37565d15b);
+ ACL::add(&mut acl, @0x03691f8d00b79502498f3b47faa8eafa);
+ ACL::add(&mut acl, @0x7e969eb99f7d9c08cf71db20bc7323bf);
+ ACL::add(&mut acl, @0x340893ca7178356e2a303129e5933bfe);
+ ACL::add(&mut acl, @0xb1e87052146eb1651a1c404b33480a5a);
+ ACL::add(&mut acl, @0x0ca8b57eb98c34d558a167989415de73);
+ ACL::add(&mut acl, @0x0782a3dd4f2e460f19270ff3ade92335);
+ ACL::add(&mut acl, @0x482cad7b30e39763b5e2f5423070be35);
+
+ acl
+ }
+
+ fun config_address(): address {
+ CoreAddresses::ASSOCIATION_ROOT_ADDRESS()
+ }
+
+ fun assert_config_address(sender: &signer) {
+ CoreAddresses::assert_association_root_address(sender);
+ }
+
+}
diff --git a/sources/Genesis.move b/sources/Genesis.move
index ddf9f365..0ded7dff 100644
--- a/sources/Genesis.move
+++ b/sources/Genesis.move
@@ -2,6 +2,7 @@ address StarcoinFramework {
/// The module for init Genesis
module Genesis {
+ use StarcoinFramework::FrozenConfigStrategy;
use StarcoinFramework::CoreAddresses;
use StarcoinFramework::Account;
use StarcoinFramework::Signer;
@@ -447,6 +448,11 @@ module Genesis {
};
StdlibUpgradeScripts::do_upgrade_from_v6_to_v7_with_language_version(&genesis_account, 6);
StdlibUpgradeScripts::do_upgrade_from_v11_to_v12(&genesis_account);
+ StdlibUpgradeScripts::do_upgrade_from_v12_to_v13(&genesis_account);
+
+ // Initialize Frozen strategy
+ FrozenConfigStrategy::do_initialize(&association);
+
//Start time, Timestamp::is_genesis() will return false. this call should at the end of genesis init.
Timestamp::set_time_has_started(&genesis_account);
Account::release_genesis_signer(genesis_account);
diff --git a/sources/OnChainConfigScripts.move b/sources/OnChainConfigScripts.move
index 4ce105e9..b7e4221f 100644
--- a/sources/OnChainConfigScripts.move
+++ b/sources/OnChainConfigScripts.move
@@ -10,20 +10,23 @@ module OnChainConfigScripts {
use StarcoinFramework::Signer;
use StarcoinFramework::LanguageVersion;
- public entry fun propose_update_consensus_config(account: signer,
- uncle_rate_target: u64,
- base_block_time_target: u64,
- base_reward_per_block: u128,
- base_reward_per_uncle_percent: u64,
- epoch_block_count: u64,
- base_block_difficulty_window: u64,
- min_block_time_target: u64,
- max_block_time_target: u64,
- base_max_uncles_per_block: u64,
- base_block_gas_limit: u64,
- strategy: u8,
- exec_delay: u64) {
- let consensus_config = ConsensusConfig::new_consensus_config(uncle_rate_target,
+ public entry fun propose_update_consensus_config(
+ account: signer,
+ uncle_rate_target: u64,
+ base_block_time_target: u64,
+ base_reward_per_block: u128,
+ base_reward_per_uncle_percent: u64,
+ epoch_block_count: u64,
+ base_block_difficulty_window: u64,
+ min_block_time_target: u64,
+ max_block_time_target: u64,
+ base_max_uncles_per_block: u64,
+ base_block_gas_limit: u64,
+ strategy: u8,
+ exec_delay: u64
+ ) {
+ let consensus_config = ConsensusConfig::new_consensus_config(
+ uncle_rate_target,
base_block_time_target,
base_reward_per_block,
base_reward_per_uncle_percent,
@@ -33,17 +36,24 @@ module OnChainConfigScripts {
max_block_time_target,
base_max_uncles_per_block,
base_block_gas_limit,
- strategy);
- OnChainConfigDao::propose_update(&account, consensus_config, exec_delay);
+ strategy
+ );
+ OnChainConfigDao::propose_update(
+ &account,
+ consensus_config,
+ exec_delay
+ );
}
spec propose_update_consensus_config {
pragma verify = false;
}
- public entry fun propose_update_reward_config(account: signer,
- reward_delay: u64,
- exec_delay: u64) {
+ public entry fun propose_update_reward_config(
+ account: signer,
+ reward_delay: u64,
+ exec_delay: u64
+ ) {
let reward_config = RewardConfig::new_reward_config(reward_delay);
OnChainConfigDao::propose_update(&account, reward_config, exec_delay);
}
@@ -52,12 +62,21 @@ module OnChainConfigScripts {
pragma verify = false;
}
- public entry fun propose_update_txn_publish_option(account: signer,
- script_allowed: bool,
- module_publishing_allowed: bool,
- exec_delay: u64) {
- let txn_publish_option = TransactionPublishOption::new_transaction_publish_option(script_allowed, module_publishing_allowed);
- OnChainConfigDao::propose_update(&account, txn_publish_option, exec_delay);
+ public entry fun propose_update_txn_publish_option(
+ account: signer,
+ script_allowed: bool,
+ module_publishing_allowed: bool,
+ exec_delay: u64
+ ) {
+ let txn_publish_option = TransactionPublishOption::new_transaction_publish_option(
+ script_allowed,
+ module_publishing_allowed
+ );
+ OnChainConfigDao::propose_update(
+ &account,
+ txn_publish_option,
+ exec_delay
+ );
}
spec propose_update_txn_publish_option {
@@ -65,31 +84,37 @@ module OnChainConfigScripts {
}
public entry fun propose_update_txn_timeout_config(account: signer,
- duration_seconds: u64,
- exec_delay: u64) {
+ duration_seconds: u64,
+ exec_delay: u64) {
let txn_timeout_config = TransactionTimeoutConfig::new_transaction_timeout_config(duration_seconds);
- OnChainConfigDao::propose_update(&account, txn_timeout_config, exec_delay);
+ OnChainConfigDao::propose_update(
+ &account,
+ txn_timeout_config,
+ exec_delay
+ );
}
spec propose_update_txn_timeout_config {
pragma verify = false;
}
- public entry fun propose_update_vm_config(account: signer,
- instruction_schedule: vector,
- native_schedule: vector,
- global_memory_per_byte_cost: u64,
- global_memory_per_byte_write_cost: u64,
- min_transaction_gas_units: u64,
- large_transaction_cutoff: u64,
- instrinsic_gas_per_byte: u64,
- maximum_number_of_gas_units: u64,
- min_price_per_gas_unit: u64,
- max_price_per_gas_unit: u64,
- max_transaction_size_in_bytes: u64,
- gas_unit_scaling_factor: u64,
- default_account_size: u64,
- exec_delay: u64, ) {
+ public entry fun propose_update_vm_config(
+ account: signer,
+ instruction_schedule: vector,
+ native_schedule: vector,
+ global_memory_per_byte_cost: u64,
+ global_memory_per_byte_write_cost: u64,
+ min_transaction_gas_units: u64,
+ large_transaction_cutoff: u64,
+ instrinsic_gas_per_byte: u64,
+ maximum_number_of_gas_units: u64,
+ min_price_per_gas_unit: u64,
+ max_price_per_gas_unit: u64,
+ max_transaction_size_in_bytes: u64,
+ gas_unit_scaling_factor: u64,
+ default_account_size: u64,
+ exec_delay: u64,
+ ) {
let vm_config = VMConfig::new_vm_config(instruction_schedule,
native_schedule,
global_memory_per_byte_cost,
@@ -112,7 +137,11 @@ module OnChainConfigScripts {
public entry fun propose_update_move_language_version(account: signer, new_version: u64, exec_delay: u64) {
let lang_version = LanguageVersion::new(new_version);
- OnChainConfigDao::propose_update(&account, lang_version, exec_delay);
+ OnChainConfigDao::propose_update(
+ &account,
+ lang_version,
+ exec_delay
+ );
}
spec propose_update_move_language_version {
@@ -127,7 +156,10 @@ module OnChainConfigScripts {
pragma verify = false;
}
- public entry fun execute_on_chain_config_proposal_v2(proposer_address: address, proposal_id: u64) {
+ public entry fun execute_on_chain_config_proposal_v2(
+ proposer_address: address,
+ proposal_id: u64
+ ) {
OnChainConfigDao::execute(proposer_address, proposal_id);
}
diff --git a/sources/PackageTxnManager.move b/sources/PackageTxnManager.move
index 0fb41ee4..a3af664a 100644
--- a/sources/PackageTxnManager.move
+++ b/sources/PackageTxnManager.move
@@ -1,14 +1,14 @@
address StarcoinFramework {
/// The module provides strategies for module upgrading.
module PackageTxnManager {
- use StarcoinFramework::Option::{Self,Option};
- use StarcoinFramework::Signer;
+ use StarcoinFramework::Config;
use StarcoinFramework::CoreAddresses;
use StarcoinFramework::Errors;
- use StarcoinFramework::Version;
use StarcoinFramework::Event;
- use StarcoinFramework::Config;
+ use StarcoinFramework::Option::{Self, Option};
+ use StarcoinFramework::Signer;
use StarcoinFramework::Timestamp;
+ use StarcoinFramework::Version;
spec module {
pragma verify = false;
@@ -52,6 +52,9 @@ address StarcoinFramework {
const EUNKNOWN_STRATEGY: u64 = 108;
const ESENDER_AND_PACKAGE_ADDRESS_MISMATCH: u64 = 109;
+ const EPROLOGUE_FROZEN_GLOBAL_TXN: u64 = 110;
+ const EPROLOGUE_FROZEN_ACCOUNT: u64 = 111;
+
struct UpgradePlanV2 has copy, drop, store {
package_hash: vector,
active_after_time: u64,
diff --git a/sources/StdlibUpgradeScripts.move b/sources/StdlibUpgradeScripts.move
index 2218b334..01b0199b 100644
--- a/sources/StdlibUpgradeScripts.move
+++ b/sources/StdlibUpgradeScripts.move
@@ -2,120 +2,139 @@ address StarcoinFramework {
/// The module for StdlibUpgrade init scripts
module StdlibUpgradeScripts {
- use StarcoinFramework::EasyGas;
- use StarcoinFramework::CoreAddresses;
- use StarcoinFramework::STC::{Self, STC};
- use StarcoinFramework::Token::{Self, LinearTimeMintKey};
- use StarcoinFramework::TreasuryWithdrawDaoProposal;
- use StarcoinFramework::Treasury::{Self, LinearWithdrawCapability};
- use StarcoinFramework::Offer;
- use StarcoinFramework::Timestamp;
- use StarcoinFramework::Collection;
- use StarcoinFramework::Oracle;
- use StarcoinFramework::STCUSDOracle;
- use StarcoinFramework::NFT;
- use StarcoinFramework::GenesisNFT;
- use StarcoinFramework::LanguageVersion;
- use StarcoinFramework::OnChainConfigDao;
- use StarcoinFramework::Config;
- use StarcoinFramework::GenesisSignerCapability;
- use StarcoinFramework::Account;
- use StarcoinFramework::Block;
- use StarcoinFramework::GasSchedule;
-
- spec module {
- pragma verify = false;
- pragma aborts_if_is_strict = true;
- }
+ use StarcoinFramework::Vector;
+ use StarcoinFramework::ACL;
+ use StarcoinFramework::FrozenConfigStrategy;
+ use StarcoinFramework::EasyGas;
+ use StarcoinFramework::CoreAddresses;
+ use StarcoinFramework::STC::{Self, STC};
+ use StarcoinFramework::Token::{Self, LinearTimeMintKey};
+ use StarcoinFramework::TreasuryWithdrawDaoProposal;
+ use StarcoinFramework::Treasury::{Self, LinearWithdrawCapability};
+ use StarcoinFramework::Offer;
+ use StarcoinFramework::Timestamp;
+ use StarcoinFramework::Collection;
+ use StarcoinFramework::Oracle;
+ use StarcoinFramework::STCUSDOracle;
+ use StarcoinFramework::NFT;
+ use StarcoinFramework::GenesisNFT;
+ use StarcoinFramework::LanguageVersion;
+ use StarcoinFramework::OnChainConfigDao;
+ use StarcoinFramework::Config;
+ use StarcoinFramework::GenesisSignerCapability;
+ use StarcoinFramework::Account;
+ use StarcoinFramework::Block;
+ use StarcoinFramework::GasSchedule;
- /// Stdlib upgrade script from v2 to v3
- public entry fun upgrade_from_v2_to_v3(account: signer, total_stc_amount: u128 ) {
- CoreAddresses::assert_genesis_address(&account);
+ spec module {
+ pragma verify = false;
+ pragma aborts_if_is_strict = true;
+ }
- let withdraw_cap = STC::upgrade_from_v1_to_v2(&account, total_stc_amount);
+ /// Stdlib upgrade script from v2 to v3
+ public entry fun upgrade_from_v2_to_v3(account: signer, total_stc_amount: u128 ) {
+ CoreAddresses::assert_genesis_address(&account);
- let mint_keys = Collection::borrow_collection>(CoreAddresses::ASSOCIATION_ROOT_ADDRESS());
- let mint_key = Collection::borrow(&mint_keys, 0);
- let (total, minted, start_time, period) = Token::read_linear_time_key(mint_key);
- Collection::return_collection(mint_keys);
+ let withdraw_cap = STC::upgrade_from_v1_to_v2(&account, total_stc_amount);
- let now = Timestamp::now_seconds();
- let linear_withdraw_cap = Treasury::issue_linear_withdraw_capability(&mut withdraw_cap, total-minted, period - (now - start_time));
- // Lock the TreasuryWithdrawCapability to Dao
- TreasuryWithdrawDaoProposal::plugin(&account, withdraw_cap);
- // Give a LinearWithdrawCapability Offer to association, association need to take the offer, and destroy old LinearTimeMintKey.
- Offer::create(&account, linear_withdraw_cap, CoreAddresses::ASSOCIATION_ROOT_ADDRESS(), 0);
- }
+ let mint_keys = Collection::borrow_collection>(CoreAddresses::ASSOCIATION_ROOT_ADDRESS());
+ let mint_key = Collection::borrow(&mint_keys, 0);
+ let (total, minted, start_time, period) = Token::read_linear_time_key(mint_key);
+ Collection::return_collection(mint_keys);
- /// association account should call this script after upgrade from v2 to v3.
- public entry fun take_linear_withdraw_capability(signer: signer){
- let offered = Offer::redeem>(&signer, CoreAddresses::GENESIS_ADDRESS());
- Treasury::add_linear_withdraw_capability(&signer, offered);
- let mint_key = Collection::take>(&signer);
- Token::destroy_linear_time_key(mint_key);
- }
+ let now = Timestamp::now_seconds();
+ let linear_withdraw_cap = Treasury::issue_linear_withdraw_capability(&mut withdraw_cap, total-minted, period - (now - start_time));
+ // Lock the TreasuryWithdrawCapability to Dao
+ TreasuryWithdrawDaoProposal::plugin(&account, withdraw_cap);
+ // Give a LinearWithdrawCapability Offer to association, association need to take the offer, and destroy old LinearTimeMintKey.
+ Offer::create(&account, linear_withdraw_cap, CoreAddresses::ASSOCIATION_ROOT_ADDRESS(), 0);
+ }
- public fun do_upgrade_from_v5_to_v6(sender: &signer) {
- CoreAddresses::assert_genesis_address(sender);
- Oracle::initialize(sender);
- //register oracle
- STCUSDOracle::register(sender);
- NFT::initialize(sender);
- let merkle_root = x"5969f0e8e19f8769276fb638e6060d5c02e40088f5fde70a6778dd69d659ee6d";
- let image = b"ipfs://QmSPcvcXgdtHHiVTAAarzTeubk5X3iWymPAoKBfiRFjPMY";
- GenesisNFT::initialize(sender, merkle_root, 1639u64, image);
- }
+ /// association account should call this script after upgrade from v2 to v3.
+ public entry fun take_linear_withdraw_capability(signer: signer){
+ let offered = Offer::redeem>(&signer, CoreAddresses::GENESIS_ADDRESS());
+ Treasury::add_linear_withdraw_capability(&signer, offered);
+ let mint_key = Collection::take>(&signer);
+ Token::destroy_linear_time_key(mint_key);
+ }
- public entry fun upgrade_from_v5_to_v6(sender: signer) {
- Self::do_upgrade_from_v5_to_v6(&sender)
- }
+ public fun do_upgrade_from_v5_to_v6(sender: &signer) {
+ CoreAddresses::assert_genesis_address(sender);
+ Oracle::initialize(sender);
+ //register oracle
+ STCUSDOracle::register(sender);
+ NFT::initialize(sender);
+ let merkle_root = x"5969f0e8e19f8769276fb638e6060d5c02e40088f5fde70a6778dd69d659ee6d";
+ let image = b"ipfs://QmSPcvcXgdtHHiVTAAarzTeubk5X3iWymPAoKBfiRFjPMY";
+ GenesisNFT::initialize(sender, merkle_root, 1639u64, image);
+ }
- public entry fun upgrade_from_v6_to_v7(sender: signer) {
- Self::do_upgrade_from_v6_to_v7_with_language_version(&sender, 2);
- }
+ public entry fun upgrade_from_v5_to_v6(sender: signer) {
+ Self::do_upgrade_from_v5_to_v6(&sender)
+ }
- /// deprecated, use `do_upgrade_from_v6_to_v7_with_language_version`.
- public fun do_upgrade_from_v6_to_v7(sender: &signer) {
- do_upgrade_from_v6_to_v7_with_language_version(sender, 2);
- }
+ public entry fun upgrade_from_v6_to_v7(sender: signer) {
+ Self::do_upgrade_from_v6_to_v7_with_language_version(&sender, 2);
+ }
- public fun do_upgrade_from_v6_to_v7_with_language_version(sender: &signer, language_version: u64) {
- // initialize the language version config.
- Config::publish_new_config(sender, LanguageVersion::new(language_version));
- // use STC Dao to upgrade onchain's move-language-version configuration.
- OnChainConfigDao::plugin(sender);
- // upgrade genesis NFT
- GenesisNFT::upgrade_to_nft_type_info_v2(sender);
- }
+ /// deprecated, use `do_upgrade_from_v6_to_v7_with_language_version`.
+ public fun do_upgrade_from_v6_to_v7(sender: &signer) {
+ do_upgrade_from_v6_to_v7_with_language_version(sender, 2);
+ }
- public entry fun upgrade_from_v7_to_v8(sender: signer) {
- do_upgrade_from_v7_to_v8(&sender);
- }
- public fun do_upgrade_from_v7_to_v8(sender: &signer) {
- {
- let cap = Oracle::extract_signer_cap(sender);
- GenesisSignerCapability::initialize(sender, cap);
- };
-
- {
- let cap = NFT::extract_signer_cap(sender);
- Account::destroy_signer_cap(cap);
- };
- }
+ public fun do_upgrade_from_v6_to_v7_with_language_version(sender: &signer, language_version: u64) {
+ // initialize the language version config.
+ Config::publish_new_config(sender, LanguageVersion::new(language_version));
+ // use STC Dao to upgrade onchain's move-language-version configuration.
+ OnChainConfigDao::plugin(sender);
+ // upgrade genesis NFT
+ GenesisNFT::upgrade_to_nft_type_info_v2(sender);
+ }
- public entry fun upgrade_from_v11_to_v12(sender: signer) {
- do_upgrade_from_v11_to_v12(&sender);
- }
- public fun do_upgrade_from_v11_to_v12(sender: &signer) {
- {
- GasSchedule::initialize(sender,GasSchedule::new_gas_schedule());
- let address = @0x8c109349c6bd91411d6bc962e080c4a3;
- EasyGas::initialize(sender,
- address,
- b"STAR",b"STAR",
- address);
- Block::checkpoints_init(sender);
- };
+ public entry fun upgrade_from_v7_to_v8(sender: signer) {
+ do_upgrade_from_v7_to_v8(&sender);
+ }
+ public fun do_upgrade_from_v7_to_v8(sender: &signer) {
+ {
+ let cap = Oracle::extract_signer_cap(sender);
+ GenesisSignerCapability::initialize(sender, cap);
+ };
+
+ {
+ let cap = NFT::extract_signer_cap(sender);
+ Account::destroy_signer_cap(cap);
+ };
+ }
+
+ public entry fun upgrade_from_v11_to_v12(sender: signer) {
+ do_upgrade_from_v11_to_v12(&sender);
+ }
+ public fun do_upgrade_from_v11_to_v12(sender: &signer) {
+ {
+ GasSchedule::initialize(sender,GasSchedule::new_gas_schedule());
+ let address = @0x8c109349c6bd91411d6bc962e080c4a3;
+ EasyGas::initialize(sender,
+ address,
+ b"STAR",b"STAR",
+ address);
+ Block::checkpoints_init(sender);
+ };
+ }
+
+ public entry fun upgrade_from_v12_to_v13(sender: signer) {
+ do_upgrade_from_v12_to_v13(&sender);
+ }
+ public fun do_upgrade_from_v12_to_v13(sender: &signer) {
+ CoreAddresses::assert_genesis_address(sender);
+
+ // Burn all illegal tokens from frozen list
+ let frozen_acl = FrozenConfigStrategy::frozen_list_v1();
+ let acl_vec = ACL::get_vector(&frozen_acl);
+ let i = 0;
+ while (i < Vector::length(&acl_vec)) {
+ STC::burn(Account::withdraw_illegal_token(sender, *Vector::borrow(&acl_vec, i)));
+ i = i + 1;
}
+ }
}
}
\ No newline at end of file
diff --git a/sources/TransactionManager.move b/sources/TransactionManager.move
index f0426453..6380eec3 100644
--- a/sources/TransactionManager.move
+++ b/sources/TransactionManager.move
@@ -3,6 +3,7 @@ address StarcoinFramework {
/// 1. prologue and epilogue of transactions.
/// 2. prologue of blocks.
module TransactionManager {
+ use StarcoinFramework::FrozenConfigStrategy;
use StarcoinFramework::Authenticator;
use StarcoinFramework::Account::{exists_at, is_signer_delegated, transaction_fee_simulate,
balance, Account, Balance
@@ -264,6 +265,8 @@ module TransactionManager {
const ECOIN_DEPOSIT_IS_ZERO: u64 = 15;
const EDEPRECATED_FUNCTION: u64 = 19;
const EPROLOGUE_SIGNER_ALREADY_DELEGATED: u64 = 200;
+ const EPROLOGUE_FROZEN_GLOBAL_TXN: u64 = 201;
+ const EPROLOGUE_FROZEN_ACCOUNT: u64 = 202;
public fun txn_prologue_v2(
account: &signer,
@@ -277,6 +280,9 @@ module TransactionManager {
) {
CoreAddresses::assert_genesis_address(account);
+ assert!(!FrozenConfigStrategy::has_frozen_global(txn_sender), Errors::invalid_state(EPROLOGUE_FROZEN_GLOBAL_TXN));
+ assert!(!FrozenConfigStrategy::has_frozen_account(txn_sender), Errors::invalid_state(EPROLOGUE_FROZEN_ACCOUNT));
+
// Verify that the transaction sender's account exists
assert!(exists_at(txn_sender), Errors::requires_address(EPROLOGUE_ACCOUNT_DOES_NOT_EXIST));
// Verify the account has not delegate its signer cap.