From 7b37eea492df282dcb3c7895557d471eed919055 Mon Sep 17 00:00:00 2001 From: gopherjk121 Date: Fri, 19 Jan 2024 21:56:56 +0800 Subject: [PATCH 1/4] add consensus params fix --- app/upgrades/v200/upgrades.go | 10 ++++++++ x/mint/client/cli/query.go | 44 +++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/app/upgrades/v200/upgrades.go b/app/upgrades/v200/upgrades.go index 869b6d5..9fab58a 100644 --- a/app/upgrades/v200/upgrades.go +++ b/app/upgrades/v200/upgrades.go @@ -6,6 +6,8 @@ import ( wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" "github.com/TERITORI/teritori-chain/app/keepers" minttypes "github.com/TERITORI/teritori-chain/x/mint/types" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + tmtypes "github.com/cometbft/cometbft/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" @@ -72,6 +74,14 @@ func CreateUpgradeHandler( v = reflect.Indirect(reflect.ValueOf(params.TotalBurntAmount)).Interface() subspace.Set(ctx, minttypes.KeyTotalBurntAmount, v) + cp := tmtypes.DefaultConsensusParams().ToProto() + keepers.ConsensusParamsKeeper.Set(ctx, &tmproto.ConsensusParams{ + Block: cp.Block, + Validator: cp.Validator, + Evidence: cp.Evidence, + Version: cp.Version, + }) + return mm.RunMigrations(ctx, configurator, vm) } } diff --git a/x/mint/client/cli/query.go b/x/mint/client/cli/query.go index ff6c572..601a391 100644 --- a/x/mint/client/cli/query.go +++ b/x/mint/client/cli/query.go @@ -3,6 +3,7 @@ package cli import ( "context" "fmt" + "strings" "github.com/spf13/cobra" @@ -10,6 +11,8 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/version" + consensustypes "github.com/cosmos/cosmos-sdk/x/consensus/types" ) // GetQueryCmd returns the cli query commands for the minting module. @@ -27,6 +30,7 @@ func GetQueryCmd() *cobra.Command { GetCmdQueryBlockProvisions(), GetCmdQueryInflation(), GetCmdQueryStakingAPR(), + GetConsensusParamsCmd(), ) return mintingQueryCmd @@ -143,3 +147,43 @@ func GetCmdQueryStakingAPR() *cobra.Command { flags.AddQueryFlagsToCmd(cmd) return cmd } + +func GetConsensusParamsCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "consensus-params", + Short: "Query consensus params", + Long: strings.TrimSpace( + fmt.Sprintf(`Query the total balance of an account or of a specific denomination. + +Example: + $ %s query %s consensus-params +`, + version.AppName, types.ModuleName, + ), + ), + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := consensustypes.NewQueryClient(clientCtx) + + ctx := cmd.Context() + + params := consensustypes.QueryParamsRequest{} + + res, err := queryClient.Params(ctx, ¶ms) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} From b4c2689f298edf66dfcbbc54d2bfcaa1d0af355a Mon Sep 17 00:00:00 2001 From: Norman Meier Date: Mon, 22 Jan 2024 13:12:51 +0100 Subject: [PATCH 2/4] chore: update test Signed-off-by: Norman Meier --- integration-test/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration-test/run.sh b/integration-test/run.sh index bddc419..5f520e7 100755 --- a/integration-test/run.sh +++ b/integration-test/run.sh @@ -3,7 +3,7 @@ set -euo pipefail IFS=$'\n\t' set -x -commit=66134e9580135a07aba64e00b68af9f30f8fdb93 +commit=3a01c9753a19f39f5b399b9985f3a1d44ec81d23 if [[ -z "${TERITORI_DAPP_REPO:-}" ]]; then rm -fr teritori-dapp From 1e7b2d53bd1e2b10da4ef57804aae39136c9f95e Mon Sep 17 00:00:00 2001 From: Norman Meier Date: Mon, 22 Jan 2024 13:20:16 +0100 Subject: [PATCH 3/4] chore: update test in ci Signed-off-by: Norman Meier --- .github/workflows/integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index e42779e..64cfeb4 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -18,7 +18,7 @@ jobs: with: repository: TERITORI/teritori-dapp path: teritori-dapp - ref: 66134e9580135a07aba64e00b68af9f30f8fdb93 + ref: 3a01c9753a19f39f5b399b9985f3a1d44ec81d23 - uses: actions/setup-go@v3 with: From 72d4d85fb71f92d8ada18983620868ded6e85630 Mon Sep 17 00:00:00 2001 From: gopherjk121 Date: Mon, 22 Jan 2024 21:05:11 +0800 Subject: [PATCH 4/4] update comment for consensus params query cli --- x/mint/client/cli/query.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/mint/client/cli/query.go b/x/mint/client/cli/query.go index 601a391..2823c05 100644 --- a/x/mint/client/cli/query.go +++ b/x/mint/client/cli/query.go @@ -153,7 +153,7 @@ func GetConsensusParamsCmd() *cobra.Command { Use: "consensus-params", Short: "Query consensus params", Long: strings.TrimSpace( - fmt.Sprintf(`Query the total balance of an account or of a specific denomination. + fmt.Sprintf(`Query consensus params. Example: $ %s query %s consensus-params