Skip to content

Commit

Permalink
check latest confirmation
Browse files Browse the repository at this point in the history
  • Loading branch information
Sneh1999 committed Aug 15, 2024
1 parent 39d9e3d commit d073691
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions .github/workflows/smoke-test-node.bash
Original file line number Diff line number Diff line change
@@ -1,26 +1,37 @@
#!/bin/bash
# The script starts up the test node and waits until the timeout (10min) or
# until send-l2 succeeds.
# until send-l2 succeeds and the latest confirmation is fetched.

# Start the test node and get PID, to terminate it once send-l2 is done.
cd ${GITHUB_WORKSPACE}

./snoke-test-node.bash --init --detach
./smoke-test-node.bash --init --detach

START=$(date +%s)
L2_TRANSACTION_SUCCEEDED=false
L3_TRANSACTION_SUCCEEDED=false
LATEST_CONFIRMATION_FETCHED=false
SUCCEEDED=false

while true; do
if [ "$L2_TRANSACTION_SUCCEEDED" = false ]; then
if ${GITHUB_WORKSPACE}/snoke-test-node.bash script send-l2 --ethamount 100 --to user_l2user --wait; then
if ${GITHUB_WORKSPACE}/smoke-test-node.bash script send-l2 --ethamount 100 --to user_l2user --wait; then
echo "Sending l2 transaction succeeded"
L2_TRANSACTION_SUCCEEDED=true
fi
fi

if [ "$L2_TRANSACTION_SUCCEEDED" = true ]; then
if [ "$LATEST_CONFIRMATION_FETCHED" = false ]; then
rollupAddress=`docker compose run --entrypoint sh poster -c "jq -r '.[0].rollup.rollup' /config/deployed_chain_info.json | tail -n 1 | tr -d '\r\n'"`
cast call --rpc-url http://localhost:8545 $rollupAddress 'latestConfirmed()(uint256)' | grep "error" > /dev/null
error=` cast call --rpc-url http://localhost:8545 $rollupAddress 'latestConfirmed()(uint256)' | grep "error"`
if [ "$error" == "" ]; then
echo "Lastest confirmation fetched"
LATEST_CONFIRMATION_FETCHED=true
fi
fi


if [ "$L2_TRANSACTION_SUCCEEDED" = true ] && [ "$LASTEST_CONFIRMATION_FETCHED" = true ]; then
SUCCEEDED=true
break
fi
Expand Down

0 comments on commit d073691

Please sign in to comment.