forked from input-output-hk/mithril
-
Notifications
You must be signed in to change notification settings - Fork 0
/
devnet-run.sh
executable file
·73 lines (65 loc) · 2.18 KB
/
devnet-run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env bash
set -e
# Default values
if [ -z "${NODES}" ]; then
NODES="*"
fi
if [ -z "${ARTIFACTS_DIR}" ]; then
ARTIFACTS_DIR="artifacts"
fi
if [ -z "${FORCE_DELETE_ARTIFACTS_DIR}" ]; then
FORCE_DELETE_ARTIFACTS_DIR="true"
fi
if [ -z "${DELEGATE_PERIOD}" ]; then
DELEGATE_PERIOD="180"
fi
# Bootstrap devnet
echo "====================================================================="
echo " Bootstrap Mithril/Cardano devnet"
echo "====================================================================="
echo
if [[ "$FORCE_DELETE_ARTIFACTS_DIR" == "true" ]]; then
echo ">> The ${ARTIFACTS_DIR} directory was force deleted"
rm -rf ${ARTIFACTS_DIR} > /dev/null
fi
ARTIFACTS_DIR=${ARTIFACTS_DIR} $(pwd)/devnet-mkfiles.sh
echo
# Change directory
pushd ${ARTIFACTS_DIR} > /dev/null
# Start devnet Cardano nodes
if [ "${NODES}" = "cardano" ] || [ "${NODES}" = "*" ]; then
echo "====================================================================="
echo " Start Cardano nodes"
echo "====================================================================="
echo
./start-cardano.sh
echo
fi
# Start devnet Mithril nodes
if [ "${NODES}" = "mithril" ] || [ "${NODES}" = "*" ]; then
echo ">> Info: Mithril Aggregator will be attached to the first Cardano BFT node"
echo ">> Info: Mithril Signers will be attached to each Cardano SPO node"
echo "====================================================================="
echo " Start Mithril nodes"
echo "====================================================================="
echo
./start-mithril.sh
echo
fi
# Schedule stake delegation
echo "====================================================================="
echo " Schedule Cardano Stake Delegation"
echo "====================================================================="
echo
DELEGATION_ROUND=0
echo ">> Begin scheduled stakes delegation"
while true
do
echo ">> $(date +"%T"): Wait ${DELEGATE_PERIOD}s until next stakes delegation round..."
sleep ${DELEGATE_PERIOD}
DELEGATION_ROUND=$(( $DELEGATION_ROUND + 1 ))
echo ">> Run stakes delegation round #${DELEGATION_ROUND}!"
DELEGATION_ROUND=${DELEGATION_ROUND} ./delegate.sh
done
echo
popd