Commit 658d4df5 authored by Mark Tyneway's avatar Mark Tyneway Committed by GitHub

Merge pull request #8487 from ethereum-optimism/chore/shellcheck-setup

chore: apply shellcheck auto fixes
parents a2e2e1cd f0ff921a
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# This script updates the prisma schema # This script updates the prisma schema
# #
SCRIPT_DIR=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) SCRIPT_DIR=$( cd "$(dirname "${BASH_SOURCE[0]}")" || exit ; pwd -P )
DATABASE_URL=${DATABASE_URL:-postgresql://db_username:db_password@localhost:5434/db_name} DATABASE_URL=${DATABASE_URL:-postgresql://db_username:db_password@localhost:5434/db_name}
PRISMA_FILE="$SCRIPT_DIR/schema.prisma" PRISMA_FILE="$SCRIPT_DIR/schema.prisma"
...@@ -10,21 +10,21 @@ TEMP_FILE="$SCRIPT_DIR/temp-schema.prisma" ...@@ -10,21 +10,21 @@ TEMP_FILE="$SCRIPT_DIR/temp-schema.prisma"
function update_prisma() { function update_prisma() {
echo "Updating Prisma Schema..." echo "Updating Prisma Schema..."
npx prisma db pull --url $DATABASE_URL --schema $PRISMA_FILE npx prisma db pull --url "$DATABASE_URL" --schema "$PRISMA_FILE"
echo "Update completed." echo "Update completed."
} }
function check_prisma() { function check_prisma() {
echo "Checking Prisma Schema..." echo "Checking Prisma Schema..."
cp $PRISMA_FILE $TEMP_FILE cp "$PRISMA_FILE" "$TEMP_FILE"
npx prisma db pull --url $DATABASE_URL --schema $TEMP_FILE npx prisma db pull --url "$DATABASE_URL" --schema "$TEMP_FILE"
diff $PRISMA_FILE $TEMP_FILE > /dev/null diff "$PRISMA_FILE" "$TEMP_FILE" > /dev/null
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "Prisma Schema is up-to-date." echo "Prisma Schema is up-to-date."
rm $TEMP_FILE rm "$TEMP_FILE"
else else
echo "Prisma Schema is not up-to-date." echo "Prisma Schema is not up-to-date."
rm $TEMP_FILE rm "$TEMP_FILE"
return 1 return 1
fi fi
} }
......
...@@ -12,19 +12,19 @@ TRACES=$DIR/call-traces ...@@ -12,19 +12,19 @@ TRACES=$DIR/call-traces
RECEIPTS=$DIR/receipts RECEIPTS=$DIR/receipts
DIFFS=$DIR/state-diffs DIFFS=$DIR/state-diffs
mkdir -p $TRACES mkdir -p "$TRACES"
mkdir -p $RECEIPTS mkdir -p "$RECEIPTS"
mkdir -p $DIFFS mkdir -p "$DIFFS"
cast rpc \ cast rpc \
debug_traceTransaction \ debug_traceTransaction \
$HASH \ "$HASH" \
'{"tracer": "callTracer"}' | jq > $TRACES/$HASH.json '{"tracer": "callTracer"}' | jq > "$TRACES"/"$HASH".json
cast receipt $HASH --json | jq > $RECEIPTS/$HASH.json cast receipt "$HASH" --json | jq > "$RECEIPTS"/"$HASH".json
cast rpc \ cast rpc \
debug_traceTransaction \ debug_traceTransaction \
$HASH \ "$HASH" \
'{"tracer": "prestateTracer"}' | jq > $DIFFS/$HASH.json '{"tracer": "prestateTracer"}' | jq > "$DIFFS"/"$HASH".json
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
set -euo pipefail set -euo pipefail
SOURCE_DIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd) SOURCE_DIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
CHALLENGER_DIR=$(echo ${SOURCE_DIR%/*/*}) CHALLENGER_DIR=$(echo "${SOURCE_DIR%/*/*}")
MONOREPO_DIR=$(echo ${SOURCE_DIR%/*/*/*}) MONOREPO_DIR=$(echo "${SOURCE_DIR%/*/*/*}")
# Check that the fault game address file exists # Check that the fault game address file exists
FAULT_GAME_ADDR_FILE="$CHALLENGER_DIR/.fault-game-address" FAULT_GAME_ADDR_FILE="$CHALLENGER_DIR/.fault-game-address"
...@@ -15,24 +15,24 @@ fi ...@@ -15,24 +15,24 @@ fi
# Charlie's Address: 0xF45B7537828CB2fffBC69996B054c2Aaf36DC778 # Charlie's Address: 0xF45B7537828CB2fffBC69996B054c2Aaf36DC778
CHARLIE_KEY="74feb147d72bfae943e6b4e483410933d9e447d5dc47d52432dcc2c1454dabb7" CHARLIE_KEY="74feb147d72bfae943e6b4e483410933d9e447d5dc47d52432dcc2c1454dabb7"
DISPUTE_GAME_PROXY=$(jq -r .DisputeGameFactoryProxy $MONOREPO_DIR/.devnet/addresses.json) DISPUTE_GAME_PROXY=$(jq -r .DisputeGameFactoryProxy "$MONOREPO_DIR"/.devnet/addresses.json)
FAULT_GAME_ADDRESS=$(cat $FAULT_GAME_ADDR_FILE) FAULT_GAME_ADDRESS=$(cat "$FAULT_GAME_ADDR_FILE")
echo "Fault dispute game address: $FAULT_GAME_ADDRESS" echo "Fault dispute game address: $FAULT_GAME_ADDRESS"
DATADIR=`mktemp -d` DATADIR=$(mktemp -d)
trap cleanup SIGINT trap cleanup SIGINT
cleanup(){ cleanup(){
rm -rf "${DATADIR}" rm -rf "${DATADIR}"
} }
$CHALLENGER_DIR/bin/op-challenger \ "$CHALLENGER_DIR"/bin/op-challenger \
--l1-eth-rpc http://localhost:8545 \ --l1-eth-rpc http://localhost:8545 \
--trace-type="alphabet" \ --trace-type="alphabet" \
--alphabet "abcdefgh" \ --alphabet "abcdefgh" \
--datadir "${DATADIR}" \ --datadir "${DATADIR}" \
--game-factory-address $DISPUTE_GAME_PROXY \ --game-factory-address "$DISPUTE_GAME_PROXY" \
--game-allowlist $FAULT_GAME_ADDRESS \ --game-allowlist "$FAULT_GAME_ADDRESS" \
--private-key $CHARLIE_KEY \ --private-key "$CHARLIE_KEY" \
--num-confirmations 1 \ --num-confirmations 1 \
--metrics.enabled --metrics.port=7304 \ --metrics.enabled --metrics.port=7304 \
--pprof.enabled --pprof.port=6064 \ --pprof.enabled --pprof.port=6064 \
......
...@@ -3,31 +3,31 @@ ...@@ -3,31 +3,31 @@
set -euo pipefail set -euo pipefail
SOURCE_DIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd) SOURCE_DIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
CHALLENGER_DIR=$(echo ${SOURCE_DIR%/*/*}) CHALLENGER_DIR=$(echo "${SOURCE_DIR%/*/*}")
MONOREPO_DIR=$(echo ${SOURCE_DIR%/*/*/*}) MONOREPO_DIR=$(echo "${SOURCE_DIR%/*/*/*}")
cd $CHALLENGER_DIR cd "$CHALLENGER_DIR"
make make
cd $MONOREPO_DIR cd "$MONOREPO_DIR"
make devnet-clean make devnet-clean
make cannon-prestate make cannon-prestate
make devnet-up make devnet-up
DEVNET_SPONSOR="ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" DEVNET_SPONSOR="ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
DISPUTE_GAME_FACTORY=$(jq -r .DisputeGameFactoryProxy $MONOREPO_DIR/.devnet/addresses.json) DISPUTE_GAME_FACTORY=$(jq -r .DisputeGameFactoryProxy "$MONOREPO_DIR"/.devnet/addresses.json)
echo "----------------------------------------------------------------" echo "----------------------------------------------------------------"
echo " Dispute Game Factory at $DISPUTE_GAME_FACTORY" echo " Dispute Game Factory at $DISPUTE_GAME_FACTORY"
echo "----------------------------------------------------------------" echo "----------------------------------------------------------------"
L2_OUTPUT_ORACLE_PROXY=$(jq -r .L2OutputOracleProxy $MONOREPO_DIR/.devnet/addresses.json) L2_OUTPUT_ORACLE_PROXY=$(jq -r .L2OutputOracleProxy "$MONOREPO_DIR"/.devnet/addresses.json)
echo "----------------------------------------------------------------" echo "----------------------------------------------------------------"
echo " L2 Output Oracle Proxy at $L2_OUTPUT_ORACLE_PROXY" echo " L2 Output Oracle Proxy at $L2_OUTPUT_ORACLE_PROXY"
echo "----------------------------------------------------------------" echo "----------------------------------------------------------------"
BLOCK_ORACLE_PROXY=$(jq -r .BlockOracle $MONOREPO_DIR/.devnet/addresses.json) BLOCK_ORACLE_PROXY=$(jq -r .BlockOracle "$MONOREPO_DIR"/.devnet/addresses.json)
echo "----------------------------------------------------------------" echo "----------------------------------------------------------------"
echo " Block Oracle Proxy at $BLOCK_ORACLE_PROXY" echo " Block Oracle Proxy at $BLOCK_ORACLE_PROXY"
...@@ -45,15 +45,15 @@ echo " - Balance: $(cast balance 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266)" ...@@ -45,15 +45,15 @@ echo " - Balance: $(cast balance 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266)"
echo "----------------------------------------------------------------" echo "----------------------------------------------------------------"
echo "Funding Charlie" echo "Funding Charlie"
cast send $CHARLIE_ADDRESS --value 5ether --private-key $DEVNET_SPONSOR cast send "$CHARLIE_ADDRESS" --value 5ether --private-key "$DEVNET_SPONSOR"
echo "Funding Mallory" echo "Funding Mallory"
cast send $MALLORY_ADDRESS --value 5ether --private-key $DEVNET_SPONSOR cast send "$MALLORY_ADDRESS" --value 5ether --private-key "$DEVNET_SPONSOR"
# Loop and wait until there are at least 2 outputs in the l2 output oracle # Loop and wait until there are at least 2 outputs in the l2 output oracle
echo "Waiting until 2 output proposals are in the l2 output oracle..." echo "Waiting until 2 output proposals are in the l2 output oracle..."
echo "NOTE: This may show errors if no output proposals are in the oracle yet." echo "NOTE: This may show errors if no output proposals are in the oracle yet."
while [[ $(cast call $L2_OUTPUT_ORACLE_PROXY "latestOutputIndex()" | cast to-dec) -lt 2 ]] while [[ $(cast call "$L2_OUTPUT_ORACLE_PROXY" "latestOutputIndex()" | cast to-dec) -lt 2 ]]
do do
echo "[BLOCK: $(cast block-number)] Waiting for output proposals..." echo "[BLOCK: $(cast block-number)] Waiting for output proposals..."
sleep 2 sleep 2
...@@ -65,4 +65,4 @@ ROOT_CLAIM=$(cast keccak $(cast abi-encode "f(uint256,uint256)" 15 122)) ...@@ -65,4 +65,4 @@ ROOT_CLAIM=$(cast keccak $(cast abi-encode "f(uint256,uint256)" 15 122))
# Replace the first byte of the claim with the invalid vm status indicator # Replace the first byte of the claim with the invalid vm status indicator
ROOT_CLAIM="0x01${ROOT_CLAIM:4}" ROOT_CLAIM="0x01${ROOT_CLAIM:4}"
GAME_TYPE=255 ${SOURCE_DIR}/../create_game.sh http://localhost:8545 "${DISPUTE_GAME_FACTORY}" "${ROOT_CLAIM}" --private-key "${DEVNET_SPONSOR}" GAME_TYPE=255 "${SOURCE_DIR}"/../create_game.sh http://localhost:8545 "${DISPUTE_GAME_FACTORY}" "${ROOT_CLAIM}" --private-key "${DEVNET_SPONSOR}"
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
set -euo pipefail set -euo pipefail
SOURCE_DIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd) SOURCE_DIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
CHALLENGER_DIR=$(echo ${SOURCE_DIR%/*/*}) CHALLENGER_DIR=$(echo "${SOURCE_DIR%/*/*}")
MONOREPO_DIR=$(echo ${SOURCE_DIR%/*/*/*}) MONOREPO_DIR=$(echo "${SOURCE_DIR%/*/*/*}")
# Check that the fault game address file exists # Check that the fault game address file exists
FAULT_GAME_ADDR_FILE="$CHALLENGER_DIR/.fault-game-address" FAULT_GAME_ADDR_FILE="$CHALLENGER_DIR/.fault-game-address"
...@@ -15,24 +15,24 @@ fi ...@@ -15,24 +15,24 @@ fi
# Mallory's Address: 0x4641c704a6c743f73ee1f36C7568Fbf4b80681e4 # Mallory's Address: 0x4641c704a6c743f73ee1f36C7568Fbf4b80681e4
MALLORY_KEY="28d7045146193f5f4eeb151c4843544b1b0d30a7ac1680c845a416fac65a7715" MALLORY_KEY="28d7045146193f5f4eeb151c4843544b1b0d30a7ac1680c845a416fac65a7715"
DISPUTE_GAME_PROXY=$(jq -r .DisputeGameFactoryProxy $MONOREPO_DIR/.devnet/addresses.json) DISPUTE_GAME_PROXY=$(jq -r .DisputeGameFactoryProxy "$MONOREPO_DIR"/.devnet/addresses.json)
FAULT_GAME_ADDRESS=$(cat $FAULT_GAME_ADDR_FILE) FAULT_GAME_ADDRESS=$(cat "$FAULT_GAME_ADDR_FILE")
echo "Fault dispute game address: $FAULT_GAME_ADDRESS" echo "Fault dispute game address: $FAULT_GAME_ADDRESS"
DATADIR=`mktemp -d` DATADIR=$(mktemp -d)
trap cleanup SIGINT trap cleanup SIGINT
cleanup(){ cleanup(){
rm -rf "${DATADIR}" rm -rf "${DATADIR}"
} }
$CHALLENGER_DIR/bin/op-challenger \ "$CHALLENGER_DIR"/bin/op-challenger \
--l1-eth-rpc http://localhost:8545 \ --l1-eth-rpc http://localhost:8545 \
--trace-type="alphabet" \ --trace-type="alphabet" \
--alphabet "abcdexyz" \ --alphabet "abcdexyz" \
--datadir "${DATADIR}" \ --datadir "${DATADIR}" \
--game-factory-address $DISPUTE_GAME_PROXY \ --game-factory-address "$DISPUTE_GAME_PROXY" \
--game-allowlist $FAULT_GAME_ADDRESS \ --game-allowlist "$FAULT_GAME_ADDRESS" \
--private-key $MALLORY_KEY \ --private-key "$MALLORY_KEY" \
--num-confirmations 1 \ --num-confirmations 1 \
--metrics.enabled --metrics.port=7305 \ --metrics.enabled --metrics.port=7305 \
--pprof.enabled --pprof.port=6065 \ --pprof.enabled --pprof.port=6065 \
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
set -euo pipefail set -euo pipefail
SOURCE_DIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd) SOURCE_DIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
CHALLENGER_DIR=$(echo ${SOURCE_DIR%/*}) CHALLENGER_DIR=$(echo "${SOURCE_DIR%/*}")
MONOREPO_DIR=$(echo ${CHALLENGER_DIR%/*}) MONOREPO_DIR=$(echo "${CHALLENGER_DIR%/*}")
# ./create_game.sh <rpc-addr> <dispute-game-factory-addr> <cast signing args> # ./create_game.sh <rpc-addr> <dispute-game-factory-addr> <cast signing args>
RPC=${1:?Must specify RPC address} RPC=${1:?Must specify RPC address}
...@@ -33,6 +33,7 @@ echo "L2 Block Number: ${L2_BLOCK_NUM}" ...@@ -33,6 +33,7 @@ echo "L2 Block Number: ${L2_BLOCK_NUM}"
# Create a checkpoint in the block oracle to commit to the current L1 head. # Create a checkpoint in the block oracle to commit to the current L1 head.
# This defines the L1 head that will be used in the dispute game. # This defines the L1 head that will be used in the dispute game.
echo "Checkpointing the block oracle..." echo "Checkpointing the block oracle..."
# shellcheck disable=SC2086
L1_CHECKPOINT=$(cast send --rpc-url "${RPC}" ${SIGNER_ARGS} "${BLOCK_ORACLE_ADDR}" "checkpoint()" --json | jq -r '.logs[0].topics[1]' | cast to-dec) L1_CHECKPOINT=$(cast send --rpc-url "${RPC}" ${SIGNER_ARGS} "${BLOCK_ORACLE_ADDR}" "checkpoint()" --json | jq -r '.logs[0].topics[1]' | cast to-dec)
echo "L1 Checkpoint: $L1_CHECKPOINT" echo "L1 Checkpoint: $L1_CHECKPOINT"
...@@ -41,9 +42,10 @@ echo "L1 Checkpoint: $L1_CHECKPOINT" ...@@ -41,9 +42,10 @@ echo "L1 Checkpoint: $L1_CHECKPOINT"
EXTRA_DATA=$(cast abi-encode "f(uint256,uint256)" "${L2_BLOCK_NUM}" "${L1_CHECKPOINT}") EXTRA_DATA=$(cast abi-encode "f(uint256,uint256)" "${L2_BLOCK_NUM}" "${L1_CHECKPOINT}")
echo "Initializing the game" echo "Initializing the game"
# shellcheck disable=SC2086
FAULT_GAME_DATA=$(cast send --rpc-url "${RPC}" ${SIGNER_ARGS} "${FACTORY_ADDR}" "create(uint8,bytes32,bytes) returns(address)" "${GAME_TYPE}" "${ROOT_CLAIM}" "${EXTRA_DATA}" --json) FAULT_GAME_DATA=$(cast send --rpc-url "${RPC}" ${SIGNER_ARGS} "${FACTORY_ADDR}" "create(uint8,bytes32,bytes) returns(address)" "${GAME_TYPE}" "${ROOT_CLAIM}" "${EXTRA_DATA}" --json)
# Extract the address of the newly created game from the receipt logs. # Extract the address of the newly created game from the receipt logs.
FAULT_GAME_ADDRESS=$(echo "${FAULT_GAME_DATA}" | jq -r '.logs[0].topics[1]' | cast parse-bytes32-address) FAULT_GAME_ADDRESS=$(echo "${FAULT_GAME_DATA}" | jq -r '.logs[0].topics[1]' | cast parse-bytes32-address)
echo "Fault game address: ${FAULT_GAME_ADDRESS}" echo "Fault game address: ${FAULT_GAME_ADDRESS}"
echo "${FAULT_GAME_ADDRESS}" > $CHALLENGER_DIR/.fault-game-address echo "${FAULT_GAME_ADDRESS}" > "$CHALLENGER_DIR"/.fault-game-address
...@@ -22,4 +22,5 @@ then ...@@ -22,4 +22,5 @@ then
fi fi
# Perform the move. # Perform the move.
# shellcheck disable=SC2086
cast send --rpc-url "${RPC}" ${SIGNER_ARGS} "${GAME_ADDR}" "$ACTION(uint256,bytes32)" "${PARENT_INDEX}" "${CLAIM}" cast send --rpc-url "${RPC}" ${SIGNER_ARGS} "${GAME_ADDR}" "$ACTION(uint256,bytes32)" "${PARENT_INDEX}" "${CLAIM}"
...@@ -6,6 +6,7 @@ GAME_ADDR=${2:?Must specify game address} ...@@ -6,6 +6,7 @@ GAME_ADDR=${2:?Must specify game address}
SIGNER_ARGS="${@:3}" SIGNER_ARGS="${@:3}"
# Perform the move. # Perform the move.
# shellcheck disable=SC2086
RESULT_DATA=$(cast send --rpc-url "${RPC}" ${SIGNER_ARGS} "${GAME_ADDR}" "resolve()" --json) RESULT_DATA=$(cast send --rpc-url "${RPC}" ${SIGNER_ARGS} "${GAME_ADDR}" "resolve()" --json)
RESULT=$(echo "${RESULT_DATA}" | jq -r '.logs[0].topics[1]' | cast to-dec) RESULT=$(echo "${RESULT_DATA}" | jq -r '.logs[0].topics[1]' | cast to-dec)
......
...@@ -5,12 +5,12 @@ set -euo pipefail ...@@ -5,12 +5,12 @@ set -euo pipefail
RPC="${1:?Must specify RPC address}" RPC="${1:?Must specify RPC address}"
FAULT_GAME_ADDRESS="${2:?Must specify game address}" FAULT_GAME_ADDRESS="${2:?Must specify game address}"
DIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd) DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
DIR=$(echo ${DIR%/*/*}) DIR=$(echo "${DIR%/*/*}")
cd $DIR/packages/contracts-bedrock cd "$DIR"/packages/contracts-bedrock
forge script scripts/FaultDisputeGameViz.s.sol \ forge script scripts/FaultDisputeGameViz.s.sol \
--sig "remote(address)" $FAULT_GAME_ADDRESS \ --sig "remote(address)" "$FAULT_GAME_ADDRESS" \
--fork-url "$RPC" --fork-url "$RPC"
mv dispute_game.svg "$dir" mv dispute_game.svg "$DIR"
echo $1 echo "$1"
jq '.frames[] | {timestamp, inclusion_block}' $1 jq '.frames[] | {timestamp, inclusion_block}' "$1"
jq '.batches[]|.Timestamp' $1 jq '.batches[]|.Timestamp' "$1"
...@@ -56,10 +56,10 @@ generate_test_vector() { ...@@ -56,10 +56,10 @@ generate_test_vector() {
echo "{\"name\": \"$name\"}" > "$metadata_file" echo "{\"name\": \"$name\"}" > "$metadata_file"
cast rpc eth_getBlockByHash $blockhash $fulltxs > $data_file cast rpc eth_getBlockByHash "$blockhash" "$fulltxs" > "$data_file"
# Mutate data using the provided function # Mutate data using the provided function
$mutation_func "$data_file" $metadata_file $mutation_func "$data_file" "$metadata_file"
} }
mkdir -p data/headers mkdir -p data/headers
......
...@@ -54,10 +54,10 @@ exec geth \ ...@@ -54,10 +54,10 @@ exec geth \
--syncmode=full \ --syncmode=full \
--nodiscover \ --nodiscover \
--maxpeers=1 \ --maxpeers=1 \
--networkid=$CHAIN_ID \ --networkid="$CHAIN_ID" \
--unlock=$BLOCK_SIGNER_ADDRESS \ --unlock="$BLOCK_SIGNER_ADDRESS" \
--mine \ --mine \
--miner.etherbase=$BLOCK_SIGNER_ADDRESS \ --miner.etherbase="$BLOCK_SIGNER_ADDRESS" \
--password="$GETH_DATA_DIR"/password \ --password="$GETH_DATA_DIR"/password \
--allow-insecure-unlock \ --allow-insecure-unlock \
--rpc.allow-unprotected-txs \ --rpc.allow-unprotected-txs \
......
...@@ -39,7 +39,7 @@ exec geth \ ...@@ -39,7 +39,7 @@ exec geth \
--syncmode=full \ --syncmode=full \
--nodiscover \ --nodiscover \
--maxpeers=0 \ --maxpeers=0 \
--networkid=$CHAIN_ID \ --networkid="$CHAIN_ID" \
--rpc.allow-unprotected-txs \ --rpc.allow-unprotected-txs \
--authrpc.addr="0.0.0.0" \ --authrpc.addr="0.0.0.0" \
--authrpc.port="8551" \ --authrpc.port="8551" \
......
...@@ -26,19 +26,19 @@ echo "Created tempdir @ $TMP_DIR" ...@@ -26,19 +26,19 @@ echo "Created tempdir @ $TMP_DIR"
# Clone the foundry repo temporarily. We do this to avoid the need for a personal access # Clone the foundry repo temporarily. We do this to avoid the need for a personal access
# token to interact with the GitHub REST API, and clean it up after we're done. # token to interact with the GitHub REST API, and clean it up after we're done.
git clone https://github.com/foundry-rs/foundry.git $TMP_DIR && cd $TMP_DIR git clone https://github.com/foundry-rs/foundry.git "$TMP_DIR" && cd "$TMP_DIR"
# If the nightly tag exists, we can download the pre-built binaries rather than building # If the nightly tag exists, we can download the pre-built binaries rather than building
# from source. Otherwise, clone the repository, check out the commit SHA, and build `forge`, # from source. Otherwise, clone the repository, check out the commit SHA, and build `forge`,
# `cast`, `anvil`, and `chisel` from source. # `cast`, `anvil`, and `chisel` from source.
if git rev-parse "$TAG" >/dev/null 2>&1; then if git rev-parse "$TAG" >/dev/null 2>&1; then
echo "Nightly tag exists! Downloading prebuilt binaries..." echo "Nightly tag exists! Downloading prebuilt binaries..."
foundryup -v $TAG foundryup -v "$TAG"
else else
echo "Nightly tag doesn't exist! Building from source..." echo "Nightly tag doesn't exist! Building from source..."
foundryup -C $SHA foundryup -C "$SHA"
fi fi
# Remove the temporary foundry repo; Used just for checking the nightly tag's existence. # Remove the temporary foundry repo; Used just for checking the nightly tag's existence.
rm -rf $TMP_DIR rm -rf "$TMP_DIR"
echo "Removed tempdir @ $TMP_DIR" echo "Removed tempdir @ $TMP_DIR"
...@@ -12,8 +12,8 @@ else ...@@ -12,8 +12,8 @@ else
MOD_TIME_FMT="-c %Y" MOD_TIME_FMT="-c %Y"
fi fi
FILE_1_AGE=$(stat $MOD_TIME_FMT "$1") FILE_1_AGE=$(stat "$MOD_TIME_FMT" "$1")
FILE_2_AGE=$(stat $MOD_TIME_FMT "$2") FILE_2_AGE=$(stat "$MOD_TIME_FMT" "$2")
if [ "$FILE_1_AGE" -gt "$FILE_2_AGE" ]; then if [ "$FILE_1_AGE" -gt "$FILE_2_AGE" ]; then
exit 0 exit 0
......
...@@ -56,9 +56,9 @@ todos=$(rg -o --with-filename -n -g '!ops/scripts/todo-checker.sh' 'TODO\(([^)]+ ...@@ -56,9 +56,9 @@ todos=$(rg -o --with-filename -n -g '!ops/scripts/todo-checker.sh' 'TODO\(([^)]+
IFS=$'\n' # Set Internal Field Separator to newline for iteration IFS=$'\n' # Set Internal Field Separator to newline for iteration
for todo in $todos; do for todo in $todos; do
# Extract the text inside the parenthesis # Extract the text inside the parenthesis
FILE=$(echo $todo | awk -F':' '{print $1}') FILE=$(echo "$todo" | awk -F':' '{print $1}')
LINE_NUM=$(echo $todo | awk -F':' '{print $2}') LINE_NUM=$(echo "$todo" | awk -F':' '{print $2}')
ISSUE_REFERENCE=$(echo $todo | sed -n 's/.*TODO(\([^)]*\)).*/\1/p') ISSUE_REFERENCE=$(echo "$todo" | sed -n 's/.*TODO(\([^)]*\)).*/\1/p')
# Parse the format of the TODO comment. There are 3 supported formats: # Parse the format of the TODO comment. There are 3 supported formats:
# * TODO(<issue_number>): <description> (Default org & repo: "ethereum-optimism/monorepo") # * TODO(<issue_number>): <description> (Default org & repo: "ethereum-optimism/monorepo")
......
...@@ -30,16 +30,16 @@ cleanup() { ...@@ -30,16 +30,16 @@ cleanup() {
# written before the solidity tests try to read it # written before the solidity tests try to read it
wait_l2_outfile() { wait_l2_outfile() {
i=1 i=1
while [ $i -le $2 ]; do while [ $i -le "$2" ]; do
i=$(($i + 1)) i=$(($i + 1))
if [ ! -f "$OUTFILE_L2" ]; then if [ ! -f "$OUTFILE_L2" ]; then
sleep $1 sleep "$1"
continue continue
fi fi
if [ $(du -m "$OUTFILE_L2" | cut -f1) -lt 8 ]; then if [ $(du -m "$OUTFILE_L2" | cut -f1) -lt 8 ]; then
sleep $1 sleep "$1"
continue continue
fi fi
...@@ -59,11 +59,11 @@ if mkdir -- "$LOCKDIR" > /dev/null 2>&1; then ...@@ -59,11 +59,11 @@ if mkdir -- "$LOCKDIR" > /dev/null 2>&1; then
mkdir -p "$TESTDATA_DIR" mkdir -p "$TESTDATA_DIR"
if [ ! -f "$DEPLOY_ARTIFACT" ]; then if [ ! -f "$DEPLOY_ARTIFACT" ]; then
forge script $CONTRACTS_DIR/scripts/Deploy.s.sol:Deploy > /dev/null 2>&1 forge script "$CONTRACTS_DIR"/scripts/Deploy.s.sol:Deploy > /dev/null 2>&1
fi fi
if [ ! -f "$OUTFILE_L2" ]; then if [ ! -f "$OUTFILE_L2" ]; then
go run $OP_NODE genesis l2 \ go run "$OP_NODE" genesis l2 \
--deploy-config "$CONTRACTS_DIR/deploy-config/hardhat.json" \ --deploy-config "$CONTRACTS_DIR/deploy-config/hardhat.json" \
--l1-deployments "$DEPLOY_ARTIFACT" \ --l1-deployments "$DEPLOY_ARTIFACT" \
--l1-starting-block "$L1_STARTING_BLOCK_PATH" \ --l1-starting-block "$L1_STARTING_BLOCK_PATH" \
......
...@@ -20,7 +20,7 @@ reqenv "GS_SEQUENCER_ADDRESS" ...@@ -20,7 +20,7 @@ reqenv "GS_SEQUENCER_ADDRESS"
reqenv "L1_RPC_URL" reqenv "L1_RPC_URL"
# Get the finalized block timestamp and hash # Get the finalized block timestamp and hash
block=$(cast block finalized --rpc-url $L1_RPC_URL) block=$(cast block finalized --rpc-url "$L1_RPC_URL")
timestamp=$(echo "$block" | awk '/timestamp/ { print $2 }') timestamp=$(echo "$block" | awk '/timestamp/ { print $2 }')
blockhash=$(echo "$block" | awk '/hash/ { print $2 }') blockhash=$(echo "$block" | awk '/hash/ { print $2 }')
......
...@@ -8,7 +8,7 @@ SLITHER_REPORT_BACKUP="slither-report.json.temp" ...@@ -8,7 +8,7 @@ SLITHER_REPORT_BACKUP="slither-report.json.temp"
# Get the absolute path of the parent directory of this script # Get the absolute path of the parent directory of this script
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && cd .. && pwd )" DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && cd .. && pwd )"
echo "Running slither in $DIR" echo "Running slither in $DIR"
cd $DIR cd "$DIR"
# Clean up any previous artifacts. # Clean up any previous artifacts.
# We do not check if pnpm is installed since it is used across the monorepo # We do not check if pnpm is installed since it is used across the monorepo
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
if ! command -v forge &> /dev/null if ! command -v forge &> /dev/null
then then
# shellcheck disable=SC2006
echo "Is Foundry not installed? Consider installing via `curl -L https://foundry.paradigm.xyz | bash` and then running `foundryup` on a new terminal. For more context, check the installation instructions in the book: https://book.getfoundry.sh/getting-started/installation.html." echo "Is Foundry not installed? Consider installing via `curl -L https://foundry.paradigm.xyz | bash` and then running `foundryup` on a new terminal. For more context, check the installation instructions in the book: https://book.getfoundry.sh/getting-started/installation.html."
exit 1 exit 1
fi fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment