Skip to content

Commit 56e6831

Browse files
fix: use client/v2 v2.0.0-beta3; fix broken client.toml usage (#3210) (#3224)
* fix: use client/v2 v2.0.0-beta3; fix broken client.toml usage * Update root.go (cherry picked from commit 27da5e8) Co-authored-by: MSalopek <[email protected]>
1 parent af8ccac commit 56e6831

File tree

3 files changed

+9
-25
lines changed

3 files changed

+9
-25
lines changed

cmd/gaiad/cmd/root.go

+6-22
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ import (
3737
"github.com/cosmos/cosmos-sdk/codec"
3838
addresscodec "github.com/cosmos/cosmos-sdk/codec/address"
3939
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
40-
"github.com/cosmos/cosmos-sdk/crypto/keyring"
4140
"github.com/cosmos/cosmos-sdk/server"
4241
serverconfig "github.com/cosmos/cosmos-sdk/server/config"
4342
servertypes "github.com/cosmos/cosmos-sdk/server/types"
@@ -46,7 +45,7 @@ import (
4645
"github.com/cosmos/cosmos-sdk/types/tx/signing"
4746
authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli"
4847
"github.com/cosmos/cosmos-sdk/x/auth/tx"
49-
txmodule "github.com/cosmos/cosmos-sdk/x/auth/tx/config"
48+
authtxconfig "github.com/cosmos/cosmos-sdk/x/auth/tx/config"
5049
"github.com/cosmos/cosmos-sdk/x/auth/types"
5150
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
5251
"github.com/cosmos/cosmos-sdk/x/crisis"
@@ -86,7 +85,6 @@ func NewRootCmd() *cobra.Command {
8685
initClientCtx := client.Context{}.
8786
WithCodec(tempApplication.AppCodec()).
8887
WithInterfaceRegistry(tempApplication.InterfaceRegistry()).
89-
WithTxConfig(tempApplication.GetTxConfig()).
9088
WithLegacyAmino(tempApplication.LegacyAmino()).
9189
WithInput(os.Stdin).
9290
WithAccountRetriever(types.AccountRetriever{}).
@@ -117,10 +115,10 @@ func NewRootCmd() *cobra.Command {
117115
if !initClientCtx.Offline {
118116
txConfigOpts := tx.ConfigOptions{
119117
EnabledSignModes: append(tx.DefaultSignModes, signing.SignMode_SIGN_MODE_TEXTUAL),
120-
TextualCoinMetadataQueryFn: txmodule.NewGRPCCoinMetadataQueryFn(initClientCtx),
118+
TextualCoinMetadataQueryFn: authtxconfig.NewGRPCCoinMetadataQueryFn(initClientCtx),
121119
}
122120
txConfigWithTextual, err := tx.NewTxConfigWithOptions(
123-
codec.NewProtoCodec(tempApplication.InterfaceRegistry()),
121+
initClientCtx.Codec,
124122
txConfigOpts,
125123
)
126124
if err != nil {
@@ -142,36 +140,22 @@ func NewRootCmd() *cobra.Command {
142140

143141
initRootCmd(rootCmd, tempApplication.ModuleBasics, tempApplication.AppCodec(), tempApplication.InterfaceRegistry(), tempApplication.GetTxConfig())
144142

145-
autoCliOpts, err := enrichAutoCliOpts(tempApplication.AutoCliOpts(), initClientCtx)
146-
if err != nil {
147-
panic(err)
148-
}
149-
143+
autoCliOpts := enrichAutoCliOpts(tempApplication.AutoCliOpts(), initClientCtx)
150144
if err := autoCliOpts.EnhanceRootCommand(rootCmd); err != nil {
151145
panic(err)
152146
}
153147

154148
return rootCmd
155149
}
156150

157-
func enrichAutoCliOpts(autoCliOpts autocli.AppOptions, clientCtx client.Context) (autocli.AppOptions, error) {
151+
func enrichAutoCliOpts(autoCliOpts autocli.AppOptions, clientCtx client.Context) autocli.AppOptions {
158152
autoCliOpts.AddressCodec = addresscodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix())
159153
autoCliOpts.ValidatorAddressCodec = addresscodec.NewBech32Codec(sdk.GetConfig().GetBech32ValidatorAddrPrefix())
160154
autoCliOpts.ConsensusAddressCodec = addresscodec.NewBech32Codec(sdk.GetConfig().GetBech32ConsensusAddrPrefix())
161155

162-
var err error
163-
clientCtx, err = config.ReadFromClientConfig(clientCtx)
164-
if err != nil {
165-
return autocli.AppOptions{}, err
166-
}
167-
168156
autoCliOpts.ClientCtx = clientCtx
169-
autoCliOpts.Keyring, err = keyring.NewAutoCLIKeyring(clientCtx.Keyring)
170-
if err != nil {
171-
return autocli.AppOptions{}, err
172-
}
173157

174-
return autoCliOpts, nil
158+
return autoCliOpts
175159
}
176160

177161
// initCometConfig helps to override default CometBFT Config values.

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.22.3
44

55
require (
66
cosmossdk.io/api v0.7.5
7-
cosmossdk.io/client/v2 v2.0.0-beta.1.0.20240124105859-5ad1805d0e79
7+
cosmossdk.io/client/v2 v2.0.0-beta.3
88
cosmossdk.io/core v0.11.0
99
cosmossdk.io/errors v1.0.1
1010
cosmossdk.io/log v1.3.1

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuW
190190
cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1Vwf+KmJENM0=
191191
cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M=
192192
collectd.org v0.3.0/go.mod h1:A/8DzQBkF6abtvrT2j/AU/4tiBgJWYyh0y/oB/4MlWE=
193-
cosmossdk.io/client/v2 v2.0.0-beta.1.0.20240124105859-5ad1805d0e79 h1:Hr1t0fCq1nbFC7hLs0Xvy9WAiH7Iti5iVLXMM5C37F0=
194-
cosmossdk.io/client/v2 v2.0.0-beta.1.0.20240124105859-5ad1805d0e79/go.mod h1:8pN6LSVReNnIxrC2QGcvuIJ/m1pJN6FNYn2kAYtYftI=
193+
cosmossdk.io/client/v2 v2.0.0-beta.3 h1:+TTuH0DwQYsUq2JFAl3fDZzKq5gQG7nt3dAattkjFDU=
194+
cosmossdk.io/client/v2 v2.0.0-beta.3/go.mod h1:CZcL41HpJPOOayTCO28j8weNBQprG+SRiKX39votypo=
195195
cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s=
196196
cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0=
197197
cosmossdk.io/core v0.11.0 h1:vtIafqUi+1ZNAE/oxLOQQ7Oek2n4S48SWLG8h/+wdbo=

0 commit comments

Comments
 (0)