diff --git a/language/diem-framework/modules/doc/Globals.md b/language/diem-framework/modules/doc/Globals.md index eaf56b8d63..70ad3c4823 100644 --- a/language/diem-framework/modules/doc/Globals.md +++ b/language/diem-framework/modules/doc/Globals.md @@ -24,6 +24,8 @@ This module provides global variables and constants that have no specific owner - [Function `get_epoch_mining_thres_upper`](#0x1_Globals_get_epoch_mining_thres_upper) - [Function `get_unlock`](#0x1_Globals_get_unlock) - [Function `get_min_blocks_epoch`](#0x1_Globals_get_min_blocks_epoch) +- [Function `get_vouch_threshold`](#0x1_Globals_get_vouch_threshold) +- [Function `get_signing_threshold`](#0x1_Globals_get_signing_threshold) - [Function `get_constants`](#0x1_Globals_get_constants) @@ -113,6 +115,18 @@ epoch by a miner to remain compliant
+
+
+vouch_threshold: u64 +
+
+ +
+
+signing_threshold_pct: u64 +
+
+
@@ -381,6 +395,56 @@ Get the mining threshold + + + + +## Function `get_vouch_threshold` + +Get the threshold for unrelated vouchers per validator + + +
public fun get_vouch_threshold(): u64
+
+ + + +
+Implementation + + +
public fun get_vouch_threshold(): u64 {
+  get_constants().vouch_threshold
+}
+
+ + + +
+ + + +## Function `get_signing_threshold` + +Get the threshold of number of signed blocks in an epoch per validator + + +
public fun get_signing_threshold(): u64
+
+ + + +
+Implementation + + +
public fun get_signing_threshold(): u64 {
+  get_constants().signing_threshold_pct
+}
+
+ + +
@@ -414,6 +478,8 @@ Get the constants for the current network epoch_mining_thres_upper: 1000, // upper bound unlimited epoch_slow_wallet_unlock: 10, min_blocks_per_epoch: 0, + vouch_threshold: 0, + signing_threshold_pct: 3, } }; @@ -428,6 +494,8 @@ Get the constants for the current network epoch_mining_thres_upper: 72, // upper bound enforced at 20 mins per proof. epoch_slow_wallet_unlock: 10000000, min_blocks_per_epoch: 1000, + vouch_threshold: 0, + signing_threshold_pct: 3, } } else { return GlobalConstants { @@ -445,6 +513,8 @@ Get the constants for the current network epoch_mining_thres_upper: 72, // upper bound enforced at 20 mins per proof. epoch_slow_wallet_unlock: 1000 * COIN_SCALING_FACTOR, // approx 10 years for largest accounts in genesis. min_blocks_per_epoch: 10000, + vouch_threshold: 2, // Production is 2 vouchers per validator + signing_threshold_pct: 3, } } } diff --git a/language/diem-framework/modules/doc/Stats.md b/language/diem-framework/modules/doc/Stats.md index 8668e5ca4c..a04e8d7f44 100644 --- a/language/diem-framework/modules/doc/Stats.md +++ b/language/diem-framework/modules/doc/Stats.md @@ -29,6 +29,7 @@
use 0x1::CoreAddresses;
 use 0x1::Errors;
 use 0x1::FixedPoint32;
+use 0x1::Globals;
 use 0x1::Signer;
 use 0x1::Testnet;
 use 0x1::Vector;
@@ -331,7 +332,10 @@
   assert(sender == CoreAddresses::DIEM_ROOT_ADDRESS(), Errors::requires_role(190006));
   let range = height_end-height_start;
   // TODO: Change to 5 percent
-  let threshold_signing = FixedPoint32::multiply_u64(range, FixedPoint32::create_from_rational(5, 100));
+  let threshold_signing = FixedPoint32::multiply_u64(
+    range,
+    FixedPoint32::create_from_rational(Globals::get_signing_threshold(), 100)
+  );
   if (node_current_votes(vm, node_addr) >  threshold_signing) { return true };
   return false
 }
diff --git a/language/diem-framework/modules/doc/Vouch.md b/language/diem-framework/modules/doc/Vouch.md
index 48867f4cfa..cb60a37ecc 100644
--- a/language/diem-framework/modules/doc/Vouch.md
+++ b/language/diem-framework/modules/doc/Vouch.md
@@ -20,9 +20,8 @@
 
use 0x1::Ancestry;
 use 0x1::CoreAddresses;
 use 0x1::DiemSystem;
+use 0x1::Globals;
 use 0x1::Signer;
-use 0x1::StagingNet;
-use 0x1::Testnet;
 use 0x1::ValidatorUniverse;
 use 0x1::Vector;
 
@@ -355,15 +354,11 @@
public fun unrelated_buddies_above_thresh(val: address): bool acquires Vouch{
-  if (Testnet::is_testnet() || StagingNet::is_staging_net()) {
-    return true
-  };
-
   if (!exists<Vouch>(val)) return false;
 
   let len = Vector::length(&unrelated_buddies(val));
 
-  (len >= 4) // TODO: move to Globals
+  (len >= Globals::get_vouch_threshold())
 }
 
diff --git a/language/diem-framework/releases/artifacts/current/docs/modules/Globals.md b/language/diem-framework/releases/artifacts/current/docs/modules/Globals.md index eaf56b8d63..70ad3c4823 100644 --- a/language/diem-framework/releases/artifacts/current/docs/modules/Globals.md +++ b/language/diem-framework/releases/artifacts/current/docs/modules/Globals.md @@ -24,6 +24,8 @@ This module provides global variables and constants that have no specific owner - [Function `get_epoch_mining_thres_upper`](#0x1_Globals_get_epoch_mining_thres_upper) - [Function `get_unlock`](#0x1_Globals_get_unlock) - [Function `get_min_blocks_epoch`](#0x1_Globals_get_min_blocks_epoch) +- [Function `get_vouch_threshold`](#0x1_Globals_get_vouch_threshold) +- [Function `get_signing_threshold`](#0x1_Globals_get_signing_threshold) - [Function `get_constants`](#0x1_Globals_get_constants) @@ -113,6 +115,18 @@ epoch by a miner to remain compliant
+
+
+vouch_threshold: u64 +
+
+ +
+
+signing_threshold_pct: u64 +
+
+
@@ -381,6 +395,56 @@ Get the mining threshold + + + + +## Function `get_vouch_threshold` + +Get the threshold for unrelated vouchers per validator + + +
public fun get_vouch_threshold(): u64
+
+ + + +
+Implementation + + +
public fun get_vouch_threshold(): u64 {
+  get_constants().vouch_threshold
+}
+
+ + + +
+ + + +## Function `get_signing_threshold` + +Get the threshold of number of signed blocks in an epoch per validator + + +
public fun get_signing_threshold(): u64
+
+ + + +
+Implementation + + +
public fun get_signing_threshold(): u64 {
+  get_constants().signing_threshold_pct
+}
+
+ + +
@@ -414,6 +478,8 @@ Get the constants for the current network epoch_mining_thres_upper: 1000, // upper bound unlimited epoch_slow_wallet_unlock: 10, min_blocks_per_epoch: 0, + vouch_threshold: 0, + signing_threshold_pct: 3, } }; @@ -428,6 +494,8 @@ Get the constants for the current network epoch_mining_thres_upper: 72, // upper bound enforced at 20 mins per proof. epoch_slow_wallet_unlock: 10000000, min_blocks_per_epoch: 1000, + vouch_threshold: 0, + signing_threshold_pct: 3, } } else { return GlobalConstants { @@ -445,6 +513,8 @@ Get the constants for the current network epoch_mining_thres_upper: 72, // upper bound enforced at 20 mins per proof. epoch_slow_wallet_unlock: 1000 * COIN_SCALING_FACTOR, // approx 10 years for largest accounts in genesis. min_blocks_per_epoch: 10000, + vouch_threshold: 2, // Production is 2 vouchers per validator + signing_threshold_pct: 3, } } } diff --git a/language/diem-framework/releases/artifacts/current/docs/modules/Stats.md b/language/diem-framework/releases/artifacts/current/docs/modules/Stats.md index 8668e5ca4c..a04e8d7f44 100644 --- a/language/diem-framework/releases/artifacts/current/docs/modules/Stats.md +++ b/language/diem-framework/releases/artifacts/current/docs/modules/Stats.md @@ -29,6 +29,7 @@
use 0x1::CoreAddresses;
 use 0x1::Errors;
 use 0x1::FixedPoint32;
+use 0x1::Globals;
 use 0x1::Signer;
 use 0x1::Testnet;
 use 0x1::Vector;
@@ -331,7 +332,10 @@
   assert(sender == CoreAddresses::DIEM_ROOT_ADDRESS(), Errors::requires_role(190006));
   let range = height_end-height_start;
   // TODO: Change to 5 percent
-  let threshold_signing = FixedPoint32::multiply_u64(range, FixedPoint32::create_from_rational(5, 100));
+  let threshold_signing = FixedPoint32::multiply_u64(
+    range,
+    FixedPoint32::create_from_rational(Globals::get_signing_threshold(), 100)
+  );
   if (node_current_votes(vm, node_addr) >  threshold_signing) { return true };
   return false
 }
diff --git a/language/diem-framework/releases/artifacts/current/docs/modules/Vouch.md b/language/diem-framework/releases/artifacts/current/docs/modules/Vouch.md
index 48867f4cfa..cb60a37ecc 100644
--- a/language/diem-framework/releases/artifacts/current/docs/modules/Vouch.md
+++ b/language/diem-framework/releases/artifacts/current/docs/modules/Vouch.md
@@ -20,9 +20,8 @@
 
use 0x1::Ancestry;
 use 0x1::CoreAddresses;
 use 0x1::DiemSystem;
+use 0x1::Globals;
 use 0x1::Signer;
-use 0x1::StagingNet;
-use 0x1::Testnet;
 use 0x1::ValidatorUniverse;
 use 0x1::Vector;
 
@@ -355,15 +354,11 @@
public fun unrelated_buddies_above_thresh(val: address): bool acquires Vouch{
-  if (Testnet::is_testnet() || StagingNet::is_staging_net()) {
-    return true
-  };
-
   if (!exists<Vouch>(val)) return false;
 
   let len = Vector::length(&unrelated_buddies(val));
 
-  (len >= 4) // TODO: move to Globals
+  (len >= Globals::get_vouch_threshold())
 }
 
diff --git a/language/diem-framework/releases/artifacts/current/modules/023_Stats.mv b/language/diem-framework/releases/artifacts/current/modules/023_Stats.mv deleted file mode 100644 index 93b4ca32ee..0000000000 Binary files a/language/diem-framework/releases/artifacts/current/modules/023_Stats.mv and /dev/null differ diff --git a/language/diem-framework/releases/artifacts/current/modules/024_StagingNet.mv b/language/diem-framework/releases/artifacts/current/modules/024_StagingNet.mv deleted file mode 100644 index e83a2a6717..0000000000 Binary files a/language/diem-framework/releases/artifacts/current/modules/024_StagingNet.mv and /dev/null differ diff --git a/language/diem-framework/releases/artifacts/current/modules/025_Hash.mv b/language/diem-framework/releases/artifacts/current/modules/025_Hash.mv deleted file mode 100644 index cd88b742d2..0000000000 Binary files a/language/diem-framework/releases/artifacts/current/modules/025_Hash.mv and /dev/null differ diff --git a/language/diem-framework/releases/artifacts/current/modules/026_GAS.mv b/language/diem-framework/releases/artifacts/current/modules/026_GAS.mv deleted file mode 100644 index a793c6e901..0000000000 Binary files a/language/diem-framework/releases/artifacts/current/modules/026_GAS.mv and /dev/null differ diff --git a/language/diem-framework/releases/artifacts/current/modules/027_Globals.mv b/language/diem-framework/releases/artifacts/current/modules/027_Globals.mv deleted file mode 100644 index a34033cdf3..0000000000 Binary files a/language/diem-framework/releases/artifacts/current/modules/027_Globals.mv and /dev/null differ diff --git a/language/diem-framework/releases/artifacts/current/modules/036_Vouch.mv b/language/diem-framework/releases/artifacts/current/modules/036_Vouch.mv index e8b30a089b..ef336bee81 100644 Binary files a/language/diem-framework/releases/artifacts/current/modules/036_Vouch.mv and b/language/diem-framework/releases/artifacts/current/modules/036_Vouch.mv differ diff --git a/language/diem-framework/staged/stdlib.mv b/language/diem-framework/staged/stdlib.mv index 8f5dd19576..971a810008 100644 Binary files a/language/diem-framework/staged/stdlib.mv and b/language/diem-framework/staged/stdlib.mv differ diff --git a/ol/changelog/5_2_0.md b/ol/changelog/5_2_0.md new file mode 100644 index 0000000000..7aa2ddf4d6 --- /dev/null +++ b/ol/changelog/5_2_0.md @@ -0,0 +1,38 @@ +## 5.2.0 + +This upgrade impacts Carpe, Stdlib, and Node binaries. + +Upgrade steps: +1. Roll out Carpe updates to users (backwards compatible with 5.1.2 chain) +2. Validator operators deploy new binaries (backwards compatible with 5.1.2 chain) +2. Vote Stdlib upgrade + +## Deployment + +There is no need to update rust binaries. + +The stdlib payload hash for voting is: cc5c2236b1cd22cb82654ef2d62e01835498bed9d1c356c8157b061b78a2fe26 + + +Execute a lazy vote from a validator in the validator set with: +`txs oracle-upgrade --vote -h cc5c2236b1cd22cb82654ef2d62e01835498bed9d1c356c8157b061b78a2fe26` + +Or build from source and vote: +``` +cd libra +make stdlib +txs oracle-upgrade --vote -f + +``` +### Summary + +### Changes + +##### Move Changes + +[TODO] + +##### Rust Changes + +[TODO] +