Seismic testnet genesis #58
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Seismic testnet genesis | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| paths: | |
| - crates/seismic/chainspec/res/genesis/testnet.json | |
| schedule: | |
| - cron: "0 0 * * *" | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }} | |
| cancel-in-progress: true | |
| jobs: | |
| verify: | |
| name: Verify public testnet genesis | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: testnet-genesis | |
| - name: Compare archived, built-in, and live genesis hashes | |
| env: | |
| TESTNET_RPC_URL: https://testnet-1.seismictest.net/rpc | |
| run: | | |
| set -euo pipefail | |
| builtin_hash=$(cargo run --locked --quiet -p seismic-reth -- genesis-hash --chain testnet) | |
| file_hash=$(cargo run --locked --quiet -p seismic-reth -- genesis-hash --chain crates/seismic/chainspec/res/genesis/testnet.json) | |
| live_hash=$( | |
| curl \ | |
| --fail-with-body \ | |
| --silent \ | |
| --show-error \ | |
| --retry 5 \ | |
| --retry-all-errors \ | |
| --header 'content-type: application/json' \ | |
| --data '{"jsonrpc":"2.0","id":1,"method":"eth_getBlockByNumber","params":["0x0",false]}' \ | |
| "$TESTNET_RPC_URL" | | |
| jq -er '.result.hash' | |
| ) | |
| builtin_hash=${builtin_hash,,} | |
| file_hash=${file_hash,,} | |
| live_hash=${live_hash,,} | |
| printf 'built-in: %s\narchived: %s\nlive: %s\n' \ | |
| "$builtin_hash" "$file_hash" "$live_hash" | |
| test "$builtin_hash" = "$file_hash" | |
| test "$file_hash" = "$live_hash" |