refactor: rename commands to match consensus engine name (#14956)

This commit is contained in:
Julien Robert
2023-02-08 20:09:28 +00:00
committed by GitHub
parent 0c35d7a8f9
commit c17c3caab8
82 changed files with 384 additions and 331 deletions
+2 -2
View File
@@ -86,9 +86,9 @@ func New(clientCtx client.Context, logger log.Logger, grpcSrv *grpc.Server) *Ser
}
}
// Start starts the API server. Internally, the API server leverages Tendermint's
// Start starts the API server. Internally, the API server leverages CometBFT's
// JSON RPC server. Configuration options are provided via config.APIConfig
// and are delegated to the Tendermint JSON RPC server. The process is
// and are delegated to the CometBFT JSON RPC server. The process is
// non-blocking, so an external signal handler must be used.
func (s *Server) Start(cfg config.Config) error {
s.mtx.Lock()
+3 -3
View File
@@ -18,7 +18,7 @@ import (
"github.com/stretchr/testify/suite"
"google.golang.org/grpc/codes"
"github.com/cosmos/cosmos-sdk/client/grpc/tmservice"
"github.com/cosmos/cosmos-sdk/client/grpc/cmtservice"
"github.com/cosmos/cosmos-sdk/codec"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
"github.com/cosmos/cosmos-sdk/testutil/network"
@@ -73,13 +73,13 @@ func (s *GRPCWebTestSuite) Test_Latest_Validators() {
headers, trailers, responses, err := s.makeGrpcRequest(
"/cosmos.base.tendermint.v1beta1.Service/GetLatestValidatorSet",
headerWithFlag(),
serializeProtoMessages([]proto.Message{&tmservice.GetLatestValidatorSetRequest{}}), false)
serializeProtoMessages([]proto.Message{&cmtservice.GetLatestValidatorSetRequest{}}), false)
s.Require().NoError(err)
s.Require().Equal(1, len(responses))
s.assertTrailerGrpcCode(trailers, codes.OK, "")
s.assertContentTypeSet(headers, contentType)
var valsSet tmservice.GetLatestValidatorSetResponse
var valsSet cmtservice.GetLatestValidatorSetResponse
err = s.protoCdc.Unmarshal(responses[0], &valsSet)
s.Require().NoError(err)
pubKey, ok := valsSet.Validators[0].PubKey.GetCachedValue().(cryptotypes.PubKey)
+8 -8
View File
@@ -5,7 +5,7 @@ import (
"github.com/cometbft/cometbft/p2p"
pvm "github.com/cometbft/cometbft/privval"
tversion "github.com/cometbft/cometbft/version"
cmtversion "github.com/cometbft/cometbft/version"
"github.com/spf13/cobra"
"sigs.k8s.io/yaml"
@@ -49,7 +49,7 @@ func ShowValidatorCmd() *cobra.Command {
return err
}
sdkPK, err := cryptocodec.FromTmPubKeyInterface(pk)
sdkPK, err := cryptocodec.FromCmtPubKeyInterface(pk)
if err != nil {
return err
}
@@ -96,21 +96,21 @@ func VersionCmd() *cobra.Command {
Long: "Print protocols' and libraries' version numbers against which this app has been compiled.",
RunE: func(cmd *cobra.Command, args []string) error {
bs, err := yaml.Marshal(&struct {
Tendermint string
CometBFT string
ABCI string
BlockProtocol uint64
P2PProtocol uint64
}{
Tendermint: tversion.TMCoreSemVer,
ABCI: tversion.ABCIVersion,
BlockProtocol: tversion.BlockProtocol,
P2PProtocol: tversion.P2PProtocol,
CometBFT: cmtversion.TMCoreSemVer,
ABCI: cmtversion.ABCIVersion,
BlockProtocol: cmtversion.BlockProtocol,
P2PProtocol: cmtversion.P2PProtocol,
})
if err != nil {
return err
}
fmt.Println(string(bs))
cmd.Print(string(bs))
return nil
},
}
+1 -1
View File
@@ -36,7 +36,7 @@ application.
// rollback CometBFT state
height, hash, err := cmtcmd.RollbackState(ctx.Config, removeBlock)
if err != nil {
return fmt.Errorf("failed to rollback cometbft state: %w", err)
return fmt.Errorf("failed to rollback CometBFT state: %w", err)
}
// rollback the multistore
+14 -4
View File
@@ -15,6 +15,7 @@ import (
"github.com/cometbft/cometbft/proxy"
"github.com/cometbft/cometbft/rpc/client/local"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
@@ -33,7 +34,7 @@ import (
const (
// CometBFT full-node start flags
flagWithTendermint = "with-tendermint"
flagWithComet = "with-comet"
flagAddress = "address"
flagTransport = "transport"
flagTraceStore = "trace-store"
@@ -131,8 +132,8 @@ is performed. Note, when enabled, gRPC will also be automatically enabled.
return err
}
withTM, _ := cmd.Flags().GetBool(flagWithTendermint)
if !withTM {
withCMT, _ := cmd.Flags().GetBool(flagWithComet)
if !withCMT {
serverCtx.Logger.Info("starting ABCI without CometBFT")
return startStandAlone(serverCtx, appCreator)
}
@@ -150,7 +151,7 @@ is performed. Note, when enabled, gRPC will also be automatically enabled.
}
cmd.Flags().String(flags.FlagHome, defaultNodeHome, "The application home directory")
cmd.Flags().Bool(flagWithTendermint, true, "Run abci app embedded in-process with CometBFT")
cmd.Flags().Bool(flagWithComet, true, "Run abci app embedded in-process with CometBFT")
cmd.Flags().String(flagAddress, "tcp://0.0.0.0:26658", "Listen address")
cmd.Flags().String(flagTransport, "socket", "Transport protocol: socket, grpc")
cmd.Flags().String(flagTraceStore, "", "Enable KVStore tracing to an output file")
@@ -189,6 +190,15 @@ is performed. Note, when enabled, gRPC will also be automatically enabled.
cmd.Flags().Int(FlagMempoolMaxTxs, mempool.DefaultMaxTx, "Sets MaxTx value for the app-side mempool")
// support old flags name for backwards compatibility
cmd.Flags().SetNormalizeFunc(func(f *pflag.FlagSet, name string) pflag.NormalizedName {
if name == "with-tendermint" {
name = flagWithComet
}
return pflag.NormalizedName(name)
})
// add support for all CometBFT-specific command line options
tcmd.AddNodeFlags(cmd)
return cmd
+1 -1
View File
@@ -282,7 +282,7 @@ func interceptConfigs(rootViper *viper.Viper, customAppTemplate string, customCo
func AddCommands(rootCmd *cobra.Command, defaultNodeHome string, appCreator types.AppCreator, appExport types.AppExporter, addStartFlags types.ModuleInitFlags) {
cometCmd := &cobra.Command{
Use: "comet",
Aliases: []string{"cmt", "cometbft", "tendermint"},
Aliases: []string{"cometbft", "tendermint"},
Short: "CometBFT subcommands",
}
+2 -2
View File
@@ -68,9 +68,9 @@ func TestInterceptConfigsPreRunHandlerCreatesConfigFilesWhenMissing(t *testing.T
t.Fatal("config.toml created as empty file")
}
// Test that tendermint config is initialized
// Test that CometBFT config is initialized
if serverCtx.Config == nil {
t.Fatal("tendermint config not created")
t.Fatal("CometBFT config not created")
}
// Test that app.toml is created