Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 58 additions & 8 deletions mithril-test-lab/mithril-devnet/devnet-mkfiles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,7 @@ fi

# download cardano-cli & cardano-node
curl -s ${CARDANO_BINARY_URL} --output cardano-bin.tar.gz
mkdir tmp
tar xzf cardano-bin.tar.gz -C tmp
cp tmp/cardano-cli .
cp tmp/cardano-node .
rm -rf tmp
tar xzf cardano-bin.tar.gz ./cardano-cli ./cardano-node
rm -f cardano-bin.tar.gz

# and copy cardano-cli & cardano-node
Expand Down Expand Up @@ -480,10 +476,9 @@ echo "stake address regitration certs, and stake address delegatation certs"
echo
ls -1 addresses/
echo "====================================================================="

echo

# Next is to make the stake pool registration cert

for NODE in ${POOL_NODES}; do

./cardano-cli stake-pool registration-certificate \
Expand All @@ -494,11 +489,26 @@ for NODE in ${POOL_NODES}; do
--reward-account-verification-key-file ${NODE}/owner.vkey \
--pool-owner-stake-verification-key-file ${NODE}/owner.vkey \
--out-file ${NODE}/registration.cert

done

echo "Generated stake pool registration certs:"
ls -1 node-*/registration.cert
echo "====================================================================="
echo

# Next is to prepare the pool env files
POOL_IDX=0
for NODE in ${POOL_NODES}; do

echo PARTY_ID=${POOL_IDX} > ${NODE}/pool.env
POOL_IDX=$(( $POOL_IDX + 1))

done

echo "Generated pool env files:"
ls -1 node-*/pool.env
echo "====================================================================="

cat >> activate.sh <<EOF
#!/bin/bash
Expand Down Expand Up @@ -562,6 +572,29 @@ EOF

done

# Wait until pools are activated on the Cardano network
cat >> activate.sh <<EOF
echo ">> Wait for Cardano pools to be activated"
while true
do
POOLS=\$(./pools.sh 2> /dev/null)
if [ "\$POOLS" != "" ] ; then
echo ">>>> Activated!"
POOL_IDX=1
./pools.sh | while read POOL_ID ; do
echo ">>>> Found PoolId: \$POOL_ID"
echo PARTY_ID=\${POOL_ID} > node-pool\${POOL_IDX}/pool.env
POOL_IDX=\$(( \$POOL_IDX + 1))
done
break
else
echo ">>>> Not activated yet"
sleep 2
fi
done

EOF

chmod u+x activate.sh

echo "Generated activate.sh script"
Expand Down Expand Up @@ -657,6 +690,20 @@ echo "Generated query.sh script"
echo "====================================================================="
echo

cat >> pools.sh <<EOF
#!/bin/bash

CARDANO_NODE_SOCKET_PATH=node-bft1/ipc/node.sock ./cardano-cli query stake-pools \\
--cardano-mode \\
--testnet-magic ${NETWORK_MAGIC}
EOF

chmod u+x pools.sh

echo "Generated pools.sh script"
echo "====================================================================="
echo

echo "Generate docker-compose.yaml file"
cat >> docker-compose.yaml <<EOF
version: "3.9"
Expand Down Expand Up @@ -776,6 +823,7 @@ cat >> docker-compose.yaml <<EOF
- RUST_BACKTRACE=1
- GOOGLE_APPLICATION_CREDENTIALS_JSON=
- NETWORK=devnet
- NETWORK_MAGIC=${NETWORK_MAGIC}
- RUN_INTERVAL=5000
- URL_SNAPSHOT_MANIFEST=
- SNAPSHOT_STORE_TYPE=local
Expand Down Expand Up @@ -816,11 +864,13 @@ cat >> docker-compose.yaml <<EOF
- ./${NODE}:/data
networks:
- mithril_network
env_file:
- ./${NODE}/pool.env
environment:
- RUST_BACKTRACE=1
- AGGREGATOR_ENDPOINT=http://mithril-aggregator:8080/aggregator
- NETWORK=devnet
- PARTY_ID=${NODE_IX}
- NETWORK_MAGIC=${NETWORK_MAGIC}
- RUN_INTERVAL=1000
- DB_DIRECTORY=/data/db
- STAKE_STORE_DIRECTORY=/data/mithril/signer/db/stake_db
Expand Down
16 changes: 8 additions & 8 deletions mithril-test-lab/mithril-devnet/devnet-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,22 @@ echo
# Change directory
cd ${ROOT}

# Start devnet Mithril nodes
if [ "${NODES}" = "mithril" ] || [ "${NODES}" = "*" ]; then
# Start devnet Cardano nodes
if [ "${NODES}" = "cardano" ] || [ "${NODES}" = "*" ]; then
echo "====================================================================="
echo " Start Mithril nodes"
echo " Start Cardano nodes"
echo "====================================================================="
echo
./start-mithril.sh
./start-cardano.sh
echo
fi

# Start devnet Cardano nodes
if [ "${NODES}" = "cardano" ] || [ "${NODES}" = "*" ]; then
# Start devnet Mithril nodes
if [ "${NODES}" = "mithril" ] || [ "${NODES}" = "*" ]; then
echo "====================================================================="
echo " Start Cardano nodes"
echo " Start Mithril nodes"
echo "====================================================================="
echo
./start-cardano.sh
./start-mithril.sh
echo
fi