Skip to content

Commit 5fe3e29

Browse files
committed
Fix compute devnet max rounds
Adapt the computation to the real epoch duration.
1 parent 8c7ba09 commit 5fe3e29

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

mithril-test-lab/mithril-devnet/devnet-mkfiles.sh

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -601,9 +601,12 @@ done
601601
# Wait until pools are activated on the Cardano network
602602
cat >> activate.sh <<EOF
603603
echo ">> Wait for Cardano pools to be activated"
604-
POOLS_ACTIVATION_WAIT_ROUNDS_MAX=20
605-
POOL_STAKE_RETRIEVAL_WAIT_ROUNDS_MAX=30
604+
POOLS_ACTIVATION_WAIT_ROUND_DELAY=2
605+
POOLS_ACTIVATION_WAIT_ROUNDS_MAX=\$(echo "scale=0; 2 * $EPOCH_LENGTH * $SLOT_LENGTH / \$POOLS_ACTIVATION_WAIT_ROUND_DELAY" | bc)
606606
POOLS_ACTIVATION_WAIT_ROUNDS=1
607+
POOL_STAKE_RETRIEVAL_WAIT_ROUND_DELAY=2
608+
POOL_STAKE_RETRIEVAL_WAIT_ROUNDS_MAX=\$POOLS_ACTIVATION_WAIT_ROUNDS_MAX
609+
607610
while true
608611
do
609612
POOLS=\$(./pools.sh 2> /dev/null)
@@ -621,7 +624,7 @@ do
621624
break
622625
else
623626
echo ">>>> Stakes are not retrievable for this pool yet... [attempt \$POOL_STAKE_RETRIEVAL_WAIT_ROUNDS]"
624-
sleep 2
627+
sleep \$POOL_STAKE_RETRIEVAL_WAIT_ROUND_DELAY
625628
fi
626629
POOL_STAKE_RETRIEVAL_WAIT_ROUNDS=\$(( \$POOL_STAKE_RETRIEVAL_WAIT_ROUNDS + 1 ))
627630
if [ "\$POOL_STAKE_RETRIEVAL_WAIT_ROUNDS" -gt "\$POOL_STAKE_RETRIEVAL_WAIT_ROUNDS_MAX" ] ; then
@@ -634,7 +637,7 @@ do
634637
break
635638
else
636639
echo ">>>> Cardano pools are not activated yet... [attempt \$POOLS_ACTIVATION_WAIT_ROUNDS]"
637-
sleep 2
640+
sleep \$POOLS_ACTIVATION_WAIT_ROUND_DELAY
638641
fi
639642
POOLS_ACTIVATION_WAIT_ROUNDS=\$(( \$POOLS_ACTIVATION_WAIT_ROUNDS + 1 ))
640643
if [ "\$POOLS_ACTIVATION_WAIT_ROUNDS" -gt "\$POOLS_ACTIVATION_WAIT_ROUNDS_MAX" ] ; then
@@ -1001,7 +1004,7 @@ done
10011004
NODE_IX=0
10021005
for NODE in ${POOL_NODES}; do
10031006
NODE_ID=$(( $NODE_IX + 1))
1004-
if [ `expr $NODE_IX % 2` == 0 ]; then
1007+
if [ `expr $NODE_IX % 2` == 0 || -z "${WITH_UNCERTIFIED_SIGNERS}" ]; then
10051008
# 50% of signers with key certification
10061009
cat >> ${NODE}/info.json <<EOF
10071010
{
@@ -1193,17 +1196,16 @@ cat >> start-cardano.sh <<EOF
11931196
echo ">> Wait for Cardano network to be ready"
11941197
CARDANO_ACTIVATION_WAIT_ROUNDS_MAX=30
11951198
CARDANO_ACTIVATION_WAIT_ROUNDS=1
1199+
CARDANO_ACTIVATION_WAIT_ROUND_DELAY=2
11961200
while true
11971201
do
1198-
EPOCH=\$(CARDANO_NODE_SOCKET_PATH=node-bft1/ipc/node.sock ./cardano-cli query tip \\
1199-
--cardano-mode \\
1200-
--testnet-magic ${NETWORK_MAGIC} 2> /dev/null | jq .epoch | sed -e "s/null//" | sed -e "s/ //" | tr -d '\n')
1202+
EPOCH=\$(CARDANO_NODE_SOCKET_PATH=node-bft1/ipc/node.sock ./cardano-cli query tip --cardano-mode --testnet-magic ${NETWORK_MAGIC} 2> /dev/null | jq -r .epoch)
12011203
if [ "\$EPOCH" != "" ] ; then
12021204
echo ">>>> Cardano network is ready!"
12031205
break
12041206
else
12051207
echo ">>>> Cardano network is not ready yet... [attempt \$CARDANO_ACTIVATION_WAIT_ROUNDS]"
1206-
sleep 2
1208+
sleep \$CARDANO_ACTIVATION_WAIT_ROUND_DELAY
12071209
fi
12081210
CARDANO_ACTIVATION_WAIT_ROUNDS=\$(( \$CARDANO_ACTIVATION_WAIT_ROUNDS + 1 ))
12091211
if [ "\$CARDANO_ACTIVATION_WAIT_ROUNDS" -gt "\$CARDANO_ACTIVATION_WAIT_ROUNDS_MAX" ] ; then
@@ -1258,12 +1260,12 @@ done
12581260
cat >> start-mithril.sh <<EOF
12591261
12601262
echo ">> Wait for Mithril signers to be registered"
1263+
EPOCH_NOW=\$(CARDANO_NODE_SOCKET_PATH=node-bft1/ipc/node.sock ./cardano-cli query tip --cardano-mode --testnet-magic ${NETWORK_MAGIC} 2> /dev/null | jq -r .epoch)
12611264
while true
12621265
do
1263-
EPOCH=\$(CARDANO_NODE_SOCKET_PATH=node-bft1/ipc/node.sock ./cardano-cli query tip \\
1264-
--cardano-mode \\
1265-
--testnet-magic ${NETWORK_MAGIC} 2> /dev/null | jq .epoch | sed -e "s/null//" | sed -e "s/ //" | tr -d '\n')
1266-
if [ \$EPOCH -ge 2 ] ; then
1266+
EPOCH=\$(CARDANO_NODE_SOCKET_PATH=node-bft1/ipc/node.sock ./cardano-cli query tip --cardano-mode --testnet-magic ${NETWORK_MAGIC} 2> /dev/null | jq -r .epoch)
1267+
EPOCH_DELTA=\$(( \$EPOCH - \$EPOCH_NOW ))
1268+
if [ \$EPOCH_DELTA -ge 2 ] ; then
12671269
echo ">>>> Ready!"
12681270
break
12691271
else

0 commit comments

Comments
 (0)