openethereum/scripts/actions/validate-chainspecs.sh
Raw Pong Ghmoa 2a3b321a34
validate mainnet specs against all forks (#11625)
* ethcore/res: move test specifications in test-specs subdirectory

* ethcore/spec: update paths for test machines

* scripts/actions: validate mainnet specs against all forks

* fix unexpected end of macro invocation

* scripts/actions: remove first empty line

Co-Authored-By: Niklas Adolfsson <niklasadolfsson1@gmail.com>

Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
2020-04-15 12:15:04 +02:00

38 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
set -e # fail on any error
set -u # treat unset variables as error
echo -e "*** Running \`validate_chainspecs.sh\`"
ERR=0
time cargo build --release -p chainspec --verbose --color=always
echo -e "\n*** Validating custom chain specifications:"
for spec in ethcore/res/*.json; do
if ! ./target/release/chainspec "$spec"; then ERR=1; fi
done
echo -e "\n*** Validating test-chain specifications:"
for spec in ethcore/res/ethereum/test-specs/*.json; do
if ! ./target/release/chainspec "$spec"; then ERR=1; fi
done
echo -e "\n*** Validating ethereum chain specifications:"
for spec in ethcore/res/ethereum/*.json; do
if ! ./target/release/chainspec "$spec"; then ERR=1; fi
done
echo -e "\n*** Checking mainnet EIPs against test specifications:"
for spec in "ethcore/res/ethereum/foundation.json" "ethcore/res/ethereum/classic.json"; do
for fork in "frontier" "homestead" "byzantium" "constantinople" "st_peters" "istanbul"; do
for eip in $(grep --only-matching "eip.*Transition" ethcore/res/ethereum/test-specs/${fork}_test.json); do
if ! grep -q $eip $spec; then
echo "ERROR: $fork $eip is missing in the $spec"
ERR=1
else
echo "$spec contains $fork $eip"
fi
done
done
done
exit $ERR