Skip to content

Commit

Permalink
add script for ics setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Anmol1696 committed Jun 28, 2024
1 parent 15fa3b9 commit 382d649
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 3 deletions.
5 changes: 5 additions & 0 deletions starship/charts/devnet/scripts/default/create-genesis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ echo "Adding key...." $(jq -r ".faucet[0].name" $KEYS_CONFIG)
jq -r ".faucet[0].mnemonic" $KEYS_CONFIG | $CHAIN_BIN keys add $(jq -r ".faucet[0].name" $KEYS_CONFIG) --recover --keyring-backend="test"
$CHAIN_BIN $CHAIN_GENESIS_CMD add-genesis-account $($CHAIN_BIN keys show -a $(jq -r .faucet[0].name $KEYS_CONFIG) --keyring-backend="test") $COINS --keyring-backend="test"

# Add test keys to the keyring and self delegate initial coins
echo "Adding key...." $(jq -r ".keys[0].name" $KEYS_CONFIG)
jq -r ".keys[0].mnemonic" $KEYS_CONFIG | $CHAIN_BIN keys add $(jq -r ".keys[0].name" $KEYS_CONFIG) --recover --keyring-backend="test"
$CHAIN_BIN $CHAIN_GENESIS_CMD add-genesis-account $($CHAIN_BIN keys show -a $(jq -r .keys[0].name $KEYS_CONFIG) --keyring-backend="test") $COINS --keyring-backend="test"

if [[ $FAUCET_ENABLED == "false" && $NUM_RELAYERS -gt "-1" ]];
then
## Add relayers keys and delegate tokens
Expand Down
34 changes: 34 additions & 0 deletions starship/charts/devnet/scripts/default/create-ics.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

set -eux

DENOM="${DENOM:=uatom}"
COINS="${COINS:=100000000000000000uatom}"
CHAIN_ID="${CHAIN_ID:=cosmoshub-1}"
CHAIN_BIN="${CHAIN_BIN:=gaiad}"
CHAIN_DIR="${CHAIN_DIR:=$HOME/.gaia}"
NODE_URL="${NODE_URL:=http://0.0.0.0:26657}"
KEYS_CONFIG="${KEYS_CONFIG:=configs/keys.json}"

PROPOSAL_FILE="${PROPOSAL_FILE}"
KEY_NAME="ics-setup"

add_key() {
# Add test keys to the keyring and self delegate initial coins
echo "Adding key...." $(jq -r ".test[0].name" $KEYS_CONFIG)
jq -r ".test[0].mnemonic" $KEYS_CONFIG | $CHAIN_BIN keys add $KEY_NAME --recover --keyring-backend="test"
echo $($CHAIN_BIN keys show -a $KEY_NAME --keyring-backend="test")
}

submit_proposal() {
echo "Get all porposals"
$CHAIN_BIN query gov proposals --output json --node $NODE_URL
echo "Submit gov proposal on chain"
$CHAIN_BIN tx gov submit-proposal consumer-addition $PROPOSAL_FILE \
--from $KEY_NAME \
--chain-id $CHAIN_ID \
--node $NODE_URL \
--keyring-backend="test" \
--output json \
--yes
}
6 changes: 4 additions & 2 deletions starship/charts/devnet/templates/chains/cosmos/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ data:
{{ toJson $chain.genesis | nindent 4 }}
---
{{- end }}
{{- if hasKey $chain.ics.enabled }}
{{- if $chain.ics.enabled }}
{{ $icsChain := include "devnet.fullchain" (dict "name" $chain.ics.provider "file" $defaultFile "context" $) | fromJson }}
apiVersion: v1
kind: ConfigMap
metadata:
Expand Down Expand Up @@ -58,7 +59,8 @@ data:
"validators_power_cap": 0,
"validator_set_cap": 0,
"allowlist": [],
"denylist": []
"denylist": [],
"deposit": "10000{{ $$icsChain.denom }}"
}
---
{{- end }}
Expand Down
9 changes: 8 additions & 1 deletion starship/charts/devnet/templates/chains/cosmos/genesis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,11 @@ spec:
mv $CHAIN_DIR/config/provider_priv_validator_key.json $CHAIN_DIR/config/priv_validator_key.json
echo "Create consumer addition proposal"
cat /proposal/proposal.json
resources: {{- include "devnet.node.resources" ( dict "node" $chain "context" $ ) | trim | nindent 12 }}
volumeMounts:
- mountPath: /proposal
name: proposal
- mountPath: {{ $chain.home }}
name: node
- mountPath: /configs
Expand Down Expand Up @@ -456,6 +458,11 @@ spec:
- name: faucet
emptyDir: { }
{{- end }}
{{- if $chain.ics.enabled }}
- name: proposal
configMap:
name: consumer-proposal-{{ $chain.hostname }}
{{- end }}
---
{{- end }}
{{- end }}

0 comments on commit 382d649

Please sign in to comment.