Skip to content

Instantly share code, notes, and snippets.

@cwgoes
Created October 10, 2018 17:45
Show Gist options
  • Save cwgoes/3ab18585a72966bb9e68e8a9428a28b8 to your computer and use it in GitHub Desktop.
Save cwgoes/3ab18585a72966bb9e68e8a9428a28b8 to your computer and use it in GitHub Desktop.
Byzantine validator crash fault reproduction
#!/bin/sh
set -xe
GAIAD_BYZANTINE=/tmp/gaiad-byzantine
GAIAD_NORMAL=/home/cwgoes/working/go/bin/gaiad
TMP=$(mktemp -d)
echo '' | $GAIAD_NORMAL init gen-tx --home $TMP/.gaiad0 --home-client $TMP/.gaiacli0 --name node0 | jq .gen_tx_file > $TMP/node0.json
echo '' | $GAIAD_NORMAL init gen-tx --home $TMP/.gaiad1 --home-client $TMP/.gaiacli1 --name node1 | jq .gen_tx_file > $TMP/node1.json
echo '' | $GAIAD_NORMAL init gen-tx --home $TMP/.gaiad2 --home-client $TMP/.gaiacli2 --name node2 | jq .gen_tx_file > $TMP/node2.json
echo '' | $GAIAD_NORMAL init gen-tx --home $TMP/.gaiad3 --home-client $TMP/.gaiacli3 --name node3 | jq .gen_tx_file > $TMP/node3.json
echo '' | $GAIAD_NORMAL init gen-tx --home $TMP/.gaiad4 --home-client $TMP/.gaiacli4 --name node4 | jq .gen_tx_file > $TMP/node4.json
echo '' | $GAIAD_BYZANTINE init gen-tx --home $TMP/.gaiad-byz0 --home-client $TMP/.gaiacli-byz0 --name byz0 | jq .gen_tx_file > $TMP/byz0.json
echo '' | $GAIAD_BYZANTINE init gen-tx --home $TMP/.gaiad-byz1 --home-client $TMP/.gaiacli-byz1 --name byz1 | jq .gen_tx_file > $TMP/byz1.json
NODE0_ID=$(cat $TMP/node0.json | jq .node_id -r)
NODE1_ID=$(cat $TMP/node1.json | jq .node_id -r)
NODE2_ID=$(cat $TMP/node2.json | jq .node_id -r)
NODE3_ID=$(cat $TMP/node3.json | jq .node_id -r)
NODE4_ID=$(cat $TMP/node4.json | jq .node_id -r)
BYZ0_ID=$(cat $TMP/byz0.json | jq .node_id -r)
BYZ1_ID=$(cat $TMP/byz1.json | jq .node_id -r)
rm $TMP/.gaiad0/config/gentx/*
rm $TMP/.gaiad1/config/gentx/*
rm $TMP/.gaiad2/config/gentx/*
rm $TMP/.gaiad3/config/gentx/*
rm $TMP/.gaiad4/config/gentx/*
rm $TMP/.gaiad-byz0/config/gentx/*
rm $TMP/.gaiad-byz1/config/gentx/*
cp $TMP/node*.json $TMP/.gaiad0/config/gentx
cp $TMP/node*.json $TMP/.gaiad1/config/gentx
cp $TMP/node*.json $TMP/.gaiad2/config/gentx
cp $TMP/node*.json $TMP/.gaiad3/config/gentx
cp $TMP/node*.json $TMP/.gaiad4/config/gentx
cp $TMP/node*.json $TMP/.gaiad-byz0/config/gentx
cp $TMP/node*.json $TMP/.gaiad-byz1/config/gentx
$GAIAD_NORMAL init --home $TMP/.gaiad0 --with-txs --chain-id test
$GAIAD_NORMAL init --home $TMP/.gaiad1 --with-txs --chain-id test
$GAIAD_NORMAL init --home $TMP/.gaiad2 --with-txs --chain-id test
$GAIAD_NORMAL init --home $TMP/.gaiad3 --with-txs --chain-id test
$GAIAD_NORMAL init --home $TMP/.gaiad4 --with-txs --chain-id test
$GAIAD_BYZANTINE init --home $TMP/.gaiad-byz0 --with-txs --chain-id test
$GAIAD_BYZANTINE init --home $TMP/.gaiad-byz1 --with-txs --chain-id test
cp $TMP/.gaiad1/config/priv_validator.json $TMP/.gaiad-byz0/config/priv_validator.json
cp $TMP/.gaiad2/config/priv_validator.json $TMP/.gaiad-byz1/config/priv_validator.json
$GAIAD_NORMAL --home $TMP/.gaiad1 start --p2p.laddr tcp://0.0.0.0:16657 --p2p.persistent_peers "$NODE3_ID@127.0.0.1:16658" --rpc.laddr "tcp://0.0.0.0:1235" &
sleep 1
$GAIAD_BYZANTINE --home $TMP/.gaiad-byz0 start --p2p.laddr tcp://0.0.0.0:16671 --p2p.persistent_peers "$NODE1_ID@127.0.0.1:16657,$BYZ1_ID@127.0.0.1:16672" --rpc.laddr "tcp://0.0.0.0:1239" &
sleep 1
$GAIAD_NORMAL --home $TMP/.gaiad2 start --p2p.laddr tcp://0.0.0.0:16658 --p2p.persistent_peers "$NODE4_ID@127.0.0.1:16659,$BYZ0_ID@127.0.0.1:16671" --rpc.laddr "tcp://0.0.0.0:1236" &
sleep 1
$GAIAD_BYZANTINE --home $TMP/.gaiad-byz1 start --p2p.laddr tcp://0.0.0.0:16672 --p2p.persistent_peers "$NODE2_ID@127.0.0.1:16658" --rpc.laddr "tcp://0.0.0.0:1240" &
sleep 30
$GAIAD_NORMAL --home $TMP/.gaiad0 start --p2p.laddr tcp://0.0.0.0:16656 --p2p.persistent_peers "$NODE2_ID@127.0.0.1:16657" --rpc.laddr "tcp://0.0.0.0:1234" &
sleep 30
$GAIAD_NORMAL --home $TMP/.gaiad4 start --p2p.laddr tcp://0.0.0.0:16670 --p2p.persistent_peers "$NODE1_ID@127.0.0.1:16656" --rpc.laddr "tcp://0.0.0.0:1238" &
# $GAIAD_NORMAL --home $TMP/.gaiad3 start --p2p.laddr tcp://0.0.0.0:16659 --p2p.persistent_peers "$NODE5_ID@127.0.0.1:16660" --rpc.laddr "tcp://0.0.0.0:1237" &
ls $TMP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment