mirror of
https://github.com/0glabs/0g-storage-node.git
synced 2024-11-20 15:05:19 +00:00
Remove the 0gchain genesis init script for mac os (#208)
Some checks failed
abi-consistent-check / build-and-compare (push) Has been cancelled
code-coverage / unittest-cov (push) Has been cancelled
rust / check (push) Has been cancelled
rust / test (push) Has been cancelled
rust / lints (push) Has been cancelled
functional-test / test (push) Has been cancelled
Some checks failed
abi-consistent-check / build-and-compare (push) Has been cancelled
code-coverage / unittest-cov (push) Has been cancelled
rust / check (push) Has been cancelled
rust / test (push) Has been cancelled
rust / lints (push) Has been cancelled
functional-test / test (push) Has been cancelled
* Remove the 0gchain genesis init script for mac os * fix on mac
This commit is contained in:
parent
5849e9c2ba
commit
1dd7bf7734
@ -1,95 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
BINARY=$(cd $(dirname ${BASH_SOURCE[0]})/../tmp; pwd)/0gchaind
|
|
||||||
ROOT_DIR=${1:-.}
|
|
||||||
NUM_NODES=${2:-3}
|
|
||||||
P2P_PORT_START=${3:-26656}
|
|
||||||
CHAIN_ID=zgchainpy_9000-777
|
|
||||||
|
|
||||||
# install jq if not unavailable
|
|
||||||
jq --version >/dev/null 2>&1 || sudo snap install jq -y
|
|
||||||
|
|
||||||
mkdir -p $ROOT_DIR
|
|
||||||
|
|
||||||
# Init configs
|
|
||||||
for ((i=0; i<$NUM_NODES; i++)) do
|
|
||||||
$BINARY init node$i --home $ROOT_DIR/node$i --chain-id $CHAIN_ID
|
|
||||||
|
|
||||||
# Change genesis.json
|
|
||||||
GENESIS=$ROOT_DIR/node$i/config/genesis.json
|
|
||||||
TMP_GENESIS=$ROOT_DIR/node$i/config/tmp_genesis.json
|
|
||||||
|
|
||||||
# Replace stake with neuron
|
|
||||||
sed -in-place='' 's/stake/ua0gi/g' "$GENESIS"
|
|
||||||
|
|
||||||
# Replace the default evm denom of aphoton with neuron
|
|
||||||
sed -in-place='' 's/aphoton/neuron/g' "$GENESIS"
|
|
||||||
|
|
||||||
cat $GENESIS | jq '.consensus_params.block.max_gas = "25000000"' >$TMP_GENESIS && mv $TMP_GENESIS $GENESIS
|
|
||||||
|
|
||||||
# Zero out the total supply so it gets recalculated during InitGenesis
|
|
||||||
cat $GENESIS | jq '.app_state.bank.supply = []' >$TMP_GENESIS && mv $TMP_GENESIS $GENESIS
|
|
||||||
|
|
||||||
# Disable fee market
|
|
||||||
cat $GENESIS | jq '.app_state.feemarket.params.no_base_fee = true' >$TMP_GENESIS && mv $TMP_GENESIS $GENESIS
|
|
||||||
|
|
||||||
# Disable london fork
|
|
||||||
cat $GENESIS | jq '.app_state.evm.params.chain_config.london_block = null' >$TMP_GENESIS && mv $TMP_GENESIS $GENESIS
|
|
||||||
cat $GENESIS | jq '.app_state.evm.params.chain_config.arrow_glacier_block = null' >$TMP_GENESIS && mv $TMP_GENESIS $GENESIS
|
|
||||||
cat $GENESIS | jq '.app_state.evm.params.chain_config.gray_glacier_block = null' >$TMP_GENESIS && mv $TMP_GENESIS $GENESIS
|
|
||||||
cat $GENESIS | jq '.app_state.evm.params.chain_config.merge_netsplit_block = null' >$TMP_GENESIS && mv $TMP_GENESIS $GENESIS
|
|
||||||
cat $GENESIS | jq '.app_state.evm.params.chain_config.shanghai_block = null' >$TMP_GENESIS && mv $TMP_GENESIS $GENESIS
|
|
||||||
cat $GENESIS | jq '.app_state.evm.params.chain_config.cancun_block = null' >$TMP_GENESIS && mv $TMP_GENESIS $GENESIS
|
|
||||||
|
|
||||||
# cat $GENESIS | jq '.app_state["staking"]["params"]["bond_denom"]="a0gi"' >$TMP_GENESIS && mv $TMP_GENESIS $GENESIS
|
|
||||||
# cat $GENESIS | jq '.app_state["gov"]["params"]["min_deposit"][0]["denom"]="a0gi"' >$TMP_GENESIS && mv $TMP_GENESIS $GENESIS
|
|
||||||
|
|
||||||
cat "$GENESIS" | jq '.app_state["staking"]["params"]["max_validators"]=125' >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
|
|
||||||
cat "$GENESIS" | jq '.app_state["slashing"]["params"]["signed_blocks_window"]="1000"' >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
|
|
||||||
|
|
||||||
cat "$GENESIS" | jq '.app_state["consensus_params"]["block"]["time_iota_ms"]="3000"' >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
|
|
||||||
|
|
||||||
# Change app.toml
|
|
||||||
APP_TOML=$ROOT_DIR/node$i/config/app.toml
|
|
||||||
sed -i '' 's/minimum-gas-prices = "0ua0gi"/minimum-gas-prices = "1000000000neuron"/' $APP_TOML
|
|
||||||
sed -i '' '/\[grpc\]/,/^\[/ s/enable = true/enable = false/' $APP_TOML
|
|
||||||
sed -i '' '/\[grpc-web\]/,/^\[/ s/enable = true/enable = false/' $APP_TOML
|
|
||||||
sed -i '' '/\[json-rpc\]/,/^\[/ s/enable = false/enable = true/' $APP_TOML
|
|
||||||
|
|
||||||
# Change config.toml
|
|
||||||
CONFIG_TOML=$ROOT_DIR/node$i/config/config.toml
|
|
||||||
sed -i '' '/seeds = /c\
|
|
||||||
seeds = ""' $CONFIG_TOML
|
|
||||||
sed -i '' 's/addr_book_strict = true/addr_book_strict = false/' $CONFIG_TOML
|
|
||||||
done
|
|
||||||
|
|
||||||
# Update persistent_peers in config.toml
|
|
||||||
for ((i=1; i<$NUM_NODES; i++)) do
|
|
||||||
PERSISTENT_NODES=""
|
|
||||||
for ((j=0; j<$i; j++)) do
|
|
||||||
if [[ $j -gt 0 ]]; then PERSISTENT_NODES=$PERSISTENT_NODES,; fi
|
|
||||||
NODE_ID=`$BINARY tendermint show-node-id --home $ROOT_DIR/node$j`
|
|
||||||
P2P_PORT=$(($P2P_PORT_START+$j))
|
|
||||||
PERSISTENT_NODES=$PERSISTENT_NODES$NODE_ID@127.0.0.1:$P2P_PORT
|
|
||||||
done
|
|
||||||
sed -i '' "/persistent_peers = /c\
|
|
||||||
persistent_peers = \"$PERSISTENT_NODES\"" $ROOT_DIR/node$i/config/config.toml
|
|
||||||
done
|
|
||||||
|
|
||||||
# Create genesis with a single validator
|
|
||||||
$BINARY keys add val0 --keyring-backend test --home $ROOT_DIR/node0
|
|
||||||
$BINARY add-genesis-account val0 15000000000000000000ua0gi --keyring-backend test --home $ROOT_DIR/node0
|
|
||||||
|
|
||||||
# add genesis account for tests, see GENESIS_PRIV_KEY and GENESIS_PRIV_KEY1 in node_config.py
|
|
||||||
$BINARY add-genesis-account 0g1l0j9dqdvd3fatfqywhm4y6avrln4jracmt6ztf 40000000000000000000ua0gi --home $ROOT_DIR/node0
|
|
||||||
$BINARY add-genesis-account 0g1pemg6y3etj9tlhkl0vdwkrw36f74u2nl8sjw7g 40000000000000000000ua0gi --home $ROOT_DIR/node0
|
|
||||||
|
|
||||||
mkdir -p $ROOT_DIR/gentxs
|
|
||||||
$BINARY gentx val0 10000000000000000000ua0gi --keyring-backend test --home $ROOT_DIR/node0 --output-document $ROOT_DIR/gentxs/node0.json
|
|
||||||
$BINARY collect-gentxs --home $ROOT_DIR/node0 --gentx-dir $ROOT_DIR/gentxs
|
|
||||||
$BINARY validate-genesis --home $ROOT_DIR/node0
|
|
||||||
for ((i=1; i<$NUM_NODES; i++)) do
|
|
||||||
cp $ROOT_DIR/node0/config/genesis.json $ROOT_DIR/node$i/config/genesis.json
|
|
||||||
done
|
|
@ -13,6 +13,12 @@ jq --version >/dev/null 2>&1 || sudo snap install jq -y
|
|||||||
|
|
||||||
mkdir -p $ROOT_DIR
|
mkdir -p $ROOT_DIR
|
||||||
|
|
||||||
|
SED_I="sed -i"
|
||||||
|
OS_NAME=`uname -o`
|
||||||
|
if [[ "$OS_NAME" = "Darwin" ]]; then
|
||||||
|
SED_I="sed -i ''"
|
||||||
|
fi
|
||||||
|
|
||||||
# Init configs
|
# Init configs
|
||||||
for ((i=0; i<$NUM_NODES; i++)) do
|
for ((i=0; i<$NUM_NODES; i++)) do
|
||||||
$BINARY init node$i --home $ROOT_DIR/node$i --chain-id $CHAIN_ID
|
$BINARY init node$i --home $ROOT_DIR/node$i --chain-id $CHAIN_ID
|
||||||
@ -22,10 +28,10 @@ for ((i=0; i<$NUM_NODES; i++)) do
|
|||||||
TMP_GENESIS=$ROOT_DIR/node$i/config/tmp_genesis.json
|
TMP_GENESIS=$ROOT_DIR/node$i/config/tmp_genesis.json
|
||||||
|
|
||||||
# Replace stake with neuron
|
# Replace stake with neuron
|
||||||
sed -in-place='' 's/stake/ua0gi/g' "$GENESIS"
|
$SED_I 's/stake/ua0gi/g' "$GENESIS"
|
||||||
|
|
||||||
# Replace the default evm denom of aphoton with neuron
|
# Replace the default evm denom of aphoton with neuron
|
||||||
sed -in-place='' 's/aphoton/neuron/g' "$GENESIS"
|
$SED_I 's/aphoton/neuron/g' "$GENESIS"
|
||||||
|
|
||||||
cat $GENESIS | jq '.consensus_params.block.max_gas = "25000000"' >$TMP_GENESIS && mv $TMP_GENESIS $GENESIS
|
cat $GENESIS | jq '.consensus_params.block.max_gas = "25000000"' >$TMP_GENESIS && mv $TMP_GENESIS $GENESIS
|
||||||
|
|
||||||
@ -53,24 +59,24 @@ for ((i=0; i<$NUM_NODES; i++)) do
|
|||||||
|
|
||||||
# Change app.toml
|
# Change app.toml
|
||||||
APP_TOML=$ROOT_DIR/node$i/config/app.toml
|
APP_TOML=$ROOT_DIR/node$i/config/app.toml
|
||||||
sed -i 's/minimum-gas-prices = "0ua0gi"/minimum-gas-prices = "1000000000neuron"/' $APP_TOML
|
$SED_I 's/minimum-gas-prices = "0ua0gi"/minimum-gas-prices = "1000000000neuron"/' $APP_TOML
|
||||||
sed -i '/\[grpc\]/,/^\[/ s/enable = true/enable = false/' $APP_TOML
|
$SED_I '/\[grpc\]/,/^\[/ s/enable = true/enable = false/' $APP_TOML
|
||||||
sed -i '/\[grpc-web\]/,/^\[/ s/enable = true/enable = false/' $APP_TOML
|
$SED_I '/\[grpc-web\]/,/^\[/ s/enable = true/enable = false/' $APP_TOML
|
||||||
sed -i '/\[json-rpc\]/,/^\[/ s/enable = false/enable = true/' $APP_TOML
|
$SED_I '/\[json-rpc\]/,/^\[/ s/enable = false/enable = true/' $APP_TOML
|
||||||
|
|
||||||
# Change config.toml
|
# Change config.toml
|
||||||
CONFIG_TOML=$ROOT_DIR/node$i/config/config.toml
|
CONFIG_TOML=$ROOT_DIR/node$i/config/config.toml
|
||||||
sed -i '/seeds = /c\seeds = ""' $CONFIG_TOML
|
# $SED_I '/seeds = /c\seeds = ""' $CONFIG_TOML
|
||||||
sed -i 's/addr_book_strict = true/addr_book_strict = false/' $CONFIG_TOML
|
$SED_I 's/addr_book_strict = true/addr_book_strict = false/' $CONFIG_TOML
|
||||||
|
|
||||||
# Change block time to very small
|
# Change block time to very small
|
||||||
sed -i '/timeout_propose = "3s"/c\timeout_propose = "300ms"' $CONFIG_TOML
|
$SED_I 's/timeout_propose = "3s"/timeout_propose = "300ms"/' $CONFIG_TOML
|
||||||
sed -i '/timeout_propose_delta = "500ms"/c\timeout_propose_delta = "50ms"' $CONFIG_TOML
|
$SED_I 's/timeout_propose_delta = "500ms"/timeout_propose_delta = "50ms"/' $CONFIG_TOML
|
||||||
sed -i '/timeout_prevote = "1s"/c\timeout_prevote = "100ms"' $CONFIG_TOML
|
$SED_I 's/timeout_prevote = "1s"/timeout_prevote = "100ms"/' $CONFIG_TOML
|
||||||
sed -i '/timeout_prevote_delta = "500ms"/c\timeout_prevote_delta = "50ms"' $CONFIG_TOML
|
$SED_I 's/timeout_prevote_delta = "500ms"/timeout_prevote_delta = "50ms"/' $CONFIG_TOML
|
||||||
sed -i '/timeout_precommit = "1s"/c\timeout_precommit = "100ms"' $CONFIG_TOML
|
$SED_I 's/timeout_precommit = "1s"/timeout_precommit = "100ms"/' $CONFIG_TOML
|
||||||
sed -i '/timeout_precommit_delta = "500ms"/c\timeout_precommit_delta = "50ms"' $CONFIG_TOML
|
$SED_I 's/timeout_precommit_delta = "500ms"/timeout_precommit_delta = "50ms"/' $CONFIG_TOML
|
||||||
sed -i '/timeout_commit = "5s"/c\timeout_commit = "500ms"' $CONFIG_TOML
|
$SED_I 's/timeout_commit = "5s"/timeout_commit = "500ms"/' $CONFIG_TOML
|
||||||
done
|
done
|
||||||
|
|
||||||
# Update persistent_peers in config.toml
|
# Update persistent_peers in config.toml
|
||||||
@ -82,7 +88,7 @@ for ((i=1; i<$NUM_NODES; i++)) do
|
|||||||
P2P_PORT=$(($P2P_PORT_START+$j))
|
P2P_PORT=$(($P2P_PORT_START+$j))
|
||||||
PERSISTENT_NODES=$PERSISTENT_NODES$NODE_ID@127.0.0.1:$P2P_PORT
|
PERSISTENT_NODES=$PERSISTENT_NODES$NODE_ID@127.0.0.1:$P2P_PORT
|
||||||
done
|
done
|
||||||
sed -i "/persistent_peers = /c\persistent_peers = \"$PERSISTENT_NODES\"" $ROOT_DIR/node$i/config/config.toml
|
$SED_I "s/persistent_peers = \"\"/persistent_peers = \"$PERSISTENT_NODES\"/" $ROOT_DIR/node$i/config/config.toml
|
||||||
done
|
done
|
||||||
|
|
||||||
# Create genesis with a single validator
|
# Create genesis with a single validator
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import tempfile
|
import tempfile
|
||||||
import platform
|
|
||||||
|
|
||||||
from test_framework.blockchain_node import BlockChainNodeType, BlockchainNode
|
from test_framework.blockchain_node import BlockChainNodeType, BlockchainNode
|
||||||
from utility.utils import blockchain_rpc_port, arrange_port
|
from utility.utils import blockchain_rpc_port, arrange_port
|
||||||
@ -22,13 +21,6 @@ def zg_node_init_genesis(binary: str, root_dir: str, num_nodes: int):
|
|||||||
os.path.dirname(os.path.realpath(__file__)), # test_framework folder
|
os.path.dirname(os.path.realpath(__file__)), # test_framework folder
|
||||||
"..", "config", "0gchain-init-genesis.sh"
|
"..", "config", "0gchain-init-genesis.sh"
|
||||||
)
|
)
|
||||||
sys = platform.system().lower()
|
|
||||||
if sys == "darwin":
|
|
||||||
shell_script = os.path.join(
|
|
||||||
os.path.dirname(os.path.realpath(__file__)), # test_framework folder
|
|
||||||
"..", "config", "0gchain-init-genesis-mac.sh"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
zgchaind_dir = os.path.join(root_dir, "0gchaind")
|
zgchaind_dir = os.path.join(root_dir, "0gchaind")
|
||||||
os.mkdir(zgchaind_dir)
|
os.mkdir(zgchaind_dir)
|
||||||
|
Loading…
Reference in New Issue
Block a user