mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-09 13:56:23 +00:00
parent
026d569d8e
commit
1c4d145f26
10
interop/diff_genesis_vs_lighthouse.sh
Executable file
10
interop/diff_genesis_vs_lighthouse.sh
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Lighthouse genesis state
|
||||
curl localhost:5052/beacon/state?slot=0 | python -m json.tool | sed 's/"0x/"/' > /tmp/lighthouse_state.json
|
||||
|
||||
# Format nimbus the same
|
||||
cat data/state_snapshot.json | python -m json.tool | sed 's/"0x/"/' > /tmp/nimbus_state.json
|
||||
|
||||
diff -uw /tmp/nimbus_state.json /tmp/lighthouse_state.json
|
||||
|
34
interop/diff_genesis_vs_zcli.sh
Executable file
34
interop/diff_genesis_vs_zcli.sh
Executable file
@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
|
||||
ETH2_PM=${ETH2_PM_PATH:-"eth2.0-pm"}
|
||||
|
||||
set -eu
|
||||
|
||||
echo Locating zcli...
|
||||
if ! command -v zcli; then
|
||||
go get -tags preset_minimal github.com/protolambda/zcli
|
||||
fi
|
||||
|
||||
if [[ ! -d "$ETH2_PM" ]]; then
|
||||
git clone https://github.com/ethereum/eth2.0-pm "$ETH2_PM"
|
||||
fi
|
||||
|
||||
# Fetch genesis time, as set up by start.sh
|
||||
if command -v jq; then
|
||||
# requires the jq package for json parsing
|
||||
genesis_time=$(jq '.genesis_time' data/state_snapshot.json)
|
||||
else
|
||||
# grep -P for perl parsing, not available on Mac
|
||||
genesis_time=$(grep -oP '(?<=genesis_time": )\w+(?=,)' data/state_snapshot.json)
|
||||
fi
|
||||
|
||||
echo Genesis time was $genesis_time
|
||||
|
||||
zcli genesis mock \
|
||||
--count 16 \
|
||||
--genesis-time $genesis_time \
|
||||
--keys "${ETH2_PM}/interop/mocked_start/keygen_10000_validators.yaml" \
|
||||
--out data/zcli_genesis.ssz
|
||||
|
||||
zcli diff state data/zcli_genesis.ssz data/state_snapshot.ssz
|
||||
|
@ -5,21 +5,58 @@
|
||||
|
||||
# https://github.com/sigp/lighthouse/blob/master/docs/interop.md
|
||||
|
||||
set -eu
|
||||
|
||||
echo Locating protoc...
|
||||
if ! command -v protoc; then
|
||||
MSG="protoc (the Google Protobuf compiler) is missing. Please install it manually"
|
||||
if [[ "$OSTYPE" == "linux-gnu" ]]; then
|
||||
MSG+=" with sudo apt install protobuf-compiler"
|
||||
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
MSG+=" with 'brew install protobuf'"
|
||||
elif [[ "$OSTYPE" == "cygwin" ]]; then
|
||||
# POSIX compatibility layer and Linux environment emulation for Windows
|
||||
MSG+=""
|
||||
elif [[ "$OSTYPE" == "msys" ]]; then
|
||||
# Lightweight shell and GNU utilities compiled for Windows (part of MinGW)
|
||||
MSG+=""
|
||||
elif [[ "$OSTYPE" == "win32" ]]; then
|
||||
# I'm not sure this can happen.
|
||||
MSG+=""
|
||||
elif [[ "$OSTYPE" == "freebsd"* ]]; then
|
||||
# ...
|
||||
MSG+=""
|
||||
else
|
||||
# Unknown.
|
||||
MSG+=""
|
||||
fi
|
||||
echo $MSG
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cargo_path=$(which cargo)
|
||||
[[ -x "$cargo_path" ]] || { echo "install rust first (https://rust-lang.org)"; exit 1; }
|
||||
|
||||
[[ -d "lighthouse" ]] || {
|
||||
git clone https://github.com/sigp/lighthouse.git
|
||||
cd lighthouse
|
||||
LIGHTHOUSE=${LIGHTHOSE_PATH:-"lighthouse"}
|
||||
|
||||
[[ -d "$LIGHTHOUSE" ]] || {
|
||||
git clone https://github.com/sigp/lighthouse.git "$LIGHTHOUSE"
|
||||
pushd "$LIGHTHOUSE"
|
||||
git checkout interop # temporary interop branch - will get merged soon I expect!
|
||||
cargo update
|
||||
cd ..
|
||||
popd
|
||||
}
|
||||
|
||||
# Fetch genesis time, as set up by start.sh
|
||||
genesis_time=$(grep -oP '(?<=genesis_time": )\w+(?=,)' data/state_snapshot.json)
|
||||
if command -v jq; then
|
||||
genesis_time=$(jq '.genesis_time' data/state_snapshot.json)
|
||||
else
|
||||
genesis_time=$(grep -oP '(?<=genesis_time": )\w+(?=,)' data/state_snapshot.json)
|
||||
fi
|
||||
|
||||
cd lighthouse
|
||||
echo Genesis time was $genesis_time
|
||||
|
||||
cd "$LIGHTHOUSE"
|
||||
cargo build
|
||||
|
||||
cd target/debug
|
||||
|
Loading…
x
Reference in New Issue
Block a user