Skip to content

Commit

Permalink
Add check for rollup sync before running evm process
Browse files Browse the repository at this point in the history
  • Loading branch information
puppetninja committed Jul 30, 2024
1 parent 8b32e34 commit b188881
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions charts/tezos/scripts/evm-observer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@ ROLLUP_DATA_DIR="${TEZ_VAR}/rollup"
EVM_DATA_DIR="${TEZ_VAR}/evm"
EVM_CONFIG_FILE="${EVM_DATA_DIR}/config.json"

# Wait till rollup node to be fully synchronized to run init from rollup command
WAIT_LIMIT=30
COUNTER=0
while [ "$(curl -s http://localhost:8932/local/synchronized)" != "synchronized" ] && [ $COUNTER -lt $WAIT_LIMIT ]; do
echo "polling ${COUNTER}/${WAIT_LIMIT}: rollup node not synchronized yet"
sleep 60
done

if [ "$(curl -s http://localhost:8932/local/synchronized)" != "synchronized" ]; then
echo "ERROR: rollup node not synchronized within wait limit, exiting...."
exit 1
fi

if [ ! -e "${EVM_DATA_DIR}/store.sqlite" ]; then
$TEZ_BIN/octez-evm-node init from rollup node ${ROLLUP_DATA_DIR} --data-dir ${EVM_DATA_DIR}
fi
Expand Down

0 comments on commit b188881

Please sign in to comment.