tests: fix script (#43)
This commit is contained in:
parent
596373dc9d
commit
bd89830d64
4
Makefile
4
Makefile
@ -442,13 +442,13 @@ ifeq ($(OS),Windows_NT)
|
||||
mkdir build &
|
||||
@$(MAKE) docker-localnet
|
||||
|
||||
IF not exist "build/node0/$(ETHERMINT_BINARY)/config/genesis.json" docker run --rm -v $(CURDIR)/build\ethermint\Z ethermintd/node "ethermintd testnet --v 4 -o /ethermint --starting-ip-address 192.168.10.2 --keyring-backend=test"
|
||||
IF not exist "build/node0/$(ETHERMINT_BINARY)/config/genesis.json" docker run --rm -v $(CURDIR)/build\ethermint\Z ethermintd/node "ethermintd testnet --v 4 -o /ethermint --keyring-backend=test"
|
||||
docker-compose up -d
|
||||
else
|
||||
mkdir -p ./build/
|
||||
@$(MAKE) docker-localnet
|
||||
|
||||
if ! [ -f build/node0/$(ETHERMINT_BINARY)/config/genesis.json ]; then docker run --rm -v $(CURDIR)/build:/ethermint:Z ethermintd/node "ethermintd testnet --v 4 -o /ethermint --starting-ip-address 192.168.10.2 --keyring-backend=test"; fi
|
||||
if ! [ -f build/node0/$(ETHERMINT_BINARY)/config/genesis.json ]; then docker run --rm -v $(CURDIR)/build:/ethermint:Z ethermintd/node "ethermintd testnet --v 4 -o /ethermint --keyring-backend=test"; fi
|
||||
docker-compose up -d
|
||||
endif
|
||||
|
||||
|
@ -35,7 +35,7 @@ cat $HOME/.ethermint/config/genesis.json | jq '.app_state["mint"]["params"]["min
|
||||
"$PWD"/build/ethermintd validate-genesis
|
||||
|
||||
# Start the node (remove the --pruning=nothing flag if historical queries are not needed) in background and log to file
|
||||
"$PWD"/build/ethermintd start --pruning=nothing --rpc.unsafe --rpc-api "web3, eth, personal, net" --keyring-backend test > ethermintd.log 2>&1 &
|
||||
"$PWD"/build/ethermintd start --pruning=nothing --rpc.unsafe --evm-rpc.address="0.0.0.0:8545" --keyring-backend test > ethermintd.log 2>&1 &
|
||||
|
||||
# Give ethermintd node enough time to launch
|
||||
sleep 5
|
||||
@ -48,8 +48,8 @@ mv "$PWD"/tests/solidity/suites/basic/counter/*.bin "$PWD"/tests/solidity/suites
|
||||
ACCT=$(curl --fail --silent -X POST --data '{"jsonrpc":"2.0","method":"eth_accounts","params":[],"id":1}' -H "Content-Type: application/json" http://localhost:8545 | grep -o '\0x[^"]*')
|
||||
echo "$ACCT"
|
||||
|
||||
# Start testcases
|
||||
curl -X POST --data '{"jsonrpc":"2.0","method":"personal_unlockAccount","params":["'$ACCT'", ""],"id":1}' -H "Content-Type: application/json" http://localhost:8545
|
||||
# Start testcases (not supported)
|
||||
# curl -X POST --data '{"jsonrpc":"2.0","method":"personal_unlockAccount","params":["'$ACCT'", ""],"id":1}' -H "Content-Type: application/json" http://localhost:8545
|
||||
|
||||
#PRIVKEY="$("$PWD"/build/ethermintd keys export $KEY)"
|
||||
|
||||
|
@ -72,7 +72,7 @@ init_func() {
|
||||
"$PWD"/build/ethermintd add-genesis-account \
|
||||
"$("$PWD"/build/ethermintd keys show "$KEY$i" --keyring-backend test -a --home "$DATA_DIR$i")" 1000000000000000000aphoton,1000000000000000000stake \
|
||||
--keyring-backend test --home "$DATA_DIR$i"
|
||||
"$PWD"/build/ethermintd gentx "$KEY$i" --amount=1000000000000000000aphoton --chain-id $CHAINID --keyring-backend test --home "$DATA_DIR$i"
|
||||
"$PWD"/build/ethermintd gentx "$KEY$i" 1000000000000000000stake --chain-id $CHAINID --keyring-backend test --home "$DATA_DIR$i"
|
||||
"$PWD"/build/ethermintd collect-gentxs --home "$DATA_DIR$i"
|
||||
"$PWD"/build/ethermintd validate-genesis --home "$DATA_DIR$i"
|
||||
|
||||
@ -106,9 +106,8 @@ start_func() {
|
||||
echo "starting ethermint node $i in background ..."
|
||||
"$PWD"/build/ethermintd start --pruning=nothing --rpc.unsafe \
|
||||
--p2p.laddr tcp://$IP_ADDR:$NODE_P2P_PORT"$i" --address tcp://$IP_ADDR:$NODE_PORT"$i" --rpc.laddr tcp://$IP_ADDR:$NODE_RPC_PORT"$i" \
|
||||
--json-rpc.address http://$IP_ADDR:$RPC_PORT"$i" \
|
||||
--evm-rpc.address $IP_ADDR:$RPC_PORT"$i" \
|
||||
--keyring-backend test --home "$DATA_DIR$i" \
|
||||
--rpc-api "web3, eth, personal, net" \
|
||||
>"$DATA_DIR"/node"$i".log 2>&1 & disown
|
||||
|
||||
ETHERMINT_PID=$!
|
||||
|
34
scripts/start.sh
Normal file → Executable file
34
scripts/start.sh
Normal file → Executable file
@ -10,7 +10,7 @@ SLEEP_TIMEOUT=5
|
||||
TEST_QTD=1
|
||||
|
||||
#PORT AND RPC_PORT 3 initial digits, to be concat with a suffix later when node is initialized
|
||||
RPC_PORT="8545"
|
||||
RPC_PORT="854"
|
||||
IP_ADDR="0.0.0.0"
|
||||
MODE="rpc"
|
||||
|
||||
@ -73,21 +73,15 @@ arrcli=()
|
||||
|
||||
init_func() {
|
||||
echo "create and add new keys"
|
||||
"$PWD"/build/ethermintd config keyring-backend test --home "$DATA_CLI_DIR$i"
|
||||
"$PWD"/build/ethermintd keys add $KEY"$i" --home "$DATA_CLI_DIR$i" --no-backup --chain-id $CHAINID --algo "eth_secp256k1"
|
||||
"$PWD"/build/ethermintd keys add $KEY"$i" --home "$DATA_DIR$i" --no-backup --chain-id $CHAINID --algo "eth_secp256k1" --keyring-backend test
|
||||
echo "init Ethermint with moniker=$MONIKER and chain-id=$CHAINID"
|
||||
"$PWD"/build/ethermintd init $MONIKER --chain-id $CHAINID --home "$DATA_DIR$i"
|
||||
echo "init ethermintd with chain-id=$CHAINID and config it trust-node true"
|
||||
"$PWD"/build/ethermintd config chain-id $CHAINID --home "$DATA_CLI_DIR$i"
|
||||
"$PWD"/build/ethermintd config output json --home "$DATA_CLI_DIR$i"
|
||||
"$PWD"/build/ethermintd config indent true --home "$DATA_CLI_DIR$i"
|
||||
"$PWD"/build/ethermintd config trust-node true --home "$DATA_CLI_DIR$i"
|
||||
echo "prepare genesis: Allocate genesis accounts"
|
||||
"$PWD"/build/ethermintd add-genesis-account \
|
||||
"$("$PWD"/build/ethermintd keys show "$KEY$i" -a --home "$DATA_CLI_DIR$i" )" 1000000000000000000aphoton,1000000000000000000stake \
|
||||
--home "$DATA_DIR$i" --home-client "$DATA_CLI_DIR$i"
|
||||
"$("$PWD"/build/ethermintd keys show "$KEY$i" -a --home "$DATA_DIR$i" --keyring-backend test)" 1000000000000000000aphoton,1000000000000000000stake \
|
||||
--home "$DATA_DIR$i" --keyring-backend test
|
||||
echo "prepare genesis: Sign genesis transaction"
|
||||
"$PWD"/build/ethermintd gentx --name $KEY"$i" --keyring-backend test --home "$DATA_DIR$i" --home-client "$DATA_CLI_DIR$i"
|
||||
"$PWD"/build/ethermintd gentx $KEY"$i" 1000000000000000000stake --keyring-backend test --home "$DATA_DIR$i" --keyring-backend test --chain-id $CHAINID
|
||||
echo "prepare genesis: Collect genesis tx"
|
||||
"$PWD"/build/ethermintd collect-gentxs --home "$DATA_DIR$i"
|
||||
echo "prepare genesis: Run validate-genesis to ensure everything worked and that the genesis file is setup correctly"
|
||||
@ -98,7 +92,8 @@ start_func() {
|
||||
echo "starting ethermint node $i in background ..."
|
||||
"$PWD"/build/ethermintd start --pruning=nothing --rpc.unsafe \
|
||||
--p2p.laddr tcp://$IP_ADDR:$NODE_P2P_PORT"$i" --address tcp://$IP_ADDR:$NODE_PORT"$i" --rpc.laddr tcp://$IP_ADDR:$NODE_RPC_PORT"$i" \
|
||||
--home "$DATA_DIR$i" \
|
||||
--evm-rpc.address $IP_ADDR:$RPC_PORT"$i" \
|
||||
--keyring-backend test --home "$DATA_DIR$i" \
|
||||
>"$DATA_DIR"/node"$i".log 2>&1 & disown
|
||||
|
||||
ETHERMINT_PID=$!
|
||||
@ -107,27 +102,12 @@ start_func() {
|
||||
arr+=("$ETHERMINT_PID")
|
||||
}
|
||||
|
||||
start_cli_func() {
|
||||
echo "starting ethermint node $i in background ..."
|
||||
"$PWD"/build/ethermintd rest-server --unlock-key $KEY"$i" --chain-id $CHAINID --trace \
|
||||
--laddr "tcp://localhost:$RPC_PORT$i" --node tcp://$IP_ADDR:$NODE_RPC_PORT"$i" \
|
||||
--home "$DATA_CLI_DIR$i" --read-timeout 30 --write-timeout 30 \
|
||||
--rpc-api "web3, eth, personal, net" \
|
||||
>"$DATA_CLI_DIR"/cli"$i".log 2>&1 & disown
|
||||
|
||||
ETHERMINT_CLI_PID=$!
|
||||
echo "started ethermintd node, pid=$ETHERMINT_CLI_PID"
|
||||
# add PID to array
|
||||
arrcli+=("$ETHERMINT_CLI_PID")
|
||||
}
|
||||
|
||||
# Run node with static blockchain database
|
||||
# For loop N times
|
||||
for i in $(seq 1 "$QTD"); do
|
||||
init_func "$i"
|
||||
start_func "$i"
|
||||
sleep 1
|
||||
start_cli_func "$i"
|
||||
echo "sleeping $SLEEP_TIMEOUT seconds for startup"
|
||||
sleep "$SLEEP_TIMEOUT"
|
||||
echo "done sleeping"
|
||||
|
@ -40,4 +40,4 @@ ethermintd collect-gentxs
|
||||
ethermintd validate-genesis
|
||||
|
||||
# Start the node (remove the --pruning=nothing flag if historical queries are not needed)
|
||||
ethermintd start --pruning=nothing --rpc.unsafe --rpc-api "web3, eth, personal, net" --keyring-backend test --trace --log_level "info"
|
||||
ethermintd start --pruning=nothing --rpc.unsafe --evm-rpc.address "0.0.0.0:8545" --keyring-backend test --trace --log_level "info"
|
||||
|
Loading…
Reference in New Issue
Block a user