Skip to content

Commit

Permalink
chore: comment unknown cmd code
Browse files Browse the repository at this point in the history
  • Loading branch information
shifty11 committed Mar 19, 2024
1 parent c5b651e commit ef0be52
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 12 deletions.
4 changes: 1 addition & 3 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"github.com/cosmos/cosmos-sdk/client/grpc/cmtservice"
"github.com/cosmos/cosmos-sdk/client/grpc/node"
"github.com/cosmos/cosmos-sdk/codec"
addressCodec "github.com/cosmos/cosmos-sdk/codec/address"
"github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/runtime"
"github.com/cosmos/cosmos-sdk/server"
Expand Down Expand Up @@ -240,6 +239,7 @@ func NewKYVEApp(
legacyAmino := encodingConfig.Amino
interfaceRegistry := encodingConfig.InterfaceRegistry
txConfig := encodingConfig.TxConfig
addressCdc := encodingConfig.AddressCoded

// Below we could construct and set an application specific mempool and
// ABCI 1.0 PrepareProposal and ProcessProposal handlers. These defaults are
Expand Down Expand Up @@ -357,8 +357,6 @@ func NewKYVEApp(

app.CapabilityKeeper.Seal()

addressCdc := addressCodec.NewBech32Codec(sdk.Bech32MainPrefix)

// add keepers
app.AccountKeeper = authKeeper.NewAccountKeeper(
appCodec,
Expand Down
6 changes: 6 additions & 0 deletions app/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
package app

import (
"cosmossdk.io/core/address"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
addressCodec "github.com/cosmos/cosmos-sdk/codec/address"
codecTypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/std"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth/tx"
)

Expand All @@ -17,6 +20,7 @@ type EncodingConfig struct {
Marshaler codec.Codec
TxConfig client.TxConfig
Amino *codec.LegacyAmino
AddressCoded address.Codec
}

// NewEncodingConfig creates an EncodingConfig instance.
Expand All @@ -25,12 +29,14 @@ func NewEncodingConfig() EncodingConfig {
interfaceRegistry := codecTypes.NewInterfaceRegistry()
marshaler := codec.NewProtoCodec(interfaceRegistry)
txCfg := tx.NewTxConfig(marshaler, tx.DefaultSignModes)
addressCdc := addressCodec.NewBech32Codec(sdk.Bech32MainPrefix)

encodingConfig := EncodingConfig{
InterfaceRegistry: interfaceRegistry,
Marshaler: marshaler,
TxConfig: txCfg,
Amino: amino,
AddressCoded: addressCdc,
}

return encodingConfig
Expand Down
5 changes: 4 additions & 1 deletion cmd/kyved/gen_accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,10 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa
baseAccount := authTypes.NewBaseAccount(addr, nil, 0, 0)

if !vestingAmt.IsZero() {
baseVestingAccount := vestingTypes.NewBaseVestingAccount(baseAccount, vestingAmt.Sort(), vestingEnd)
baseVestingAccount, err := vestingTypes.NewBaseVestingAccount(baseAccount, vestingAmt.Sort(), vestingEnd)
if err != nil {
return fmt.Errorf("failed to create base vesting account: %w", err)
}

if (balances.Coins.IsZero() && !baseVestingAccount.OriginalVesting.IsZero()) ||
baseVestingAccount.OriginalVesting.IsAnyGT(balances.Coins) {
Expand Down
22 changes: 14 additions & 8 deletions cmd/kyved/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"github.com/cosmos/cosmos-sdk/client/config"
"github.com/cosmos/cosmos-sdk/client/debug"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/keys"
"github.com/cosmos/cosmos-sdk/client/pruning"
"github.com/cosmos/cosmos-sdk/client/rpc"
"github.com/cosmos/cosmos-sdk/server"
Expand Down Expand Up @@ -89,26 +88,31 @@ func NewRootCmd(encodingConfig kyveApp.EncodingConfig) *cobra.Command {
rootCmd.AddCommand(
genUtilCli.InitCmd(kyveApp.ModuleBasics, kyveApp.DefaultNodeHome),
// TODO(@john): Investigate why the one directly from the module is nil.
genUtilCli.CollectGenTxsCmd(bankTypes.GenesisBalancesIterator{}, kyveApp.DefaultNodeHome, genUtilTypes.DefaultMessageValidator),
genUtilCli.MigrateGenesisCmd(),
genUtilCli.CollectGenTxsCmd(bankTypes.GenesisBalancesIterator{}, kyveApp.DefaultNodeHome, genUtilTypes.DefaultMessageValidator, ac.encodingConfig.AddressCoded),
// TODO(@rapha): fix migrations
genUtilCli.MigrateGenesisCmd(nil),
genUtilCli.GenTxCmd(
kyveApp.ModuleBasics,
encodingConfig.TxConfig,
bankTypes.GenesisBalancesIterator{},
kyveApp.DefaultNodeHome,
ac.encodingConfig.AddressCoded,
),
infoCommand(),
genUtilCli.ValidateGenesisCmd(kyveApp.ModuleBasics),
addGenesisAccountCmd(kyveApp.DefaultNodeHome),
tmCli.NewCompletionCmd(rootCmd, true),
debug.Cmd(),
config.Cmd(),
// TODO(@rapha): fix config
//config.Cmd(),
pruning.Cmd(ac.createApp, kyveApp.DefaultNodeHome),

rpc.StatusCommand(),
// TODO(@rapha): fix StatusCommand
//rpc.StatusCommand(),
queryCommand(),
txCommand(),
keys.Commands(kyveApp.DefaultNodeHome),
// TODO(@rapha): fix this
//keys.Commands(kyveApp.DefaultNodeHome),
)

return rootCmd
Expand All @@ -125,9 +129,11 @@ func queryCommand() *cobra.Command {
}

cmd.AddCommand(
rpc.BlockCommand(),
// TODO(@rapha): fix this
//rpc.BlockCommand(),
rpc.ValidatorCommand(),
authCli.GetAccountCmd(),
// TODO(@rapha): fix this
//authCli.GetAccountCmd(),
authCli.QueryTxCmd(),
authCli.QueryTxsByEventsCmd(),
)
Expand Down

0 comments on commit ef0be52

Please sign in to comment.