Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add launch scripts #111

Merged
merged 1 commit into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions scripts/.env-sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
CORE_SYMBOL_NAME=EOS
EVM_CONTRACT_ROOT=/path/to/eos-evm-contract
LEAP_ROOT=/path/to/leap-4
EVM_BRIDGE_ROOT=/path/to/evm-bridge-contracts
EVM_NODE_ROOT=/path/to/eos-evm-node
WEB3_RPC_ENDPOINT=http://localhost:5000
NODEOS_RPC_ENDPOINT=http://localhost:8889
POLL_INTERVAL=500
WS_LISTENING_PORT=3333
WS_LISTENING_HOST=localhost
MAX_LOGS_SUBS_PER_CONNECTION=1
MAX_MINEDTX_SUBS_PER_CONNECTION=1
LOG_LEVEL=debug
GENESIS_JSON=eos-evm-genesis.json
78 changes: 78 additions & 0 deletions scripts/start-evm-node.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#!/bin/bash
if [ ! -f .env ]; then
echo ".env file not found"
exit 1
fi

source .env
trap "kill 0" SIGINT

CLEAN=0
if [ "$1" == "--clean" ]; then
CLEAN=1
fi

if [ $CLEAN -eq 1 ]; then
rm -rf data-evm-node
fi

mkdir -p data-evm-node/snapshots

if [ ! -f $EVM_NODE_ROOT/build/src/eos-evm-node ]; then
echo $EVM_NODE_ROOT/build/src/eos-evm-node not found
exit 1
fi

if [ ! -f $EVM_NODE_ROOT/build/src/eos-evm-rpc ]; then
echo $EVM_NODE_ROOT/build/src/eos-evm-rpc not found
exit 1
fi

if [ ! -f $EVM_NODE_ROOT/peripherals/eos-evm-ws-proxy/main.js ]; then
echo $EVM_NODE_ROOT/peripherals/eos-evm-ws-proxy/main.js not found
exit 1
fi

if [ ! -f eos-evm-genesis.json ]; then
echo "Waiting for eos-evm-genesis.json ..."
while [ ! -f eos-evm-genesis.json ]; do
sleep 1
done
fi

echo "Launching EOS EVM Node"
$EVM_NODE_ROOT/build/src/eos-evm-node \
--plugin=blockchain_plugin \
--ship-endpoint=127.0.0.1:8999 \
--genesis-json=eos-evm-genesis.json \
--ship-core-account=eosio.evm \
--chain-data=data-evm-node \
--ship-max-retry=1000000 \
--ship-delay-second=2 \
--stdout=1 \
--nocolor=1 \
--verbosity=5 > node.log &

sleep 2

echo "Launching EOS EVM Rpc"
$EVM_NODE_ROOT/build/src/eos-evm-rpc \
--eos-evm-node=127.0.0.1:8080 \
--http-port=0.0.0.0:8881 \
--chaindata=data-evm-node \
--stdout=1 \
--nocolor=1 \
--verbosity=10 \
--api-spec=eth,debug,net,trace > rpc.log &

sleep 2

echo "Launching EOS EVM WS proxy"
if [ ! -d "node_modules" ]; then
cp $EVM_NODE_ROOT/peripherals/eos-evm-ws-proxy/package.json .
npm install
fi

node $EVM_NODE_ROOT/peripherals/eos-evm-ws-proxy/main.js > ws.log &

wait
40 changes: 40 additions & 0 deletions scripts/start-evm-runtime.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash
if [ ! -f .env ]; then
echo ".env file not found"
exit 1
fi

source .env

# check required files / folder
if [ ! -d $LEAP_ROOT/build/tests/TestHarness ]; then
echo $LEAP_ROOT/build/tests/TestHarness not found
exit 1
fi

if [[ ! -f "$EVM_CONTRACT_ROOT/build/evm_runtime/evm_runtime.wasm" || ! -f "$EVM_CONTRACT_ROOT/build/evm_runtime/evm_runtime.abi" ]]; then
echo $EVM_CONTRACT_ROOT/build/evm_runtime/evm_runtime wasm/abi not found
exit 1
fi

if [[ "$CORE_SYMBOL_NAME" != "EOS" ]]; then
echo "CORE_SYMBOL_NAME is not 'EOS' (warning)"
fi

CLEAN=0
if [ "$1" == "--clean" ]; then
CLEAN=1
fi

if [ $CLEAN -eq 1 ]; then
rm -rf venv
fi

if [ ! -d "venv" ]; then
python3 -m venv venv
./venv/bin/pip install web3 flask flask_cors
ln -s $LEAP_ROOT/build/tests/TestHarness venv/lib/python3.10/site-packages/TestHarness
fi

CORE_SYMBOL_NAME=$CORE_SYMBOL_NAME ./venv/bin/python3 $EVM_NODE_ROOT/tests/nodeos_eos_evm_server.py --eos-evm-contract-root $EVM_CONTRACT_ROOT/build --eos-evm-bridge-contracts-root $EVM_BRIDGE_ROOT/build
mv eos-evm-genesis.json eos-evm-genesis.json.last &> /dev/null
Loading