Skip to content

Commit

Permalink
changelog and stdlib.mv
Browse files Browse the repository at this point in the history
  • Loading branch information
0o-de-lally committed Aug 11, 2022
1 parent c6d6c65 commit 4d0b3f6
Show file tree
Hide file tree
Showing 14 changed files with 192 additions and 16 deletions.
70 changes: 70 additions & 0 deletions language/diem-framework/modules/doc/Globals.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down Expand Up @@ -113,6 +115,18 @@ epoch by a miner to remain compliant
</dt>
<dd>

</dd>
<dt>
<code>vouch_threshold: u64</code>
</dt>
<dd>

</dd>
<dt>
<code>signing_threshold_pct: u64</code>
</dt>
<dd>

</dd>
</dl>

Expand Down Expand Up @@ -381,6 +395,56 @@ Get the mining threshold



</details>

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

## Function `get_vouch_threshold`

Get the threshold for unrelated vouchers per validator


<pre><code><b>public</b> <b>fun</b> <a href="Globals.md#0x1_Globals_get_vouch_threshold">get_vouch_threshold</a>(): u64
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>public</b> <b>fun</b> <a href="Globals.md#0x1_Globals_get_vouch_threshold">get_vouch_threshold</a>(): u64 {
<a href="Globals.md#0x1_Globals_get_constants">get_constants</a>().vouch_threshold
}
</code></pre>



</details>

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

## Function `get_signing_threshold`

Get the threshold of number of signed blocks in an epoch per validator


<pre><code><b>public</b> <b>fun</b> <a href="Globals.md#0x1_Globals_get_signing_threshold">get_signing_threshold</a>(): u64
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>public</b> <b>fun</b> <a href="Globals.md#0x1_Globals_get_signing_threshold">get_signing_threshold</a>(): u64 {
<a href="Globals.md#0x1_Globals_get_constants">get_constants</a>().signing_threshold_pct
}
</code></pre>



</details>

<a name="0x1_Globals_get_constants"></a>
Expand Down Expand Up @@ -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,
}
};

Expand All @@ -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,
}
} <b>else</b> {
<b>return</b> <a href="Globals.md#0x1_Globals_GlobalConstants">GlobalConstants</a> {
Expand All @@ -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 * <a href="Globals.md#0x1_Globals_COIN_SCALING_FACTOR">COIN_SCALING_FACTOR</a>, // 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,
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion language/diem-framework/modules/doc/Stats.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<pre><code><b>use</b> <a href="CoreAddresses.md#0x1_CoreAddresses">0x1::CoreAddresses</a>;
<b>use</b> <a href="../../../../../../move-stdlib/docs/Errors.md#0x1_Errors">0x1::Errors</a>;
<b>use</b> <a href="../../../../../../move-stdlib/docs/FixedPoint32.md#0x1_FixedPoint32">0x1::FixedPoint32</a>;
<b>use</b> <a href="Globals.md#0x1_Globals">0x1::Globals</a>;
<b>use</b> <a href="../../../../../../move-stdlib/docs/Signer.md#0x1_Signer">0x1::Signer</a>;
<b>use</b> <a href="Testnet.md#0x1_Testnet">0x1::Testnet</a>;
<b>use</b> <a href="../../../../../../move-stdlib/docs/Vector.md#0x1_Vector">0x1::Vector</a>;
Expand Down Expand Up @@ -331,7 +332,10 @@
<b>assert</b>(sender == <a href="CoreAddresses.md#0x1_CoreAddresses_DIEM_ROOT_ADDRESS">CoreAddresses::DIEM_ROOT_ADDRESS</a>(), <a href="../../../../../../move-stdlib/docs/Errors.md#0x1_Errors_requires_role">Errors::requires_role</a>(190006));
<b>let</b> range = height_end-height_start;
// TODO: Change <b>to</b> 5 percent
<b>let</b> threshold_signing = <a href="../../../../../../move-stdlib/docs/FixedPoint32.md#0x1_FixedPoint32_multiply_u64">FixedPoint32::multiply_u64</a>(range, <a href="../../../../../../move-stdlib/docs/FixedPoint32.md#0x1_FixedPoint32_create_from_rational">FixedPoint32::create_from_rational</a>(5, 100));
<b>let</b> threshold_signing = <a href="../../../../../../move-stdlib/docs/FixedPoint32.md#0x1_FixedPoint32_multiply_u64">FixedPoint32::multiply_u64</a>(
range,
<a href="../../../../../../move-stdlib/docs/FixedPoint32.md#0x1_FixedPoint32_create_from_rational">FixedPoint32::create_from_rational</a>(<a href="Globals.md#0x1_Globals_get_signing_threshold">Globals::get_signing_threshold</a>(), 100)
);
<b>if</b> (<a href="Stats.md#0x1_Stats_node_current_votes">node_current_votes</a>(vm, node_addr) &gt; threshold_signing) { <b>return</b> <b>true</b> };
<b>return</b> <b>false</b>
}
Expand Down
9 changes: 2 additions & 7 deletions language/diem-framework/modules/doc/Vouch.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@
<pre><code><b>use</b> <a href="Ancestry.md#0x1_Ancestry">0x1::Ancestry</a>;
<b>use</b> <a href="CoreAddresses.md#0x1_CoreAddresses">0x1::CoreAddresses</a>;
<b>use</b> <a href="DiemSystem.md#0x1_DiemSystem">0x1::DiemSystem</a>;
<b>use</b> <a href="Globals.md#0x1_Globals">0x1::Globals</a>;
<b>use</b> <a href="../../../../../../move-stdlib/docs/Signer.md#0x1_Signer">0x1::Signer</a>;
<b>use</b> <a href="Testnet.md#0x1_StagingNet">0x1::StagingNet</a>;
<b>use</b> <a href="Testnet.md#0x1_Testnet">0x1::Testnet</a>;
<b>use</b> <a href="ValidatorUniverse.md#0x1_ValidatorUniverse">0x1::ValidatorUniverse</a>;
<b>use</b> <a href="../../../../../../move-stdlib/docs/Vector.md#0x1_Vector">0x1::Vector</a>;
</code></pre>
Expand Down Expand Up @@ -355,15 +354,11 @@


<pre><code><b>public</b> <b>fun</b> <a href="Vouch.md#0x1_Vouch_unrelated_buddies_above_thresh">unrelated_buddies_above_thresh</a>(val: address): bool <b>acquires</b> <a href="Vouch.md#0x1_Vouch">Vouch</a>{
<b>if</b> (<a href="Testnet.md#0x1_Testnet_is_testnet">Testnet::is_testnet</a>() || <a href="Testnet.md#0x1_StagingNet_is_staging_net">StagingNet::is_staging_net</a>()) {
<b>return</b> <b>true</b>
};

<b>if</b> (!<b>exists</b>&lt;<a href="Vouch.md#0x1_Vouch">Vouch</a>&gt;(val)) <b>return</b> <b>false</b>;

<b>let</b> len = <a href="../../../../../../move-stdlib/docs/Vector.md#0x1_Vector_length">Vector::length</a>(&<a href="Vouch.md#0x1_Vouch_unrelated_buddies">unrelated_buddies</a>(val));

(len &gt;= 4) // TODO: <b>move</b> <b>to</b> <a href="Globals.md#0x1_Globals">Globals</a>
(len &gt;= <a href="Globals.md#0x1_Globals_get_vouch_threshold">Globals::get_vouch_threshold</a>())
}
</code></pre>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down Expand Up @@ -113,6 +115,18 @@ epoch by a miner to remain compliant
</dt>
<dd>

</dd>
<dt>
<code>vouch_threshold: u64</code>
</dt>
<dd>

</dd>
<dt>
<code>signing_threshold_pct: u64</code>
</dt>
<dd>

</dd>
</dl>

Expand Down Expand Up @@ -381,6 +395,56 @@ Get the mining threshold



</details>

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

## Function `get_vouch_threshold`

Get the threshold for unrelated vouchers per validator


<pre><code><b>public</b> <b>fun</b> <a href="Globals.md#0x1_Globals_get_vouch_threshold">get_vouch_threshold</a>(): u64
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>public</b> <b>fun</b> <a href="Globals.md#0x1_Globals_get_vouch_threshold">get_vouch_threshold</a>(): u64 {
<a href="Globals.md#0x1_Globals_get_constants">get_constants</a>().vouch_threshold
}
</code></pre>



</details>

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

## Function `get_signing_threshold`

Get the threshold of number of signed blocks in an epoch per validator


<pre><code><b>public</b> <b>fun</b> <a href="Globals.md#0x1_Globals_get_signing_threshold">get_signing_threshold</a>(): u64
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>public</b> <b>fun</b> <a href="Globals.md#0x1_Globals_get_signing_threshold">get_signing_threshold</a>(): u64 {
<a href="Globals.md#0x1_Globals_get_constants">get_constants</a>().signing_threshold_pct
}
</code></pre>



</details>

<a name="0x1_Globals_get_constants"></a>
Expand Down Expand Up @@ -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,
}
};

Expand All @@ -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,
}
} <b>else</b> {
<b>return</b> <a href="Globals.md#0x1_Globals_GlobalConstants">GlobalConstants</a> {
Expand All @@ -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 * <a href="Globals.md#0x1_Globals_COIN_SCALING_FACTOR">COIN_SCALING_FACTOR</a>, // 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,
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<pre><code><b>use</b> <a href="CoreAddresses.md#0x1_CoreAddresses">0x1::CoreAddresses</a>;
<b>use</b> <a href="../../../../../../move-stdlib/docs/Errors.md#0x1_Errors">0x1::Errors</a>;
<b>use</b> <a href="../../../../../../move-stdlib/docs/FixedPoint32.md#0x1_FixedPoint32">0x1::FixedPoint32</a>;
<b>use</b> <a href="Globals.md#0x1_Globals">0x1::Globals</a>;
<b>use</b> <a href="../../../../../../move-stdlib/docs/Signer.md#0x1_Signer">0x1::Signer</a>;
<b>use</b> <a href="Testnet.md#0x1_Testnet">0x1::Testnet</a>;
<b>use</b> <a href="../../../../../../move-stdlib/docs/Vector.md#0x1_Vector">0x1::Vector</a>;
Expand Down Expand Up @@ -331,7 +332,10 @@
<b>assert</b>(sender == <a href="CoreAddresses.md#0x1_CoreAddresses_DIEM_ROOT_ADDRESS">CoreAddresses::DIEM_ROOT_ADDRESS</a>(), <a href="../../../../../../move-stdlib/docs/Errors.md#0x1_Errors_requires_role">Errors::requires_role</a>(190006));
<b>let</b> range = height_end-height_start;
// TODO: Change <b>to</b> 5 percent
<b>let</b> threshold_signing = <a href="../../../../../../move-stdlib/docs/FixedPoint32.md#0x1_FixedPoint32_multiply_u64">FixedPoint32::multiply_u64</a>(range, <a href="../../../../../../move-stdlib/docs/FixedPoint32.md#0x1_FixedPoint32_create_from_rational">FixedPoint32::create_from_rational</a>(5, 100));
<b>let</b> threshold_signing = <a href="../../../../../../move-stdlib/docs/FixedPoint32.md#0x1_FixedPoint32_multiply_u64">FixedPoint32::multiply_u64</a>(
range,
<a href="../../../../../../move-stdlib/docs/FixedPoint32.md#0x1_FixedPoint32_create_from_rational">FixedPoint32::create_from_rational</a>(<a href="Globals.md#0x1_Globals_get_signing_threshold">Globals::get_signing_threshold</a>(), 100)
);
<b>if</b> (<a href="Stats.md#0x1_Stats_node_current_votes">node_current_votes</a>(vm, node_addr) &gt; threshold_signing) { <b>return</b> <b>true</b> };
<b>return</b> <b>false</b>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@
<pre><code><b>use</b> <a href="Ancestry.md#0x1_Ancestry">0x1::Ancestry</a>;
<b>use</b> <a href="CoreAddresses.md#0x1_CoreAddresses">0x1::CoreAddresses</a>;
<b>use</b> <a href="DiemSystem.md#0x1_DiemSystem">0x1::DiemSystem</a>;
<b>use</b> <a href="Globals.md#0x1_Globals">0x1::Globals</a>;
<b>use</b> <a href="../../../../../../move-stdlib/docs/Signer.md#0x1_Signer">0x1::Signer</a>;
<b>use</b> <a href="Testnet.md#0x1_StagingNet">0x1::StagingNet</a>;
<b>use</b> <a href="Testnet.md#0x1_Testnet">0x1::Testnet</a>;
<b>use</b> <a href="ValidatorUniverse.md#0x1_ValidatorUniverse">0x1::ValidatorUniverse</a>;
<b>use</b> <a href="../../../../../../move-stdlib/docs/Vector.md#0x1_Vector">0x1::Vector</a>;
</code></pre>
Expand Down Expand Up @@ -355,15 +354,11 @@


<pre><code><b>public</b> <b>fun</b> <a href="Vouch.md#0x1_Vouch_unrelated_buddies_above_thresh">unrelated_buddies_above_thresh</a>(val: address): bool <b>acquires</b> <a href="Vouch.md#0x1_Vouch">Vouch</a>{
<b>if</b> (<a href="Testnet.md#0x1_Testnet_is_testnet">Testnet::is_testnet</a>() || <a href="Testnet.md#0x1_StagingNet_is_staging_net">StagingNet::is_staging_net</a>()) {
<b>return</b> <b>true</b>
};

<b>if</b> (!<b>exists</b>&lt;<a href="Vouch.md#0x1_Vouch">Vouch</a>&gt;(val)) <b>return</b> <b>false</b>;

<b>let</b> len = <a href="../../../../../../move-stdlib/docs/Vector.md#0x1_Vector_length">Vector::length</a>(&<a href="Vouch.md#0x1_Vouch_unrelated_buddies">unrelated_buddies</a>(val));

(len &gt;= 4) // TODO: <b>move</b> <b>to</b> <a href="Globals.md#0x1_Globals">Globals</a>
(len &gt;= <a href="Globals.md#0x1_Globals_get_vouch_threshold">Globals::get_vouch_threshold</a>())
}
</code></pre>

Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified language/diem-framework/staged/stdlib.mv
Binary file not shown.
38 changes: 38 additions & 0 deletions ol/changelog/5_2_0.md
Original file line number Diff line number Diff line change
@@ -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 <path to stdlib.mv shown above>
```
### Summary

### Changes

##### Move Changes

[TODO]

##### Rust Changes

[TODO]

0 comments on commit 4d0b3f6

Please sign in to comment.