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 juno config #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
15 changes: 15 additions & 0 deletions juno/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# no apt to install jq, so we copy it over
FROM wesleydeanflexion/busybox-jq:14 AS jq

FROM cephalopodequipment/junod:9.0.0

USER root

COPY --from=jq /bin/jq /bin/jq

WORKDIR /opt

COPY scripts/* /opt

ENTRYPOINT [ ]
CMD [ "/opt/run.sh" ]
11 changes: 11 additions & 0 deletions juno/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.PHONY: build publish

IMAGE=confio/juno-ci
TAG=9.0.0

build:
docker build -t $(IMAGE):$(TAG) .
docker tag $(IMAGE):$(TAG) $(IMAGE):latest

publish: build
docker push $(IMAGE):$(TAG)
8 changes: 8 additions & 0 deletions juno/scripts/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
set -o errexit -o nounset -o pipefail
command -v shellcheck >/dev/null && shellcheck "$0"

# add debug info here
cp -R "/template/.junod" /root
mkdir -p /root/log
junod start --rpc.laddr tcp://0.0.0.0:26657 --trace
76 changes: 76 additions & 0 deletions juno/scripts/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#!/bin/sh
set -o errexit -o nounset
command -v shellcheck >/dev/null && shellcheck "$0"

PASSWORD=${PASSWORD:-1234567890}
CHAIN_ID=${CHAIN_ID:-juno-testing}
MONIKER=${MONIKER:-juno-moniker}

STAKE=ujuno
TRANSFER_PORT=${TRANSFER_PORT:-transfer}

# 1000 ATOM
START_BALANCE="1000000000$STAKE"

echo "Creating genesis ..."
rm -rf "${HOME}/.junod"
junod init --chain-id "$CHAIN_ID" "$MONIKER"
cd "${HOME}/.junod"

sed -i "s/\"stake\"/\"$STAKE\"/" config/genesis.json # staking/governance token is hardcoded in config, change this
sed -i "s/\"port_id\": *\"transfer\"/\"port_id\": \"$TRANSFER_PORT\"/" config/genesis.json # allow custom ibc transfer port

# this is essential for sub-1s block times (or header times go crazy)
sed -i 's/"time_iota_ms": "1000"/"time_iota_ms": "10"/' config/genesis.json

echo "Setting up validator ..."
if ! junod keys show validator 2>/dev/null; then
echo "Validator does not yet exist. Creating it ..."
(
echo "$PASSWORD"
echo "$PASSWORD"
) | junod keys add validator
fi
# hardcode the validator account for this instance
echo "$PASSWORD" | junod add-genesis-account validator "$START_BALANCE"

echo "Setting up accounts ..."
# (optionally) add a few more genesis accounts
for addr in "$@"; do
echo "$addr"
junod add-genesis-account "$addr" "$START_BALANCE"
done

echo "Creating genesis tx ..."
SELF_DELEGATION="3000000$STAKE" # 3 JUNO (leads to a voting power of 3)
(
echo "$PASSWORD"
echo "$PASSWORD"
echo "$PASSWORD"
) | junod gentx validator "$SELF_DELEGATION" --offline --chain-id "$CHAIN_ID" --moniker="$MONIKER"
junod collect-gentxs

# so weird, but found I needed the -M flag after lots of debugging odd error messages
# happening when redirecting stdout
jq -S -M . < config/genesis.json > genesis.tmp
mv genesis.tmp config/genesis.json
chmod a+rx config/genesis.json

# Custom settings in config.toml
sed -i"" \
-e 's/^cors_allowed_origins =.*$/cors_allowed_origins = ["*"]/' \
-e 's/^timeout_propose =.*$/timeout_propose = "100ms"/' \
-e 's/^timeout_propose_delta =.*$/timeout_propose_delta = "100ms"/' \
-e 's/^timeout_prevote =.*$/timeout_prevote = "100ms"/' \
-e 's/^timeout_prevote_delta =.*$/timeout_prevote_delta = "100ms"/' \
-e 's/^timeout_precommit =.*$/timeout_precommit = "100ms"/' \
-e 's/^timeout_precommit_delta =.*$/timeout_precommit_delta = "100ms"/' \
-e 's/^timeout_commit =.*$/timeout_commit = "200ms"/' \
"config/config.toml"

# Custom settings app.toml
sed -i"" \
-e 's/^enable =.*$/enable = true/' \
-e 's/^enabled-unsafe-cors =.*$/enabled-unsafe-cors = true/' \
-e 's/^minimum-gas-prices = \".*\"/minimum-gas-prices = \"0ujuno\"/' \
"config/app.toml"