• Mark Tyneway's avatar
    contracts-bedrock: add deploy config validator · 0ee1c09c
    Mark Tyneway authored
    Adds a validator for the deploy configs so that we can be
    automatically sure that deploy configs are valid. The problem
    is that `getting-started.json` will never pass deploy config
    validation because it is invalid JSON and it is the one that
    we want to be sure is up to date. Will leave solving that to
    future work because it requires a change to the getting started
    guide for the op stack.
    0ee1c09c
check-deploy-configs.sh 711 Bytes
#!/usr/bin/env bash

# This script is used to check for valid deploy configs.
# It should check all configs and return a non-zero exit code if any of them are invalid.
# getting-started.json isn't valid JSON so its skipped.

code=$?

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
CONTRACTS_BASE=$(dirname $SCRIPT_DIR)
MONOREPO_BASE=$(dirname $(dirname $CONTRACTS_BASE))

for config in $CONTRACTS_BASE/deploy-config/*.json; do
    if grep -q "getting-started" <<< "$config"; then
      echo "Skipping getting-started.json"
      continue
    fi

    go run $MONOREPO_BASE/op-chain-ops/cmd/check-deploy-config/main.go --path $config
    [ $? -eq 0 ]  || code=$?
done

exit $code