diff --git a/integration_test/entrypoint.sh b/integration_test/entrypoint.sh index b42964220..566f13269 100755 --- a/integration_test/entrypoint.sh +++ b/integration_test/entrypoint.sh @@ -7,15 +7,17 @@ DIR=$( pwd ) -if ! command -v docker &>/dev/null 2>&1; then - echo "ERROR: docker command not found" - exit 1 -fi +# load tool commands. +source "./scripts/common.sh" -if ! docker info >/dev/null 2>&1; then - echo "ERROR: docker daemon isn't running" - exit 1 -fi +# make sure all the commands are available. +check_command "solc" +check_command "cast" +check_command "forge" +check_command "docker" + +# make sure environment variables are set +check_env "TAIKO_MONO_DIR" TESTNET_CONFIG=$DIR/nodes/docker-compose.yml diff --git a/integration_test/nodes/docker-compose.yml b/integration_test/nodes/docker-compose.yml index 64a816b99..7c52581fe 100644 --- a/integration_test/nodes/docker-compose.yml +++ b/integration_test/nodes/docker-compose.yml @@ -2,27 +2,27 @@ version: "3.9" services: l1_node: - image: ghcr.io/foundry-rs/foundry:latest + image: ghcr.dockerproxy.com/foundry-rs/foundry:latest restart: unless-stopped pull_policy: always ports: - - 18545:8545 - - 18546:8545 + - "18545:8545" + - "18546:8545" entrypoint: - anvil - --host - "0.0.0.0" l2_execution_engine: - image: gcr.io/evmchain/taiko-geth:taiko + image: gcr.dockerproxy.com/evmchain/taiko-geth:taiko restart: unless-stopped pull_policy: always volumes: - .:/host ports: - - 28545:8545 - - 28546:8546 - - 28551:8551 + - "28545:8545" + - "28546:8546" + - "28551:8551" command: - --nodiscover - --gcmode diff --git a/integration_test/nodes/init.sh b/integration_test/nodes/init.sh index dcd7b7b54..be96471c9 100755 --- a/integration_test/nodes/init.sh +++ b/integration_test/nodes/init.sh @@ -7,9 +7,6 @@ DIR=$( pwd ) -# Download solc for PlonkVerifier -$TAIKO_MONO_DIR/packages/protocol/script/download_solc.sh - echo "Starting testnet..." docker compose -f $TESTNET_CONFIG down -v --remove-orphans &>/dev/null @@ -21,14 +18,7 @@ NODE_URL=localhost:18545 $DIR/../util/wait_for_node.sh NODE_URL=localhost:28545 $DIR/../util/wait_for_node.sh # Get the hash of L2 genesis. -L2_GENESIS_HASH=$( - curl \ - --silent \ - -X POST \ - -H "Content-Type: application/json" \ - -d '{"jsonrpc":"2.0","id":0,"method":"eth_getBlockByNumber","params":["0x0", false]}' \ - localhost:28545 | jq .result.hash | sed 's/\"//g' -) +L2_GENESIS_HASH=$(cast block --rpc-url localhost:28545 0x0 -f hash) GUARDIAN_PROVERS_ADDRESSES_LIST=( "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" diff --git a/scripts/common.sh b/scripts/common.sh new file mode 100644 index 000000000..2d3744e0a --- /dev/null +++ b/scripts/common.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +RED='\033[1;31m' +NC='\033[0m' # No Color + +print_error() { + local msg="$1" + echo -e "${RED}$msg${NC}" +} + +check_env() { + local name="$1" + local value="${!name}" + + if [ -z "$value" ]; then + print_error "$name not set in env" + exit 1 + fi +} + +check_command() { + if ! command -v "$1" &> /dev/null; then + print_error "$1 could not be found" + exit + fi +} +