From 4cc4f01d447016c9c43fe8b86c02076f61438607 Mon Sep 17 00:00:00 2001 From: EnzinoBB Date: Fri, 9 Oct 2026 13:25:49 +0200 Subject: [PATCH 1/4] ci(testnet): turn block rewards on with signed special transactions The test network's master key is also its starter key (CREDITS_TESTNET), so it can sign "managing" special transactions as the hardcoded key does on mainnet: - order 9 moves StartingDPOS (rewards are 0 before it, solvercore.cpp); - order 37 turns staking and mining on with a 1 CS block reward from a given round. fund.py --dpos-at / --reward-round sends both after funding. The user field is encoded the way APIHandler parses it, and signed the way Transaction::to_byte_stream_for_sig() serialises a string field. run.sh passes DPOS_AT / REWARD_ROUND. The workflow gets dpos_at, reward_round and restart_at inputs. With rewards on, every block changes the balances of the trusted nodes, so the STATE DIGEST comparison now covers reward crediting (paths A and B). Co-Authored-By: Claude Opus 5.5 --- .github/workflows/testnet.yml | 12 +++++++ ci/testnet/__pycache__/fund.cpython-312.pyc | Bin 9555 -> 11340 bytes ci/testnet/fund.py | 36 +++++++++++++++++--- ci/testnet/run.sh | 7 +++- 4 files changed, 49 insertions(+), 6 deletions(-) diff --git a/.github/workflows/testnet.yml b/.github/workflows/testnet.yml index 9601dcd69..b0f40c949 100644 --- a/.github/workflows/testnet.yml +++ b/.github/workflows/testnet.yml @@ -16,6 +16,15 @@ on: disk_full_node: description: 'Node whose block DB disk fills up for a while (0 = off)' default: '0' + restart_at: + description: 'Sequence at which the last node is restarted (0 = off)' + default: '300' + dpos_at: + description: 'Move StartingDPOS to this sequence via special order 9 (0 = off)' + default: '0' + reward_round: + description: 'Turn block rewards on at this round via special order 37 (0 = off)' + default: '0' schedule: - cron: '17 2 * * *' pull_request: @@ -111,6 +120,9 @@ jobs: TARGET_SEQ: ${{ inputs.target_seq || '1100' }} TIMEOUT_MIN: ${{ inputs.timeout_min || '45' }} DISK_FULL_NODE: ${{ inputs.disk_full_node || '0' }} + RESTART_AT: ${{ inputs.restart_at || '300' }} + DPOS_AT: ${{ inputs.dpos_at || '0' }} + REWARD_ROUND: ${{ inputs.reward_round || '0' }} FUND: '1' LOAD_SECONDS: '300' WORK: ${{ github.workspace }}/testnet-run diff --git a/ci/testnet/__pycache__/fund.cpython-312.pyc b/ci/testnet/__pycache__/fund.cpython-312.pyc index e082fecbec7de824d86d8096681dfc3dea2754aa..d9aa956eb5a0a148b90dacc4ead3e0e23fec6612 100644 GIT binary patch delta 4300 zcmahMZA=`;b?0vHZn--S?vBsnYdJp8fNku!juV^!Hebdy#*jFMIH%3c0e2jCcy@^c zU3w%UiY=uobQ&4UO-ib$aSMu45jD<_Dz4f}P8%r@92u|DDwXnwN>yC@Uw`$@E(^x8 z)VbTYGxOe?dGp?z_uj6b_~Hf6-!e0u9JD=O-im)*H18=uzy4iKnI%0?in9mGEL>E? z-X+8+I1c-!01lL6|138U1Y8j3n7Dxo3)jKn+*uCiEm?GOZlDt917#I1#Raoypc>wV z@UFoDn61S{07JMK;GSq5E*Y)mI3mERdzLsZTVDZjla@(Ks7$(JrJq<<_KUmQU_%2Q zPst6EBKEcQiVY1UdQl>{futsqm`$yWSnE*wY)lyeq)93P?h#UDBr1+cvJxfYXmqk( zyf_kzjEFH=loE1EWLQ~|$QD{m4e3)#R93`fRJoWUqt4o6ec}GLzW!5f{o%g;mNWfr zXTsfW=R)N)m@iYU~j`>~;2&3D5!-lPL@Wz`>JZR3gbO9vM!Mh$-UBlT06@QIJDs zn~X`ZBq(BKj(-Z}ZaTnpo6G|?%K$uJzT;T=tLPUUCv6hyrl#n~8Pi|NG4pfOpG zt(aG~`BmQZ{3W&qG?iz!W7>voaR>E!{PcwkHx0V|^xs~ASGl;G{p;X(j!<1s$uJ}yWcrJY};HRr@!QxP<=+4bn9btA_ zy_up^Il}JkIRq4$=13_vd+{w{sR)ZCh@T zteR${YNu*9k44J^IR!wIyUn>x9S0xs_(R(YTh1_OtiurNpFw!0lR@Sd;s<@*&^nYCbI{#%=7hzEie+d2At~X z<3jFJQ(v|(Rk+b znl%wkYJ5BuOX^-v>KOkX0JJVEhHB{BS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Yu#Bg3 zg=KA(^?1=0uyKpLt)gVm7%1_=QpT_;ORgjcX@#$SMJ3E=#YC-hG!NT9v1e~sqN$dF z0%ttq64V2~;bIsh)G-!&z|&Z7u;)dPZ^c`QhlLEyD()o&?M$!kGK2TB2UwEj0y9D8 zNppHD>cylZNpQrFj=7Sf3XK_hq008|Z%Ew);g86J{}Iuw;=EUjQFHaXg zS43j?6de?E!{t?3im@e=JCNyo!Qoib95?nuCtf(sJzQckb8HRmr@Mx;I-<*fd=2V& z!Q!tY0gGh&EK3}EB$ug=_uxk@dwJ2~rfbQv)@*#w1)P$-5?fC z=+kcj_ca2pIqxVUKKkv=UyVlT=GE~|%J!4Qb5yq6-;@f^O{usc=oq5wh@MA;QS;-rS#5m5sV&$wdw~y%f0xhGMRER-(N)ZN zKXiI})>pCJ%PZj1sEB_&`~^h#TJhtE z$;BpHZdg&h3(+X0e^aAWeUKKt6TcPzm?$0Wp@|1i=yc?MR-wiFF@-*I fKQ>H [--port 9090] [--amount 60000] [--load-seconds 0] + [--dpos-at SEQ --reward-round SEQ] The genesis funds of a CREDITS_TESTNET build go to the key given in CS_TESTNET_GENESIS_KEY; this script holds its seed. It sends CS from it to every node (above the 50'000 minimum stake), then, for --load-seconds, small random transfers between nodes, through the Thrift API of node 1. +With --dpos-at and --reward-round the master key, which is also the starter key of the test network +(CS_TESTNET_STARTER_KEY), sends two special "managing" transactions: order 9 moves StartingDPOS to +--dpos-at, and order 37 turns mining and staking on with a 1 CS block reward from --reward-round. +Trusted nodes then earn rewards split by stake, as on mainnet. + Transaction building and signing are adapted from BK's tools/tps_gen/tps_gen.py (akaitrade/node). """ import argparse @@ -31,6 +37,9 @@ CURRENCY_CS = 1 TX_TYPE_TRANSFER = 0 +UF_MANAGING = 7 # cs::trx_uf::sp::managing +UF_TYPE_STRING = 2 # csdb::UserField::String +SPECIAL_TARGET = bytes(31) + b"\x07" # the target mainnet special transactions use (1111...118) def encode_max_fee(value): @@ -63,7 +72,10 @@ def pack_inner_id(inner_id): return inner_id.to_bytes(6, "little") # source and target given as public keys, not wallet ids -def transfer(src, dst_pk, amount_int, amount_frac=0): +def transfer(src, dst_pk, amount_int, amount_frac=0, managing=None): + # signed bytes: Transaction::to_byte_stream_for_sig(); a string user field signs as u32 size + bytes + fields_for_sig = struct.pack(" "$WORK/fund.log" 2>&1 & + python3 "$HERE/fund.py" "$WORK" "$NODES" "$MASTER_SEED" --load-seconds "$LOAD_SECONDS" \ + --dpos-at "$DPOS_AT" --reward-round "$REWARD_ROUND" > "$WORK/fund.log" 2>&1 & FUND_PID=$! fi From 2c244c218b370e9cf63d482df9801c0e5a4c28c1 Mon Sep 17 00:00:00 2001 From: EnzinoBB Date: Fri, 9 Oct 2026 15:06:11 +0200 Subject: [PATCH 2/4] ci(testnet): delegations with and without a time limit fund.py --delegations: every node delegates 1000 CS to the next one without a time limit and 500 CS until a UTC time a few minutes ahead; halfway through the load phase the even nodes withdraw the first delegation. The nodes then apply, expire and withdraw delegations, and the STATE DIGEST, which covers the delegation records, must still match on every node. Enabled with DELEGATE=1 in run.sh, or the 'delegate' input of the Testnet workflow. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/testnet.yml | 4 ++ ci/testnet/__pycache__/fund.cpython-312.pyc | Bin 11340 -> 14506 bytes ci/testnet/fund.py | 64 +++++++++++++++++--- ci/testnet/run.sh | 7 ++- 4 files changed, 64 insertions(+), 11 deletions(-) diff --git a/.github/workflows/testnet.yml b/.github/workflows/testnet.yml index b0f40c949..1294961c3 100644 --- a/.github/workflows/testnet.yml +++ b/.github/workflows/testnet.yml @@ -25,6 +25,9 @@ on: reward_round: description: 'Turn block rewards on at this round via special order 37 (0 = off)' default: '0' + delegate: + description: 'Nodes delegate to each other, with and without a time limit (0 = off)' + default: '0' schedule: - cron: '17 2 * * *' pull_request: @@ -123,6 +126,7 @@ jobs: RESTART_AT: ${{ inputs.restart_at || '300' }} DPOS_AT: ${{ inputs.dpos_at || '0' }} REWARD_ROUND: ${{ inputs.reward_round || '0' }} + DELEGATE: ${{ inputs.delegate || '0' }} FUND: '1' LOAD_SECONDS: '300' WORK: ${{ github.workspace }}/testnet-run diff --git a/ci/testnet/__pycache__/fund.cpython-312.pyc b/ci/testnet/__pycache__/fund.cpython-312.pyc index d9aa956eb5a0a148b90dacc4ead3e0e23fec6612..65f349c18b974f0770d60996d010629ba54d2a92 100644 GIT binary patch delta 6328 zcma(#Yfv0Vdebwr?-vWpE-bG>Jj9BJ;E-%RumloFAj#+j!a~UFWoLm!u#0+z!$PyS z_@ay8tc#$=j-->X%+=M^;Xo3(b+1=v}_yUtOarGP8tGc{c2dYalx@$PdJ@0q1la;me8 z&jLyxU%+RdL!BES_d;II=Rj)(p9`>(&jVN$+Q{dhDxw_eK_Jb221GKvq?kV9Can&Z*J(-{ z)AM@ypKJm$$OrA^$S9w+*A%j1TB-*{X>^jl*PtnX%pm{0eSMx$qWV>{(r8n;Wc0%f zWv4yQVf0%yoP;E!{F0;6W?JHC^ry)?9i^qbj@QktY<6m$mZt%oKXq(|Nj`Pt!6ZFt zwHC8B9l*7xZO^le>R`HywhNQ+YFt1-o5-?tRv3wv@20)zH2U*2Y@`N+RYve}8^Mcp z8b;iql|Y1x8vuNldm4EC%DPy;L~ryH-B1&+1DbVOO)?&(eD>B+rfydYCc-17!=rTF zE=<<>Zw9V8kWLJ*clXmCD zzKOp3@<7Ia#tja_)RTAV?9|!mEi;F&p%1oyX1{ajXrira;n2wi&#Q?*c-|8pM?bJG z4zP;2?z4i#krNA^E<*67$2*QLSnu2N#v0D;NoKepJCL+k$C^_{M(kEgWN#P>4D9i1 z@+Yo{%^(tSs7W%&TQeKol3r5^P3dArP{patjf_b$$)9FcLQd+LveCUBRm#oZtB|97thXsWVg6~uegCRi(^oD$9MIRgphaw_=75ZX7 z0k07dAfTIop!|v3T}C^Fk^kG>VM?6rSt#yZu=UApo_bVx z{cX=?l(8G|3X4MlUeST7g@Jx%KnSZ ztx(6rcJNC8d<>3~as>bdbqmA;!L(A|QY9t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cOiZ@{%Yq%`#VnQcA%Et+LHDAIG4{PuR5gCPD91otb&cPzEH1pDXrz^9TBHg@|T(t+!{ diff --git a/ci/testnet/fund.py b/ci/testnet/fund.py index e101bc106..46fb7bc35 100644 --- a/ci/testnet/fund.py +++ b/ci/testnet/fund.py @@ -2,7 +2,7 @@ """Fund the nodes of a private test network and keep some transfers flowing. Usage: fund.py [--port 9090] [--amount 60000] [--load-seconds 0] - [--dpos-at SEQ --reward-round SEQ] + [--dpos-at SEQ --reward-round SEQ] [--delegations] The genesis funds of a CREDITS_TESTNET build go to the key given in CS_TESTNET_GENESIS_KEY; this script holds its seed. It sends CS from it to every node (above the 50'000 minimum stake), @@ -13,6 +13,11 @@ --dpos-at, and order 37 turns mining and staking on with a 1 CS block reward from --reward-round. Trusted nodes then earn rewards split by stake, as on mainnet. +With --delegations every node delegates to the next one twice: 1'000 CS without a time limit and +500 CS until --delegation-seconds from now (a timed delegation, which the nodes release on their +own once a block is past that time). Halfway through the load phase, the even nodes withdraw the +delegation without a time limit. + Transaction building and signing are adapted from BK's tools/tps_gen/tps_gen.py (akaitrade/node). """ import argparse @@ -37,8 +42,12 @@ CURRENCY_CS = 1 TX_TYPE_TRANSFER = 0 +UF_DELEGATED = 5 # cs::trx_uf::sp::delegated UF_MANAGING = 7 # cs::trx_uf::sp::managing +UF_TYPE_INTEGER = 1 # csdb::UserField::Integer UF_TYPE_STRING = 2 # csdb::UserField::String +DELEGATE = 1 # cs::trx_uf::sp::de::legate +DELEGATE_WITHDRAW = 2 # cs::trx_uf::sp::de::legated_withdraw (a value >= 4 is a UTC expiry time) SPECIAL_TARGET = bytes(31) + b"\x07" # the target mainnet special transactions use (1111...118) @@ -72,10 +81,15 @@ def pack_inner_id(inner_id): return inner_id.to_bytes(6, "little") # source and target given as public keys, not wallet ids -def transfer(src, dst_pk, amount_int, amount_frac=0, managing=None): - # signed bytes: Transaction::to_byte_stream_for_sig(); a string user field signs as u32 size + bytes - fields_for_sig = struct.pack("= start + args.load_seconds / 2: + withdrawn = True + for i, src, dst in pairs[1::2]: + failures += delegate(f"n{i} withdraws 1000 from n{i % len(nodes) + 1}", + src, dst, 1000, DELEGATE_WITHDRAW) src, dst = random.sample(nodes, 2) ok, message = send(client, src, dst.pk, random.randint(1, 50)) sent += 1 if ok else 0 diff --git a/ci/testnet/run.sh b/ci/testnet/run.sh index 52376d78c..7a536b25f 100755 --- a/ci/testnet/run.sh +++ b/ci/testnet/run.sh @@ -11,6 +11,8 @@ # (default 30) and then keeps random transfers flowing for LOAD_SECONDS (default 300) # DPOS_AT / REWARD_ROUND (default 0 = off, needs FUND=1): the master key, which is also the # starter key, moves StartingDPOS and turns block rewards on (special orders 9 and 37) +# DELEGATE (default 0, needs FUND=1): nodes delegate to each other, with and without a time +# limit (DELEGATION_SECONDS, default 240), and some delegations are withdrawn later # DISK_FULL_NODE (default 0 = off): put that node's block DB on a DISK_TMPFS_MB (default 64) tmpfs, # fill it when the chain reaches DISK_FULL_AT (default 400) and free it DISK_FULL_SECONDS # (default 60) later; the node must recover and end with the same state digest (needs sudo) @@ -31,6 +33,8 @@ LOAD_SECONDS=${LOAD_SECONDS:-300} DISK_FULL_NODE=${DISK_FULL_NODE:-0} DPOS_AT=${DPOS_AT:-0} REWARD_ROUND=${REWARD_ROUND:-0} +DELEGATE=${DELEGATE:-0} +DELEGATION_SECONDS=${DELEGATION_SECONDS:-240} DISK_FULL_AT=${DISK_FULL_AT:-400} DISK_FULL_SECONDS=${DISK_FULL_SECONDS:-60} DISK_TMPFS_MB=${DISK_TMPFS_MB:-64} @@ -165,7 +169,8 @@ while :; do if [ "$FUND" = "1" ] && [ -z "$FUND_PID" ] && [ "$min" -ge "$FUND_AT" ]; then echo "funding nodes from the genesis key, then $LOAD_SECONDS s of transfers" python3 "$HERE/fund.py" "$WORK" "$NODES" "$MASTER_SEED" --load-seconds "$LOAD_SECONDS" \ - --dpos-at "$DPOS_AT" --reward-round "$REWARD_ROUND" > "$WORK/fund.log" 2>&1 & + --dpos-at "$DPOS_AT" --reward-round "$REWARD_ROUND" --delegation-seconds "$DELEGATION_SECONDS" \ + $([ "$DELEGATE" = "1" ] && echo --delegations) > "$WORK/fund.log" 2>&1 & FUND_PID=$! fi From 6946fec8d26ff11affaa13f7d9c4ea92a53d2ca3 Mon Sep 17 00:00:00 2001 From: EnzinoBB Date: Fri, 9 Oct 2026 18:19:31 +0200 Subject: [PATCH 3/4] ci(testnet): send orders 9 and 37 independently fund.py sent the special orders only when both --dpos-at and --reward-round were set, so a run with rewards on and the default StartingDPOS (10'000) silently sent neither (run 37943830969: its state digest stayed the same from block 1000 to 12000). Each order is now sent on its own. Also stop tracking the Python bytecode cache that slipped in with the first fund.py commit. Co-Authored-By: Claude Opus 5.5 --- ci/testnet/.gitignore | 1 + ci/testnet/__pycache__/fund.cpython-312.pyc | Bin 14506 -> 0 bytes ci/testnet/fund.py | 19 ++++++++++++------- 3 files changed, 13 insertions(+), 7 deletions(-) create mode 100644 ci/testnet/.gitignore delete mode 100644 ci/testnet/__pycache__/fund.cpython-312.pyc diff --git a/ci/testnet/.gitignore b/ci/testnet/.gitignore new file mode 100644 index 000000000..c18dd8d83 --- /dev/null +++ b/ci/testnet/.gitignore @@ -0,0 +1 @@ +__pycache__/ diff --git a/ci/testnet/__pycache__/fund.cpython-312.pyc b/ci/testnet/__pycache__/fund.cpython-312.pyc deleted file mode 100644 index 65f349c18b974f0770d60996d010629ba54d2a92..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 14506 zcmb_?Yfu|$l3~3s8ZrZfn8lft%KuEZ%Fh(u9 z@oeu|YD9=owpS~sR4*l`IlVb@s_WIsslHb)r*tnZr-ojmoSJ$~kZS$r zVN0)t#IY&Ab=cNxlk++L+~K_5Jd)tFgO%!%GU?#1OkT~s1k$OtXHu^4E~%8%wAb+` z^xk|$`!eIJInKfA;7`xecXKw(SF9m8)8HE_WF~#dIyM``+-NKT+<*co@g3ayS3T1}P>)i(Fc1U-?{FSU-#V?y5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?^?LDTom7XDz>FDW^cM*`N(`eX)c)W znkS>3adXvF+fxIK_QI^qsd!-|PLVC-O6Nao@3;JuF?R8t|6xs>?D>uP-Q{f&&vfDR zwYmD4(U~oCqtVXA{Dq5mOTTzOzV*NZ%fXoWT|Ag~lX}ytz9^wDdR$mCduisuI+Be4I*h%kK`w@63pqn**yv0cZO8-J}` zY551^y^i~x@rI7rvGcKQ7h+u(V?DjG%RhM7H<&0MikpWbZR@%nU9SIoVddc8h3=iW z-xxpkcI;@!{ejp!mtz;N#J0Vk+*TR&F6>{@J=c;YM}AL`mLq`699RR8gxNCLjN59T zYX9WiWJ}UkFfFbYRmb7qRz2C4EGS+rsEij>#&Rns+t-ZNJI*QRCwu1T2S(-_Tk&VE z&o9ki`t-epmZj#^11<3bE%(Xzf%bS!`-AfKWbu|rdva?fY|XVmMqTqCJR>xgHgd)^ zO-}Eh(n@Wy=g8D$1_jJ8w{0$euIaO} z==BBh=VM=vCAJ=3*2XFtV%Fm;uHVpS;m$yZ$CUn7+s(F_>PY7!YI~G~=(}eENm$O2 z-#x1%ESE?D?bZMNWO+|D_0O7ZJ$q$;LgeLcH|R^KjCOQ5>m@Mre-a7cpWmYQ_j2dW7O`Gk`f+ zSC@4bSyMqt$k$_Z0HbXfp^5!_xLJi$MLA_+gC3t~7glKeeYKvK_l6J+jh3Da*0 z!*27oeZFOWOVk_Nb1YHP z5Ifr&8yt@L0uPPBN&UB0+oTD+CSpV`_&ZOUlXBUfKWR(m*(a^&NI@qH3S&gxH+ha} z{zoNqJ@LHCN$WG6g{=5JLzqhD@)O4LN&WxPQRMdD6A(SKlH~5^^iI<9`~pdnJD)i; nB=gLuA$LDBo+Zg0PkS{4WsZa%XiL7K=s$0LswF7JLH7RvOLFUT diff --git a/ci/testnet/fund.py b/ci/testnet/fund.py index 46fb7bc35..ab65e70b4 100644 --- a/ci/testnet/fund.py +++ b/ci/testnet/fund.py @@ -8,7 +8,7 @@ script holds its seed. It sends CS from it to every node (above the 50'000 minimum stake), then, for --load-seconds, small random transfers between nodes, through the Thrift API of node 1. -With --dpos-at and --reward-round the master key, which is also the starter key of the test network +With --dpos-at and/or --reward-round the master key, which is also the starter key of the test network (CS_TESTNET_STARTER_KEY), sends two special "managing" transactions: order 9 moves StartingDPOS to --dpos-at, and order 37 turns mining and staking on with a 1 CS block reward from --reward-round. Trusted nodes then earn rewards split by stake, as on mainnet. @@ -168,12 +168,17 @@ def main(): print(f"fund n{i}: {'ok' if ok else 'FAILED ' + message}", flush=True) failures += 0 if ok else 1 - if args.dpos_at and args.reward_round: - # Node::processSpecialInfo: u16 order, then the order's fields (cs::IDataStream, little endian) - order9 = struct.pack(" Date: Sat, 10 Oct 2026 09:12:40 +0200 Subject: [PATCH 4/4] ci(testnet): special order 22 and its replay after a quick start fund.py --min-stake sends special order 22 (minimum stake of a trusted node). With MIN_STAKE set and the restart test on, run.sh requires the restarted node to log the order twice: once live, and once more when it is replayed after the quick start. Exposed as the 'min_stake' workflow input. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/testnet.yml | 4 ++++ ci/testnet/fund.py | 8 ++++++-- ci/testnet/run.sh | 15 ++++++++++++++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/.github/workflows/testnet.yml b/.github/workflows/testnet.yml index 1294961c3..fa8bbbda4 100644 --- a/.github/workflows/testnet.yml +++ b/.github/workflows/testnet.yml @@ -25,6 +25,9 @@ on: reward_round: description: 'Turn block rewards on at this round via special order 37 (0 = off)' default: '0' + min_stake: + description: 'Set the minimum stake via special order 22, in CS (0 = off)' + default: '0' delegate: description: 'Nodes delegate to each other, with and without a time limit (0 = off)' default: '0' @@ -127,6 +130,7 @@ jobs: DPOS_AT: ${{ inputs.dpos_at || '0' }} REWARD_ROUND: ${{ inputs.reward_round || '0' }} DELEGATE: ${{ inputs.delegate || '0' }} + MIN_STAKE: ${{ inputs.min_stake || '0' }} FUND: '1' LOAD_SECONDS: '300' WORK: ${{ github.workspace }}/testnet-run diff --git a/ci/testnet/fund.py b/ci/testnet/fund.py index ab65e70b4..d303dab42 100644 --- a/ci/testnet/fund.py +++ b/ci/testnet/fund.py @@ -2,7 +2,7 @@ """Fund the nodes of a private test network and keep some transfers flowing. Usage: fund.py [--port 9090] [--amount 60000] [--load-seconds 0] - [--dpos-at SEQ --reward-round SEQ] [--delegations] + [--dpos-at SEQ --reward-round SEQ] [--min-stake CS] [--delegations] The genesis funds of a CREDITS_TESTNET build go to the key given in CS_TESTNET_GENESIS_KEY; this script holds its seed. It sends CS from it to every node (above the 50'000 minimum stake), @@ -11,7 +11,8 @@ With --dpos-at and/or --reward-round the master key, which is also the starter key of the test network (CS_TESTNET_STARTER_KEY), sends two special "managing" transactions: order 9 moves StartingDPOS to --dpos-at, and order 37 turns mining and staking on with a 1 CS block reward from --reward-round. -Trusted nodes then earn rewards split by stake, as on mainnet. +Trusted nodes then earn rewards split by stake, as on mainnet. --min-stake sends order 22, which +sets the minimum stake of a trusted node (keep it below the funded amount). With --delegations every node delegates to the next one twice: 1'000 CS without a time limit and 500 CS until --delegation-seconds from now (a timed delegation, which the nodes release on their @@ -152,6 +153,7 @@ def main(): parser.add_argument("--load-seconds", type=int, default=0) parser.add_argument("--dpos-at", type=int, default=0) parser.add_argument("--reward-round", type=int, default=0) + parser.add_argument("--min-stake", type=int, default=0) parser.add_argument("--delegations", action="store_true") parser.add_argument("--delegation-seconds", type=int, default=240) args = parser.parse_args() @@ -177,6 +179,8 @@ def main(): # staking+mining, reward 1.0, coeff 0 orders.append(("order 37 (rewards from round %d)" % args.reward_round, struct.pack(" "$WORK/fund.log" 2>&1 & FUND_PID=$! fi @@ -195,6 +198,16 @@ if [ "$DISK_FULL_NODE" -gt 0 ]; then echo "disk-full test: n$DISK_FULL_NODE logged $(grep -ah "Couldn't save block" "$WORK/n$DISK_FULL_NODE"/*.log | wc -l) failed block saves" fi +if [ "$MIN_STAKE" -gt 0 ] && [ "$RESTART_AT" -gt 0 ]; then + # order 22 lands well before the restart: once applied live, once more after the quick start + applied=$(grep -ah "MinStakeValue changed to" "$WORK/n$NODES"/*.log | wc -l) + echo "special orders: n$NODES applied order 22 $applied time(s)" + if [ "$applied" -lt 2 ]; then + echo "FAIL: n$NODES lost special order 22 across its quick start" + exit 1 + fi +fi + # every node logs "STATE DIGEST # wallets "; at a sequence logged by several nodes the # digests must be identical python3 - "$WORK" "$NODES" "$FUND" <<'PY'