From 6f75370b1764b8e935e64e5b19deca6ad03384ff Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Tue, 22 Oct 2024 09:54:33 +0000 Subject: [PATCH] Updates for stage2 setup (#60) Part of [Create a public laconicd testnet](https://www.notion.so/Create-a-public-laconicd-testnet-896a11bdd8094eff8f1b49c0be0ca3b8) - Add `bc` installation in Dockerfile (required for stage1 to stage2 testnet migration) - Populate attributes map index when importing records from genesis to allow fetching records with filters from a chain with imported state Reviewed-on: https://git.vdb.to/cerc-io/laconicd/pulls/60 Co-authored-by: Prathamesh Musale Co-committed-by: Prathamesh Musale --- Dockerfile | 2 +- scripts/init.sh | 4 ++-- x/auction/client/cli/tx.go | 6 +++--- x/registry/keeper/genesis.go | 5 +++++ 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5916d465..7844c9ec 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,7 +19,7 @@ FROM ubuntu:22.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 bash \ + jq curl netcat bash bc \ && rm -rf /var/lib/apt/lists/* # Copy over binary from the builder diff --git a/scripts/init.sh b/scripts/init.sh index e41ea227..8a1333dc 100755 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -10,7 +10,7 @@ LOGLEVEL=${LOGLEVEL:-"info"} input_genesis_file=${GENESIS_FILE} -if [ "$1" == "clean" ] || [ ! -d "$HOME/.laconicd/data/blockstore.db" ]; then +if [ "$1" == "clean" ] || [ ! -d "$HOME/.laconicd/data" ]; then # validate dependencies are installed command -v jq > /dev/null 2>&1 || { echo >&2 "jq not installed. More info: https://stedolan.github.io/jq/download/" @@ -30,7 +30,7 @@ if [ "$1" == "clean" ] || [ ! -d "$HOME/.laconicd/data/blockstore.db" ]; then # if $KEY exists it should be deleted laconicd keys add $KEY --keyring-backend $KEYRING - # Set moniker and chain-id for Ethermint (Moniker can be anything, chain-id must be an integer) + # Set moniker and chain-id laconicd init $MONIKER --chain-id $CHAINID --default-denom $DENOM if [[ -f ${input_genesis_file} ]]; then diff --git a/x/auction/client/cli/tx.go b/x/auction/client/cli/tx.go index 7ff1dda0..b5f71483 100644 --- a/x/auction/client/cli/tx.go +++ b/x/auction/client/cli/tx.go @@ -53,9 +53,9 @@ func GetCmdCommitBid() *cobra.Command { if chainId == "" { // Take from config if not provided chainId = clientCtx.ChainID - if chainId == "" { - return fmt.Errorf("--chain-id required") - } + } + if chainId == "" { + return fmt.Errorf("--chain-id required") } bidAmount, err := sdk.ParseCoinNormalized(args[1]) diff --git a/x/registry/keeper/genesis.go b/x/registry/keeper/genesis.go index 36ec275d..99649a43 100644 --- a/x/registry/keeper/genesis.go +++ b/x/registry/keeper/genesis.go @@ -30,6 +30,11 @@ func (k *Keeper) InitGenesis(ctx sdk.Context, data *registry.GenesisState) error return err } } + + readableRecord := record.ToReadableRecord() + if err := k.processAttributes(ctx, readableRecord.Attributes, record.Id); err != nil { + return err + } } for _, authority := range data.Authorities {