init.sh updates
use toml config parser - don't name key "alice" init.sh nitro config
This commit is contained in:
parent
054a7f2c6a
commit
ba0ba384fc
@ -19,7 +19,7 @@ FROM ubuntu:24.04
|
||||
# Install ca-certificates, jq, curl, bash, and other necessary packages
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
jq curl netcat-openbsd bash \
|
||||
jq yq curl netcat-openbsd bash \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy over binary from the builder
|
||||
|
@ -3,7 +3,7 @@
|
||||
LACONIC_BIN=${LACONIC_BIN:-laconicd}
|
||||
LACONIC_HOME="${LACONIC_HOME:-$HOME/.laconicd}"
|
||||
|
||||
KEY="alice"
|
||||
KEY="node_key"
|
||||
CHAINID=${CHAINID:-"laconic_9000-1"}
|
||||
MONIKER=${MONIKER:-"localtestnet"}
|
||||
KEYRING=${KEYRING:-"test"}
|
||||
@ -39,6 +39,10 @@ if [ "$1" == "clean" ] || [ ! -d "$LACONIC_HOME/data/blockstore.db" ]; then
|
||||
# if $KEY exists it should be deleted
|
||||
printf "y\n" | $laconicd keys add $KEY --keyring-backend $KEYRING --no-backup
|
||||
|
||||
# Set the Nitro node PK
|
||||
# TODO generate?
|
||||
echo "$NITRO_PK" | $laconicd keys import-hex "${KEY}_nitro"
|
||||
|
||||
# Set moniker and chain-id for Ethermint (Moniker can be anything, chain-id must be an integer)
|
||||
$laconicd init $MONIKER --chain-id $CHAINID --default-denom $DENOM
|
||||
|
||||
@ -102,16 +106,32 @@ if [ "$1" == "clean" ] || [ ! -d "$LACONIC_HOME/data/blockstore.db" ]; then
|
||||
# Set gas limit in genesis
|
||||
update_genesis '.consensus["params"]["block"]["max_gas"]="10000000"'
|
||||
|
||||
# disable produce empty block
|
||||
$sed_i 's/create_empty_blocks = true/create_empty_blocks = false/g' $LACONIC_HOME/config/config.toml
|
||||
update_config() {
|
||||
mv -f "$2" "${2}.bak" && tomlq --toml-output "$1" "${2}.bak" > "$2"
|
||||
}
|
||||
|
||||
# Run this to allow requests from any origin
|
||||
$sed_i 's/cors_allowed_origins.*$/cors_allowed_origins = ["*"]/' $LACONIC_HOME/config/config.toml
|
||||
# disable empty blocks
|
||||
update_config '.consensus.create_empty_blocks = false' $LACONIC_HOME/config/config.toml
|
||||
|
||||
# Allow requests from any origin
|
||||
update_config '.rpc.cors_allowed_origins = ["*"]' $LACONIC_HOME/config/config.toml
|
||||
|
||||
# Enable telemetry (prometheus metrics: http://localhost:1317/metrics?format=prometheus)
|
||||
$sed_i 's/enabled = false/enabled = true/g' $LACONIC_HOME/config/app.toml
|
||||
$sed_i 's/prometheus-retention-time = 0/prometheus-retention-time = 60/g' $LACONIC_HOME/config/app.toml
|
||||
$sed_i 's/prometheus = false/prometheus = true/g' $LACONIC_HOME/config/config.toml
|
||||
update_config '.telemetry.enabled = true' $LACONIC_HOME/config/app.toml
|
||||
update_config '.telemetry."prometheus-retention-time" = 60' $LACONIC_HOME/config/app.toml
|
||||
update_config '.instrumentation.prometheus = true' $LACONIC_HOME/config/config.toml
|
||||
|
||||
# Nitro config
|
||||
update_config "
|
||||
.nitro.\"eth-pk\" = \"${KEY}\" |
|
||||
.nitro.\"eth-url\" = \"${NITRO_ETH_URL}\" |
|
||||
.nitro.\"eth-ca-address\" = \"${NITRO_ETH_CA_ADDRESS}\" |
|
||||
.nitro.\"eth-na-address\" = \"${NITRO_ETH_NA_ADDRESS}\" |
|
||||
.nitro.\"eth-vpa-address\" = \"${NITRO_ETH_VPA_ADDRESS}\" |
|
||||
.nitro.\"eth-start-block\" = \"${NITRO_ETH_START_BLOCK}\" |
|
||||
.nitro.pk = \"${KEY}_nitro\" |
|
||||
.nitro.\"boot-peers\" = \"${NITRO_BOOT_PEERS}\"
|
||||
" $LACONIC_HOME/config/app.toml
|
||||
|
||||
# Allocate genesis accounts (cosmos formatted addresses)
|
||||
# 10^30 alnt | 10^12 lnt
|
||||
@ -132,9 +152,9 @@ fi
|
||||
|
||||
# Start the node (remove the --pruning=nothing flag if historical queries are not needed)
|
||||
# TODO new pruning config
|
||||
$laconicd start \
|
||||
--log_level $LOGLEVEL \
|
||||
--server.minimum-gas-prices=1$DENOM \
|
||||
exec $laconicd start \
|
||||
--log_level "$LOGLEVEL" \
|
||||
--server.minimum-gas-prices="1$DENOM" \
|
||||
--rpc.laddr="tcp://0.0.0.0:26657" \
|
||||
--grpc.address="127.0.0.1:9091" \
|
||||
--gql.enable --gql.playground
|
||||
|
Loading…
Reference in New Issue
Block a user