update fork

This commit is contained in:
0xmuralik
2022-10-10 16:08:33 +05:30
parent 632d53e34a
commit 56d59feaa0
383 changed files with 36784 additions and 21462 deletions
Executable
+6
View File
@@ -0,0 +1,6 @@
export PASSWORD='123456'
export VALIDATOR1_MNEMONIC="visit craft resemble online window solution west chuckle music diesel vital settle comic tribe project blame bulb armed flower region sausage mercy arrive release"
export VALIDATOR2_MNEMONIC="direct travel shrug hand twice agent sail sell jump phone velvet pilot mango charge usual multiply orient garment bleak virtual action mention panda vast"
export COMMUNITY_MNEMONIC="notable error gospel wave pair ugly measure elite toddler cost various fly make eye ketchup despair slab throw tribe swarm word fruit into inmate"
export SIGNER1_MNEMONIC="shed crumble dismiss loyal latin million oblige gesture shrug still oxygen custom remove ribbon disorder palace addict again blanket sad flock consider obey popular"
export SIGNER2_MNEMONIC="night renew tonight dinner shaft scheme domain oppose echo summer broccoli agent face guitar surface belt veteran siren poem alcohol menu custom crunch index"
Regular → Executable
+12 -12
View File
@@ -1,14 +1,14 @@
#!/bin/bash
KEY="mykey"
CHAINID="laconic_9000-1"
CHAINID="ethermint_9000-1"
MONIKER="localtestnet"
# stop and remove existing daemon and client data and process(es)
rm -rf ~/.laconic*
pkill -f "laconic*"
rm -rf ~/.ethermint*
pkill -f "ethermint*"
make build
make build-ethermint
# if $KEY exists it should be override
"$PWD"/build/laconicd keys add $KEY --keyring-backend test --algo "eth_secp256k1"
@@ -17,10 +17,10 @@ make build
"$PWD"/build/laconicd init $MONIKER --chain-id $CHAINID
# Change parameter token denominations to aphoton
cat $HOME/.laconicd/config/genesis.json | jq '.app_state["staking"]["params"]["bond_denom"]="stake"' > $HOME/.laconicd/config/tmp_genesis.json && mv $HOME/.laconicd/config/tmp_genesis.json $HOME/.laconicd/config/genesis.json
cat $HOME/.laconicd/config/genesis.json | jq '.app_state["crisis"]["constant_fee"]["denom"]="aphoton"' > $HOME/.laconicd/config/tmp_genesis.json && mv $HOME/.laconicd/config/tmp_genesis.json $HOME/.laconicd/config/genesis.json
cat $HOME/.laconicd/config/genesis.json | jq '.app_state["gov"]["deposit_params"]["min_deposit"][0]["denom"]="aphoton"' > $HOME/.laconicd/config/tmp_genesis.json && mv $HOME/.laconicd/config/tmp_genesis.json $HOME/.laconicd/config/genesis.json
cat $HOME/.laconicd/config/genesis.json | jq '.app_state["mint"]["params"]["mint_denom"]="aphoton"' > $HOME/.laconicd/config/tmp_genesis.json && mv $HOME/.laconicd/config/tmp_genesis.json $HOME/.laconicd/config/genesis.json
cat $HOME/.ethermint/config/genesis.json | jq '.app_state["staking"]["params"]["bond_denom"]="stake"' > $HOME/.ethermint/config/tmp_genesis.json && mv $HOME/.ethermint/config/tmp_genesis.json $HOME/.ethermint/config/genesis.json
cat $HOME/.ethermint/config/genesis.json | jq '.app_state["crisis"]["constant_fee"]["denom"]="aphoton"' > $HOME/.ethermint/config/tmp_genesis.json && mv $HOME/.ethermint/config/tmp_genesis.json $HOME/.ethermint/config/genesis.json
cat $HOME/.ethermint/config/genesis.json | jq '.app_state["gov"]["deposit_params"]["min_deposit"][0]["denom"]="aphoton"' > $HOME/.ethermint/config/tmp_genesis.json && mv $HOME/.ethermint/config/tmp_genesis.json $HOME/.ethermint/config/genesis.json
cat $HOME/.ethermint/config/genesis.json | jq '.app_state["mint"]["params"]["mint_denom"]="aphoton"' > $HOME/.ethermint/config/tmp_genesis.json && mv $HOME/.ethermint/config/tmp_genesis.json $HOME/.ethermint/config/genesis.json
# Allocate genesis accounts (cosmos formatted addresses)
"$PWD"/build/laconicd add-genesis-account "$("$PWD"/build/laconicd keys show "$KEY" -a --keyring-backend test)" 100000000000000000000aphoton,10000000000000000000stake --keyring-backend test
@@ -35,9 +35,9 @@ cat $HOME/.laconicd/config/genesis.json | jq '.app_state["mint"]["params"]["mint
"$PWD"/build/laconicd validate-genesis
# Start the node (remove the --pruning=nothing flag if historical queries are not needed) in background and log to file
"$PWD"/build/laconicd start --pruning=nothing --mode validator --rpc.unsafe --json-rpc.address="0.0.0.0:8545" --keyring-backend test > ethermintd.log 2>&1 &
"$PWD"/build/laconicd start --pruning=nothing --rpc.unsafe --json-rpc.address="0.0.0.0:8545" --keyring-backend test > laconicd.log 2>&1 &
# Give ethermintd node enough time to launch
# Give laconicd node enough time to launch
sleep 5
solcjs --abi "$PWD"/tests/solidity/suites/basic/contracts/Counter.sol --bin -o "$PWD"/tests/solidity/suites/basic/counter
@@ -57,7 +57,7 @@ echo "$ACCT"
cd tests/solidity/suites/basic/ && go get && go run main.go $ACCT
# After tests
# kill test ethermintd
echo "going to shutdown ethermintd in 3 seconds..."
# kill test laconicd
echo "going to shutdown laconicd in 3 seconds..."
sleep 3
pkill -f "ethermint*"
+56
View File
@@ -0,0 +1,56 @@
dotenv: .env
ethermint_9000-1:
cmd: laconicd
start-flags: "--trace"
app-config:
minimum-gas-prices: 0aphoton
index-events:
- ethereum_tx.ethereumTxHash
json-rpc:
address: "0.0.0.0:{EVMRPC_PORT}"
ws-address: "0.0.0.0:{EVMRPC_PORT_WS}"
api: "eth,net,web3,debug"
validators:
- coins: 1000000000000000000stake,10000000000000000000000aphoton
staked: 1000000000000000000stake
mnemonic: ${VALIDATOR1_MNEMONIC}
- coins: 1000000000000000000stake,10000000000000000000000aphoton
staked: 1000000000000000000stake
mnemonic: ${VALIDATOR2_MNEMONIC}
accounts:
- name: community
coins: 10000000000000000000000aphoton
mnemonic: ${COMMUNITY_MNEMONIC}
- name: signer1
coins: 20000000000000000000000aphoton
mnemonic: ${SIGNER1_MNEMONIC}
- name: signer2
coins: 30000000000000000000000aphoton
mnemonic: ${SIGNER2_MNEMONIC}
genesis:
consensus_params:
block:
max_bytes: "1048576"
max_gas: "81500000"
app_state:
evm:
params:
evm_denom: aphoton
gov:
voting_params:
voting_period: "10s"
deposit_params:
max_deposit_period: "10s"
min_deposit:
- denom: "aphoton"
amount: "1"
transfer:
params:
receive_enabled: true
send_enabled: true
feemarket:
params:
no_base_fee: false
base_fee: "100000000000"
min_gas_multiplier: "0"
+23 -25
View File
@@ -14,6 +14,8 @@ REMOVE_DATA_DIR=false
#PORT AND RPC_PORT 3 initial digits, to be concat with a suffix later when node is initialized
RPC_PORT="854"
# Ethereum JSONRPC Websocket
WS_PORT="855"
IP_ADDR="0.0.0.0"
KEY="mykey"
@@ -32,7 +34,6 @@ usage() {
echo "-q <number> -- Quantity of nodes to run. eg: 3"
echo "-z <number> -- Quantity of nodes to run tests against eg: 3"
echo "-s <number> -- Sleep between operations in secs. eg: 5"
echo "-m <string> -- Mode for testing. eg: rpc"
echo "-r <string> -- Remove test dir after, eg: true, default is false"
exit 1
}
@@ -53,15 +54,15 @@ done
set -euxo pipefail
DATA_DIR=$(mktemp -d -t ethermint-datadir.XXXXX)
DATA_DIR=$(mktemp -d -t laconic-datadir.XXXXX)
if [[ ! "$DATA_DIR" ]]; then
echo "Could not create $DATA_DIR"
exit 1
fi
# Compile laconic
echo "compiling laconic"
# Compile laconicd
echo "compiling laconicd"
make build
# PID array declaration
@@ -104,22 +105,18 @@ init_func() {
}
start_func() {
echo "starting laconic node $i in background ..."
"$PWD"/build/laconicd 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=$IP_ADDR:$RPC_PORT"$i" \
--json-rpc.api="eth,txpool,personal,net,debug,web3" \
--keyring-backend test --mode validator --home "$DATA_DIR$i" \
--log_level debug \
echo "starting laconicd node $i in background ..."
"$PWD"/build/laconicd 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=$IP_ADDR:$RPC_PORT"$i" --json-rpc.ws-address=$IP_ADDR:$WS_PORT"$i" \
--json-rpc.api="eth,txpool,personal,net,debug,web3" \
--keyring-backend test --home "$DATA_DIR$i" \
>"$DATA_DIR"/node"$i".log 2>&1 & disown
LACONIC_PID=$!
echo "started laconic node, pid=$LACONIC_PID"
LACONICD_PID=$!
echo "started laconicd node, pid=$LACONICD_PID"
# add PID to array
arr+=("$LACONIC_PID")
arr+=("$LACONICD_PID")
if [[ $MODE == "pending" ]]; then
echo "waiting for the first block..."
@@ -149,7 +146,7 @@ if [[ -z $TEST || $TEST == "integration" ]] ; then
for i in $(seq 1 "$TEST_QTD"); do
HOST_RPC=http://$IP_ADDR:$RPC_PORT"$i"
echo "going to test laconic node $HOST_RPC ..."
echo "going to test laconicd node $HOST_RPC ..."
MODE=$MODE HOST=$HOST_RPC go test ./tests/e2e/... -timeout=$time_out -v -short
TEST_FAIL=$?
done
@@ -163,20 +160,21 @@ if [[ -z $TEST || $TEST == "rpc" || $TEST == "pending" ]]; then
for i in $(seq 1 "$TEST_QTD"); do
HOST_RPC=http://$IP_ADDR:$RPC_PORT"$i"
echo "going to test laconic node $HOST_RPC ..."
MODE=$MODE HOST=$HOST_RPC go test ./tests/rpc/... -timeout=$time_out -v -short
HOST_WS=$IP_ADDR:$WS_PORT"$i"
echo "going to test laconicd node rpc=$HOST_RPC ws=$HOST_WS ..."
MODE=$MODE HOST=$HOST_RPC HOST_WS=$HOST_WS go test ./tests/rpc/... -timeout=$time_out -v -short
TEST_FAIL=$?
done
fi
stop_func() {
LACONIC_PID=$i
echo "shutting down node, pid=$LACONIC_PID ..."
LACONICD_PID=$i
echo "shutting down node, pid=$LACONICD_PID ..."
# Shutdown laconic node
kill -9 "$LACONIC_PID"
wait "$LACONIC_PID"
# Shutdown laconicd node
kill -9 "$LACONICD_PID"
wait "$LACONICD_PID"
if [ $REMOVE_DATA_DIR == "true" ]
then
+1 -1
View File
@@ -113,7 +113,7 @@ f_install_protoc_gen_swagger() {
fi
pushd "${TEMPDIR}" >/dev/null
go get github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger
go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@latest
npm install -g swagger-combine
popd >/dev/null
f_print_done
+1 -1
View File
@@ -40,5 +40,5 @@ $(find "$(pwd)/proto" -maxdepth 5 -name '*.proto')
# go mod tidy
# move proto files to the right places
cp -r github.com/cerc-io/laconicd/* ./
cp -r github.com/evmos/ethermint/* ./
rm -rf github.com
+13
View File
@@ -0,0 +1,13 @@
#!/bin/sh
set -e
cd "$(dirname "$0")"
# explicitly set a short TMPDIR to prevent path too long issue on macosx
export TMPDIR=/tmp
echo "build test contracts"
cd ../tests/integration_tests/contracts
HUSKY_SKIP_INSTALL=1 npm install
npm run typechain
cd ..
pytest -vv -s
+1 -1
View File
@@ -3,7 +3,7 @@ export GOPATH=~/go
export PATH=$PATH:$GOPATH/bin
# remove existing daemon
rm -rf ~/.laconic*
rm -rf ~/.laconicd
# build ethermint binary
make install
+6 -7
View File
@@ -1,13 +1,12 @@
#!/bin/sh
#!/bin/bash
echo "prepare genesis: Run validate-genesis to ensure everything worked and that the genesis file is setup correctly"
laconicd validate-genesis --home /laconic
./ethermintd validate-genesis --home /ethermint
echo "starting laconic node $ID in background ..."
laconicd start \
--home /laconic \
--keyring-backend test \
--mode validator
echo "starting ethermint node $ID in background ..."
./ethermintd start \
--home /ethermint \
--keyring-backend test
echo "started ethermint node"
tail -f /dev/null
+31
View File
@@ -0,0 +1,31 @@
#!/bin/sh
set -e
CONFIG=$1
if [ -z "$CONFIG" ]; then
echo "No config file supplied"
exit 1
fi
shift
DOTENV=$1
if [ -z "$DOTENV" ]; then
echo "No dotenv file supplied"
exit 1
fi
shift
DATA=$1
if [ -z "$DATA" ]; then
echo "No data directory supplied"
exit 1
fi
shift
echo 'pystarport:'
echo ' config: '$CONFIG
echo ' dotenv: '$DOTENV
echo ' data: '$DATA
pystarport init --config $CONFIG --dotenv $DOTENV --data $DATA $@
supervisord -c $DATA/tasks.ini
+58
View File
@@ -0,0 +1,58 @@
#!/bin/sh
set -e
CONFIG=$1
if [ -z $CONFIG ]; then
echo "No config file supplied"
exit 1
fi
shift
DATA=$1
if [ -z $DATA ]; then
echo "No data directory supplied"
exit 1
fi
shift
geth --datadir $DATA init $CONFIG
pwdfile=$(mktemp /tmp/password.XXXXXX)
tmpfile=$(mktemp /tmp/validator-key.XXXXXX)
cat > $pwdfile << EOF
$PASSWORD
EOF
# import validator key
validator_key=$(python -c """
from eth_account import Account
Account.enable_unaudited_hdwallet_features()
print(Account.from_mnemonic('$VALIDATOR1_MNEMONIC').key.hex().replace('0x',''))
""")
cat > $tmpfile << EOF
$validator_key
EOF
geth --datadir $DATA account import $tmpfile --password $pwdfile
# import community key
community_key=$(python -c """
from eth_account import Account
Account.enable_unaudited_hdwallet_features()
print(Account.from_mnemonic('$COMMUNITY_MNEMONIC').key.hex().replace('0x',''))
""")
cat > $tmpfile << EOF
$community_key
EOF
geth --datadir $DATA account import $tmpfile --password $pwdfile
rm $tmpfile
# start up
geth --networkid 9000 --datadir $DATA --http --http.addr localhost --http.api 'personal,eth,net,web3,txpool,miner' \
-unlock '0x57f96e6b86cdefdb3d412547816a82e3e0ebf9d2' --password $pwdfile \
--mine --allow-insecure-unlock \
$@
rm $pwdfile
+9 -9
View File
@@ -18,7 +18,7 @@ KEY="mykey"
CHAINID="ethermint_9000-1"
MONIKER="mymoniker"
## default port prefixes for ethermintd
## default port prefixes for laconicd
NODE_P2P_PORT="2660"
NODE_PORT="2663"
NODE_RPC_PORT="2666"
@@ -61,9 +61,9 @@ if [[ ! "$DATA_CLI_DIR" ]]; then
exit 1
fi
# Compile laconic
echo "compiling laconic"
make build
# Compile ethermint
echo "compiling ethermint"
make build-ethermint
# PID array declaration
arr=()
@@ -89,15 +89,15 @@ init_func() {
}
start_func() {
echo "starting laconic node $i in background ..."
echo "starting ethermint node $i in background ..."
"$PWD"/build/laconicd 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=$IP_ADDR:$RPC_PORT"$i" \
--keyring-backend test --mode validator --home "$DATA_DIR$i" \
--keyring-backend test --home "$DATA_DIR$i" \
>"$DATA_DIR"/node"$i".log 2>&1 & disown
ETHERMINT_PID=$!
echo "started laconic node, pid=$ETHERMINT_PID"
echo "started ethermint node, pid=$ETHERMINT_PID"
# add PID to array
arr+=("$ETHERMINT_PID")
}
@@ -123,7 +123,7 @@ if [[ -z $TEST || $TEST == "rpc" ]]; then
for i in $(seq 1 "$TEST_QTD"); do
HOST_RPC=http://$IP_ADDR:$RPC_PORT"$i"
echo "going to test laconic node $HOST_RPC ..."
echo "going to test ethermint node $HOST_RPC ..."
MODE=$MODE HOST=$HOST_RPC go test ./tests/e2e/... -timeout=300s -v -short
MODE=$MODE HOST=$HOST_RPC go test ./tests/rpc/... -timeout=300s -v -short
@@ -136,7 +136,7 @@ stop_func() {
ETHERMINT_PID=$i
echo "shutting down node, pid=$ETHERMINT_PID ..."
# Shutdown laconic node
# Shutdown ethermint node
kill -9 "$ETHERMINT_PID"
wait "$ETHERMINT_PID"
}