Skip to content

Commit

Permalink
Restore logs output functionality in cluster script (#1561)
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan-Ethernal committed May 29, 2023
1 parent 952524b commit 363931b
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions scripts/cluster
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,16 @@ function createGenesis() {
function initRootchain() {
echo "Initializing rootchain"

./polygon-edge rootchain server > /dev/null &

if [ "$1" == "write-logs" ]; then
echo "Writing rootchain server logs to the file..."
./polygon-edge rootchain server 2>&1 | tee ./rootchain-server.log &
else
./polygon-edge rootchain server >/dev/null &
fi

set +e
t=1
while [ $t -gt 0 ]
do
while [ $t -gt 0 ]; do
nc -z 127.0.0.1 8545 </dev/null
t=$?
sleep 1
Expand All @@ -56,8 +60,8 @@ function initRootchain() {

./polygon-edge rootchain deploy \
--stake-manager ${stakeManagerAddr} \
--test
--test

customSupernetManagerAddr=$(cat genesis.json | jq -r '.params.engine.polybft.bridge.customSupernetManagerAddr')
supernetID=$(cat genesis.json | jq -r '.params.engine.polybft.supernetID')

Expand All @@ -74,22 +78,21 @@ function initRootchain() {
--jsonrpc http://127.0.0.1:8545

counter=1
while [ $counter -le 4 ]
do
while [ $counter -le 4 ]; do
echo "Registering validator: ${counter}"

./polygon-edge polybft register-validator \
--supernet-manager ${customSupernetManagerAddr} \
--data-dir test-chain-${counter} \
--jsonrpc http://127.0.0.1:8545
--supernet-manager ${customSupernetManagerAddr} \
--data-dir test-chain-${counter} \
--jsonrpc http://127.0.0.1:8545

./polygon-edge polybft stake \
--data-dir test-chain-${counter} \
--amount 1000000000000000000000000 \
--supernet-id ${supernetID} \
--stake-manager ${stakeManagerAddr} \
--stake-token ${stakeToken} \
--jsonrpc http://127.0.0.1:8545
--data-dir test-chain-${counter} \
--amount 1000000000000000000000000 \
--supernet-id ${supernetID} \
--stake-manager ${stakeManagerAddr} \
--stake-token ${stakeToken} \
--jsonrpc http://127.0.0.1:8545

((counter++))
done
Expand Down Expand Up @@ -203,7 +206,7 @@ case "$2" in
initPolybftConsensus
# Create genesis file and start the server from binary
createGenesis
initRootchain
initRootchain $2
startServerFromBinary $2
exit 0
else
Expand Down

0 comments on commit 363931b

Please sign in to comment.