Skip to content

Commit

Permalink
improvements(cli): Align debug CLI commands with Cosmos SDK plus othe…
Browse files Browse the repository at this point in the history
…r minor clean up (#54)
  • Loading branch information
MalteHerrmann authored Oct 10, 2024
1 parent 78d16bd commit 112d40b
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 18 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ This changelog was created using the `clu` binary

### Improvements

- (cli) [#54](https://github.com/evmos/os/pull/54) Align debug CLI commands with Cosmos SDK plus other minor clean up.
- (cli) [#53](https://github.com/evmos/os/pull/53) Enable specifying default key type for adding keys.
- (ante) [#52](https://github.com/evmos/os/pull/52) Refactor ante handlers to be easier to use in partner chains.
- (all) [#48](https://github.com/evmos/os/pull/48) Move latest changes from evmOS main (f943af3b incl. SDK v50).
Expand Down
17 changes: 13 additions & 4 deletions client/debug/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/ethereum/go-ethereum/common"

"github.com/cosmos/cosmos-sdk/client"
cosmosclientdebug "github.com/cosmos/cosmos-sdk/client/debug"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/version"
Expand All @@ -35,10 +36,18 @@ func Cmd() *cobra.Command {
RunE: client.ValidateCmd,
}

cmd.AddCommand(PubkeyCmd())
cmd.AddCommand(AddrCmd())
cmd.AddCommand(RawBytesCmd())
cmd.AddCommand(LegacyEIP712Cmd())
cmd.AddCommand(
// default Cosmos SDK debug commands
cosmosclientdebug.CodecCmd(),
cosmosclientdebug.PrefixesCmd(),
cosmosclientdebug.PubkeyRawCmd(), // TODO: support eth_secp256k1 pubkeys for this one too?

// evmOS adjusted debug commands
PubkeyCmd(),
AddrCmd(),
RawBytesCmd(),
LegacyEIP712Cmd(),
)

return cmd
}
Expand Down
4 changes: 1 addition & 3 deletions client/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,12 @@ import (
//
// The defaultToEthKeys boolean indicates whether to use
// Ethereum compatible keys by default or stick with the Cosmos SDK default.
//
// TODO: (on follow up PR) adjust Tendermint mentions to CometBFT
func KeyCommands(defaultNodeHome string, defaultToEthKeys bool) *cobra.Command {
cmd := &cobra.Command{
Use: "keys",
Short: "Manage your application's keys",
Long: `Keyring management commands. These keys may be in any format supported by the
Tendermint crypto library and can be used by light-clients, full nodes, or any other application
CometBFT crypto library and can be used by light-clients, full nodes, or any other application
that needs to sign with a private key.
The keyring supports the following backends:
Expand Down
12 changes: 6 additions & 6 deletions server/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ func AddCommands(
appExport types.AppExporter,
addStartFlags types.ModuleInitFlags,
) {
// TODO: this needs to be updated to use the comet subcommands and alias it to tendermint
tendermintCmd := &cobra.Command{
Use: "tendermint",
Short: "Tendermint subcommands",
cometbftCmd := &cobra.Command{
Use: "comet",
Aliases: []string{"cometbft", "tendermint"},
Short: "CometBFT subcommands",
}

tendermintCmd.AddCommand(
cometbftCmd.AddCommand(
sdkserver.ShowNodeIDCmd(),
sdkserver.ShowValidatorCmd(),
sdkserver.ShowAddressCmd(),
Expand All @@ -51,7 +51,7 @@ func AddCommands(

rootCmd.AddCommand(
startCmd,
tendermintCmd,
cometbftCmd,
sdkserver.ExportCmd(appExport, opts.DefaultNodeHome),
version.NewVersionCommand(),
sdkserver.NewRollbackCmd(opts.AppCreator, opts.DefaultNodeHome),
Expand Down
2 changes: 1 addition & 1 deletion x/evm/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func NewRawTxCmd() *cobra.Command {
return err
}

// broadcast to a Tendermint node
// broadcast to a CometBFT node
res, err := clientCtx.BroadcastTx(txBytes)
if err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions x/evm/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var (

const (
// Amino names
updateParamsName = "os/MsgUpdateParams"
updateParamsName = "os/evm/MsgUpdateParams"
)

// NOTE: This is required for the GetSignBytes function
Expand All @@ -47,7 +47,7 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
&MsgUpdateParams{},
)
registry.RegisterInterface(
"ethermint.evm.v1.TxData",
"os.evm.v1.TxData",
(*TxData)(nil),
&DynamicFeeTx{},
&AccessListTx{},
Expand Down
4 changes: 2 additions & 2 deletions x/evm/types/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (log *Log) Validate() error {
return nil
}

// ToEthereum returns the Ethereum type Log from a Ethermint proto compatible Log.
// ToEthereum returns the Ethereum type Log from an evmOS proto compatible Log.
func (log *Log) ToEthereum() *ethtypes.Log {
topics := make([]common.Hash, len(log.Topics))
for i, topic := range log.Topics {
Expand Down Expand Up @@ -98,7 +98,7 @@ func NewLogsFromEth(ethlogs []*ethtypes.Log) []*Log {
return logs
}

// LogsToEthereum casts the Ethermint Logs to a slice of Ethereum Logs.
// LogsToEthereum casts the evmOS logs to a slice of Ethereum Logs.
func LogsToEthereum(logs []*Log) []*ethtypes.Log {
var ethLogs []*ethtypes.Log //nolint: prealloc
for i := range logs {
Expand Down

0 comments on commit 112d40b

Please sign in to comment.