Skip to content

Commit

Permalink
update script
Browse files Browse the repository at this point in the history
  • Loading branch information
0age committed Mar 1, 2024
1 parent bedbfd5 commit 639dc10
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions tstorish.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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

0 comments on commit 639dc10

Please sign in to comment.