From 4d0b3f6fed8da156619be191351163d4fda58903 Mon Sep 17 00:00:00 2001 From: 0o-de-lally <1364012+0o-de-lally@users.noreply.github.com> Date: Thu, 11 Aug 2022 17:12:33 -0400 Subject: [PATCH] changelog and stdlib.mv --- .../diem-framework/modules/doc/Globals.md | 70 ++++++++++++++++++ language/diem-framework/modules/doc/Stats.md | 6 +- language/diem-framework/modules/doc/Vouch.md | 9 +-- .../artifacts/current/docs/modules/Globals.md | 70 ++++++++++++++++++ .../artifacts/current/docs/modules/Stats.md | 6 +- .../artifacts/current/docs/modules/Vouch.md | 9 +-- .../artifacts/current/modules/023_Stats.mv | Bin 2979 -> 0 bytes .../current/modules/024_StagingNet.mv | Bin 299 -> 0 bytes .../artifacts/current/modules/025_Hash.mv | Bin 90 -> 0 bytes .../artifacts/current/modules/026_GAS.mv | Bin 394 -> 0 bytes .../artifacts/current/modules/027_Globals.mv | Bin 1254 -> 0 bytes .../artifacts/current/modules/036_Vouch.mv | Bin 1412 -> 1356 bytes language/diem-framework/staged/stdlib.mv | Bin 122349 -> 122507 bytes ol/changelog/5_2_0.md | 38 ++++++++++ 14 files changed, 192 insertions(+), 16 deletions(-) delete mode 100644 language/diem-framework/releases/artifacts/current/modules/023_Stats.mv delete mode 100644 language/diem-framework/releases/artifacts/current/modules/024_StagingNet.mv delete mode 100644 language/diem-framework/releases/artifacts/current/modules/025_Hash.mv delete mode 100644 language/diem-framework/releases/artifacts/current/modules/026_GAS.mv delete mode 100644 language/diem-framework/releases/artifacts/current/modules/027_Globals.mv create mode 100644 ol/changelog/5_2_0.md 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
+public fun get_vouch_threshold(): u64
+
+
+
+
+public fun get_vouch_threshold(): u64 {
+ get_constants().vouch_threshold
+}
+
+
+
+
+public fun get_signing_threshold(): u64
+
+
+
+
+public fun get_signing_threshold(): u64 {
+ get_constants().signing_threshold_pct
+}
+
+
+
+
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 93b4ca32ee1536daabf59101184fa541e40faa1f..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 2979
zcmbtW-EI`g6|Vp8sjB&DGoCTVfWamXe}({o-t0yZ!bFOchzKL@qSn~c;1eM;a_2-TMIKddR
zoOMLU%k{r;^>=<%|C@iqgMY}cRrsf{Xa5qe`>(^lcG~|ObTF7R!6Z{mGsA*_vCuIo
z@od4uER4)a#hBNIu{L!b7+IIP9(7TOZbhRz*MhZg9b>Bjqycq9vaV5g9)ryl*5-^~
zWuB=m?U~p%hM8+!!dGxo|AIZ&k24>By`SX6=U+^1d=p(+$*ZB~rA>%e=!g$H8=EidgS>tc4me5Lt
zS1CE?n%fo@ETKo^_*=;hbb>mFkOD}M>472i;E*(z4zD^0IfqRf9asq*n8^u{wS#Mh
zVCwl8!?g){?PsLam?$K4OOnP9u9!F!LWW}IzT_=c14*MXe!m)3W&259q>snrA}!0b
zG*62nFG~OO>_a;Kb)HSD`}fR#_IjEY!Hcx4rfFqfriWEt1p8^VH>yVA%h9BsNFPi_
z(>LyQS|vwWi4mu3B$s(nrQ_t?Xi_Ezr^#`VAD3M+RCzU;eD?k>uhKHiriZnq7D(l@
zX;vkph9)2{9yd%}Eh4OG`@*^OI?1YfCM<
zW|{R&Gr0~yFpE(zBc#)}$6&qpi>JRzoASQj)9@ISNQ;n-(+`-$kvS>Sw+KxC
zut-N(!mA>Gn-rre%crA>e|s{ivg65Va`Nzj&B}yUjo`MkDfTcMCnd5bMWrq`oDO>3
z>I+tGSb0%il3a+(D5Fg(X|y0_F^@Say=ik{1=)_G<4i{@H+hfsg`n5YAGu}GxoG8z
zdAdbs6%LTTx4z|Cvf~(ccBdZCd!p}EN5#U2HnjYj+|Zk3S0d)VJ%{mu4Q#k2uj{y@
zY!J)77wxuXRzyCA0w+t;20qZ+m|)?lttQXMx?JdtH9*tDx!Z6{{!&jnZEIrP_l|_Q
zZ9pn-o%P%DH#!3>+?TATtv=BN%XV+{6PyqWf?9voR&l-Dp~sOkr?oAAum8YdYjJ2l
zI$(@GMLZzd1$22)Mi^f#
zJVGD102m=KZg8BZrpvpc!<&8GbvCwMdS#W|)L+y_ZKe0#Ik)RPMN!POV!pZoc8{jP
z$k=gfdb}t53#%iWTos5B=NB4c03c#N`ESIm0x>ZEoS2|c*Tl$ZtT;mq--cSdysv7e
z6GTjdm|7-AWBe=h}~Nd3%qd#5esyveF{ZBzxsERlzXpZVyWElZlxdrI!mRmukq)F9<0oLSQkA}(}$KrOxR`_i$a5v%n(wDUtQk^J1T6i@F
zLG5LC<|_k_@CK&{^?lF@z#5F+|~E2TBHqTI$LoU
zLC`AUh}Gq5%Yl2iVAbSz%__u(Suvz!HgxBqX2#8vMHiz>*jU`ZBAf-=@`~OHMN4>^
zeCuwV3bP!I7n3ig!r2^c`Ot;Cu7%?Hn4`DqE!W6VN9WG2b0{9+aGRMiV1n*fpMd@N
z{{f?d_@7`M0y~>;4?YF^{`m&Tr5#)3TbIzbo9sreQtEuUK+{x3@*|qwu>$3T%ImSX
zW9XtvZJRzLR(4t3#ZlTtp7eM>?nSuccKNDfjz^*B5ze*Cbu!Fwezw3-p00RxGN_&C
fvYDGUJ?@WA%L|nA204#3F!e_dzzTP4x@mt41_VvN
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 e83a2a671787880b85b5c3dee4f2170691d1471d..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 299
zcmYjMyH3L}6usB4y0%jhn2=Z)5Mp3qW2{Jq4p6CKMOLJ^k)<>db~?b`59wF%2`u~v
z13!VQ4sfUYIQKmE7eAT+fJBf)GHTBGRW`ZXq5QxT^@-ek;eEOz5TL*$08c##Orrz_
zI7J3T@w62N5D8M`NL4k~t?%0>H)an*aPy`KE=Ctc8Nv{vsC?VIU>5NYsC@57Uw8i9
z&3v@+$Y6Un>SnvyyxFyPU8CwFl^xc3u_zzyYPo#2^P*UlRh0$zy7fuPhM{xG_Ww!|
saDoT-^h`lca(XFVz7OF6a%PA@jdZ2~HM!O>J%!u!kkCkTdXwV+0<8Bri2wiq
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 cd88b742d23b4b66bbce6e745db6ffc088a2c089..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 90
zcmZ1|^O~E9fq{XIk%5VsiHntonVnypLrs9ki~}gj2*eB^X+|z47LUZ@436TAM5A~k
XQ!^057{manKmv>mj7$uSK+FID$59C!
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 a793c6e9018598831577f06a48a3a91aa9a95c71..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 394
zcmYjN%Sr=55bU1E?mD}P2}Cb?@Eg=aE`m|fi-;KS!@4_(4f_Z)vtT^?3EsTuPxwuO
zKj9=1u@6OeRX0@E$NqQ906-yREKB(4KpYD>-i>cQF?nHw=#|CljmhktorE<61{?%P
z2p~iZ5Cu*q0r(ao2*o(CR3Zw@AfOOZV3Yyl923L@WRxYydDy#}OnZ}}XuHN=Q%&B9
z3o>-)dN+%(3K8x_{%-sqWagPwb8o4newW=_r7&7=@sF+wi0t{meAprIj3~|U5L}6OjUo+&<>Dl&%`{ElhhB2ftMg~7ihfp~H
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 a34033cdf3897c7ab86bc1a1243c1bbd428c21eb..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 1254
zcmaJ>&2G~`5T4z&*NNk}N$dWXN}P(s3n0XSUzGzwLgl`7oK0%s*ulGL>8%p)fVhIh
zBlOH0a6&u-5--7wouo!>*~57L_WQ=Ov-@T5Plp3Qhe5!DmWW;2f#xgw9pN0(tHvf5&?-WiIBt!i5`hQ3bqT3
zIed>XaPJ_RvyYky@nQ@+{dLmzxWlb7&nk$pU8Rn`{oYQJTy$d#(nt(U_{Y7crxgS(!E>LGyn$ZmwwU2I9?InAXXE
zjb*E5x!$Ck0#$?N0fVhnXK|J-e=|amMQf;I6>|9RvGvlt>Z^*&@ob`V>!(K9`shPc
z@z7}?6ixyTX>&2rdi->y_VD(qSQC+07aL+zY>92LBWNIjdpL9W6%Rdl0C(m4K3O=a
zLBIl>X3^=egML?p?yh`PMF8Y*q1>yJ@g{6tIq5>s!fR45`CH5tf8m*bVHJ2k6#MRd
zdEB1oEWzQ|$I3lwyA@Hd
O@nym@r3cBYUaG%}PyK@c
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 e8b30a089be7a5c7a22f63b035fb2277b0e57964..ef336bee81929273fc7d32e7b94f95e7bd6203d1 100644
GIT binary patch
delta 321
zcmWlTO-chn5QSe=cTXohKbcM@F>3t5g)k@38wjoh4-otbi4cq=(Txj*xDPT2f{Wl8
z^cdN@6Zft>L9Bt|QSVh1Up<9O_we5N4HIZeDQztfn@XnYieMY6BAT641#FvPB-)C#
z=vpFU(-uy!E_Ze#_L6Sa8wBb!ThLp|fwu)?cgoNSEfP)wk2+eBb5S`h%-CK6|PWFHU5fLp+_yyWp+1X%WM=UOch8VeCO-!uKC5G71sFjVC
zy(I}h#L8cwv$EN|ypP$uot3$_H_P6)6#!rmGLc1;-(vKHb@_sK7{7`ip%=1l-lTHx
zaw(Iw3Bw2i2qKW6AO;QL*4PCTzzPCz977_RrNP?@vaVQq_NYM!x=9)@K(}h#t#j)b
z+eyUONjZ+Txhd}QJH3;5c6(U^0e4$Ds6KJ`9)lQgm);MF0n4Qc*LldG{kXm&BCJmE
zsH;ZP$*j0Gqw;bxolVY)GCnWn<*X>H2mI}t>3m#nbjozTnHq=qSqw4z_!28T?fWK?
wRN4uteai{n(#k{&149^4CYv>;UOGzY7#$i^yz&1z6fu7sItLbfUVTQ@9}~4PWB>pF
diff --git a/language/diem-framework/staged/stdlib.mv b/language/diem-framework/staged/stdlib.mv
index 8f5dd195762366d3219be0a0211541fc29eb062a..971a81000878ad3eadd782e75ab13e6e6b47cc45 100644
GIT binary patch
delta 1112
zcmZ`&J!~9B6n<}JXJ&VHc5m0W_v<_R?i_3km|!T92#KEprHF)(KxqQ9O>(-6xtzgg
zD4=je1Wk~x7$BsCG6+z1%}gb0QipJzwCRVD_pdi^co-w}x%ORdk#
zn)y_IVPR=?#rK0a1h$^mDHU8(%7JZ5O^5kTw360wiAb{PzC^}^h$qt5l0Fj{DV+RE?LgFBGFyRvv1wj^&wWLFUvZ7tZ
zLDgAn4(jBrIuKFIXTX5iCk(KAB;}ngNCY*P5WVWqy-pcw-bq8f!66B&Q^Wl8_{2^58@L=u5mBG2>W31#?U$~6_qau4@>FLs>77fjt
zni@XMk+GKcp`ClnOcc_lJV8afl}@G8d87L?nwETg@ArPCZCmN>v;F?D{J`2*Pc2^2
zf2ZH$*&E&%6S0M-QEjp7%)jF$dMu=QPn;3a2X=A0XjjJBCXo+DkZK~wckGS@C!&Pz
z_yngn7r9TE1=Lto3P}&D9C?J5n5?2o1<4xyrs|O+aB`wZ3^z(;@S2dIFKiF6~*W(ls;noh}0?+3!i59(o*NkPyj%H5R2GQbp^f0*pM&q75cx^x~DJed~j7)&AMKWqvu)7
zixC76cpyQ6?*r%%h}h;h0s#jhBoDwy1rRyJ9E3K9yhEZHsf2le_8f-`K?qRv*~=VC
zE?jn~@M_fq5dt>AfY&Pxh)qg?+T5lP)Ruh0+?sM;wXNN;ui*GWp~&1`t}u60*{A+`
z5737V1@a>ZL43?-B&PLlViz`-_F$A&*wk7a=|}tHiILW$FE8NEjokZg
zhX_U(O@#yAsF35aKfCJb>oTuaWf1%%i{>}^l%lJ-)Sf%CKf?|{^h75j$S!WWS7U_s
z^^up&OVe1kYIM+!jQ(PW#=iJ8mr^?ws7M)=s7w{Al6w>oJ_u*&6CVbkN1f!xxse!y
zhC4!Gh+C70V%cH;92<^O5J^lmxm}Isz&;r7x97)u?Va(%cJo&@<&Ey`5i~!x@3hb|
zv%h{ee?EL)A?qm>sYls2=q+MiF5_ABZ-}=-Uy=FXrc`D{F3IRw;QIAHJ@J|D`%g=J
z%TN$&iRH#xVlQ^}w7F?s@igIoTryv!K!-J(Vvcj`EHungd>*NnaQt%Lvv$O
z$7ZHJpPciDCr{1IOwKhA{(%*HdTpcm^BJt#lehaYZGC_H2@chg0+CeO2&t2z5nNR$
uBP{~xgF2
+
+```
+### Summary
+
+### Changes
+
+##### Move Changes
+
+[TODO]
+
+##### Rust Changes
+
+[TODO]
+