diff --git a/tstorish.sh b/tstorish.sh index e0a7ce4..51178e7 100644 --- a/tstorish.sh +++ b/tstorish.sh @@ -1,3 +1,5 @@ +# exit on any failure +set -e # remove old dump rm -f seaport.dump # spin up anvil and prepare to dump state @@ -8,22 +10,33 @@ pid=$! FOUNDRY_PROFILE=optimized forge script TstorishDeploy --rpc-url http://localhost:8545 --slow --skip-simulation --broadcast --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 # get code of 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512 seaport=$(curl -sX POST --data '{"jsonrpc":"2.0","method":"eth_getCode","params":["0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512", "latest"],"id":1}' -H "Content-Type: application/json" http://localhost:8545 | jq '.result') +# execute first Tstorish test +FOUNDRY_PROFILE=tstorishLegacy forge test --match-test test_preActivate -vvvv --fork-url http://localhost:8545 --evm-version shanghai # exit anvil -echo $seaport -kill $pid +if kill -0 $pid 2>/dev/null; then + kill $pid + echo ">>> Shutting down shanghai anvil" +else + echo ">>> Unable to locate shanghai anvil PID" +fi anvil --hardfork shanghai & # save pid to kill later pid=$! # wait for anvil to warm up -sleep 5 +sleep 1 # call setCode on the 0xe7f address with the $seaport var -curl -X POST --data '{"jsonrpc":"2.0","method":"anvil_setCode","params":["0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512", '"$seaport"'],"id":1}' -H "Content-Type: application/json" http://localhost:8545 +curl -sX POST --data '{"jsonrpc":"2.0","method":"anvil_setCode","params":["0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512", '"$seaport"'],"id":1}' -H "Content-Type: application/json" http://localhost:8545 # mine a block -# execute Tstorish test -FOUNDRY_PROFILE=tstorish forge test -vvvv --fork-url http://localhost:8545 +# execute second Tstorish test +FOUNDRY_PROFILE=tstorish forge test --match-test test_activate -vvvv --fork-url http://localhost:8545 --evm-version cancun # get exit code of previous exit_code=$? -# kill anvil -kill $pid +# exit anvil +if kill -0 $pid 2>/dev/null; then + kill $pid + echo ">>> Shutting down cancun anvil" +else + echo ">>> Unable to locate cancun anvil PID" +fi # exit with exit code of previous exit $exit_code