From 1579c90d7de087759cca6d52b61c3fde5c3a1e89 Mon Sep 17 00:00:00 2001 From: Marri Harish Date: Wed, 2 Oct 2024 23:39:03 +0530 Subject: [PATCH] fix unsupported sign-mode issue (#8728) * fix unsupported sign-mode issue * update changelog --------- Co-authored-by: PaddyMc (cherry picked from commit 502f559e6415019eacfe187bd8944a15bcae3793) # Conflicts: # CHANGELOG.md --- CHANGELOG.md | 15 +++++++++++++++ cmd/osmosisd/cmd/root.go | 25 +++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d53877d2e4..a52e9b3e3b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * [#8563](https://github.com/osmosis-labs/osmosis/pull/8563) Add additional queries in x/gauges * [#8726](https://github.com/osmosis-labs/osmosis/pull/8726) fix: multiple temp directories on command executions * [#8731](https://github.com/osmosis-labs/osmosis/pull/8731) fix: in place testnet logs +<<<<<<< HEAD +======= +* [#8728](https://github.com/osmosis-labs/osmosis/pull/8728) fix unsupported sign-mode issue +* [#8743](https://github.com/osmosis-labs/osmosis/pull/8743) chore: bump sdk and cometbft + +### State Machine Breaking + +* [#8732](https://github.com/osmosis-labs/osmosis/pull/8732) fix: iterate delegations continue instead of erroring + +## v26.0.1 + +### State Machine Breaking + +* [#8732](https://github.com/osmosis-labs/osmosis/pull/8732) fix: iterate delegations continue instead of erroring +>>>>>>> 502f559e6 (fix unsupported sign-mode issue (#8728)) ## v26.0.0 diff --git a/cmd/osmosisd/cmd/root.go b/cmd/osmosisd/cmd/root.go index 0fbecb600a8..5facf835939 100644 --- a/cmd/osmosisd/cmd/root.go +++ b/cmd/osmosisd/cmd/root.go @@ -20,6 +20,7 @@ import ( "cosmossdk.io/core/appmodule" runtimeservices "github.com/cosmos/cosmos-sdk/runtime/services" authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec" + "github.com/cosmos/cosmos-sdk/x/auth/tx" cosmosdb "github.com/cosmos/cosmos-db" @@ -61,7 +62,9 @@ import ( servertypes "github.com/cosmos/cosmos-sdk/server/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" + "github.com/cosmos/cosmos-sdk/types/tx/signing" authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" + authtxconfig "github.com/cosmos/cosmos-sdk/x/auth/tx/config" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/cosmos-sdk/x/crisis" @@ -389,6 +392,24 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) { return err } + // This needs to go after ReadFromClientConfig, as that function + // sets the RPC client needed for SIGN_MODE_TEXTUAL. This sign mode + // is only available if the client is online. + if !initClientCtx.Offline { + txConfigOpts := tx.ConfigOptions{ + EnabledSignModes: append(tx.DefaultSignModes, signing.SignMode_SIGN_MODE_TEXTUAL), + TextualCoinMetadataQueryFn: authtxconfig.NewGRPCCoinMetadataQueryFn(initClientCtx), + } + txConfigWithTextual, err := tx.NewTxConfigWithOptions( + initClientCtx.Codec, + txConfigOpts, + ) + if err != nil { + return err + } + initClientCtx = initClientCtx.WithTxConfig(txConfigWithTextual) + } + // Only loads asset list into a map if human readable denoms are enabled. assetMap, assetMapRev := map[string]DenomUnitMap{}, map[string]string{} if humanReadableDenomsInput || humanReadableDenomsOutput { @@ -1308,5 +1329,9 @@ func autoCliOpts(initClientCtx client.Context, tempApp *osmosis.OsmosisApp) auto ValidatorAddressCodec: authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ValidatorAddrPrefix()), ConsensusAddressCodec: authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ConsensusAddrPrefix()), ClientCtx: initClientCtx, + TxConfigOpts: tx.ConfigOptions{ + EnabledSignModes: tx.DefaultSignModes, + TextualCoinMetadataQueryFn: authtxconfig.NewGRPCCoinMetadataQueryFn(initClientCtx), + }, } }