Skip to content

Commit

Permalink
hotfix: update neutron setup to be divided into update config
Browse files Browse the repository at this point in the history
  • Loading branch information
Anmol1696 committed Jul 12, 2024
1 parent 10df516 commit 1eda7fc
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 30 deletions.
27 changes: 0 additions & 27 deletions starship/charts/devnet/scripts/neutron/create-neutron-genesis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ FAUCET_ENABLED="${FAUCET_ENABLED:=true}"
NUM_VALIDATORS="${NUM_VALIDATORS:=1}"
NUM_RELAYERS="${NUM_RELAYERS:=0}"

P2PPORT=${P2PPORT:-26656}
RPCPORT=${RPCPORT:-26657}
RESTPORT=${RESTPORT:-1317}
ROSETTA=${ROSETTA:-8080}

GENESIS_PATH="$CHAIN_DIR/config/genesis.json"

CONTRACTS_BINARIES_DIR=${CONTRACTS_BINARIES_DIR:-./contracts}
Expand Down Expand Up @@ -72,28 +67,6 @@ echo "Adding key.... demowallet2"
jq -r ".keys[0].mnemonic" $KEYS_CONFIG | $BINARY keys add demowallet3 --index 3 --recover --keyring-backend="test"
$BINARY add-genesis-account $($BINARY keys show -a demowallet3 --keyring-backend="test") $COINS --keyring-backend="test"

sed -i -e 's/timeout_commit = "5s"/timeout_commit = "1s"/g' "$CHAIN_DIR/config/config.toml"
sed -i -e 's/timeout_propose = "3s"/timeout_propose = "1s"/g' "$CHAIN_DIR/config/config.toml"
sed -i -e 's/index_all_keys = false/index_all_keys = true/g' "$CHAIN_DIR/config/config.toml"
sed -i -e 's/enable = false/enable = true/g' "$CHAIN_DIR/config/app.toml"
sed -i -e 's/swagger = false/swagger = true/g' "$CHAIN_DIR/config/app.toml"
sed -i -e "s/minimum-gas-prices = \"\"/minimum-gas-prices = \"0$STAKEDENOM\"/g" "$CHAIN_DIR/config/app.toml"
sed -i -e 's/enabled = false/enabled = true/g' "$CHAIN_DIR/config/app.toml"
sed -i -e 's/prometheus-retention-time = 0/prometheus-retention-time = 1000/g' "$CHAIN_DIR/config/app.toml"
sed -i -e 's/enabled-unsafe-cors = false/enabled-unsafe-cors = true/g' "$CHAIN_DIR/config/app.toml"

sed -i -e 's#"tcp://0.0.0.0:26656"#"tcp://0.0.0.0:'"$P2PPORT"'"#g' "$CHAIN_DIR/config/config.toml"
sed -i -e 's#"tcp://127.0.0.1:26657"#"tcp://0.0.0.0:'"$RPCPORT"'"#g' "$CHAIN_DIR/config/config.toml"
sed -i -e 's#"tcp://localhost:1317"#"tcp://0.0.0.0:'"$RESTPORT"'"#g' "$CHAIN_DIR/config/app.toml"
sed -i -e 's#"tcp://0.0.0.0:1317"#"tcp://0.0.0.0:'"$RESTPORT"'"#g' "$CHAIN_DIR/config/app.toml"
sed -i -e 's#":8080"#":'"$ROSETTA"'"#g' "$CHAIN_DIR/config/app.toml"
sed -i -e 's#localhost#0.0.0.0#g' "$CHAIN_DIR/config/app.toml"

echo "Update client.toml file"
sed -i -e 's#keyring-backend = "os"#keyring-backend = "test"#g' $CHAIN_DIR/config/client.toml
sed -i -e 's#output = "text"#output = "json"#g' $CHAIN_DIR/config/client.toml
sed -i -e "s#chain-id = \"\"#chain-id = \"$CHAIN_ID\"#g" $CHAIN_DIR/config/client.toml

echo "Update genesis.json file with updated local params"
sed -i "s/\"time_iota_ms\": \".*\"/\"time_iota_ms\": \"$TIME_IOTA_MS\"/" $CHAIN_DIR/config/genesis.json

Expand Down
27 changes: 26 additions & 1 deletion starship/charts/devnet/scripts/neutron/update-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,33 @@ CHAIN_ID="${CHAIN_ID:=osmosis}"
CHAIN_DIR="${CHAIN_DIR:=$HOME/.osmosisd}"
KEYS_CONFIG="${KEYS_CONFIG:=configs/keys.json}"

P2PPORT=${P2PPORT:-26656}
RPCPORT=${RPCPORT:-26657}
RESTPORT=${RESTPORT:-1317}
ROSETTA=${ROSETTA:-8080}

set -eux

ls $CHAIN_DIR

echo "Already done"
sed -i -e 's/timeout_commit = "5s"/timeout_commit = "1s"/g' "$CHAIN_DIR/config/config.toml"
sed -i -e 's/timeout_propose = "3s"/timeout_propose = "1s"/g' "$CHAIN_DIR/config/config.toml"
sed -i -e 's/index_all_keys = false/index_all_keys = true/g' "$CHAIN_DIR/config/config.toml"
sed -i -e 's/enable = false/enable = true/g' "$CHAIN_DIR/config/app.toml"
sed -i -e 's/swagger = false/swagger = true/g' "$CHAIN_DIR/config/app.toml"
sed -i -e "s/minimum-gas-prices = \"\"/minimum-gas-prices = \"0$STAKEDENOM\"/g" "$CHAIN_DIR/config/app.toml"
sed -i -e 's/enabled = false/enabled = true/g' "$CHAIN_DIR/config/app.toml"
sed -i -e 's/prometheus-retention-time = 0/prometheus-retention-time = 1000/g' "$CHAIN_DIR/config/app.toml"
sed -i -e 's/enabled-unsafe-cors = false/enabled-unsafe-cors = true/g' "$CHAIN_DIR/config/app.toml"

sed -i -e 's#"tcp://0.0.0.0:26656"#"tcp://0.0.0.0:'"$P2PPORT"'"#g' "$CHAIN_DIR/config/config.toml"
sed -i -e 's#"tcp://127.0.0.1:26657"#"tcp://0.0.0.0:'"$RPCPORT"'"#g' "$CHAIN_DIR/config/config.toml"
sed -i -e 's#"tcp://localhost:1317"#"tcp://0.0.0.0:'"$RESTPORT"'"#g' "$CHAIN_DIR/config/app.toml"
sed -i -e 's#"tcp://0.0.0.0:1317"#"tcp://0.0.0.0:'"$RESTPORT"'"#g' "$CHAIN_DIR/config/app.toml"
sed -i -e 's#":8080"#":'"$ROSETTA"'"#g' "$CHAIN_DIR/config/app.toml"
sed -i -e 's#localhost#0.0.0.0#g' "$CHAIN_DIR/config/app.toml"

echo "Update client.toml file"
sed -i -e 's#keyring-backend = "os"#keyring-backend = "test"#g' $CHAIN_DIR/config/client.toml
sed -i -e 's#output = "text"#output = "json"#g' $CHAIN_DIR/config/client.toml
sed -i -e "s#chain-id = \"\"#chain-id = \"$CHAIN_ID\"#g" $CHAIN_DIR/config/client.toml
39 changes: 38 additions & 1 deletion starship/charts/devnet/templates/chains/cosmos/validator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,43 @@ spec:
name: addresses
- mountPath: /scripts
name: scripts
{{- if $chain.ics.enabled }}
{{ $icsChain := include "devnet.fullchain" (dict "name" $chain.ics.provider "file" $defaultFile "context" $) | fromJson }}
- name: init-ics
image: {{ $icsChain.image }}
imagePullPolicy: {{ $.Values.images.imagePullPolicy }}
env:
{{- include "devnet.defaultEvnVars" $chain | indent 12 }}
{{- include "devnet.evnVars" $chain | indent 12 }}
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: KEYS_CONFIG
value: /configs/keys.json
command:
- bash
- "-c"
- |
VAL_INDEX=${HOSTNAME##*-}
echo "Validator Index: $VAL_INDEX"
echo "Fetching priv keys from provider exposer"
curl -s http://{{ $icsChain.hostname }}-validator-$VAL_INDEX.{{ $icsChain.hostname }}-validator.$NAMESPACE.svc.cluster.local:8081/priv_keys | jq > $CHAIN_DIR/config/provider_priv_validator_key.json
cat $CHAIN_DIR/config/provider_priv_validator_key.json
echo "Replace provider priv validator key with provider keys"
mv $CHAIN_DIR/config/priv_validator_key.json $CHAIN_DIR/config/previous_priv_validator_key.json
mv $CHAIN_DIR/config/provider_priv_validator_key.json $CHAIN_DIR/config/priv_validator_key.json
resources: {{- include "devnet.node.resources" ( dict "node" $chain "context" $ ) | trim | nindent 12 }}
volumeMounts:
- mountPath: {{ $chain.home }}
name: node
- mountPath: /configs
name: addresses
- mountPath: /scripts
name: scripts
{{- end }}
containers:
- name: validator
image: {{ $chain.image }}
Expand Down Expand Up @@ -207,7 +244,7 @@ spec:
$CHAIN_BIN start $START_ARGS
{{- end }}
{{/*If cometmock is enabled, then validator is initialized in hook of cometmock statefulset*/}}
{{- if not ($chain.cometmock.enabled) }}
{{- if and (not $chain.cometmock.enabled) (not $chain.ics.enabled) }}
lifecycle:
postStart:
exec:
Expand Down
2 changes: 1 addition & 1 deletion starship/tests/e2e/configs/neutron-relayer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ chains:
exposer: 38083
- id: cosmoshub-4
name: cosmoshub
numValidators: 2
numValidators: 1
ports:
rest: 1317
rpc: 26657
Expand Down

0 comments on commit 1eda7fc

Please sign in to comment.