From 8f89f81c1d7bb6c73ed96f3bd737a9d25efe3f71 Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Thu, 20 Jun 2024 16:11:24 +0700 Subject: [PATCH 01/62] add prune func --- store/v2/root/store.go | 4 ++++ store/v2/store.go | 2 ++ 2 files changed, 6 insertions(+) diff --git a/store/v2/root/store.go b/store/v2/root/store.go index e5543a91a2cc..f04ad113ef7e 100644 --- a/store/v2/root/store.go +++ b/store/v2/root/store.go @@ -430,3 +430,7 @@ func (s *Store) commitSC() error { return nil } + +func (s *Store) Prune(version uint64) error { + return s.pruningManager.Prune(version) +} \ No newline at end of file diff --git a/store/v2/store.go b/store/v2/store.go index e331a153e0af..dfd9e38f7c73 100644 --- a/store/v2/store.go +++ b/store/v2/store.go @@ -62,6 +62,8 @@ type RootStore interface { // SetMetrics sets the telemetry handler on the RootStore. SetMetrics(m metrics.Metrics) + Prune(version uint64) error + io.Closer } From 462dd13765dc43c386306b54d53245075fc596e8 Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Thu, 20 Jun 2024 16:12:19 +0700 Subject: [PATCH 02/62] add prune cmd --- server/v2/cometbft/commands.go | 113 +++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) diff --git a/server/v2/cometbft/commands.go b/server/v2/cometbft/commands.go index b635ca505c36..ae1788e96f5e 100644 --- a/server/v2/cometbft/commands.go +++ b/server/v2/cometbft/commands.go @@ -15,18 +15,24 @@ import ( "github.com/cometbft/cometbft/rpc/client/local" cmtversion "github.com/cometbft/cometbft/version" "github.com/spf13/cobra" + "github.com/spf13/viper" "google.golang.org/protobuf/encoding/protojson" "sigs.k8s.io/yaml" + "cosmossdk.io/log" + serverv2 "cosmossdk.io/server/v2" "cosmossdk.io/server/v2/cometbft/client/rpc" "cosmossdk.io/server/v2/cometbft/flags" auth "cosmossdk.io/x/auth/client/cli" "github.com/cosmos/cosmos-sdk/client" + pruningtypes "cosmossdk.io/store/pruning/types" + storev2 "cosmossdk.io/store/v2" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" "github.com/cosmos/cosmos-sdk/version" + "github.com/spf13/cast" ) func (s *CometBFTServer[T]) rpcClient(cmd *cobra.Command) (rpc.CometRPC, error) { @@ -369,6 +375,89 @@ func (s *CometBFTServer[T]) QueryBlockResultsCmd() *cobra.Command { return cmd } +// QueryBlockResultsCmd implements the default command for a BlockResults query. +func (s *CometBFTServer[T]) PrunesCmd(appCreator serverv2.AppCreator[T]) *cobra.Command { + cmd := &cobra.Command{ + Use: "prune [pruning-method]", + Short: "Prune app history states by keeping the recent heights and deleting old heights", + Long: `Prune app history states by keeping the recent heights and deleting old heights. +The pruning option is provided via the 'pruning' argument or alternatively with '--pruning-keep-recent' + +- default: the last 362880 states are kept +- nothing: all historic states will be saved, nothing will be deleted (i.e. archiving node) +- everything: 2 latest states will be kept +- custom: allow pruning options to be manually specified through 'pruning-keep-recent' + +Note: When the --app-db-backend flag is not specified, the default backend type is 'goleveldb'. +Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, + Example: fmt.Sprintf("%s prune custom --pruning-keep-recent 100 --app-db-backend 'goleveldb'", version.AppName), + Args: cobra.RangeArgs(0, 1), + RunE: func(cmd *cobra.Command, args []string) error { + // bind flags to the Context's Viper so we can get pruning options. + vp := viper.New() + if err := vp.BindPFlags(cmd.Flags()); err != nil { + return err + } + if err := vp.BindPFlags(cmd.PersistentFlags()); err != nil { + return err + } + + // use the first argument if present to set the pruning method + if len(args) > 0 { + vp.Set(serverv2.FlagPruning, args[0]) + } else { + vp.Set(serverv2.FlagPruning, pruningtypes.PruningOptionDefault) + } + pruningOptions, err := getPruningOptionsFromFlags(vp) + if err != nil { + return err + } + + cmd.Printf("get pruning options from command flags, strategy: %v, keep-recent: %v\n", + pruningOptions.Strategy, + pruningOptions.KeepRecent, + ) + + logger := log.NewLogger(cmd.OutOrStdout()) + app := appCreator(logger, vp) + store := app.GetStore() + + rootStore, ok := store.(storev2.RootStore) + if !ok { + return fmt.Errorf("currently only support the pruning of rootmulti.Store type") + } + latestHeight, err := rootStore.GetLatestVersion() + if err != nil { + return err + } + + // valid heights should be greater than 0. + if latestHeight <= 0 { + return fmt.Errorf("the database has no valid heights to prune, the latest height: %v", latestHeight) + } + + pruningHeight := latestHeight - pruningOptions.KeepRecent + cmd.Printf("pruning heights up to %v\n", pruningHeight) + + err = rootStore.Prune(pruningHeight) + if err != nil { + return err + } + + cmd.Println("successfully pruned the application root multi stores") + return nil + }, + } + + cmd.Flags().String(serverv2.FlagAppDBBackend, "", "The type of database for application and snapshots databases") + cmd.Flags().Uint64(serverv2.FlagPruningKeepRecent, 0, "Number of recent heights to keep on disk (ignored if pruning is not 'custom')") + cmd.Flags().Uint64(serverv2.FlagPruningInterval, 10, + `Height interval at which pruned heights are removed from disk (ignored if pruning is not 'custom'), + this is not used by this command but kept for compatibility with the complete pruning options`) + + return cmd +} + func parseOptionalHeight(heightStr string) (*int64, error) { h, err := strconv.Atoi(heightStr) if err != nil { @@ -441,3 +530,27 @@ func printOutput(cmd *cobra.Command, out []byte) error { } return nil } + +func getPruningOptionsFromFlags(v *viper.Viper) (pruningtypes.PruningOptions, error) { + strategy := strings.ToLower(cast.ToString(v.Get(serverv2.FlagPruning))) + + switch strategy { + case pruningtypes.PruningOptionDefault, pruningtypes.PruningOptionNothing, pruningtypes.PruningOptionEverything: + return pruningtypes.NewPruningOptionsFromString(strategy), nil + + case pruningtypes.PruningOptionCustom: + opts := pruningtypes.NewCustomPruningOptions( + cast.ToUint64(v.Get(serverv2.FlagPruningKeepRecent)), + cast.ToUint64(v.Get(serverv2.FlagPruningInterval)), + ) + + if err := opts.Validate(); err != nil { + return opts, fmt.Errorf("invalid custom pruning options: %w", err) + } + + return opts, nil + + default: + return pruningtypes.PruningOptions{}, fmt.Errorf("unknown pruning strategy %s", strategy) + } +} From 33f674aa72224d5fe7aa06e26c0dc252e791c544 Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Thu, 20 Jun 2024 16:12:36 +0700 Subject: [PATCH 03/62] add to cmd set --- server/v2/cometbft/server.go | 3 ++- server/v2/commands.go | 2 +- server/v2/flags.go | 6 +++++- server/v2/server.go | 10 +++++----- simapp/v2/simdv2/cmd/commands.go | 1 - 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/server/v2/cometbft/server.go b/server/v2/cometbft/server.go index eb9ca0d41ed9..b904c91f7e04 100644 --- a/server/v2/cometbft/server.go +++ b/server/v2/cometbft/server.go @@ -215,7 +215,7 @@ func (s *CometBFTServer[T]) StartCmdFlags() pflag.FlagSet { return flags } -func (s *CometBFTServer[T]) CLICommands() serverv2.CLIConfig { +func (s *CometBFTServer[T]) CLICommands(appCreator serverv2.AppCreator[T]) serverv2.CLIConfig { return serverv2.CLIConfig{ Commands: []*cobra.Command{ s.StatusCommand(), @@ -226,6 +226,7 @@ func (s *CometBFTServer[T]) CLICommands() serverv2.CLIConfig { s.QueryBlockCmd(), s.QueryBlocksCmd(), s.QueryBlockResultsCmd(), + s.PrunesCmd(appCreator), cmtcmd.ResetAllCmd, cmtcmd.ResetStateCmd, }, diff --git a/server/v2/commands.go b/server/v2/commands.go index 82d7cb869e0b..66a663e4031d 100644 --- a/server/v2/commands.go +++ b/server/v2/commands.go @@ -70,7 +70,7 @@ func Commands(rootCmd *cobra.Command, newApp AppCreator[transaction.Tx], logger }, } - cmds := server.CLICommands() + cmds := server.CLICommands(newApp) cmds.Commands = append(cmds.Commands, startCmd) return cmds, nil diff --git a/server/v2/flags.go b/server/v2/flags.go index 6ef849a31dfa..64920fa723a6 100644 --- a/server/v2/flags.go +++ b/server/v2/flags.go @@ -10,5 +10,9 @@ const ( FlagLogNoColor = "log_no_color" FlagTrace = "trace" - OutputFormatJSON = "json" + OutputFormatJSON = "json" + FlagPruning = "pruning" + FlagAppDBBackend = "app-db-backend" + FlagPruningKeepRecent = "pruning-keep-recent" + FlagPruningInterval = "pruning-interval" ) diff --git a/server/v2/server.go b/server/v2/server.go index bfdccaf37fd0..eade2d8b23e3 100644 --- a/server/v2/server.go +++ b/server/v2/server.go @@ -26,7 +26,7 @@ type ServerComponent[T transaction.Tx] interface { // HasCLICommands is a server module that has CLI commands. type HasCLICommands interface { - CLICommands() CLIConfig + CLICommands(AppCreator[transaction.Tx]) CLIConfig } // HasConfig is a server module that has a config. @@ -118,13 +118,13 @@ func (s *Server) Stop(ctx context.Context) error { } // CLICommands returns all CLI commands of all components. -func (s *Server) CLICommands() CLIConfig { +func (s *Server) CLICommands(appCreator AppCreator[transaction.Tx]) CLIConfig { commands := CLIConfig{} for _, mod := range s.components { if climod, ok := mod.(HasCLICommands); ok { - commands.Commands = append(commands.Commands, climod.CLICommands().Commands...) - commands.Queries = append(commands.Queries, climod.CLICommands().Queries...) - commands.Txs = append(commands.Txs, climod.CLICommands().Txs...) + commands.Commands = append(commands.Commands, climod.CLICommands(appCreator).Commands...) + commands.Queries = append(commands.Queries, climod.CLICommands(appCreator).Queries...) + commands.Txs = append(commands.Txs, climod.CLICommands(appCreator).Txs...) } } diff --git a/simapp/v2/simdv2/cmd/commands.go b/simapp/v2/simdv2/cmd/commands.go index d4a18c0909d8..7efb1ae40516 100644 --- a/simapp/v2/simdv2/cmd/commands.go +++ b/simapp/v2/simdv2/cmd/commands.go @@ -69,7 +69,6 @@ func initRootCmd( genutilcli.InitCmd(moduleManager), debug.Cmd(), confixcmd.ConfigCommand(), - // pruning.Cmd(newApp), // TODO add to comet server // snapshot.Cmd(newApp), // TODO add to comet server ) From 45be50574f876e9392b1a55718bb21a97929568c Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Thu, 20 Jun 2024 16:40:33 +0700 Subject: [PATCH 04/62] lint --- store/v2/root/store.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/store/v2/root/store.go b/store/v2/root/store.go index f04ad113ef7e..529ba28f6bcc 100644 --- a/store/v2/root/store.go +++ b/store/v2/root/store.go @@ -433,4 +433,4 @@ func (s *Store) commitSC() error { func (s *Store) Prune(version uint64) error { return s.pruningManager.Prune(version) -} \ No newline at end of file +} From 47691359a8db085dc93ca6e3223f0e61026e1f5f Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Thu, 20 Jun 2024 18:50:01 +0700 Subject: [PATCH 05/62] move prune to store component --- server/v2/cometbft/commands.go | 115 +---------- server/v2/cometbft/server.go | 3 +- server/v2/store/commands.go | 125 ++++++++++++ server/v2/store/go.mod | 72 +++++++ server/v2/store/go.sum | 358 +++++++++++++++++++++++++++++++++ server/v2/store/server.go | 39 ++++ 6 files changed, 596 insertions(+), 116 deletions(-) create mode 100644 server/v2/store/commands.go create mode 100644 server/v2/store/go.mod create mode 100644 server/v2/store/go.sum create mode 100644 server/v2/store/server.go diff --git a/server/v2/cometbft/commands.go b/server/v2/cometbft/commands.go index ae1788e96f5e..27355f7a2e2d 100644 --- a/server/v2/cometbft/commands.go +++ b/server/v2/cometbft/commands.go @@ -15,24 +15,18 @@ import ( "github.com/cometbft/cometbft/rpc/client/local" cmtversion "github.com/cometbft/cometbft/version" "github.com/spf13/cobra" - "github.com/spf13/viper" "google.golang.org/protobuf/encoding/protojson" "sigs.k8s.io/yaml" - "cosmossdk.io/log" - serverv2 "cosmossdk.io/server/v2" "cosmossdk.io/server/v2/cometbft/client/rpc" "cosmossdk.io/server/v2/cometbft/flags" auth "cosmossdk.io/x/auth/client/cli" "github.com/cosmos/cosmos-sdk/client" - pruningtypes "cosmossdk.io/store/pruning/types" - storev2 "cosmossdk.io/store/v2" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" "github.com/cosmos/cosmos-sdk/version" - "github.com/spf13/cast" ) func (s *CometBFTServer[T]) rpcClient(cmd *cobra.Command) (rpc.CometRPC, error) { @@ -375,89 +369,6 @@ func (s *CometBFTServer[T]) QueryBlockResultsCmd() *cobra.Command { return cmd } -// QueryBlockResultsCmd implements the default command for a BlockResults query. -func (s *CometBFTServer[T]) PrunesCmd(appCreator serverv2.AppCreator[T]) *cobra.Command { - cmd := &cobra.Command{ - Use: "prune [pruning-method]", - Short: "Prune app history states by keeping the recent heights and deleting old heights", - Long: `Prune app history states by keeping the recent heights and deleting old heights. -The pruning option is provided via the 'pruning' argument or alternatively with '--pruning-keep-recent' - -- default: the last 362880 states are kept -- nothing: all historic states will be saved, nothing will be deleted (i.e. archiving node) -- everything: 2 latest states will be kept -- custom: allow pruning options to be manually specified through 'pruning-keep-recent' - -Note: When the --app-db-backend flag is not specified, the default backend type is 'goleveldb'. -Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, - Example: fmt.Sprintf("%s prune custom --pruning-keep-recent 100 --app-db-backend 'goleveldb'", version.AppName), - Args: cobra.RangeArgs(0, 1), - RunE: func(cmd *cobra.Command, args []string) error { - // bind flags to the Context's Viper so we can get pruning options. - vp := viper.New() - if err := vp.BindPFlags(cmd.Flags()); err != nil { - return err - } - if err := vp.BindPFlags(cmd.PersistentFlags()); err != nil { - return err - } - - // use the first argument if present to set the pruning method - if len(args) > 0 { - vp.Set(serverv2.FlagPruning, args[0]) - } else { - vp.Set(serverv2.FlagPruning, pruningtypes.PruningOptionDefault) - } - pruningOptions, err := getPruningOptionsFromFlags(vp) - if err != nil { - return err - } - - cmd.Printf("get pruning options from command flags, strategy: %v, keep-recent: %v\n", - pruningOptions.Strategy, - pruningOptions.KeepRecent, - ) - - logger := log.NewLogger(cmd.OutOrStdout()) - app := appCreator(logger, vp) - store := app.GetStore() - - rootStore, ok := store.(storev2.RootStore) - if !ok { - return fmt.Errorf("currently only support the pruning of rootmulti.Store type") - } - latestHeight, err := rootStore.GetLatestVersion() - if err != nil { - return err - } - - // valid heights should be greater than 0. - if latestHeight <= 0 { - return fmt.Errorf("the database has no valid heights to prune, the latest height: %v", latestHeight) - } - - pruningHeight := latestHeight - pruningOptions.KeepRecent - cmd.Printf("pruning heights up to %v\n", pruningHeight) - - err = rootStore.Prune(pruningHeight) - if err != nil { - return err - } - - cmd.Println("successfully pruned the application root multi stores") - return nil - }, - } - - cmd.Flags().String(serverv2.FlagAppDBBackend, "", "The type of database for application and snapshots databases") - cmd.Flags().Uint64(serverv2.FlagPruningKeepRecent, 0, "Number of recent heights to keep on disk (ignored if pruning is not 'custom')") - cmd.Flags().Uint64(serverv2.FlagPruningInterval, 10, - `Height interval at which pruned heights are removed from disk (ignored if pruning is not 'custom'), - this is not used by this command but kept for compatibility with the complete pruning options`) - - return cmd -} - func parseOptionalHeight(heightStr string) (*int64, error) { h, err := strconv.Atoi(heightStr) if err != nil { @@ -503,7 +414,7 @@ func (s *CometBFTServer[T]) BootstrapStateCmd() *cobra.Command { func printOutput(cmd *cobra.Command, out []byte) error { // Get flags output - outFlag, err := cmd.Flags().GetString(flags.FlagOutput) + outFlag, err := cmd.Flags().GetString(flags.FlagOutput) if err != nil { return err } @@ -530,27 +441,3 @@ func printOutput(cmd *cobra.Command, out []byte) error { } return nil } - -func getPruningOptionsFromFlags(v *viper.Viper) (pruningtypes.PruningOptions, error) { - strategy := strings.ToLower(cast.ToString(v.Get(serverv2.FlagPruning))) - - switch strategy { - case pruningtypes.PruningOptionDefault, pruningtypes.PruningOptionNothing, pruningtypes.PruningOptionEverything: - return pruningtypes.NewPruningOptionsFromString(strategy), nil - - case pruningtypes.PruningOptionCustom: - opts := pruningtypes.NewCustomPruningOptions( - cast.ToUint64(v.Get(serverv2.FlagPruningKeepRecent)), - cast.ToUint64(v.Get(serverv2.FlagPruningInterval)), - ) - - if err := opts.Validate(); err != nil { - return opts, fmt.Errorf("invalid custom pruning options: %w", err) - } - - return opts, nil - - default: - return pruningtypes.PruningOptions{}, fmt.Errorf("unknown pruning strategy %s", strategy) - } -} diff --git a/server/v2/cometbft/server.go b/server/v2/cometbft/server.go index b904c91f7e04..7789fc69dfa6 100644 --- a/server/v2/cometbft/server.go +++ b/server/v2/cometbft/server.go @@ -215,7 +215,7 @@ func (s *CometBFTServer[T]) StartCmdFlags() pflag.FlagSet { return flags } -func (s *CometBFTServer[T]) CLICommands(appCreator serverv2.AppCreator[T]) serverv2.CLIConfig { +func (s *CometBFTServer[T]) CLICommands(_ serverv2.AppCreator[T]) serverv2.CLIConfig { return serverv2.CLIConfig{ Commands: []*cobra.Command{ s.StatusCommand(), @@ -226,7 +226,6 @@ func (s *CometBFTServer[T]) CLICommands(appCreator serverv2.AppCreator[T]) serve s.QueryBlockCmd(), s.QueryBlocksCmd(), s.QueryBlockResultsCmd(), - s.PrunesCmd(appCreator), cmtcmd.ResetAllCmd, cmtcmd.ResetStateCmd, }, diff --git a/server/v2/store/commands.go b/server/v2/store/commands.go new file mode 100644 index 000000000000..d7a931da0980 --- /dev/null +++ b/server/v2/store/commands.go @@ -0,0 +1,125 @@ +package store + +import ( + "fmt" + "strings" + + "github.com/spf13/cobra" + "github.com/spf13/viper" + + "cosmossdk.io/log" + serverv2 "cosmossdk.io/server/v2" + + "cosmossdk.io/core/transaction" + pruningtypes "cosmossdk.io/store/pruning/types" + storev2 "cosmossdk.io/store/v2" + "github.com/cosmos/cosmos-sdk/version" + "github.com/spf13/cast" +) + +// QueryBlockResultsCmd implements the default command for a BlockResults query. +func (s StoreServer) PrunesCmd(appCreator serverv2.AppCreator[transaction.Tx]) *cobra.Command { + cmd := &cobra.Command{ + Use: "prune [pruning-method]", + Short: "Prune app history states by keeping the recent heights and deleting old heights", + Long: `Prune app history states by keeping the recent heights and deleting old heights. +The pruning option is provided via the 'pruning' argument or alternatively with '--pruning-keep-recent' + +- default: the last 362880 states are kept +- nothing: all historic states will be saved, nothing will be deleted (i.e. archiving node) +- everything: 2 latest states will be kept +- custom: allow pruning options to be manually specified through 'pruning-keep-recent' + +Note: When the --app-db-backend flag is not specified, the default backend type is 'goleveldb'. +Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, + Example: fmt.Sprintf("%s prune custom --pruning-keep-recent 100 --app-db-backend 'goleveldb'", version.AppName), + Args: cobra.RangeArgs(0, 1), + RunE: func(cmd *cobra.Command, args []string) error { + // bind flags to the Context's Viper so we can get pruning options. + vp := viper.New() + if err := vp.BindPFlags(cmd.Flags()); err != nil { + return err + } + if err := vp.BindPFlags(cmd.PersistentFlags()); err != nil { + return err + } + + // use the first argument if present to set the pruning method + if len(args) > 0 { + vp.Set(serverv2.FlagPruning, args[0]) + } else { + vp.Set(serverv2.FlagPruning, pruningtypes.PruningOptionDefault) + } + pruningOptions, err := getPruningOptionsFromFlags(vp) + if err != nil { + return err + } + + cmd.Printf("get pruning options from command flags, strategy: %v, keep-recent: %v\n", + pruningOptions.Strategy, + pruningOptions.KeepRecent, + ) + + logger := log.NewLogger(cmd.OutOrStdout()) + app := appCreator(logger, vp) + store := app.GetStore() + + rootStore, ok := store.(storev2.RootStore) + if !ok { + return fmt.Errorf("currently only support the pruning of rootmulti.Store type") + } + latestHeight, err := rootStore.GetLatestVersion() + if err != nil { + return err + } + + // valid heights should be greater than 0. + if latestHeight <= 0 { + return fmt.Errorf("the database has no valid heights to prune, the latest height: %v", latestHeight) + } + + pruningHeight := latestHeight - pruningOptions.KeepRecent + cmd.Printf("pruning heights up to %v\n", pruningHeight) + + err = rootStore.Prune(pruningHeight) + if err != nil { + return err + } + + cmd.Println("successfully pruned the application root multi stores") + return nil + }, + } + + cmd.Flags().String(serverv2.FlagAppDBBackend, "", "The type of database for application and snapshots databases") + cmd.Flags().Uint64(serverv2.FlagPruningKeepRecent, 0, "Number of recent heights to keep on disk (ignored if pruning is not 'custom')") + cmd.Flags().Uint64(serverv2.FlagPruningInterval, 10, + `Height interval at which pruned heights are removed from disk (ignored if pruning is not 'custom'), + this is not used by this command but kept for compatibility with the complete pruning options`) + + return cmd +} + +func getPruningOptionsFromFlags(v *viper.Viper) (pruningtypes.PruningOptions, error) { + strategy := strings.ToLower(cast.ToString(v.Get(serverv2.FlagPruning))) + + switch strategy { + case pruningtypes.PruningOptionDefault, pruningtypes.PruningOptionNothing, pruningtypes.PruningOptionEverything: + return pruningtypes.NewPruningOptionsFromString(strategy), nil + + case pruningtypes.PruningOptionCustom: + opts := pruningtypes.NewCustomPruningOptions( + cast.ToUint64(v.Get(serverv2.FlagPruningKeepRecent)), + cast.ToUint64(v.Get(serverv2.FlagPruningInterval)), + ) + + if err := opts.Validate(); err != nil { + return opts, fmt.Errorf("invalid custom pruning options: %w", err) + } + + return opts, nil + + default: + return pruningtypes.PruningOptions{}, fmt.Errorf("unknown pruning strategy %s", strategy) + } +} diff --git a/server/v2/store/go.mod b/server/v2/store/go.mod new file mode 100644 index 000000000000..92ee241f9a8d --- /dev/null +++ b/server/v2/store/go.mod @@ -0,0 +1,72 @@ +module cosmossdk.io/server/v2/store + +go 1.22.2 + +replace ( + cosmossdk.io/api => ../../../api + cosmossdk.io/core => ../../../core + cosmossdk.io/core/testing => ../../../core/testing + cosmossdk.io/depinject => ../../../depinject + cosmossdk.io/log => ../../../log + cosmossdk.io/server/v2 => ../ + cosmossdk.io/server/v2/appmanager => ../appmanager + cosmossdk.io/store => ../../../store + cosmossdk.io/store/v2 => ../../../store/v2 + cosmossdk.io/x/accounts => ../../../x/accounts + cosmossdk.io/x/auth => ../../../x/auth + cosmossdk.io/x/bank => ../../../x/bank + cosmossdk.io/x/consensus => ../../../x/consensus + cosmossdk.io/x/staking => ../../../x/staking + github.com/cosmos/cosmos-sdk => ../../../ +) + +require ( + cosmossdk.io/core v0.12.1-0.20231114100755-569e3ff6a0d7 + cosmossdk.io/log v1.3.1 + cosmossdk.io/server/v2 v2.0.0-00010101000000-000000000000 + cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc + cosmossdk.io/store/v2 v2.0.0-00010101000000-000000000000 + github.com/cosmos/cosmos-sdk v0.51.0 + github.com/spf13/cast v1.6.0 + github.com/spf13/cobra v1.8.1 + github.com/spf13/viper v1.19.0 +) + +require ( + cosmossdk.io/errors v1.0.1 // indirect + cosmossdk.io/server/v2/appmanager v0.0.0-00010101000000-000000000000 // indirect + github.com/cosmos/gogoproto v1.5.0 // indirect + github.com/cosmos/ics23/go v0.10.0 // indirect + github.com/fsnotify/fsnotify v1.7.0 // indirect + github.com/google/go-cmp v0.6.0 // indirect + github.com/hashicorp/go-immutable-radix v1.3.1 // indirect + github.com/hashicorp/go-metrics v0.5.3 // indirect + github.com/hashicorp/golang-lru v1.0.2 // indirect + github.com/hashicorp/hcl v1.0.0 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/magiconair/properties v1.8.7 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/pelletier/go-toml/v2 v2.2.2 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/rs/zerolog v1.33.0 // indirect + github.com/sagikazarmark/locafero v0.4.0 // indirect + github.com/sagikazarmark/slog-shim v0.1.0 // indirect + github.com/sourcegraph/conc v0.3.0 // indirect + github.com/spf13/afero v1.11.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect + github.com/subosito/gotenv v1.6.0 // indirect + go.uber.org/multierr v1.11.0 // indirect + golang.org/x/crypto v0.24.0 // indirect + golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect + golang.org/x/sync v0.7.0 // indirect + golang.org/x/sys v0.21.0 // indirect + golang.org/x/text v0.16.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240515191416-fc5f0ca64291 // indirect + google.golang.org/grpc v1.64.0 // indirect + google.golang.org/protobuf v1.34.2 // indirect + gopkg.in/ini.v1 v1.67.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect + sigs.k8s.io/yaml v1.4.0 // indirect +) diff --git a/server/v2/store/go.sum b/server/v2/store/go.sum new file mode 100644 index 000000000000..98890a24c651 --- /dev/null +++ b/server/v2/store/go.sum @@ -0,0 +1,358 @@ +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.1-20240312114316-c0d3497e35d6.1 h1:lBlYy54lX1iBjFhbkd13bWlH7dMnoiyENzZ0Wok1YH4= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.1-20240312114316-c0d3497e35d6.1/go.mod h1:fYP6DZCfO5Ex4U+Xq1PqQwB8NQQhW5Y+Qbyzd/7dw7o= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.1-20240130113600-88ef6483f90f.1 h1:MfK7sTqm7NFqM/GOuuKOOemQzW8P7z07YQIW0vsYr38= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.1-20240130113600-88ef6483f90f.1/go.mod h1:RigkrxrsA6FPZontmsidcr0WGWF8zNFYleIktv6XdLc= +cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= +cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= +cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= +cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= +cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= +cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= +cosmossdk.io/x/tx v0.13.3 h1:Ha4mNaHmxBc6RMun9aKuqul8yHiL78EKJQ8g23Zf73g= +cosmossdk.io/x/tx v0.13.3/go.mod h1:I8xaHv0rhUdIvIdptKIqzYy27+n2+zBVaxO6fscFhys= +filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= +filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= +github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= +github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN7oaIRCjzsZ2dE+yG5k+rsdt3qcwykqK6HVGcKwsw4= +github.com/99designs/keyring v1.2.2 h1:pZd3neh/EmUzWONb35LxQfvuY7kiSXAq3HQd97+XBn0= +github.com/99designs/keyring v1.2.2/go.mod h1:wes/FrByc8j7lFOAGLGSNEg8f/PaI3cgTBqhFkHUrPk= +github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= +github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 h1:41iFGWnSlI2gVpmOtVTJZNodLdLQLn/KsJqFvXwnd/s= +github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/btcsuite/btcd/btcec/v2 v2.3.3 h1:6+iXlDKE8RMtKsvK0gshlXIuPbyWM/h84Ensb7o3sC0= +github.com/btcsuite/btcd/btcec/v2 v2.3.3/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= +github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= +github.com/cockroachdb/errors v1.11.1 h1:xSEW75zKaKCWzR3OfxXUxgrk/NtT4G1MiOv5lWZazG8= +github.com/cockroachdb/errors v1.11.1/go.mod h1:8MUxA3Gi6b25tYlFEBGLf+D8aISL+M4MIpiWMSNRfxw= +github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= +github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= +github.com/cockroachdb/pebble v1.1.0 h1:pcFh8CdCIt2kmEpK0OIatq67Ln9uGDYY3d5XnE0LJG4= +github.com/cockroachdb/pebble v1.1.0/go.mod h1:sEHm5NOXxyiAoKWhoFxT8xMgd/f3RA6qUqQ1BXKrh2E= +github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= +github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= +github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= +github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= +github.com/cometbft/cometbft v1.0.0-alpha.2.0.20240530055211-ae27f7eb3c08 h1:xW0les/5Lr+4qVsOYDDwl5Utj8uouvv69hEtiavHJ2M= +github.com/cometbft/cometbft v1.0.0-alpha.2.0.20240530055211-ae27f7eb3c08/go.mod h1:8uXGKqp5yPmNSbU81K/669E3rfO3H+juGkYKCPTnAtY= +github.com/cometbft/cometbft-db v0.12.0 h1:v77/z0VyfSU7k682IzZeZPFZrQAKiQwkqGN0QzAjMi0= +github.com/cometbft/cometbft-db v0.12.0/go.mod h1:aX2NbCrjNVd2ZajYxt1BsiFf/Z+TQ2MN0VxdicheYuw= +github.com/cometbft/cometbft/api v1.0.0-rc.1 h1:GtdXwDGlqwHYs16A4egjwylfYOMYyEacLBrs3Zvpt7g= +github.com/cometbft/cometbft/api v1.0.0-rc.1/go.mod h1:NDFKiBBD8HJC6QQLAoUI99YhsiRZtg2+FJWfk6A6m6o= +github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= +github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= +github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAKs= +github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= +github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= +github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= +github.com/cosmos/crypto v0.0.0-20240309083813-82ed2537802e h1:Zk4OsfLBN+0WOfH15Hg/aAYsSP7IuZQC6RZjewPuITw= +github.com/cosmos/crypto v0.0.0-20240309083813-82ed2537802e/go.mod h1:0KOK/XVzL5lj9x+NyJ7lWuJYl6F0Wd7JMVYM06bVQsc= +github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= +github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= +github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= +github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= +github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= +github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= +github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= +github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= +github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= +github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= +github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/danieljoos/wincred v1.2.1 h1:dl9cBrupW8+r5250DYkYxocLeZ1Y4vB1kxgtjxw8GQs= +github.com/danieljoos/wincred v1.2.1/go.mod h1:uGaFL9fDn3OLTvzCGulzE+SzjEe5NGlh5FdCcyfPwps= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 h1:rpfIENRNNilwHwZeG5+P150SMrnNEcHYvcCuK6dPZSg= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= +github.com/dgraph-io/badger/v4 v4.2.0 h1:kJrlajbXXL9DFTNuhhu9yCx7JJa4qpYWxtE8BzuWsEs= +github.com/dgraph-io/badger/v4 v4.2.0/go.mod h1:qfCqhPoWDFJRx1gp5QwwyGo8xk1lbHUxvK9nK0OGAak= +github.com/dgraph-io/ristretto v0.1.1 h1:6CWw5tJNgpegArSHpNHJKldNeq03FQCwYvfMVWajOK8= +github.com/dgraph-io/ristretto v0.1.1/go.mod h1:S1GPSBCYCIhmVNfcth17y2zZtQT6wzkzgwUve0VDWWA= +github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= +github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= +github.com/dvsekhvalnov/jose2go v1.6.0 h1:Y9gnSnP4qEI0+/uQkHvFXeD2PLPJeXEL+ySMEA2EjTY= +github.com/dvsekhvalnov/jose2go v1.6.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU= +github.com/emicklei/dot v1.6.2 h1:08GN+DD79cy/tzN6uLCT84+2Wk9u+wvqP+Hkx/dIR8A= +github.com/emicklei/dot v1.6.2/go.mod h1:DeV7GvQtIw4h2u73RKBkkFdvVAz0D9fzeJrgPW6gy/s= +github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= +github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= +github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= +github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= +github.com/getsentry/sentry-go v0.27.0 h1:Pv98CIbtB3LkMWmXi4Joa5OOcwbmnX88sF5qbK3r3Ps= +github.com/getsentry/sentry-go v0.27.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.13.0 h1:OoneCcHKHQ03LfBpoQCUfCluwd2Vt3ohz+kvbJneZAU= +github.com/go-kit/kit v0.13.0/go.mod h1:phqEHMMUbyrCFCTgH48JueqrM3md2HcAZ8N3XE4FKDg= +github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU= +github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4= +github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= +github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= +github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang/glog v1.2.0 h1:uCdmnmatrKCgMBlM4rMuJZWOkPDqdbZPnrMXDY4gI68= +github.com/golang/glog v1.2.0/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= +github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= +github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= +github.com/google/flatbuffers v2.0.8+incompatible h1:ivUb1cGomAB101ZM1T0nOiWz9pSrTMoa9+EiY7igmkM= +github.com/google/flatbuffers v2.0.8+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= +github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= +github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= +github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-metrics v0.5.3 h1:M5uADWMOGCTUNU1YuC4hfknOeHNaX54LDm4oYSucoNE= +github.com/hashicorp/go-metrics v0.5.3/go.mod h1:KEjodfebIOuBYSAe/bHTm+HChmKSxAOXPBieMLYozDE= +github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= +github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE= +github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c= +github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hdevalence/ed25519consensus v0.2.0 h1:37ICyZqdyj0lAZ8P4D1d1id3HqbbG1N3iBb1Tb4rdcU= +github.com/hdevalence/ed25519consensus v0.2.0/go.mod h1:w3BHWjwJbFU29IRHL1Iqkw3sus+7FctEyM4RqDxYNzo= +github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI= +github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= +github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= +github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= +github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= +github.com/linxGnu/grocksdb v1.8.14 h1:HTgyYalNwBSG/1qCQUIott44wU5b2Y9Kr3z7SK5OfGQ= +github.com/linxGnu/grocksdb v1.8.14/go.mod h1:QYiYypR2d4v63Wj1adOOfzglnoII0gLj3PNh4fZkcFA= +github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= +github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/mtibben/percent v0.2.1 h1:5gssi8Nqo8QU/r2pynCm+hBQHpkB/uNK7BJCFogWdzs= +github.com/mtibben/percent v0.2.1/go.mod h1:KG9uO+SZkUp+VkRHsCdYQV3XSZrrSpR3O9ibNBTZrns= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a h1:dlRvE5fWabOchtH7znfiFCcOvmIYgOeAS5ifBXBlh9Q= +github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a/go.mod h1:hVoHR2EVESiICEMbg137etN/Lx+lSrHPTD39Z/uE+2s= +github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= +github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= +github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba h1:3jPgmsFGBID1wFfU2AbYocNcN4wqU68UaHSdMjiw/7U= +github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= +github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= +github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= +github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= +github.com/prometheus/common v0.54.0 h1:ZlZy0BgJhTwVZUn7dLOkwCZHUkrAqd3WYtcFCWnM1D8= +github.com/prometheus/common v0.54.0/go.mod h1:/TQgMJP5CuVYveyT7n/0Ix8yLNNXy9yRSkhnLTHPDIQ= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= +github.com/prometheus/procfs v0.14.0 h1:Lw4VdGGoKEZilJsayHf0B+9YgLGREba2C6xr+Fdfq6s= +github.com/prometheus/procfs v0.14.0/go.mod h1:XL+Iwz8k8ZabyZfMFHPiilCniixqQarAy5Mu67pHlNQ= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= +github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= +github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= +github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= +github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= +github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= +github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= +github.com/sasha-s/go-deadlock v0.3.1 h1:sqv7fDNShgjcaxkO0JNcOAlr8B9+cV5Ey/OB71efZx0= +github.com/sasha-s/go-deadlock v0.3.1/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= +github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= +github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= +github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= +github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= +github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= +github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= +github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI= +github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= +github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= +github.com/supranational/blst v0.3.11 h1:LyU6FolezeWAhvQk0k6O/d49jqgO52MSDDfYgbeoEm4= +github.com/supranational/blst v0.3.11/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= +github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d h1:vfofYNRScrDdvS342BElfbETmL1Aiz3i2t0zfRj16Hs= +github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48= +github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E= +github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= +github.com/tidwall/btree v1.7.0 h1:L1fkJH/AuEh5zBnnBbmTwQ5Lt+bRJ5A8EWecslvo9iI= +github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= +github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= +github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= +github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= +github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= +github.com/zondax/ledger-go v0.14.3/go.mod h1:IKKaoxupuB43g4NxeQmbLXv7T9AlQyie1UpHb342ycI= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b h1:CzigHMRySiX3drau9C6Q5CAbNIApmLdat5jPMqChvDA= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b/go.mod h1:/y/V339mxv2sZmYYR64O07VuCpdNZqCTwO8ZcouTMI8= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 h1:qwDnMxjkyLmAFgcfgTnfJrmYKWhHnci3GjDqcZp1M3Q= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02/go.mod h1:JTnUj0mpYiAsuZLmKjTx/ex3AtMowcCgnE7YNyCEP0I= +go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5 h1:qxen9oVGzDdIRP6ejyAJc760RwW4SnVDiTYTzwnXuxo= +go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5/go.mod h1:eW0HG9/oHQhvRCvb1/pIXW4cOvtDqeQK+XSi3TnwaXY= +go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= +go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI= +golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= +golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc h1:O9NuF4s+E/PvMIy+9IUZB9znFwUIXEWSstNjek6VpVg= +golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.21.0 h1:WVXCp+/EBEHOj53Rvu+7KiT/iElMrO8ACK16SMZ3jaA= +golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= +golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY= +google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo= +google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237 h1:RFiFrvy37/mpSpdySBDrUdipW/dHwsRwh3J3+A9VgT4= +google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237/go.mod h1:Z5Iiy3jtmioajWHDGFk7CeugTyHtPvMHA4UTmUkyalE= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240515191416-fc5f0ca64291 h1:AgADTJarZTBqgjiUzRgfaBchgYB3/WFTC80GPwsMcRI= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240515191416-fc5f0ca64291/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= +google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY= +google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg= +google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= +gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= +gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= +pgregory.net/rapid v1.1.0 h1:CMa0sjHSru3puNx+J0MIAuiiEV4N0qj8/cMWGBBCsjw= +pgregory.net/rapid v1.1.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= +sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= +sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= diff --git a/server/v2/store/server.go b/server/v2/store/server.go new file mode 100644 index 000000000000..9b1adfba02ec --- /dev/null +++ b/server/v2/store/server.go @@ -0,0 +1,39 @@ +package store + +import ( + "context" + + "cosmossdk.io/core/transaction" + "cosmossdk.io/log" + serverv2 "cosmossdk.io/server/v2" + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +type StoreServer struct {} + +func (s StoreServer) Init(appI serverv2.AppI[transaction.Tx], v *viper.Viper, logger log.Logger) (serverv2.ServerComponent[transaction.Tx], error) { + return s, nil +} + +func (s StoreServer) Name() string { + return "store" +} + +func (s StoreServer) Start(ctx context.Context) error { + return nil +} + +func (s StoreServer) Stop(ctx context.Context) error { + return nil +} + +func (s StoreServer) CLICommands(appCreator serverv2.AppCreator[transaction.Tx]) serverv2.CLIConfig { + return serverv2.CLIConfig{ + Commands: []*cobra.Command{ + s.PrunesCmd(appCreator), + }, + } +} + + From d4927b4b59dde128f0e40ec2e487a4c2d33f45c5 Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Thu, 20 Jun 2024 18:50:51 +0700 Subject: [PATCH 06/62] rename --- server/v2/store/commands.go | 2 +- server/v2/store/server.go | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/server/v2/store/commands.go b/server/v2/store/commands.go index d7a931da0980..ecdb1041b987 100644 --- a/server/v2/store/commands.go +++ b/server/v2/store/commands.go @@ -18,7 +18,7 @@ import ( ) // QueryBlockResultsCmd implements the default command for a BlockResults query. -func (s StoreServer) PrunesCmd(appCreator serverv2.AppCreator[transaction.Tx]) *cobra.Command { +func (s StoreComponent) PrunesCmd(appCreator serverv2.AppCreator[transaction.Tx]) *cobra.Command { cmd := &cobra.Command{ Use: "prune [pruning-method]", Short: "Prune app history states by keeping the recent heights and deleting old heights", diff --git a/server/v2/store/server.go b/server/v2/store/server.go index 9b1adfba02ec..29a346b34772 100644 --- a/server/v2/store/server.go +++ b/server/v2/store/server.go @@ -10,25 +10,25 @@ import ( "github.com/spf13/viper" ) -type StoreServer struct {} +type StoreComponent struct {} -func (s StoreServer) Init(appI serverv2.AppI[transaction.Tx], v *viper.Viper, logger log.Logger) (serverv2.ServerComponent[transaction.Tx], error) { +func (s StoreComponent) Init(appI serverv2.AppI[transaction.Tx], v *viper.Viper, logger log.Logger) (serverv2.ServerComponent[transaction.Tx], error) { return s, nil } -func (s StoreServer) Name() string { +func (s StoreComponent) Name() string { return "store" } -func (s StoreServer) Start(ctx context.Context) error { +func (s StoreComponent) Start(ctx context.Context) error { return nil } -func (s StoreServer) Stop(ctx context.Context) error { +func (s StoreComponent) Stop(ctx context.Context) error { return nil } -func (s StoreServer) CLICommands(appCreator serverv2.AppCreator[transaction.Tx]) serverv2.CLIConfig { +func (s StoreComponent) CLICommands(appCreator serverv2.AppCreator[transaction.Tx]) serverv2.CLIConfig { return serverv2.CLIConfig{ Commands: []*cobra.Command{ s.PrunesCmd(appCreator), From b99e5548702715cc5fbfc8cf139b3b1bc7eae91e Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Thu, 20 Jun 2024 18:51:05 +0700 Subject: [PATCH 07/62] add to simapp --- simapp/v2/go.mod | 2 ++ simapp/v2/simdv2/cmd/commands.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/simapp/v2/go.mod b/simapp/v2/go.mod index c6aaf71c5702..5b355af26ba2 100644 --- a/simapp/v2/go.mod +++ b/simapp/v2/go.mod @@ -12,6 +12,7 @@ require ( cosmossdk.io/runtime/v2 v2.0.0-00010101000000-000000000000 cosmossdk.io/server/v2 v2.0.0-00010101000000-000000000000 cosmossdk.io/server/v2/cometbft v0.0.0-00010101000000-000000000000 + cosmossdk.io/server/v2/store v0.0.0-00010101000000-000000000000 cosmossdk.io/store/v2 v2.0.0 cosmossdk.io/x/accounts v0.0.0-20240226161501-23359a0b6d91 cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 @@ -296,6 +297,7 @@ replace ( cosmossdk.io/server/v2/appmanager => ../../server/v2/appmanager cosmossdk.io/server/v2/cometbft => ../../server/v2/cometbft cosmossdk.io/server/v2/stf => ../../server/v2/stf + cosmossdk.io/server/v2/store => ../../server/v2/store cosmossdk.io/store => ../../store cosmossdk.io/store/v2 => ../../store/v2 ) diff --git a/simapp/v2/simdv2/cmd/commands.go b/simapp/v2/simdv2/cmd/commands.go index 7efb1ae40516..2c4e4b3b79d6 100644 --- a/simapp/v2/simdv2/cmd/commands.go +++ b/simapp/v2/simdv2/cmd/commands.go @@ -16,6 +16,7 @@ import ( serverv2 "cosmossdk.io/server/v2" "cosmossdk.io/server/v2/api/grpc" "cosmossdk.io/server/v2/cometbft" + "cosmossdk.io/server/v2/store" "cosmossdk.io/simapp/v2" confixcmd "cosmossdk.io/tools/confix/cmd" authcmd "cosmossdk.io/x/auth/client/cli" @@ -84,6 +85,7 @@ func initRootCmd( logger, cometbft.New(&temporaryTxDecoder{txConfig}), grpc.New(), + store.StoreComponent{}, ); err != nil { panic(err) } From 44d609c91cc60b75a1f2336faebdb6d609ca7611 Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Thu, 20 Jun 2024 18:56:45 +0700 Subject: [PATCH 08/62] lint --- server/v2/store/commands.go | 6 +++--- server/v2/store/server.go | 9 ++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/server/v2/store/commands.go b/server/v2/store/commands.go index ecdb1041b987..8df1161654d1 100644 --- a/server/v2/store/commands.go +++ b/server/v2/store/commands.go @@ -4,17 +4,17 @@ import ( "fmt" "strings" + "github.com/spf13/cast" "github.com/spf13/cobra" "github.com/spf13/viper" + "cosmossdk.io/core/transaction" "cosmossdk.io/log" serverv2 "cosmossdk.io/server/v2" - - "cosmossdk.io/core/transaction" pruningtypes "cosmossdk.io/store/pruning/types" storev2 "cosmossdk.io/store/v2" + "github.com/cosmos/cosmos-sdk/version" - "github.com/spf13/cast" ) // QueryBlockResultsCmd implements the default command for a BlockResults query. diff --git a/server/v2/store/server.go b/server/v2/store/server.go index 29a346b34772..ed55d50f3289 100644 --- a/server/v2/store/server.go +++ b/server/v2/store/server.go @@ -3,14 +3,15 @@ package store import ( "context" + "github.com/spf13/cobra" + "github.com/spf13/viper" + "cosmossdk.io/core/transaction" "cosmossdk.io/log" serverv2 "cosmossdk.io/server/v2" - "github.com/spf13/cobra" - "github.com/spf13/viper" ) -type StoreComponent struct {} +type StoreComponent struct{} func (s StoreComponent) Init(appI serverv2.AppI[transaction.Tx], v *viper.Viper, logger log.Logger) (serverv2.ServerComponent[transaction.Tx], error) { return s, nil @@ -35,5 +36,3 @@ func (s StoreComponent) CLICommands(appCreator serverv2.AppCreator[transaction.T }, } } - - From 63b1b03f2eb04045540385b9d5b71981e3760780 Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Thu, 20 Jun 2024 19:13:50 +0700 Subject: [PATCH 09/62] move flags to component --- server/v2/flags.go | 4 ---- server/v2/store/commands.go | 16 ++++++++-------- server/v2/store/flags.go | 8 ++++++++ 3 files changed, 16 insertions(+), 12 deletions(-) create mode 100644 server/v2/store/flags.go diff --git a/server/v2/flags.go b/server/v2/flags.go index 64920fa723a6..bd201bfed758 100644 --- a/server/v2/flags.go +++ b/server/v2/flags.go @@ -11,8 +11,4 @@ const ( FlagTrace = "trace" OutputFormatJSON = "json" - FlagPruning = "pruning" - FlagAppDBBackend = "app-db-backend" - FlagPruningKeepRecent = "pruning-keep-recent" - FlagPruningInterval = "pruning-interval" ) diff --git a/server/v2/store/commands.go b/server/v2/store/commands.go index 8df1161654d1..cd3889185d38 100644 --- a/server/v2/store/commands.go +++ b/server/v2/store/commands.go @@ -46,9 +46,9 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, // use the first argument if present to set the pruning method if len(args) > 0 { - vp.Set(serverv2.FlagPruning, args[0]) + vp.Set(FlagPruning, args[0]) } else { - vp.Set(serverv2.FlagPruning, pruningtypes.PruningOptionDefault) + vp.Set(FlagPruning, pruningtypes.PruningOptionDefault) } pruningOptions, err := getPruningOptionsFromFlags(vp) if err != nil { @@ -91,9 +91,9 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, }, } - cmd.Flags().String(serverv2.FlagAppDBBackend, "", "The type of database for application and snapshots databases") - cmd.Flags().Uint64(serverv2.FlagPruningKeepRecent, 0, "Number of recent heights to keep on disk (ignored if pruning is not 'custom')") - cmd.Flags().Uint64(serverv2.FlagPruningInterval, 10, + cmd.Flags().String(FlagAppDBBackend, "", "The type of database for application and snapshots databases") + cmd.Flags().Uint64(FlagPruningKeepRecent, 0, "Number of recent heights to keep on disk (ignored if pruning is not 'custom')") + cmd.Flags().Uint64(FlagPruningInterval, 10, `Height interval at which pruned heights are removed from disk (ignored if pruning is not 'custom'), this is not used by this command but kept for compatibility with the complete pruning options`) @@ -101,7 +101,7 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, } func getPruningOptionsFromFlags(v *viper.Viper) (pruningtypes.PruningOptions, error) { - strategy := strings.ToLower(cast.ToString(v.Get(serverv2.FlagPruning))) + strategy := strings.ToLower(cast.ToString(v.Get(FlagPruning))) switch strategy { case pruningtypes.PruningOptionDefault, pruningtypes.PruningOptionNothing, pruningtypes.PruningOptionEverything: @@ -109,8 +109,8 @@ func getPruningOptionsFromFlags(v *viper.Viper) (pruningtypes.PruningOptions, er case pruningtypes.PruningOptionCustom: opts := pruningtypes.NewCustomPruningOptions( - cast.ToUint64(v.Get(serverv2.FlagPruningKeepRecent)), - cast.ToUint64(v.Get(serverv2.FlagPruningInterval)), + cast.ToUint64(v.Get(FlagPruningKeepRecent)), + cast.ToUint64(v.Get(FlagPruningInterval)), ) if err := opts.Validate(); err != nil { diff --git a/server/v2/store/flags.go b/server/v2/store/flags.go new file mode 100644 index 000000000000..59d4445142b9 --- /dev/null +++ b/server/v2/store/flags.go @@ -0,0 +1,8 @@ +package store + +const ( + FlagPruning = "pruning" + FlagAppDBBackend = "app-db-backend" + FlagPruningKeepRecent = "pruning-keep-recent" + FlagPruningInterval = "pruning-interval" +) \ No newline at end of file From ac93a6681f674b3240c3adb74df0c73563a49b85 Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Thu, 20 Jun 2024 19:15:51 +0700 Subject: [PATCH 10/62] New func --- server/v2/store/server.go | 4 ++++ simapp/v2/simdv2/cmd/commands.go | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/server/v2/store/server.go b/server/v2/store/server.go index ed55d50f3289..3257694e6c5a 100644 --- a/server/v2/store/server.go +++ b/server/v2/store/server.go @@ -13,6 +13,10 @@ import ( type StoreComponent struct{} +func New() serverv2.ServerComponent[transaction.Tx] { + return StoreComponent{} +} + func (s StoreComponent) Init(appI serverv2.AppI[transaction.Tx], v *viper.Viper, logger log.Logger) (serverv2.ServerComponent[transaction.Tx], error) { return s, nil } diff --git a/simapp/v2/simdv2/cmd/commands.go b/simapp/v2/simdv2/cmd/commands.go index 2c4e4b3b79d6..8306a6c92672 100644 --- a/simapp/v2/simdv2/cmd/commands.go +++ b/simapp/v2/simdv2/cmd/commands.go @@ -85,7 +85,7 @@ func initRootCmd( logger, cometbft.New(&temporaryTxDecoder{txConfig}), grpc.New(), - store.StoreComponent{}, + store.New(), ); err != nil { panic(err) } From 40eab2fb458b5819c8f5423bc6ddba9ddadcec92 Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Thu, 20 Jun 2024 19:17:11 +0700 Subject: [PATCH 11/62] unexpected change --- server/v2/cometbft/commands.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/v2/cometbft/commands.go b/server/v2/cometbft/commands.go index 27355f7a2e2d..b635ca505c36 100644 --- a/server/v2/cometbft/commands.go +++ b/server/v2/cometbft/commands.go @@ -414,7 +414,7 @@ func (s *CometBFTServer[T]) BootstrapStateCmd() *cobra.Command { func printOutput(cmd *cobra.Command, out []byte) error { // Get flags output - outFlag, err := cmd.Flags().GetString(flags.FlagOutput) + outFlag, err := cmd.Flags().GetString(flags.FlagOutput) if err != nil { return err } From 974e3f9ad5185bdae5b7204600ba030db09a7eb0 Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Thu, 20 Jun 2024 19:33:17 +0700 Subject: [PATCH 12/62] lint --- server/v2/flags.go | 2 +- server/v2/store/flags.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/v2/flags.go b/server/v2/flags.go index bd201bfed758..6ef849a31dfa 100644 --- a/server/v2/flags.go +++ b/server/v2/flags.go @@ -10,5 +10,5 @@ const ( FlagLogNoColor = "log_no_color" FlagTrace = "trace" - OutputFormatJSON = "json" + OutputFormatJSON = "json" ) diff --git a/server/v2/store/flags.go b/server/v2/store/flags.go index 59d4445142b9..24a8a3f8948d 100644 --- a/server/v2/store/flags.go +++ b/server/v2/store/flags.go @@ -5,4 +5,4 @@ const ( FlagAppDBBackend = "app-db-backend" FlagPruningKeepRecent = "pruning-keep-recent" FlagPruningInterval = "pruning-interval" -) \ No newline at end of file +) From 3ae993ab8245fbec98113b9aa5b4a8c7789e7a3c Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Thu, 20 Jun 2024 20:34:18 +0700 Subject: [PATCH 13/62] write store config to app.toml --- server/v2/store/commands.go | 2 +- server/v2/store/config.go | 22 ++++++++++++++++++++++ server/v2/store/server.go | 12 +++++++++++- 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 server/v2/store/config.go diff --git a/server/v2/store/commands.go b/server/v2/store/commands.go index cd3889185d38..cb52ab6cd4fe 100644 --- a/server/v2/store/commands.go +++ b/server/v2/store/commands.go @@ -36,7 +36,7 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, Args: cobra.RangeArgs(0, 1), RunE: func(cmd *cobra.Command, args []string) error { // bind flags to the Context's Viper so we can get pruning options. - vp := viper.New() + vp := serverv2.GetViperFromCmd(cmd) if err := vp.BindPFlags(cmd.Flags()); err != nil { return err } diff --git a/server/v2/store/config.go b/server/v2/store/config.go new file mode 100644 index 000000000000..b065292fc2cd --- /dev/null +++ b/server/v2/store/config.go @@ -0,0 +1,22 @@ +package store + +import ( + pruningtypes "cosmossdk.io/store/pruning/types" +) + +func DefaultConfig() *Config { + return &Config{ + Pruning: pruningtypes.PruningOptionDefault, + AppDBBackend: "", + PruningKeepRecent: 0, + PruningInterval: 0, + } +} + + +type Config struct { + Pruning string `mapstructure:"pruning" toml:"pruning"` + AppDBBackend string `mapstructure:"app-db-backend" toml:"app-db-backend"` + PruningKeepRecent uint64 `mapstructure:"pruning-keep-recent" toml:"pruning-keep-recent"` + PruningInterval uint64 `mapstructure:"pruning-interval" toml:"pruning-interval"` +} \ No newline at end of file diff --git a/server/v2/store/server.go b/server/v2/store/server.go index 3257694e6c5a..ab4e4d5ce2ca 100644 --- a/server/v2/store/server.go +++ b/server/v2/store/server.go @@ -11,7 +11,9 @@ import ( serverv2 "cosmossdk.io/server/v2" ) -type StoreComponent struct{} +type StoreComponent struct{ + config *Config +} func New() serverv2.ServerComponent[transaction.Tx] { return StoreComponent{} @@ -40,3 +42,11 @@ func (s StoreComponent) CLICommands(appCreator serverv2.AppCreator[transaction.T }, } } + +func (g StoreComponent) Config() any { + if g.config == nil || g.config == (&Config{}) { + return DefaultConfig() + } + + return g.config +} From 7b5fda6da0db3f9b65bbd0c9904a95f2c20531d3 Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Thu, 20 Jun 2024 21:47:49 +0700 Subject: [PATCH 14/62] read store config in Init --- server/v2/store/server.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/server/v2/store/server.go b/server/v2/store/server.go index ab4e4d5ce2ca..2c8a54a7fab8 100644 --- a/server/v2/store/server.go +++ b/server/v2/store/server.go @@ -2,6 +2,7 @@ package store import ( "context" + "fmt" "github.com/spf13/cobra" "github.com/spf13/viper" @@ -20,7 +21,13 @@ func New() serverv2.ServerComponent[transaction.Tx] { } func (s StoreComponent) Init(appI serverv2.AppI[transaction.Tx], v *viper.Viper, logger log.Logger) (serverv2.ServerComponent[transaction.Tx], error) { - return s, nil + cfg := DefaultConfig() + if v != nil { + if err := v.Sub(s.Name()).Unmarshal(&cfg); err != nil { + return StoreComponent{}, fmt.Errorf("failed to unmarshal config: %w", err) + } + } + return StoreComponent{config: cfg}, nil } func (s StoreComponent) Name() string { From 8071c9fc2ca7348bd5073e8f93b0fbf863aef673 Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Thu, 20 Jun 2024 21:48:53 +0700 Subject: [PATCH 15/62] update logic: read pruning options from flag or app.toml --- server/v2/store/commands.go | 56 ++++++++++++++++++++++++++++--------- 1 file changed, 43 insertions(+), 13 deletions(-) diff --git a/server/v2/store/commands.go b/server/v2/store/commands.go index cb52ab6cd4fe..d87976ea48a0 100644 --- a/server/v2/store/commands.go +++ b/server/v2/store/commands.go @@ -4,7 +4,6 @@ import ( "fmt" "strings" - "github.com/spf13/cast" "github.com/spf13/cobra" "github.com/spf13/viper" @@ -36,7 +35,7 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, Args: cobra.RangeArgs(0, 1), RunE: func(cmd *cobra.Command, args []string) error { // bind flags to the Context's Viper so we can get pruning options. - vp := serverv2.GetViperFromCmd(cmd) + vp := viper.New() if err := vp.BindPFlags(cmd.Flags()); err != nil { return err } @@ -44,13 +43,7 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, return err } - // use the first argument if present to set the pruning method - if len(args) > 0 { - vp.Set(FlagPruning, args[0]) - } else { - vp.Set(FlagPruning, pruningtypes.PruningOptionDefault) - } - pruningOptions, err := getPruningOptionsFromFlags(vp) + pruningOptions, err := getPruningOptionsFromCmd(cmd, args) if err != nil { return err } @@ -100,17 +93,54 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, return cmd } -func getPruningOptionsFromFlags(v *viper.Viper) (pruningtypes.PruningOptions, error) { - strategy := strings.ToLower(cast.ToString(v.Get(FlagPruning))) +func getPruningOptionsFromCmd(cmd *cobra.Command, args []string) (pruningtypes.PruningOptions, error) { + rootViper := serverv2.GetViperFromCmd(cmd) + + var pruning string + if len(args) > 0 { + // use the first argument if present to set the pruning method + pruning = args[0] + } else { + // If we not pass pruning option to the first argument, + // Get it from app.toml + // If we not do any modify to app.toml, should be default prune in there. + pruning = rootViper.GetString(FlagPruning) + } + + strategy := strings.ToLower(pruning) switch strategy { case pruningtypes.PruningOptionDefault, pruningtypes.PruningOptionNothing, pruningtypes.PruningOptionEverything: return pruningtypes.NewPruningOptionsFromString(strategy), nil case pruningtypes.PruningOptionCustom: + var ( + pruningKeepRecent uint64 + pruningInterval uint64 + err error + ) + + if cmd.Flags().Changed(FlagPruningKeepRecent) { + pruningKeepRecent, err = cmd.Flags().GetUint64(FlagPruningKeepRecent) + if err != nil { + return pruningtypes.PruningOptions{}, err + } + } else { + pruningKeepRecent = rootViper.GetUint64(FlagPruningKeepRecent) + } + + if cmd.Flags().Changed(FlagPruningInterval) { + pruningInterval, err = cmd.Flags().GetUint64(FlagPruningInterval) + if err != nil { + return pruningtypes.PruningOptions{}, err + } + } else { + pruningInterval = rootViper.GetUint64(FlagPruningInterval) + } + opts := pruningtypes.NewCustomPruningOptions( - cast.ToUint64(v.Get(FlagPruningKeepRecent)), - cast.ToUint64(v.Get(FlagPruningInterval)), + pruningKeepRecent, + pruningInterval, ) if err := opts.Validate(); err != nil { From b6a6cfe16aeff1bd091c3b2755c4ada2b47d8b8b Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Thu, 20 Jun 2024 21:51:13 +0700 Subject: [PATCH 16/62] lint --- server/v2/store/config.go | 9 ++++----- server/v2/store/server.go | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/server/v2/store/config.go b/server/v2/store/config.go index b065292fc2cd..5d482ccc19ae 100644 --- a/server/v2/store/config.go +++ b/server/v2/store/config.go @@ -6,17 +6,16 @@ import ( func DefaultConfig() *Config { return &Config{ - Pruning: pruningtypes.PruningOptionDefault, - AppDBBackend: "", + Pruning: pruningtypes.PruningOptionDefault, + AppDBBackend: "", PruningKeepRecent: 0, - PruningInterval: 0, + PruningInterval: 0, } } - type Config struct { Pruning string `mapstructure:"pruning" toml:"pruning"` AppDBBackend string `mapstructure:"app-db-backend" toml:"app-db-backend"` PruningKeepRecent uint64 `mapstructure:"pruning-keep-recent" toml:"pruning-keep-recent"` PruningInterval uint64 `mapstructure:"pruning-interval" toml:"pruning-interval"` -} \ No newline at end of file +} diff --git a/server/v2/store/server.go b/server/v2/store/server.go index 2c8a54a7fab8..bb458642bae5 100644 --- a/server/v2/store/server.go +++ b/server/v2/store/server.go @@ -12,7 +12,7 @@ import ( serverv2 "cosmossdk.io/server/v2" ) -type StoreComponent struct{ +type StoreComponent struct { config *Config } From e70f3db8411ab142a37d3bf4c83a2dde109ba317 Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Thu, 20 Jun 2024 21:56:20 +0700 Subject: [PATCH 17/62] go mod --- server/v2/store/go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/v2/store/go.mod b/server/v2/store/go.mod index 92ee241f9a8d..d4527f60c87a 100644 --- a/server/v2/store/go.mod +++ b/server/v2/store/go.mod @@ -27,7 +27,6 @@ require ( cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc cosmossdk.io/store/v2 v2.0.0-00010101000000-000000000000 github.com/cosmos/cosmos-sdk v0.51.0 - github.com/spf13/cast v1.6.0 github.com/spf13/cobra v1.8.1 github.com/spf13/viper v1.19.0 ) @@ -55,6 +54,7 @@ require ( github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/sourcegraph/conc v0.3.0 // indirect github.com/spf13/afero v1.11.0 // indirect + github.com/spf13/cast v1.6.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/subosito/gotenv v1.6.0 // indirect go.uber.org/multierr v1.11.0 // indirect From c6f36fe74191b9df4f388479dd72c502b22f2fbe Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Thu, 20 Jun 2024 23:02:09 +0700 Subject: [PATCH 18/62] make as pointer --- server/v2/store/commands.go | 2 +- server/v2/store/server.go | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/server/v2/store/commands.go b/server/v2/store/commands.go index d87976ea48a0..0f70f07cae3f 100644 --- a/server/v2/store/commands.go +++ b/server/v2/store/commands.go @@ -17,7 +17,7 @@ import ( ) // QueryBlockResultsCmd implements the default command for a BlockResults query. -func (s StoreComponent) PrunesCmd(appCreator serverv2.AppCreator[transaction.Tx]) *cobra.Command { +func (s *StoreComponent) PrunesCmd(appCreator serverv2.AppCreator[transaction.Tx]) *cobra.Command { cmd := &cobra.Command{ Use: "prune [pruning-method]", Short: "Prune app history states by keeping the recent heights and deleting old heights", diff --git a/server/v2/store/server.go b/server/v2/store/server.go index bb458642bae5..ee5972262c40 100644 --- a/server/v2/store/server.go +++ b/server/v2/store/server.go @@ -17,32 +17,33 @@ type StoreComponent struct { } func New() serverv2.ServerComponent[transaction.Tx] { - return StoreComponent{} + return &StoreComponent{} } -func (s StoreComponent) Init(appI serverv2.AppI[transaction.Tx], v *viper.Viper, logger log.Logger) (serverv2.ServerComponent[transaction.Tx], error) { +func (s *StoreComponent) Init(appI serverv2.AppI[transaction.Tx], v *viper.Viper, logger log.Logger) (serverv2.ServerComponent[transaction.Tx], error) { cfg := DefaultConfig() if v != nil { if err := v.Sub(s.Name()).Unmarshal(&cfg); err != nil { - return StoreComponent{}, fmt.Errorf("failed to unmarshal config: %w", err) + return &StoreComponent{}, fmt.Errorf("failed to unmarshal config: %w", err) } } - return StoreComponent{config: cfg}, nil + s.config = cfg + return s, nil } -func (s StoreComponent) Name() string { +func (s *StoreComponent) Name() string { return "store" } -func (s StoreComponent) Start(ctx context.Context) error { +func (s *StoreComponent) Start(ctx context.Context) error { return nil } -func (s StoreComponent) Stop(ctx context.Context) error { +func (s *StoreComponent) Stop(ctx context.Context) error { return nil } -func (s StoreComponent) CLICommands(appCreator serverv2.AppCreator[transaction.Tx]) serverv2.CLIConfig { +func (s *StoreComponent) CLICommands(appCreator serverv2.AppCreator[transaction.Tx]) serverv2.CLIConfig { return serverv2.CLIConfig{ Commands: []*cobra.Command{ s.PrunesCmd(appCreator), @@ -50,7 +51,7 @@ func (s StoreComponent) CLICommands(appCreator serverv2.AppCreator[transaction.T } } -func (g StoreComponent) Config() any { +func (g *StoreComponent) Config() any { if g.config == nil || g.config == (&Config{}) { return DefaultConfig() } From 323250aaf493d3f4ec956d874ba98b6149447145 Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Fri, 21 Jun 2024 18:04:56 +0700 Subject: [PATCH 19/62] Init only return err --- server/v2/store/server.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/v2/store/server.go b/server/v2/store/server.go index ee5972262c40..764f4e26365c 100644 --- a/server/v2/store/server.go +++ b/server/v2/store/server.go @@ -20,15 +20,15 @@ func New() serverv2.ServerComponent[transaction.Tx] { return &StoreComponent{} } -func (s *StoreComponent) Init(appI serverv2.AppI[transaction.Tx], v *viper.Viper, logger log.Logger) (serverv2.ServerComponent[transaction.Tx], error) { +func (s *StoreComponent) Init(appI serverv2.AppI[transaction.Tx], v *viper.Viper, logger log.Logger) error { cfg := DefaultConfig() if v != nil { if err := v.Sub(s.Name()).Unmarshal(&cfg); err != nil { - return &StoreComponent{}, fmt.Errorf("failed to unmarshal config: %w", err) + return fmt.Errorf("failed to unmarshal config: %w", err) } } s.config = cfg - return s, nil + return nil } func (s *StoreComponent) Name() string { From e0bc1d7313d142329bd1f723cff9f8eb3c45c9f9 Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Mon, 24 Jun 2024 18:30:12 +0700 Subject: [PATCH 20/62] remove v2/store go.mod --- server/v2/go.mod | 13 +- server/v2/go.sum | 20 +- server/v2/store/commands.go | 4 +- server/v2/store/go.mod | 72 -------- server/v2/store/go.sum | 358 ------------------------------------ 5 files changed, 23 insertions(+), 444 deletions(-) delete mode 100644 server/v2/store/go.mod delete mode 100644 server/v2/store/go.sum diff --git a/server/v2/go.mod b/server/v2/go.mod index 37d36c34aaba..9ff22e5cf087 100644 --- a/server/v2/go.mod +++ b/server/v2/go.mod @@ -10,6 +10,7 @@ replace ( cosmossdk.io/server/v2 => . cosmossdk.io/server/v2/appmanager => ./appmanager cosmossdk.io/server/v2/stf => ./stf + cosmossdk.io/store/v2 => ../../store/v2 cosmossdk.io/x/tx => ../../x/tx ) @@ -18,6 +19,8 @@ require ( cosmossdk.io/core v0.12.1-0.20231114100755-569e3ff6a0d7 cosmossdk.io/log v1.3.1 cosmossdk.io/server/v2/appmanager v0.0.0-00010101000000-000000000000 + cosmossdk.io/store v1.1.0 + cosmossdk.io/store/v2 v2.0.0-20240624103346-720c1086cb3f github.com/cosmos/cosmos-proto v1.0.0-beta.5 github.com/cosmos/gogogateway v1.2.0 github.com/cosmos/gogoproto v1.5.0 @@ -41,9 +44,11 @@ require ( ) require ( + cosmossdk.io/errors v1.0.1 // indirect github.com/DataDog/datadog-go v3.2.0+incompatible // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect + github.com/cosmos/ics23/go v0.10.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/fatih/color v1.15.0 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect @@ -51,12 +56,10 @@ require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect - github.com/hashicorp/go-uuid v1.0.1 // indirect github.com/hashicorp/golang-lru v1.0.2 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/hashicorp/yamux v0.1.1 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/jhump/protoreflect v1.15.3 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect @@ -67,7 +70,6 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/procfs v0.13.0 // indirect - github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/sagikazarmark/locafero v0.4.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/sourcegraph/conc v0.3.0 // indirect @@ -75,10 +77,11 @@ require ( github.com/spf13/cast v1.6.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect go.uber.org/multierr v1.11.0 // indirect + golang.org/x/crypto v0.24.0 // indirect golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect golang.org/x/net v0.25.0 // indirect - golang.org/x/sys v0.20.0 // indirect - golang.org/x/text v0.15.0 // indirect + golang.org/x/sys v0.21.0 // indirect + golang.org/x/text v0.16.0 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240513163218-0867130af1f8 // indirect diff --git a/server/v2/go.sum b/server/v2/go.sum index 9834b5ac704f..2cb4e05f71a2 100644 --- a/server/v2/go.sum +++ b/server/v2/go.sum @@ -1,5 +1,9 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= +cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= +cosmossdk.io/store v1.1.0 h1:LnKwgYMc9BInn9PhpTFEQVbL9UK475G2H911CGGnWHk= +cosmossdk.io/store v1.1.0/go.mod h1:oZfW/4Fc/zYqu3JmQcQdUJ3fqu5vnYTn3LZFFy8P8ng= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/DataDog/datadog-go v3.2.0+incompatible h1:qSG2N4FghB1He/r2mFrWKCaL7dXCilEuNEeAn20fdD4= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= @@ -12,8 +16,8 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24 github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/bufbuild/protocompile v0.6.0 h1:Uu7WiSQ6Yj9DbkdnOe7U4mNKp58y9WDMKDn28/ZlunY= -github.com/bufbuild/protocompile v0.6.0/go.mod h1:YNP35qEYoYGme7QMtz5SBCoN4kL4g12jTtjuzRNdjpE= +github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA= +github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= @@ -36,6 +40,8 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= +github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= +github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -251,6 +257,8 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI= +golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc h1:O9NuF4s+E/PvMIy+9IUZB9znFwUIXEWSstNjek6VpVg= golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc= @@ -309,16 +317,16 @@ golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= -golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= +golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/server/v2/store/commands.go b/server/v2/store/commands.go index 0f70f07cae3f..27816d7f3951 100644 --- a/server/v2/store/commands.go +++ b/server/v2/store/commands.go @@ -12,8 +12,6 @@ import ( serverv2 "cosmossdk.io/server/v2" pruningtypes "cosmossdk.io/store/pruning/types" storev2 "cosmossdk.io/store/v2" - - "github.com/cosmos/cosmos-sdk/version" ) // QueryBlockResultsCmd implements the default command for a BlockResults query. @@ -31,7 +29,7 @@ The pruning option is provided via the 'pruning' argument or alternatively with Note: When the --app-db-backend flag is not specified, the default backend type is 'goleveldb'. Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, - Example: fmt.Sprintf("%s prune custom --pruning-keep-recent 100 --app-db-backend 'goleveldb'", version.AppName), + Example: fmt.Sprintf("%s prune custom --pruning-keep-recent 100 --app-db-backend 'goleveldb'", ""), Args: cobra.RangeArgs(0, 1), RunE: func(cmd *cobra.Command, args []string) error { // bind flags to the Context's Viper so we can get pruning options. diff --git a/server/v2/store/go.mod b/server/v2/store/go.mod deleted file mode 100644 index d4527f60c87a..000000000000 --- a/server/v2/store/go.mod +++ /dev/null @@ -1,72 +0,0 @@ -module cosmossdk.io/server/v2/store - -go 1.22.2 - -replace ( - cosmossdk.io/api => ../../../api - cosmossdk.io/core => ../../../core - cosmossdk.io/core/testing => ../../../core/testing - cosmossdk.io/depinject => ../../../depinject - cosmossdk.io/log => ../../../log - cosmossdk.io/server/v2 => ../ - cosmossdk.io/server/v2/appmanager => ../appmanager - cosmossdk.io/store => ../../../store - cosmossdk.io/store/v2 => ../../../store/v2 - cosmossdk.io/x/accounts => ../../../x/accounts - cosmossdk.io/x/auth => ../../../x/auth - cosmossdk.io/x/bank => ../../../x/bank - cosmossdk.io/x/consensus => ../../../x/consensus - cosmossdk.io/x/staking => ../../../x/staking - github.com/cosmos/cosmos-sdk => ../../../ -) - -require ( - cosmossdk.io/core v0.12.1-0.20231114100755-569e3ff6a0d7 - cosmossdk.io/log v1.3.1 - cosmossdk.io/server/v2 v2.0.0-00010101000000-000000000000 - cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc - cosmossdk.io/store/v2 v2.0.0-00010101000000-000000000000 - github.com/cosmos/cosmos-sdk v0.51.0 - github.com/spf13/cobra v1.8.1 - github.com/spf13/viper v1.19.0 -) - -require ( - cosmossdk.io/errors v1.0.1 // indirect - cosmossdk.io/server/v2/appmanager v0.0.0-00010101000000-000000000000 // indirect - github.com/cosmos/gogoproto v1.5.0 // indirect - github.com/cosmos/ics23/go v0.10.0 // indirect - github.com/fsnotify/fsnotify v1.7.0 // indirect - github.com/google/go-cmp v0.6.0 // indirect - github.com/hashicorp/go-immutable-radix v1.3.1 // indirect - github.com/hashicorp/go-metrics v0.5.3 // indirect - github.com/hashicorp/golang-lru v1.0.2 // indirect - github.com/hashicorp/hcl v1.0.0 // indirect - github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/magiconair/properties v1.8.7 // indirect - github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.20 // indirect - github.com/mitchellh/mapstructure v1.5.0 // indirect - github.com/pelletier/go-toml/v2 v2.2.2 // indirect - github.com/pkg/errors v0.9.1 // indirect - github.com/rs/zerolog v1.33.0 // indirect - github.com/sagikazarmark/locafero v0.4.0 // indirect - github.com/sagikazarmark/slog-shim v0.1.0 // indirect - github.com/sourcegraph/conc v0.3.0 // indirect - github.com/spf13/afero v1.11.0 // indirect - github.com/spf13/cast v1.6.0 // indirect - github.com/spf13/pflag v1.0.5 // indirect - github.com/subosito/gotenv v1.6.0 // indirect - go.uber.org/multierr v1.11.0 // indirect - golang.org/x/crypto v0.24.0 // indirect - golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect - golang.org/x/sync v0.7.0 // indirect - golang.org/x/sys v0.21.0 // indirect - golang.org/x/text v0.16.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240515191416-fc5f0ca64291 // indirect - google.golang.org/grpc v1.64.0 // indirect - google.golang.org/protobuf v1.34.2 // indirect - gopkg.in/ini.v1 v1.67.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect - sigs.k8s.io/yaml v1.4.0 // indirect -) diff --git a/server/v2/store/go.sum b/server/v2/store/go.sum deleted file mode 100644 index 98890a24c651..000000000000 --- a/server/v2/store/go.sum +++ /dev/null @@ -1,358 +0,0 @@ -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.1-20240312114316-c0d3497e35d6.1 h1:lBlYy54lX1iBjFhbkd13bWlH7dMnoiyENzZ0Wok1YH4= -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.1-20240312114316-c0d3497e35d6.1/go.mod h1:fYP6DZCfO5Ex4U+Xq1PqQwB8NQQhW5Y+Qbyzd/7dw7o= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.1-20240130113600-88ef6483f90f.1 h1:MfK7sTqm7NFqM/GOuuKOOemQzW8P7z07YQIW0vsYr38= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.1-20240130113600-88ef6483f90f.1/go.mod h1:RigkrxrsA6FPZontmsidcr0WGWF8zNFYleIktv6XdLc= -cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= -cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= -cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= -cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= -cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= -cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= -cosmossdk.io/x/tx v0.13.3 h1:Ha4mNaHmxBc6RMun9aKuqul8yHiL78EKJQ8g23Zf73g= -cosmossdk.io/x/tx v0.13.3/go.mod h1:I8xaHv0rhUdIvIdptKIqzYy27+n2+zBVaxO6fscFhys= -filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= -filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= -github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= -github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN7oaIRCjzsZ2dE+yG5k+rsdt3qcwykqK6HVGcKwsw4= -github.com/99designs/keyring v1.2.2 h1:pZd3neh/EmUzWONb35LxQfvuY7kiSXAq3HQd97+XBn0= -github.com/99designs/keyring v1.2.2/go.mod h1:wes/FrByc8j7lFOAGLGSNEg8f/PaI3cgTBqhFkHUrPk= -github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= -github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= -github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= -github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= -github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 h1:41iFGWnSlI2gVpmOtVTJZNodLdLQLn/KsJqFvXwnd/s= -github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/btcsuite/btcd/btcec/v2 v2.3.3 h1:6+iXlDKE8RMtKsvK0gshlXIuPbyWM/h84Ensb7o3sC0= -github.com/btcsuite/btcd/btcec/v2 v2.3.3/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= -github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= -github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= -github.com/cockroachdb/errors v1.11.1 h1:xSEW75zKaKCWzR3OfxXUxgrk/NtT4G1MiOv5lWZazG8= -github.com/cockroachdb/errors v1.11.1/go.mod h1:8MUxA3Gi6b25tYlFEBGLf+D8aISL+M4MIpiWMSNRfxw= -github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= -github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= -github.com/cockroachdb/pebble v1.1.0 h1:pcFh8CdCIt2kmEpK0OIatq67Ln9uGDYY3d5XnE0LJG4= -github.com/cockroachdb/pebble v1.1.0/go.mod h1:sEHm5NOXxyiAoKWhoFxT8xMgd/f3RA6qUqQ1BXKrh2E= -github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= -github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= -github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= -github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= -github.com/cometbft/cometbft v1.0.0-alpha.2.0.20240530055211-ae27f7eb3c08 h1:xW0les/5Lr+4qVsOYDDwl5Utj8uouvv69hEtiavHJ2M= -github.com/cometbft/cometbft v1.0.0-alpha.2.0.20240530055211-ae27f7eb3c08/go.mod h1:8uXGKqp5yPmNSbU81K/669E3rfO3H+juGkYKCPTnAtY= -github.com/cometbft/cometbft-db v0.12.0 h1:v77/z0VyfSU7k682IzZeZPFZrQAKiQwkqGN0QzAjMi0= -github.com/cometbft/cometbft-db v0.12.0/go.mod h1:aX2NbCrjNVd2ZajYxt1BsiFf/Z+TQ2MN0VxdicheYuw= -github.com/cometbft/cometbft/api v1.0.0-rc.1 h1:GtdXwDGlqwHYs16A4egjwylfYOMYyEacLBrs3Zvpt7g= -github.com/cometbft/cometbft/api v1.0.0-rc.1/go.mod h1:NDFKiBBD8HJC6QQLAoUI99YhsiRZtg2+FJWfk6A6m6o= -github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= -github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= -github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAKs= -github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= -github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= -github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= -github.com/cosmos/crypto v0.0.0-20240309083813-82ed2537802e h1:Zk4OsfLBN+0WOfH15Hg/aAYsSP7IuZQC6RZjewPuITw= -github.com/cosmos/crypto v0.0.0-20240309083813-82ed2537802e/go.mod h1:0KOK/XVzL5lj9x+NyJ7lWuJYl6F0Wd7JMVYM06bVQsc= -github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= -github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= -github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= -github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= -github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= -github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= -github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= -github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= -github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= -github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= -github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/danieljoos/wincred v1.2.1 h1:dl9cBrupW8+r5250DYkYxocLeZ1Y4vB1kxgtjxw8GQs= -github.com/danieljoos/wincred v1.2.1/go.mod h1:uGaFL9fDn3OLTvzCGulzE+SzjEe5NGlh5FdCcyfPwps= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 h1:rpfIENRNNilwHwZeG5+P150SMrnNEcHYvcCuK6dPZSg= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= -github.com/dgraph-io/badger/v4 v4.2.0 h1:kJrlajbXXL9DFTNuhhu9yCx7JJa4qpYWxtE8BzuWsEs= -github.com/dgraph-io/badger/v4 v4.2.0/go.mod h1:qfCqhPoWDFJRx1gp5QwwyGo8xk1lbHUxvK9nK0OGAak= -github.com/dgraph-io/ristretto v0.1.1 h1:6CWw5tJNgpegArSHpNHJKldNeq03FQCwYvfMVWajOK8= -github.com/dgraph-io/ristretto v0.1.1/go.mod h1:S1GPSBCYCIhmVNfcth17y2zZtQT6wzkzgwUve0VDWWA= -github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= -github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= -github.com/dvsekhvalnov/jose2go v1.6.0 h1:Y9gnSnP4qEI0+/uQkHvFXeD2PLPJeXEL+ySMEA2EjTY= -github.com/dvsekhvalnov/jose2go v1.6.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU= -github.com/emicklei/dot v1.6.2 h1:08GN+DD79cy/tzN6uLCT84+2Wk9u+wvqP+Hkx/dIR8A= -github.com/emicklei/dot v1.6.2/go.mod h1:DeV7GvQtIw4h2u73RKBkkFdvVAz0D9fzeJrgPW6gy/s= -github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= -github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= -github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= -github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= -github.com/getsentry/sentry-go v0.27.0 h1:Pv98CIbtB3LkMWmXi4Joa5OOcwbmnX88sF5qbK3r3Ps= -github.com/getsentry/sentry-go v0.27.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.13.0 h1:OoneCcHKHQ03LfBpoQCUfCluwd2Vt3ohz+kvbJneZAU= -github.com/go-kit/kit v0.13.0/go.mod h1:phqEHMMUbyrCFCTgH48JueqrM3md2HcAZ8N3XE4FKDg= -github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU= -github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4= -github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= -github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= -github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= -github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang/glog v1.2.0 h1:uCdmnmatrKCgMBlM4rMuJZWOkPDqdbZPnrMXDY4gI68= -github.com/golang/glog v1.2.0/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= -github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= -github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= -github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= -github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= -github.com/google/flatbuffers v2.0.8+incompatible h1:ivUb1cGomAB101ZM1T0nOiWz9pSrTMoa9+EiY7igmkM= -github.com/google/flatbuffers v2.0.8+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= -github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= -github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= -github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= -github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-metrics v0.5.3 h1:M5uADWMOGCTUNU1YuC4hfknOeHNaX54LDm4oYSucoNE= -github.com/hashicorp/go-metrics v0.5.3/go.mod h1:KEjodfebIOuBYSAe/bHTm+HChmKSxAOXPBieMLYozDE= -github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= -github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE= -github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c= -github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= -github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hdevalence/ed25519consensus v0.2.0 h1:37ICyZqdyj0lAZ8P4D1d1id3HqbbG1N3iBb1Tb4rdcU= -github.com/hdevalence/ed25519consensus v0.2.0/go.mod h1:w3BHWjwJbFU29IRHL1Iqkw3sus+7FctEyM4RqDxYNzo= -github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI= -github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= -github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= -github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= -github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= -github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= -github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= -github.com/linxGnu/grocksdb v1.8.14 h1:HTgyYalNwBSG/1qCQUIott44wU5b2Y9Kr3z7SK5OfGQ= -github.com/linxGnu/grocksdb v1.8.14/go.mod h1:QYiYypR2d4v63Wj1adOOfzglnoII0gLj3PNh4fZkcFA= -github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= -github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= -github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= -github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= -github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= -github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/mtibben/percent v0.2.1 h1:5gssi8Nqo8QU/r2pynCm+hBQHpkB/uNK7BJCFogWdzs= -github.com/mtibben/percent v0.2.1/go.mod h1:KG9uO+SZkUp+VkRHsCdYQV3XSZrrSpR3O9ibNBTZrns= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a h1:dlRvE5fWabOchtH7znfiFCcOvmIYgOeAS5ifBXBlh9Q= -github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a/go.mod h1:hVoHR2EVESiICEMbg137etN/Lx+lSrHPTD39Z/uE+2s= -github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= -github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= -github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= -github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba h1:3jPgmsFGBID1wFfU2AbYocNcN4wqU68UaHSdMjiw/7U= -github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= -github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= -github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= -github.com/prometheus/common v0.54.0 h1:ZlZy0BgJhTwVZUn7dLOkwCZHUkrAqd3WYtcFCWnM1D8= -github.com/prometheus/common v0.54.0/go.mod h1:/TQgMJP5CuVYveyT7n/0Ix8yLNNXy9yRSkhnLTHPDIQ= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= -github.com/prometheus/procfs v0.14.0 h1:Lw4VdGGoKEZilJsayHf0B+9YgLGREba2C6xr+Fdfq6s= -github.com/prometheus/procfs v0.14.0/go.mod h1:XL+Iwz8k8ZabyZfMFHPiilCniixqQarAy5Mu67pHlNQ= -github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= -github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= -github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= -github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= -github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= -github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= -github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= -github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= -github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= -github.com/sasha-s/go-deadlock v0.3.1 h1:sqv7fDNShgjcaxkO0JNcOAlr8B9+cV5Ey/OB71efZx0= -github.com/sasha-s/go-deadlock v0.3.1/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= -github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= -github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= -github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= -github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= -github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= -github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= -github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI= -github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= -github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= -github.com/supranational/blst v0.3.11 h1:LyU6FolezeWAhvQk0k6O/d49jqgO52MSDDfYgbeoEm4= -github.com/supranational/blst v0.3.11/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= -github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d h1:vfofYNRScrDdvS342BElfbETmL1Aiz3i2t0zfRj16Hs= -github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48= -github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E= -github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= -github.com/tidwall/btree v1.7.0 h1:L1fkJH/AuEh5zBnnBbmTwQ5Lt+bRJ5A8EWecslvo9iI= -github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= -github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= -github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= -github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= -github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= -github.com/zondax/ledger-go v0.14.3/go.mod h1:IKKaoxupuB43g4NxeQmbLXv7T9AlQyie1UpHb342ycI= -gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b h1:CzigHMRySiX3drau9C6Q5CAbNIApmLdat5jPMqChvDA= -gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b/go.mod h1:/y/V339mxv2sZmYYR64O07VuCpdNZqCTwO8ZcouTMI8= -gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 h1:qwDnMxjkyLmAFgcfgTnfJrmYKWhHnci3GjDqcZp1M3Q= -gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02/go.mod h1:JTnUj0mpYiAsuZLmKjTx/ex3AtMowcCgnE7YNyCEP0I= -go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5 h1:qxen9oVGzDdIRP6ejyAJc760RwW4SnVDiTYTzwnXuxo= -go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5/go.mod h1:eW0HG9/oHQhvRCvb1/pIXW4cOvtDqeQK+XSi3TnwaXY= -go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= -go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= -go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI= -golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= -golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc h1:O9NuF4s+E/PvMIy+9IUZB9znFwUIXEWSstNjek6VpVg= -golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= -golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= -golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= -golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.21.0 h1:WVXCp+/EBEHOj53Rvu+7KiT/iElMrO8ACK16SMZ3jaA= -golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY= -google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo= -google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237 h1:RFiFrvy37/mpSpdySBDrUdipW/dHwsRwh3J3+A9VgT4= -google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237/go.mod h1:Z5Iiy3jtmioajWHDGFk7CeugTyHtPvMHA4UTmUkyalE= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240515191416-fc5f0ca64291 h1:AgADTJarZTBqgjiUzRgfaBchgYB3/WFTC80GPwsMcRI= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240515191416-fc5f0ca64291/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= -google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY= -google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg= -google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= -gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= -gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= -pgregory.net/rapid v1.1.0 h1:CMa0sjHSru3puNx+J0MIAuiiEV4N0qj8/cMWGBBCsjw= -pgregory.net/rapid v1.1.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= -sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= -sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= From feb346d181df7a7be79e7f5c02eb6f1ca3fa6542 Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Mon, 24 Jun 2024 18:30:26 +0700 Subject: [PATCH 21/62] simapp go mod tidy --- simapp/v2/go.mod | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/simapp/v2/go.mod b/simapp/v2/go.mod index 16f547e3e1f5..20352e8d966e 100644 --- a/simapp/v2/go.mod +++ b/simapp/v2/go.mod @@ -12,7 +12,6 @@ require ( cosmossdk.io/runtime/v2 v2.0.0-00010101000000-000000000000 cosmossdk.io/server/v2 v2.0.0-00010101000000-000000000000 cosmossdk.io/server/v2/cometbft v0.0.0-00010101000000-000000000000 - cosmossdk.io/server/v2/store v0.0.0-00010101000000-000000000000 cosmossdk.io/store/v2 v2.0.0 cosmossdk.io/x/accounts v0.0.0-20240226161501-23359a0b6d91 cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 @@ -297,7 +296,7 @@ replace ( cosmossdk.io/server/v2/appmanager => ../../server/v2/appmanager cosmossdk.io/server/v2/cometbft => ../../server/v2/cometbft cosmossdk.io/server/v2/stf => ../../server/v2/stf - cosmossdk.io/server/v2/store => ../../server/v2/store + // cosmossdk.io/server/v2/store => ../../server/v2/store cosmossdk.io/store => ../../store cosmossdk.io/store/v2 => ../../store/v2 ) From ace696d4072dc0cb7d3579c9c8a23f0e87d313bc Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Mon, 24 Jun 2024 23:51:44 +0700 Subject: [PATCH 22/62] upstream prune v1 options helper --- store/v2/options.go | 66 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/store/v2/options.go b/store/v2/options.go index 40467f76e3c2..0bc5a8bcde9a 100644 --- a/store/v2/options.go +++ b/store/v2/options.go @@ -1,5 +1,10 @@ package store +import ( + "errors" + "fmt" +) + // PruneOptions defines the pruning configuration. type PruneOptions struct { // KeepRecent sets the number of recent versions to keep. @@ -10,6 +15,67 @@ type PruneOptions struct { Interval uint64 } +// Pruning option string constants +const ( + PruningOptionDefault = "default" + PruningOptionEverything = "everything" + PruningOptionNothing = "nothing" + PruningOptionCustom = "custom" +) + +const ( + pruneEverythingKeepRecent = 2 + pruneEverythingInterval = 10 +) + +var ( + ErrPruningIntervalZero = errors.New("'pruning-interval' must not be 0. If you want to disable pruning, select pruning = \"nothing\"") + ErrPruningIntervalTooSmall = fmt.Errorf("'pruning-interval' must not be less than %d. For the most aggressive pruning, select pruning = \"everything\"", pruneEverythingInterval) + ErrPruningKeepRecentTooSmall = fmt.Errorf("'pruning-keep-recent' must not be less than %d. For the most aggressive pruning, select pruning = \"everything\"", pruneEverythingKeepRecent) +) + +func NewPruneOptions(pruningOption string) *PruneOptions { + switch pruningOption { + case PruningOptionDefault: + return &PruneOptions{ + KeepRecent: 362880, + Interval: 10, + } + case PruningOptionEverything: + return &PruneOptions{ + KeepRecent: pruneEverythingKeepRecent, + Interval: pruneEverythingInterval, + } + case PruningOptionNothing: + return &PruneOptions{ + KeepRecent: 0, + Interval: 0, + } + default: + return &PruneOptions{} + } +} + +func NewCustomPruneOptions(keepRecent, interval uint64) *PruneOptions { + return &PruneOptions{ + KeepRecent: keepRecent, + Interval: interval, + } +} + +func (po *PruneOptions) Validate() error { + if po.Interval == 0 { + return ErrPruningIntervalZero + } + if po.Interval < pruneEverythingInterval { + return ErrPruningIntervalTooSmall + } + if po.KeepRecent < pruneEverythingKeepRecent { + return ErrPruningKeepRecentTooSmall + } + return nil +} + // DefaultPruneOptions returns the default pruning options. // Interval is set to 0, which means no pruning will be done. func DefaultPruneOptions() *PruneOptions { From 1bd995dad99db6105ff7a41eb6ae5e58bfb336ba Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Mon, 24 Jun 2024 23:52:06 +0700 Subject: [PATCH 23/62] address comment --- server/v2/store/commands.go | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/server/v2/store/commands.go b/server/v2/store/commands.go index 27816d7f3951..816bc197cb88 100644 --- a/server/v2/store/commands.go +++ b/server/v2/store/commands.go @@ -10,7 +10,6 @@ import ( "cosmossdk.io/core/transaction" "cosmossdk.io/log" serverv2 "cosmossdk.io/server/v2" - pruningtypes "cosmossdk.io/store/pruning/types" storev2 "cosmossdk.io/store/v2" ) @@ -47,7 +46,7 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, } cmd.Printf("get pruning options from command flags, strategy: %v, keep-recent: %v\n", - pruningOptions.Strategy, + args[0], pruningOptions.KeepRecent, ) @@ -91,7 +90,7 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, return cmd } -func getPruningOptionsFromCmd(cmd *cobra.Command, args []string) (pruningtypes.PruningOptions, error) { +func getPruningOptionsFromCmd(cmd *cobra.Command, args []string) (*storev2.PruneOptions, error) { rootViper := serverv2.GetViperFromCmd(cmd) var pruning string @@ -108,10 +107,10 @@ func getPruningOptionsFromCmd(cmd *cobra.Command, args []string) (pruningtypes.P strategy := strings.ToLower(pruning) switch strategy { - case pruningtypes.PruningOptionDefault, pruningtypes.PruningOptionNothing, pruningtypes.PruningOptionEverything: - return pruningtypes.NewPruningOptionsFromString(strategy), nil + case storev2.PruningOptionDefault, storev2.PruningOptionNothing, storev2.PruningOptionEverything: + return storev2.NewPruneOptions(strategy), nil - case pruningtypes.PruningOptionCustom: + case storev2.PruningOptionCustom: var ( pruningKeepRecent uint64 pruningInterval uint64 @@ -121,7 +120,7 @@ func getPruningOptionsFromCmd(cmd *cobra.Command, args []string) (pruningtypes.P if cmd.Flags().Changed(FlagPruningKeepRecent) { pruningKeepRecent, err = cmd.Flags().GetUint64(FlagPruningKeepRecent) if err != nil { - return pruningtypes.PruningOptions{}, err + return &storev2.PruneOptions{}, err } } else { pruningKeepRecent = rootViper.GetUint64(FlagPruningKeepRecent) @@ -130,13 +129,13 @@ func getPruningOptionsFromCmd(cmd *cobra.Command, args []string) (pruningtypes.P if cmd.Flags().Changed(FlagPruningInterval) { pruningInterval, err = cmd.Flags().GetUint64(FlagPruningInterval) if err != nil { - return pruningtypes.PruningOptions{}, err + return &storev2.PruneOptions{}, err } } else { pruningInterval = rootViper.GetUint64(FlagPruningInterval) } - opts := pruningtypes.NewCustomPruningOptions( + opts := storev2.NewCustomPruneOptions( pruningKeepRecent, pruningInterval, ) @@ -148,6 +147,6 @@ func getPruningOptionsFromCmd(cmd *cobra.Command, args []string) (pruningtypes.P return opts, nil default: - return pruningtypes.PruningOptions{}, fmt.Errorf("unknown pruning strategy %s", strategy) + return &storev2.PruneOptions{}, fmt.Errorf("unknown pruning strategy %s", strategy) } } From 50990843a1bbc3ad40ac0ec8b6df6012f45e2d13 Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Mon, 24 Jun 2024 23:57:02 +0700 Subject: [PATCH 24/62] go mod tidy --- server/v2/cometbft/go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/v2/cometbft/go.mod b/server/v2/cometbft/go.mod index 6e92622a21c8..0a8bb510ecd3 100644 --- a/server/v2/cometbft/go.mod +++ b/server/v2/cometbft/go.mod @@ -27,7 +27,7 @@ require ( cosmossdk.io/errors v1.0.1 cosmossdk.io/server/v2 v2.0.0-00010101000000-000000000000 cosmossdk.io/server/v2/appmanager v0.0.0-00010101000000-000000000000 - cosmossdk.io/store/v2 v2.0.0-00010101000000-000000000000 + cosmossdk.io/store/v2 v2.0.0-20240624103346-720c1086cb3f cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 cosmossdk.io/x/consensus v0.0.0-00010101000000-000000000000 github.com/cometbft/cometbft v1.0.0-alpha.2.0.20240530055211-ae27f7eb3c08 From a70891c43d0f78d1671a847fac136baf092f4d27 Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Tue, 25 Jun 2024 01:59:21 +0700 Subject: [PATCH 25/62] lint --- store/v2/options.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/store/v2/options.go b/store/v2/options.go index 0bc5a8bcde9a..b60d56982b79 100644 --- a/store/v2/options.go +++ b/store/v2/options.go @@ -52,7 +52,7 @@ func NewPruneOptions(pruningOption string) *PruneOptions { Interval: 0, } default: - return &PruneOptions{} + return &PruneOptions{} } } From 355e8e22f273b57b1bb7151ea26168e48b053824 Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Tue, 25 Jun 2024 02:02:29 +0700 Subject: [PATCH 26/62] remove store v1 --- server/v2/go.mod | 2 +- server/v2/go.sum | 6 ++---- server/v2/store/config.go | 4 ++-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/server/v2/go.mod b/server/v2/go.mod index 9ff22e5cf087..a132b4bcaec5 100644 --- a/server/v2/go.mod +++ b/server/v2/go.mod @@ -19,7 +19,6 @@ require ( cosmossdk.io/core v0.12.1-0.20231114100755-569e3ff6a0d7 cosmossdk.io/log v1.3.1 cosmossdk.io/server/v2/appmanager v0.0.0-00010101000000-000000000000 - cosmossdk.io/store v1.1.0 cosmossdk.io/store/v2 v2.0.0-20240624103346-720c1086cb3f github.com/cosmos/cosmos-proto v1.0.0-beta.5 github.com/cosmos/gogogateway v1.2.0 @@ -60,6 +59,7 @@ require ( github.com/hashicorp/hcl v1.0.0 // indirect github.com/hashicorp/yamux v0.1.1 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/jhump/protoreflect v1.15.3 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect diff --git a/server/v2/go.sum b/server/v2/go.sum index 2cb4e05f71a2..e53a9697a2df 100644 --- a/server/v2/go.sum +++ b/server/v2/go.sum @@ -2,8 +2,6 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= -cosmossdk.io/store v1.1.0 h1:LnKwgYMc9BInn9PhpTFEQVbL9UK475G2H911CGGnWHk= -cosmossdk.io/store v1.1.0/go.mod h1:oZfW/4Fc/zYqu3JmQcQdUJ3fqu5vnYTn3LZFFy8P8ng= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/DataDog/datadog-go v3.2.0+incompatible h1:qSG2N4FghB1He/r2mFrWKCaL7dXCilEuNEeAn20fdD4= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= @@ -16,8 +14,8 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24 github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA= -github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8= +github.com/bufbuild/protocompile v0.6.0 h1:Uu7WiSQ6Yj9DbkdnOe7U4mNKp58y9WDMKDn28/ZlunY= +github.com/bufbuild/protocompile v0.6.0/go.mod h1:YNP35qEYoYGme7QMtz5SBCoN4kL4g12jTtjuzRNdjpE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= diff --git a/server/v2/store/config.go b/server/v2/store/config.go index 5d482ccc19ae..a6947af4bd59 100644 --- a/server/v2/store/config.go +++ b/server/v2/store/config.go @@ -1,12 +1,12 @@ package store import ( - pruningtypes "cosmossdk.io/store/pruning/types" + storev2 "cosmossdk.io/store/v2" ) func DefaultConfig() *Config { return &Config{ - Pruning: pruningtypes.PruningOptionDefault, + Pruning: storev2.PruningOptionDefault, AppDBBackend: "", PruningKeepRecent: 0, PruningInterval: 0, From 46334c8956730c03feaede9360f25ab4b626dd9f Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Tue, 25 Jun 2024 17:25:00 +0700 Subject: [PATCH 27/62] unused --- simapp/v2/go.mod | 1 - 1 file changed, 1 deletion(-) diff --git a/simapp/v2/go.mod b/simapp/v2/go.mod index 20352e8d966e..60497acc20d6 100644 --- a/simapp/v2/go.mod +++ b/simapp/v2/go.mod @@ -296,7 +296,6 @@ replace ( cosmossdk.io/server/v2/appmanager => ../../server/v2/appmanager cosmossdk.io/server/v2/cometbft => ../../server/v2/cometbft cosmossdk.io/server/v2/stf => ../../server/v2/stf - // cosmossdk.io/server/v2/store => ../../server/v2/store cosmossdk.io/store => ../../store cosmossdk.io/store/v2 => ../../store/v2 ) From 0c28588b0239db3a9758c977ee2c7bf8e206fccd Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Wed, 26 Jun 2024 15:20:18 +0700 Subject: [PATCH 28/62] move AppI, AppCreator, CLIConfig to core/server --- core/go.mod | 21 +++++++++++-- core/go.sum | 58 +++++++++++++++++++++++++++++++---- core/server/types.go | 31 +++++++++++++++++++ runtime/v2/app.go | 2 +- server/v2/api/grpc/server.go | 4 +-- server/v2/cometbft/server.go | 13 +++++--- server/v2/commands.go | 7 +++-- server/v2/config.go | 14 --------- server/v2/go.mod | 7 ++--- server/v2/go.sum | 6 ---- server/v2/server.go | 11 ++++--- server/v2/server_mock_test.go | 4 +-- server/v2/server_test.go | 3 +- server/v2/types.go | 19 ------------ 14 files changed, 130 insertions(+), 70 deletions(-) create mode 100644 core/server/types.go delete mode 100644 server/v2/types.go diff --git a/core/go.mod b/core/go.mod index 5adbe9d79219..73abc332a58f 100644 --- a/core/go.mod +++ b/core/go.mod @@ -4,6 +4,8 @@ go 1.20 require ( github.com/cosmos/gogoproto v1.5.0 + github.com/spf13/cobra v1.8.1 + github.com/spf13/viper v1.19.0 github.com/stretchr/testify v1.9.0 google.golang.org/grpc v1.64.0 google.golang.org/protobuf v1.34.2 @@ -11,15 +13,30 @@ require ( require ( github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/google/go-cmp v0.6.0 // indirect - github.com/kr/pretty v0.3.1 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/hashicorp/hcl v1.0.0 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/magiconair/properties v1.8.7 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/pelletier/go-toml/v2 v2.2.2 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect + github.com/sagikazarmark/locafero v0.4.0 // indirect + github.com/sagikazarmark/slog-shim v0.1.0 // indirect + github.com/sourcegraph/conc v0.3.0 // indirect + github.com/spf13/afero v1.11.0 // indirect + github.com/spf13/cast v1.6.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect + github.com/subosito/gotenv v1.6.0 // indirect + go.uber.org/atomic v1.9.0 // indirect + go.uber.org/multierr v1.9.0 // indirect golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect golang.org/x/net v0.25.0 // indirect golang.org/x/sys v0.20.0 // indirect golang.org/x/text v0.15.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240513163218-0867130af1f8 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect + gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/core/go.sum b/core/go.sum index 554ff253ccf6..a3a0b7dccd2c 100644 --- a/core/go.sum +++ b/core/go.sum @@ -1,26 +1,69 @@ github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= +github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= +github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= +github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= +github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= +github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= +github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= +github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= +github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= +github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= +github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= +github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= +github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= +github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= +github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= +github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI= +github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= +github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= +go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= +go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= +go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI= golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo= golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= @@ -38,5 +81,8 @@ google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWn gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= +gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/core/server/types.go b/core/server/types.go new file mode 100644 index 000000000000..4d5f03fb9f79 --- /dev/null +++ b/core/server/types.go @@ -0,0 +1,31 @@ +package server + +import ( + "github.com/spf13/cobra" + "github.com/spf13/viper" + + coreapp "cosmossdk.io/core/app" + "cosmossdk.io/core/log" + "cosmossdk.io/core/transaction" +) + +type AppCreator[T transaction.Tx] func(log.Logger, *viper.Viper) AppI[T] + +type AppI[T transaction.Tx] interface { + GetAppManager() any + GetConsensusAuthority() string + InterfaceRegistry() coreapp.InterfaceRegistry + GetStore() any +} + +// CLIConfig defines the CLI configuration for a module server. +type CLIConfig struct { + // Commands defines the main command of a module server. + Commands []*cobra.Command + // Queries defines the query commands of a module server. + // Those commands are meant to be added in the root query command. + Queries []*cobra.Command + // Txs defines the tx commands of a module server. + // Those commands are meant to be added in the root tx command. + Txs []*cobra.Command +} \ No newline at end of file diff --git a/runtime/v2/app.go b/runtime/v2/app.go index 3f7f042e6a40..e97e2aa94b50 100644 --- a/runtime/v2/app.go +++ b/runtime/v2/app.go @@ -127,6 +127,6 @@ func (a *App) ExecuteGenesisTx(_ []byte) error { panic("App.ExecuteGenesisTx not supported in runtime/v2") } -func (a *App) GetAppManager() *appmanager.AppManager[transaction.Tx] { +func (a *App) GetAppManager() any { return a.AppManager } diff --git a/server/v2/api/grpc/server.go b/server/v2/api/grpc/server.go index 7b9d62e31675..dacf8a7e587c 100644 --- a/server/v2/api/grpc/server.go +++ b/server/v2/api/grpc/server.go @@ -15,9 +15,9 @@ import ( _ "cosmossdk.io/api/amino" // Import amino.proto file for reflection appmanager "cosmossdk.io/core/app" + servercore "cosmossdk.io/core/server" "cosmossdk.io/core/transaction" "cosmossdk.io/log" - serverv2 "cosmossdk.io/server/v2" "cosmossdk.io/server/v2/api/grpc/gogoreflection" ) @@ -41,7 +41,7 @@ func New() *GRPCServer { // Init returns a correctly configured and initialized gRPC server. // Note, the caller is responsible for starting the server. -func (g *GRPCServer) Init(appI serverv2.AppI[transaction.Tx], v *viper.Viper, logger log.Logger) error { +func (g *GRPCServer) Init(appI servercore.AppI[transaction.Tx], v *viper.Viper, logger log.Logger) error { cfg := DefaultConfig() if v != nil { if err := v.Sub(serverName).Unmarshal(&cfg); err != nil { diff --git a/server/v2/cometbft/server.go b/server/v2/cometbft/server.go index 1ba01c414daa..f52bf53d177e 100644 --- a/server/v2/cometbft/server.go +++ b/server/v2/cometbft/server.go @@ -29,6 +29,7 @@ import ( "cosmossdk.io/server/v2/cometbft/types" "cosmossdk.io/store/v2/snapshots" + servercore "cosmossdk.io/core/server" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" ) @@ -70,7 +71,7 @@ func New[T transaction.Tx](txCodec transaction.Codec[T]) *CometBFTServer[T] { } } -func (s *CometBFTServer[T]) Init(appI serverv2.AppI[T], v *viper.Viper, logger log.Logger) error { +func (s *CometBFTServer[T]) Init(appI servercore.AppI[T], v *viper.Viper, logger log.Logger) error { store := appI.GetStore().(types.Store) cfg := Config{CmtConfig: GetConfigFromViper(v), ConsensusAuthority: appI.GetConsensusAuthority()} @@ -81,7 +82,11 @@ func (s *CometBFTServer[T]) Init(appI serverv2.AppI[T], v *viper.Viper, logger l // create consensus // txCodec should be in server from New() - consensus := NewConsensus[T](appI.GetAppManager(), mempool, store, cfg, s.App.txCodec, logger) + appManager, ok := appI.GetAppManager().(*appmanager.AppManager[T]) + if !ok { + return fmt.Errorf("Can not get appManager") + } + consensus := NewConsensus[T](appManager, mempool, store, cfg, s.App.txCodec, logger) consensus.SetPrepareProposalHandler(handlers.NoOpPrepareProposal[T]()) consensus.SetProcessProposalHandler(handlers.NoOpProcessProposal[T]()) @@ -211,8 +216,8 @@ func (s *CometBFTServer[T]) StartCmdFlags() pflag.FlagSet { return flags } -func (s *CometBFTServer[T]) CLICommands(_ serverv2.AppCreator[T]) serverv2.CLIConfig { - return serverv2.CLIConfig{ +func (s *CometBFTServer[T]) CLICommands(_ servercore.AppCreator[T]) servercore.CLIConfig { + return servercore.CLIConfig{ Commands: []*cobra.Command{ s.StatusCommand(), s.ShowNodeIDCmd(), diff --git a/server/v2/commands.go b/server/v2/commands.go index 0bc47f18ffaa..f2a5fd647584 100644 --- a/server/v2/commands.go +++ b/server/v2/commands.go @@ -11,13 +11,14 @@ import ( "github.com/spf13/cobra" + servercore "cosmossdk.io/core/server" "cosmossdk.io/core/transaction" "cosmossdk.io/log" ) -func Commands(rootCmd *cobra.Command, newApp AppCreator[transaction.Tx], logger log.Logger, components ...ServerComponent[transaction.Tx]) (CLIConfig, error) { +func Commands(rootCmd *cobra.Command, newApp servercore.AppCreator[transaction.Tx], logger log.Logger, components ...ServerComponent[transaction.Tx]) (servercore.CLIConfig, error) { if len(components) == 0 { - return CLIConfig{}, errors.New("no components provided") + return servercore.CLIConfig{}, errors.New("no components provided") } server := NewServer(logger, components...) @@ -76,7 +77,7 @@ func Commands(rootCmd *cobra.Command, newApp AppCreator[transaction.Tx], logger return cmds, nil } -func AddCommands(rootCmd *cobra.Command, newApp AppCreator[transaction.Tx], logger log.Logger, components ...ServerComponent[transaction.Tx]) error { +func AddCommands(rootCmd *cobra.Command, newApp servercore.AppCreator[transaction.Tx], logger log.Logger, components ...ServerComponent[transaction.Tx]) error { cmds, err := Commands(rootCmd, newApp, logger, components...) if err != nil { return err diff --git a/server/v2/config.go b/server/v2/config.go index 1a753df6481d..c3611dbffeaf 100644 --- a/server/v2/config.go +++ b/server/v2/config.go @@ -1,7 +1,5 @@ package serverv2 -import "github.com/spf13/cobra" - var ServerContextKey = struct{}{} // Config is the config of the main server. @@ -10,15 +8,3 @@ type Config struct { // If true, the server will block until the context is canceled. StartBlock bool } - -// CLIConfig defines the CLI configuration for a module server. -type CLIConfig struct { - // Commands defines the main command of a module server. - Commands []*cobra.Command - // Queries defines the query commands of a module server. - // Those commands are meant to be added in the root query command. - Queries []*cobra.Command - // Txs defines the tx commands of a module server. - // Those commands are meant to be added in the root tx command. - Txs []*cobra.Command -} diff --git a/server/v2/go.mod b/server/v2/go.mod index a132b4bcaec5..2682a6054a6b 100644 --- a/server/v2/go.mod +++ b/server/v2/go.mod @@ -18,8 +18,6 @@ require ( cosmossdk.io/api v0.7.5 cosmossdk.io/core v0.12.1-0.20231114100755-569e3ff6a0d7 cosmossdk.io/log v1.3.1 - cosmossdk.io/server/v2/appmanager v0.0.0-00010101000000-000000000000 - cosmossdk.io/store/v2 v2.0.0-20240624103346-720c1086cb3f github.com/cosmos/cosmos-proto v1.0.0-beta.5 github.com/cosmos/gogogateway v1.2.0 github.com/cosmos/gogoproto v1.5.0 @@ -43,11 +41,9 @@ require ( ) require ( - cosmossdk.io/errors v1.0.1 // indirect github.com/DataDog/datadog-go v3.2.0+incompatible // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/cosmos/ics23/go v0.10.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/fatih/color v1.15.0 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect @@ -55,6 +51,7 @@ require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect + github.com/hashicorp/go-uuid v1.0.1 // indirect github.com/hashicorp/golang-lru v1.0.2 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/hashicorp/yamux v0.1.1 // indirect @@ -70,6 +67,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/procfs v0.13.0 // indirect + github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/sagikazarmark/locafero v0.4.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/sourcegraph/conc v0.3.0 // indirect @@ -77,7 +75,6 @@ require ( github.com/spf13/cast v1.6.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/crypto v0.24.0 // indirect golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect golang.org/x/net v0.25.0 // indirect golang.org/x/sys v0.21.0 // indirect diff --git a/server/v2/go.sum b/server/v2/go.sum index e53a9697a2df..1fff9d51bd91 100644 --- a/server/v2/go.sum +++ b/server/v2/go.sum @@ -1,7 +1,5 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= -cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/DataDog/datadog-go v3.2.0+incompatible h1:qSG2N4FghB1He/r2mFrWKCaL7dXCilEuNEeAn20fdD4= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= @@ -38,8 +36,6 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= -github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= -github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -255,8 +251,6 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI= -golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc h1:O9NuF4s+E/PvMIy+9IUZB9znFwUIXEWSstNjek6VpVg= golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc= diff --git a/server/v2/server.go b/server/v2/server.go index cd71813c065c..7f064e22f83c 100644 --- a/server/v2/server.go +++ b/server/v2/server.go @@ -13,6 +13,7 @@ import ( "github.com/spf13/viper" "golang.org/x/sync/errgroup" + servercore "cosmossdk.io/core/server" "cosmossdk.io/core/transaction" "cosmossdk.io/log" ) @@ -23,12 +24,12 @@ type ServerComponent[T transaction.Tx] interface { Start(context.Context) error Stop(context.Context) error - Init(AppI[T], *viper.Viper, log.Logger) error + Init(servercore.AppI[T], *viper.Viper, log.Logger) error } // HasCLICommands is a server module that has CLI commands. type HasCLICommands interface { - CLICommands(AppCreator[transaction.Tx]) CLIConfig + CLICommands(servercore.AppCreator[transaction.Tx]) servercore.CLIConfig } // HasConfig is a server module that has a config. @@ -120,7 +121,7 @@ func (s *Server) Stop(ctx context.Context) error { } // CLICommands returns all CLI commands of all components. -func (s *Server) CLICommands(appCreator AppCreator[transaction.Tx]) CLIConfig { +func (s *Server) CLICommands(appCreator servercore.AppCreator[transaction.Tx]) servercore.CLIConfig { compart := func(name string, cmds ...*cobra.Command) *cobra.Command { if len(cmds) == 1 && strings.HasPrefix(cmds[0].Use, name) { return cmds[0] @@ -135,7 +136,7 @@ func (s *Server) CLICommands(appCreator AppCreator[transaction.Tx]) CLIConfig { return rootCmd } - commands := CLIConfig{} + commands := servercore.CLIConfig{} for _, mod := range s.components { if climod, ok := mod.(HasCLICommands); ok { commands.Commands = append(commands.Commands, compart(mod.Name(), climod.CLICommands(appCreator).Commands...)) @@ -161,7 +162,7 @@ func (s *Server) Configs() map[string]any { } // Configs returns all configs of all server components. -func (s *Server) Init(appI AppI[transaction.Tx], v *viper.Viper, logger log.Logger) error { +func (s *Server) Init(appI servercore.AppI[transaction.Tx], v *viper.Viper, logger log.Logger) error { var components []ServerComponent[transaction.Tx] for _, mod := range s.components { mod := mod diff --git a/server/v2/server_mock_test.go b/server/v2/server_mock_test.go index 10641a153e22..01d39c95b900 100644 --- a/server/v2/server_mock_test.go +++ b/server/v2/server_mock_test.go @@ -7,9 +7,9 @@ import ( "github.com/spf13/viper" + servercore "cosmossdk.io/core/server" "cosmossdk.io/core/transaction" "cosmossdk.io/log" - serverv2 "cosmossdk.io/server/v2" ) type mockServerConfig struct { @@ -55,6 +55,6 @@ func (s *mockServer) Config() any { return MockServerDefaultConfig() } -func (s *mockServer) Init(appI serverv2.AppI[transaction.Tx], v *viper.Viper, logger log.Logger) error { +func (s *mockServer) Init(appI servercore.AppI[transaction.Tx], v *viper.Viper, logger log.Logger) error { return nil } diff --git a/server/v2/server_test.go b/server/v2/server_test.go index 22a76fa53870..5bd690889371 100644 --- a/server/v2/server_test.go +++ b/server/v2/server_test.go @@ -12,6 +12,7 @@ import ( "github.com/stretchr/testify/require" coreapp "cosmossdk.io/core/app" + servercore "cosmossdk.io/core/server" "cosmossdk.io/core/transaction" "cosmossdk.io/log" serverv2 "cosmossdk.io/server/v2" @@ -30,7 +31,7 @@ func (*mockInterfaceRegistry) ListImplementations(ifaceTypeURL string) []string func (*mockInterfaceRegistry) ListAllInterfaces() []string { panic("not implemented") } type mockApp[T transaction.Tx] struct { - serverv2.AppI[T] + servercore.AppI[T] } func (*mockApp[T]) InterfaceRegistry() coreapp.InterfaceRegistry { diff --git a/server/v2/types.go b/server/v2/types.go deleted file mode 100644 index 034f333db76a..000000000000 --- a/server/v2/types.go +++ /dev/null @@ -1,19 +0,0 @@ -package serverv2 - -import ( - "github.com/spf13/viper" - - coreapp "cosmossdk.io/core/app" - "cosmossdk.io/core/transaction" - "cosmossdk.io/log" - "cosmossdk.io/server/v2/appmanager" -) - -type AppCreator[T transaction.Tx] func(log.Logger, *viper.Viper) AppI[T] - -type AppI[T transaction.Tx] interface { - GetAppManager() *appmanager.AppManager[T] - GetConsensusAuthority() string - InterfaceRegistry() coreapp.InterfaceRegistry - GetStore() any -} From eda50372ce467b8ea60c197d037e488f37a817ed Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Wed, 26 Jun 2024 15:21:17 +0700 Subject: [PATCH 29/62] move to store/v2 --- {server/v2/store => store/v2}/commands.go | 33 ++++++++++------- {server/v2/store => store/v2}/config.go | 4 +-- {server/v2/store => store/v2}/flags.go | 0 store/v2/go.mod | 18 +++++++++- store/v2/go.sum | 44 ++++++++++++++++++++++- {server/v2/store => store/v2}/server.go | 11 +++--- 6 files changed, 88 insertions(+), 22 deletions(-) rename {server/v2/store => store/v2}/commands.go (84%) rename {server/v2/store => store/v2}/config.go (85%) rename {server/v2/store => store/v2}/flags.go (100%) rename {server/v2/store => store/v2}/server.go (70%) diff --git a/server/v2/store/commands.go b/store/v2/commands.go similarity index 84% rename from server/v2/store/commands.go rename to store/v2/commands.go index 816bc197cb88..b6ecbd9a0797 100644 --- a/server/v2/store/commands.go +++ b/store/v2/commands.go @@ -7,14 +7,15 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" + servercore "cosmossdk.io/core/server" "cosmossdk.io/core/transaction" "cosmossdk.io/log" - serverv2 "cosmossdk.io/server/v2" - storev2 "cosmossdk.io/store/v2" + // storev2 "cosmossdk.io/store/v2" + corectx "cosmossdk.io/core/context" ) // QueryBlockResultsCmd implements the default command for a BlockResults query. -func (s *StoreComponent) PrunesCmd(appCreator serverv2.AppCreator[transaction.Tx]) *cobra.Command { +func (s *StoreComponent) PrunesCmd(appCreator servercore.AppCreator[transaction.Tx]) *cobra.Command { cmd := &cobra.Command{ Use: "prune [pruning-method]", Short: "Prune app history states by keeping the recent heights and deleting old heights", @@ -54,7 +55,7 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, app := appCreator(logger, vp) store := app.GetStore() - rootStore, ok := store.(storev2.RootStore) + rootStore, ok := store.(RootStore) if !ok { return fmt.Errorf("currently only support the pruning of rootmulti.Store type") } @@ -90,8 +91,14 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, return cmd } -func getPruningOptionsFromCmd(cmd *cobra.Command, args []string) (*storev2.PruneOptions, error) { - rootViper := serverv2.GetViperFromCmd(cmd) +func getPruningOptionsFromCmd(cmd *cobra.Command, args []string) (*PruneOptions, error) { + // Get viper from cmd context + var rootViper *viper.Viper + value := cmd.Context().Value(corectx.ViperContextKey{}) + rootViper, ok := value.(*viper.Viper) + if !ok { + rootViper = viper.New() + } var pruning string if len(args) > 0 { @@ -107,10 +114,10 @@ func getPruningOptionsFromCmd(cmd *cobra.Command, args []string) (*storev2.Prune strategy := strings.ToLower(pruning) switch strategy { - case storev2.PruningOptionDefault, storev2.PruningOptionNothing, storev2.PruningOptionEverything: - return storev2.NewPruneOptions(strategy), nil + case PruningOptionDefault, PruningOptionNothing, PruningOptionEverything: + return NewPruneOptions(strategy), nil - case storev2.PruningOptionCustom: + case PruningOptionCustom: var ( pruningKeepRecent uint64 pruningInterval uint64 @@ -120,7 +127,7 @@ func getPruningOptionsFromCmd(cmd *cobra.Command, args []string) (*storev2.Prune if cmd.Flags().Changed(FlagPruningKeepRecent) { pruningKeepRecent, err = cmd.Flags().GetUint64(FlagPruningKeepRecent) if err != nil { - return &storev2.PruneOptions{}, err + return &PruneOptions{}, err } } else { pruningKeepRecent = rootViper.GetUint64(FlagPruningKeepRecent) @@ -129,13 +136,13 @@ func getPruningOptionsFromCmd(cmd *cobra.Command, args []string) (*storev2.Prune if cmd.Flags().Changed(FlagPruningInterval) { pruningInterval, err = cmd.Flags().GetUint64(FlagPruningInterval) if err != nil { - return &storev2.PruneOptions{}, err + return &PruneOptions{}, err } } else { pruningInterval = rootViper.GetUint64(FlagPruningInterval) } - opts := storev2.NewCustomPruneOptions( + opts := NewCustomPruneOptions( pruningKeepRecent, pruningInterval, ) @@ -147,6 +154,6 @@ func getPruningOptionsFromCmd(cmd *cobra.Command, args []string) (*storev2.Prune return opts, nil default: - return &storev2.PruneOptions{}, fmt.Errorf("unknown pruning strategy %s", strategy) + return &PruneOptions{}, fmt.Errorf("unknown pruning strategy %s", strategy) } } diff --git a/server/v2/store/config.go b/store/v2/config.go similarity index 85% rename from server/v2/store/config.go rename to store/v2/config.go index a6947af4bd59..450e19c25475 100644 --- a/server/v2/store/config.go +++ b/store/v2/config.go @@ -1,12 +1,12 @@ package store import ( - storev2 "cosmossdk.io/store/v2" + // storev2 "cosmossdk.io/store/v2" ) func DefaultConfig() *Config { return &Config{ - Pruning: storev2.PruningOptionDefault, + Pruning: PruningOptionDefault, AppDBBackend: "", PruningKeepRecent: 0, PruningInterval: 0, diff --git a/server/v2/store/flags.go b/store/v2/flags.go similarity index 100% rename from server/v2/store/flags.go rename to store/v2/flags.go diff --git a/store/v2/go.mod b/store/v2/go.mod index c95ec57bb5cb..a7adea3a70b5 100644 --- a/store/v2/go.mod +++ b/store/v2/go.mod @@ -15,6 +15,8 @@ require ( github.com/linxGnu/grocksdb v1.8.14 github.com/mattn/go-sqlite3 v1.14.22 github.com/spf13/cast v1.6.0 + github.com/spf13/cobra v1.8.1 + github.com/spf13/viper v1.19.0 github.com/stretchr/testify v1.9.0 github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d golang.org/x/sync v0.7.0 @@ -36,14 +38,19 @@ require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/go-cmp v0.6.0 // indirect - github.com/hashicorp/go-immutable-radix v1.0.0 // indirect + github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/go-uuid v1.0.1 // indirect github.com/hashicorp/golang-lru v1.0.2 // indirect + github.com/hashicorp/hcl v1.0.0 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/klauspost/compress v1.17.7 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect + github.com/magiconair/properties v1.8.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/pelletier/go-toml/v2 v2.2.2 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.19.0 // indirect @@ -52,6 +59,14 @@ require ( github.com/prometheus/procfs v0.13.0 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/rs/zerolog v1.33.0 // indirect + github.com/sagikazarmark/locafero v0.4.0 // indirect + github.com/sagikazarmark/slog-shim v0.1.0 // indirect + github.com/sourcegraph/conc v0.3.0 // indirect + github.com/spf13/afero v1.11.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect + github.com/subosito/gotenv v1.6.0 // indirect + go.uber.org/atomic v1.9.0 // indirect + go.uber.org/multierr v1.9.0 // indirect golang.org/x/crypto v0.24.0 // indirect golang.org/x/exp v0.0.0-20240314144324-c7f7c6466f7f // indirect golang.org/x/sys v0.21.0 // indirect @@ -59,6 +74,7 @@ require ( google.golang.org/genproto/googleapis/rpc v0.0.0-20240513163218-0867130af1f8 // indirect google.golang.org/grpc v1.64.0 // indirect google.golang.org/protobuf v1.34.2 // indirect + gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/store/v2/go.sum b/store/v2/go.sum index 50c293b1be2d..b3731b97ce96 100644 --- a/store/v2/go.sum +++ b/store/v2/go.sum @@ -40,6 +40,7 @@ github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= +github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -96,8 +97,9 @@ github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-immutable-radix v1.0.0 h1:AKDB1HM5PWEA7i4nhcpwOrO2byshxBjXVn/J/3+z5/0= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= +github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-metrics v0.5.3 h1:M5uADWMOGCTUNU1YuC4hfknOeHNaX54LDm4oYSucoNE= github.com/hashicorp/go-metrics v0.5.3/go.mod h1:KEjodfebIOuBYSAe/bHTm+HChmKSxAOXPBieMLYozDE= github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= @@ -107,8 +109,12 @@ github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/b github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c= github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= @@ -127,6 +133,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/linxGnu/grocksdb v1.8.14 h1:HTgyYalNwBSG/1qCQUIott44wU5b2Y9Kr3z7SK5OfGQ= github.com/linxGnu/grocksdb v1.8.14/go.mod h1:QYiYypR2d4v63Wj1adOOfzglnoII0gLj3PNh4fZkcFA= +github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= +github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= @@ -136,6 +144,8 @@ github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= @@ -158,6 +168,8 @@ github.com/onsi/gomega v1.26.0 h1:03cDLK28U6hWvCAns6NeydX3zIm4SF3ci69ulidS32Q= github.com/onsi/gomega v1.26.0/go.mod h1:r+zV744Re+DiYCIPRlYOTxn0YkOLcAnW8k1xXdMPGhM= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= +github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= @@ -193,24 +205,51 @@ github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99 github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= +github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= +github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= +github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= +github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= +github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= +github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= +github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= +github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI= +github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= +github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d h1:vfofYNRScrDdvS342BElfbETmL1Aiz3i2t0zfRj16Hs= github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= +go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= +go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -305,6 +344,8 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= +gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -313,6 +354,7 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= diff --git a/server/v2/store/server.go b/store/v2/server.go similarity index 70% rename from server/v2/store/server.go rename to store/v2/server.go index 764f4e26365c..664abe0add48 100644 --- a/server/v2/store/server.go +++ b/store/v2/server.go @@ -7,20 +7,21 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" + servercore "cosmossdk.io/core/server" "cosmossdk.io/core/transaction" "cosmossdk.io/log" - serverv2 "cosmossdk.io/server/v2" + // serverv2 "cosmossdk.io/server/v2" ) type StoreComponent struct { config *Config } -func New() serverv2.ServerComponent[transaction.Tx] { +func New() *StoreComponent { return &StoreComponent{} } -func (s *StoreComponent) Init(appI serverv2.AppI[transaction.Tx], v *viper.Viper, logger log.Logger) error { +func (s *StoreComponent) Init(appI servercore.AppI[transaction.Tx], v *viper.Viper, logger log.Logger) error { cfg := DefaultConfig() if v != nil { if err := v.Sub(s.Name()).Unmarshal(&cfg); err != nil { @@ -43,8 +44,8 @@ func (s *StoreComponent) Stop(ctx context.Context) error { return nil } -func (s *StoreComponent) CLICommands(appCreator serverv2.AppCreator[transaction.Tx]) serverv2.CLIConfig { - return serverv2.CLIConfig{ +func (s *StoreComponent) CLICommands(appCreator servercore.AppCreator[transaction.Tx]) servercore.CLIConfig { + return servercore.CLIConfig{ Commands: []*cobra.Command{ s.PrunesCmd(appCreator), }, From 8becfe3855aca1a9930ecc00eb58b2890d86fbde Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Wed, 26 Jun 2024 15:21:42 +0700 Subject: [PATCH 30/62] update simapp --- simapp/v2/simdv2/cmd/commands.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/simapp/v2/simdv2/cmd/commands.go b/simapp/v2/simdv2/cmd/commands.go index 7869a437a677..4534a3c3ee69 100644 --- a/simapp/v2/simdv2/cmd/commands.go +++ b/simapp/v2/simdv2/cmd/commands.go @@ -10,14 +10,15 @@ import ( "github.com/spf13/viper" "cosmossdk.io/client/v2/offchain" + servercore "cosmossdk.io/core/server" "cosmossdk.io/core/transaction" "cosmossdk.io/log" runtimev2 "cosmossdk.io/runtime/v2" serverv2 "cosmossdk.io/server/v2" "cosmossdk.io/server/v2/api/grpc" "cosmossdk.io/server/v2/cometbft" - "cosmossdk.io/server/v2/store" "cosmossdk.io/simapp/v2" + storev2 "cosmossdk.io/store/v2" confixcmd "cosmossdk.io/tools/confix/cmd" authcmd "cosmossdk.io/x/auth/client/cli" @@ -53,7 +54,7 @@ func (t *temporaryTxDecoder) DecodeJSON(bz []byte) (transaction.Tx, error) { func newApp( logger log.Logger, viper *viper.Viper, -) serverv2.AppI[transaction.Tx] { +) servercore.AppI[transaction.Tx] { sa := simapp.NewSimApp(logger, viper) return sa } @@ -85,7 +86,7 @@ func initRootCmd( logger, cometbft.New(&temporaryTxDecoder{txConfig}), grpc.New(), - store.New(), + storev2.New(), ); err != nil { panic(err) } From ccc09762b1cf2121c7cc5f9d4c5475a42396c513 Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Wed, 26 Jun 2024 15:26:32 +0700 Subject: [PATCH 31/62] lint --- core/server/types.go | 2 +- store/v2/commands.go | 3 +-- store/v2/config.go | 4 ---- store/v2/server.go | 1 - 4 files changed, 2 insertions(+), 8 deletions(-) diff --git a/core/server/types.go b/core/server/types.go index 4d5f03fb9f79..9396b22119dd 100644 --- a/core/server/types.go +++ b/core/server/types.go @@ -28,4 +28,4 @@ type CLIConfig struct { // Txs defines the tx commands of a module server. // Those commands are meant to be added in the root tx command. Txs []*cobra.Command -} \ No newline at end of file +} diff --git a/store/v2/commands.go b/store/v2/commands.go index b6ecbd9a0797..f590b77b9a67 100644 --- a/store/v2/commands.go +++ b/store/v2/commands.go @@ -7,11 +7,10 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" + corectx "cosmossdk.io/core/context" servercore "cosmossdk.io/core/server" "cosmossdk.io/core/transaction" "cosmossdk.io/log" - // storev2 "cosmossdk.io/store/v2" - corectx "cosmossdk.io/core/context" ) // QueryBlockResultsCmd implements the default command for a BlockResults query. diff --git a/store/v2/config.go b/store/v2/config.go index 450e19c25475..b53aa8751adb 100644 --- a/store/v2/config.go +++ b/store/v2/config.go @@ -1,9 +1,5 @@ package store -import ( - // storev2 "cosmossdk.io/store/v2" -) - func DefaultConfig() *Config { return &Config{ Pruning: PruningOptionDefault, diff --git a/store/v2/server.go b/store/v2/server.go index 664abe0add48..d9f69baa6bff 100644 --- a/store/v2/server.go +++ b/store/v2/server.go @@ -10,7 +10,6 @@ import ( servercore "cosmossdk.io/core/server" "cosmossdk.io/core/transaction" "cosmossdk.io/log" - // serverv2 "cosmossdk.io/server/v2" ) type StoreComponent struct { From 06766985560c18c48e2db16280d9b34f136f2dd9 Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Wed, 26 Jun 2024 15:40:34 +0700 Subject: [PATCH 32/62] go mod tidy all --- collections/go.mod | 3 ++- collections/go.sum | 7 +++++-- core/testing/go.mod | 4 ++-- core/testing/go.sum | 7 +++++-- orm/go.mod | 3 +-- orm/go.sum | 8 ++++---- runtime/v2/go.mod | 17 +++++++++++++++ runtime/v2/go.sum | 41 +++++++++++++++++++++++++++++++++++++ server/v2/appmanager/go.mod | 1 - server/v2/stf/go.mod | 4 ++-- server/v2/stf/go.sum | 12 ++++++----- x/tx/go.mod | 2 +- x/tx/go.sum | 3 ++- 13 files changed, 89 insertions(+), 23 deletions(-) diff --git a/collections/go.mod b/collections/go.mod index cf803ec6f903..ceaf75bb2dcf 100644 --- a/collections/go.mod +++ b/collections/go.mod @@ -13,7 +13,8 @@ require ( github.com/cosmos/gogoproto v1.5.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/google/go-cmp v0.6.0 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/kr/pretty v0.3.1 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/tidwall/btree v1.7.0 // indirect golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect diff --git a/collections/go.sum b/collections/go.sum index 300ee085958e..807d6ced71ea 100644 --- a/collections/go.sum +++ b/collections/go.sum @@ -1,5 +1,6 @@ github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= @@ -10,8 +11,10 @@ github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= diff --git a/core/testing/go.mod b/core/testing/go.mod index 7f5d44dfe3f5..d5d3413aa5b8 100644 --- a/core/testing/go.mod +++ b/core/testing/go.mod @@ -13,7 +13,7 @@ require ( require ( github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/kr/text v0.2.0 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/kr/pretty v0.3.1 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/core/testing/go.sum b/core/testing/go.sum index 498794a52841..ed40432f2ed1 100644 --- a/core/testing/go.sum +++ b/core/testing/go.sum @@ -3,10 +3,13 @@ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1 github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= diff --git a/orm/go.mod b/orm/go.mod index ca3ed88b89ad..11f05b76e706 100644 --- a/orm/go.mod +++ b/orm/go.mod @@ -37,7 +37,6 @@ require ( github.com/cucumber/messages/go/v22 v22.0.0 // indirect github.com/cucumber/tag-expressions/go/v6 v6.1.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/getsentry/sentry-go v0.27.0 // indirect github.com/gofrs/uuid v4.4.0+incompatible // indirect github.com/gogo/protobuf v1.3.2 // indirect @@ -49,7 +48,7 @@ require ( github.com/linxGnu/grocksdb v1.8.14 // indirect github.com/onsi/gomega v1.20.0 // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.19.1 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.54.0 // indirect diff --git a/orm/go.sum b/orm/go.sum index 5cf168750dbe..133016fee65a 100644 --- a/orm/go.sum +++ b/orm/go.sum @@ -49,8 +49,8 @@ github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7z github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= -github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= -github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= +github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= +github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/getsentry/sentry-go v0.27.0 h1:Pv98CIbtB3LkMWmXi4Joa5OOcwbmnX88sF5qbK3r3Ps= github.com/getsentry/sentry-go v0.27.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= @@ -121,8 +121,9 @@ github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTw github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= @@ -193,7 +194,6 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= diff --git a/runtime/v2/go.mod b/runtime/v2/go.mod index c3b36297a1e6..bf33979e36a3 100644 --- a/runtime/v2/go.mod +++ b/runtime/v2/go.mod @@ -54,6 +54,7 @@ require ( github.com/cosmos/ics23/go v0.10.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/emicklei/dot v1.6.2 // indirect + github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/getsentry/sentry-go v0.27.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/snappy v0.0.4 // indirect @@ -62,14 +63,19 @@ require ( github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/go-metrics v0.5.3 // indirect github.com/hashicorp/golang-lru v1.0.2 // indirect + github.com/hashicorp/hcl v1.0.0 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/klauspost/compress v1.17.8 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/linxGnu/grocksdb v1.8.14 // indirect + github.com/magiconair/properties v1.8.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-sqlite3 v1.14.22 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/onsi/gomega v1.28.1 // indirect + github.com/pelletier/go-toml/v2 v2.2.2 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.19.1 // indirect @@ -78,10 +84,20 @@ require ( github.com/prometheus/procfs v0.14.0 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/rs/zerolog v1.33.0 // indirect + github.com/sagikazarmark/locafero v0.4.0 // indirect + github.com/sagikazarmark/slog-shim v0.1.0 // indirect + github.com/sourcegraph/conc v0.3.0 // indirect + github.com/spf13/afero v1.11.0 // indirect github.com/spf13/cast v1.6.0 // indirect + github.com/spf13/cobra v1.8.1 // indirect + github.com/spf13/pflag v1.0.5 // indirect + github.com/spf13/viper v1.19.0 // indirect github.com/stretchr/testify v1.9.0 // indirect + github.com/subosito/gotenv v1.6.0 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect github.com/tidwall/btree v1.7.0 // indirect + go.uber.org/atomic v1.9.0 // indirect + go.uber.org/multierr v1.9.0 // indirect golang.org/x/crypto v0.24.0 // indirect golang.org/x/net v0.25.0 // indirect golang.org/x/sync v0.7.0 // indirect @@ -89,6 +105,7 @@ require ( golang.org/x/text v0.16.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240513163218-0867130af1f8 // indirect + gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect sigs.k8s.io/yaml v1.4.0 // indirect ) diff --git a/runtime/v2/go.sum b/runtime/v2/go.sum index d9302d534177..c145d891a959 100644 --- a/runtime/v2/go.sum +++ b/runtime/v2/go.sum @@ -46,6 +46,7 @@ github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= +github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -115,8 +116,12 @@ github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/b github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c= github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= @@ -135,6 +140,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/linxGnu/grocksdb v1.8.14 h1:HTgyYalNwBSG/1qCQUIott44wU5b2Y9Kr3z7SK5OfGQ= github.com/linxGnu/grocksdb v1.8.14/go.mod h1:QYiYypR2d4v63Wj1adOOfzglnoII0gLj3PNh4fZkcFA= +github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= +github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= @@ -144,6 +151,8 @@ github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= @@ -166,6 +175,8 @@ github.com/onsi/gomega v1.28.1 h1:MijcGUbfYuznzK/5R4CPNoUP/9Xvuo20sXfEm6XxoTA= github.com/onsi/gomega v1.28.1/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= +github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= @@ -201,19 +212,42 @@ github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99 github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= +github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= +github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= +github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= +github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= +github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= +github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= +github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= +github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI= +github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= +github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d h1:vfofYNRScrDdvS342BElfbETmL1Aiz3i2t0zfRj16Hs= github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48= github.com/tidwall/btree v1.7.0 h1:L1fkJH/AuEh5zBnnBbmTwQ5Lt+bRJ5A8EWecslvo9iI= @@ -221,6 +255,10 @@ github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EU github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= +go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= +go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -317,6 +355,8 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= +gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -325,6 +365,7 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= diff --git a/server/v2/appmanager/go.mod b/server/v2/appmanager/go.mod index 5f272491f97d..54b250b93e84 100644 --- a/server/v2/appmanager/go.mod +++ b/server/v2/appmanager/go.mod @@ -10,7 +10,6 @@ require cosmossdk.io/core v0.12.0 require ( github.com/cosmos/gogoproto v1.5.0 // indirect github.com/google/go-cmp v0.6.0 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect golang.org/x/exp v0.0.0-20240314144324-c7f7c6466f7f // indirect google.golang.org/protobuf v1.34.2 // indirect ) diff --git a/server/v2/stf/go.mod b/server/v2/stf/go.mod index 1493c30a98ab..8e38092de16a 100644 --- a/server/v2/stf/go.mod +++ b/server/v2/stf/go.mod @@ -16,7 +16,7 @@ require ( require ( github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/google/go-cmp v0.6.0 // indirect - github.com/kr/text v0.1.0 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/kr/pretty v0.3.1 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/server/v2/stf/go.sum b/server/v2/stf/go.sum index 00afeef4cfd9..74a8907df971 100644 --- a/server/v2/stf/go.sum +++ b/server/v2/stf/go.sum @@ -1,5 +1,6 @@ github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= @@ -8,11 +9,12 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= diff --git a/x/tx/go.mod b/x/tx/go.mod index 717d2c99ef89..cc8b9c868510 100644 --- a/x/tx/go.mod +++ b/x/tx/go.mod @@ -23,7 +23,7 @@ require ( require ( github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/kr/text v0.2.0 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect golang.org/x/net v0.25.0 // indirect golang.org/x/sys v0.20.0 // indirect diff --git a/x/tx/go.sum b/x/tx/go.sum index 8fcd940caa9c..c94dfc7bc954 100644 --- a/x/tx/go.sum +++ b/x/tx/go.sum @@ -29,8 +29,9 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= From 1c08a6d155eeb78e5833062f9c3bdab62de9d0b1 Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Wed, 26 Jun 2024 16:06:13 +0700 Subject: [PATCH 33/62] collections go mod --- collections/go.mod | 2 +- collections/go.sum | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/collections/go.mod b/collections/go.mod index ceaf75bb2dcf..09be32626a75 100644 --- a/collections/go.mod +++ b/collections/go.mod @@ -13,7 +13,7 @@ require ( github.com/cosmos/gogoproto v1.5.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/google/go-cmp v0.6.0 // indirect - github.com/kr/pretty v0.3.1 // indirect + github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/tidwall/btree v1.7.0 // indirect diff --git a/collections/go.sum b/collections/go.sum index 807d6ced71ea..2b6eb8552488 100644 --- a/collections/go.sum +++ b/collections/go.sum @@ -11,10 +11,8 @@ github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= From 2d3e581747bb1fee6633160b355ce85bcb18ccda Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Thu, 27 Jun 2024 15:44:35 +0700 Subject: [PATCH 34/62] viper as AppOptions --- core/server/types.go | 20 +++++--------------- simapp/v2/simdv2/cmd/commands.go | 4 ++-- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/core/server/types.go b/core/server/types.go index 9396b22119dd..225bc4d6fba6 100644 --- a/core/server/types.go +++ b/core/server/types.go @@ -1,15 +1,16 @@ package server import ( - "github.com/spf13/cobra" - "github.com/spf13/viper" - coreapp "cosmossdk.io/core/app" "cosmossdk.io/core/log" "cosmossdk.io/core/transaction" ) -type AppCreator[T transaction.Tx] func(log.Logger, *viper.Viper) AppI[T] +type AppCreator[T transaction.Tx] func(log.Logger, AppOptions) AppI[T] + +type AppOptions interface { + Get(string) interface{} +} type AppI[T transaction.Tx] interface { GetAppManager() any @@ -18,14 +19,3 @@ type AppI[T transaction.Tx] interface { GetStore() any } -// CLIConfig defines the CLI configuration for a module server. -type CLIConfig struct { - // Commands defines the main command of a module server. - Commands []*cobra.Command - // Queries defines the query commands of a module server. - // Those commands are meant to be added in the root query command. - Queries []*cobra.Command - // Txs defines the tx commands of a module server. - // Those commands are meant to be added in the root tx command. - Txs []*cobra.Command -} diff --git a/simapp/v2/simdv2/cmd/commands.go b/simapp/v2/simdv2/cmd/commands.go index c68845eca835..3fdf5b82b7a2 100644 --- a/simapp/v2/simdv2/cmd/commands.go +++ b/simapp/v2/simdv2/cmd/commands.go @@ -50,8 +50,8 @@ func (t *temporaryTxDecoder) DecodeJSON(bz []byte) (transaction.Tx, error) { return t.txConfig.TxJSONDecoder()(bz) } -func newApp(logger log.Logger, viper *viper.Viper) servercore.AppI[transaction.Tx] { - return simapp.NewSimApp(logger, viper) +func newApp(logger log.Logger, appOpts servercore.AppOptions) servercore.AppI[transaction.Tx] { + return simapp.NewSimApp(logger, appOpts.(*viper.Viper)) } func initRootCmd( From 07a53d13cf0d5741ed46c0459708a5e15fe20d03 Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Thu, 27 Jun 2024 15:46:25 +0700 Subject: [PATCH 35/62] abtract HasCLICommands --- server/v2/cometbft/server.go | 34 ++++++++++++++++++++-------------- server/v2/commands.go | 4 ++-- server/v2/config.go | 14 ++++++++++++++ server/v2/server.go | 14 ++++++++------ store/v2/server.go | 16 +++++++++++----- 5 files changed, 55 insertions(+), 27 deletions(-) diff --git a/server/v2/cometbft/server.go b/server/v2/cometbft/server.go index f52bf53d177e..8f6a75c396b9 100644 --- a/server/v2/cometbft/server.go +++ b/server/v2/cometbft/server.go @@ -216,23 +216,29 @@ func (s *CometBFTServer[T]) StartCmdFlags() pflag.FlagSet { return flags } -func (s *CometBFTServer[T]) CLICommands(_ servercore.AppCreator[T]) servercore.CLIConfig { - return servercore.CLIConfig{ - Commands: []*cobra.Command{ - s.StatusCommand(), - s.ShowNodeIDCmd(), - s.ShowValidatorCmd(), - s.ShowAddressCmd(), - s.VersionCmd(), - s.QueryBlockCmd(), - s.QueryBlocksCmd(), - s.QueryBlockResultsCmd(), - cmtcmd.ResetAllCmd, - cmtcmd.ResetStateCmd, - }, +func (s *CometBFTServer[T]) GetCommands(_ servercore.AppCreator[T]) []*cobra.Command { + return []*cobra.Command{ + s.StatusCommand(), + s.ShowNodeIDCmd(), + s.ShowValidatorCmd(), + s.ShowAddressCmd(), + s.VersionCmd(), + s.QueryBlockCmd(), + s.QueryBlocksCmd(), + s.QueryBlockResultsCmd(), + cmtcmd.ResetAllCmd, + cmtcmd.ResetStateCmd, } } +func (s *CometBFTServer[T]) GetTxs() []*cobra.Command { + return nil +} + +func (s *CometBFTServer[T]) GetQueries() []*cobra.Command { + return nil +} + func (s *CometBFTServer[T]) WriteDefaultConfigAt(configPath string) error { cometConfig := cmtcfg.DefaultConfig() cmtcfg.WriteConfigFile(filepath.Join(configPath, "config.toml"), cometConfig) diff --git a/server/v2/commands.go b/server/v2/commands.go index 940325c175cf..59f114efb761 100644 --- a/server/v2/commands.go +++ b/server/v2/commands.go @@ -16,9 +16,9 @@ import ( "cosmossdk.io/log" ) -func Commands(rootCmd *cobra.Command, newApp servercore.AppCreator[transaction.Tx], logger log.Logger, components ...ServerComponent[transaction.Tx]) (servercore.CLIConfig, error) { +func Commands(rootCmd *cobra.Command, newApp servercore.AppCreator[transaction.Tx], logger log.Logger, components ...ServerComponent[transaction.Tx]) (CLIConfig, error) { if len(components) == 0 { - return servercore.CLIConfig{}, errors.New("no components provided") + return CLIConfig{}, errors.New("no components provided") } server := NewServer(logger, components...) diff --git a/server/v2/config.go b/server/v2/config.go index c3611dbffeaf..d6c3926a61d5 100644 --- a/server/v2/config.go +++ b/server/v2/config.go @@ -1,5 +1,7 @@ package serverv2 +import "github.com/spf13/cobra" + var ServerContextKey = struct{}{} // Config is the config of the main server. @@ -8,3 +10,15 @@ type Config struct { // If true, the server will block until the context is canceled. StartBlock bool } + +// CLIConfig defines the CLI configuration for a module server. +type CLIConfig struct { + // Commands defines the main command of a module server. + Commands []*cobra.Command + // Queries defines the query commands of a module server. + // Those commands are meant to be added in the root query command. + Queries []*cobra.Command + // Txs defines the tx commands of a module server. + // Those commands are meant to be added in the root tx command. + Txs []*cobra.Command +} \ No newline at end of file diff --git a/server/v2/server.go b/server/v2/server.go index 7f064e22f83c..d571f781a56f 100644 --- a/server/v2/server.go +++ b/server/v2/server.go @@ -29,7 +29,9 @@ type ServerComponent[T transaction.Tx] interface { // HasCLICommands is a server module that has CLI commands. type HasCLICommands interface { - CLICommands(servercore.AppCreator[transaction.Tx]) servercore.CLIConfig + GetCommands(servercore.AppCreator[transaction.Tx]) []*cobra.Command + GetTxs() []*cobra.Command + GetQueries() []*cobra.Command } // HasConfig is a server module that has a config. @@ -121,7 +123,7 @@ func (s *Server) Stop(ctx context.Context) error { } // CLICommands returns all CLI commands of all components. -func (s *Server) CLICommands(appCreator servercore.AppCreator[transaction.Tx]) servercore.CLIConfig { +func (s *Server) CLICommands(appCreator servercore.AppCreator[transaction.Tx]) CLIConfig { compart := func(name string, cmds ...*cobra.Command) *cobra.Command { if len(cmds) == 1 && strings.HasPrefix(cmds[0].Use, name) { return cmds[0] @@ -136,12 +138,12 @@ func (s *Server) CLICommands(appCreator servercore.AppCreator[transaction.Tx]) s return rootCmd } - commands := servercore.CLIConfig{} + commands := CLIConfig{} for _, mod := range s.components { if climod, ok := mod.(HasCLICommands); ok { - commands.Commands = append(commands.Commands, compart(mod.Name(), climod.CLICommands(appCreator).Commands...)) - commands.Txs = append(commands.Txs, compart(mod.Name(), climod.CLICommands(appCreator).Txs...)) - commands.Queries = append(commands.Queries, compart(mod.Name(), climod.CLICommands(appCreator).Queries...)) + commands.Commands = append(commands.Commands, compart(mod.Name(), climod.GetCommands(appCreator)...)) + commands.Txs = append(commands.Txs, compart(mod.Name(), climod.GetTxs()...)) + commands.Queries = append(commands.Queries, compart(mod.Name(), climod.GetQueries()...)) } } diff --git a/store/v2/server.go b/store/v2/server.go index d9f69baa6bff..51698018d995 100644 --- a/store/v2/server.go +++ b/store/v2/server.go @@ -43,14 +43,20 @@ func (s *StoreComponent) Stop(ctx context.Context) error { return nil } -func (s *StoreComponent) CLICommands(appCreator servercore.AppCreator[transaction.Tx]) servercore.CLIConfig { - return servercore.CLIConfig{ - Commands: []*cobra.Command{ - s.PrunesCmd(appCreator), - }, +func (s *StoreComponent) GetCommands(appCreator servercore.AppCreator[transaction.Tx]) []*cobra.Command { + return []*cobra.Command{ + s.PrunesCmd(appCreator), } } +func (s *StoreComponent) GetTxs() []*cobra.Command { + return nil +} + +func (s *StoreComponent) GetQueries() []*cobra.Command { + return nil +} + func (g *StoreComponent) Config() any { if g.config == nil || g.config == (&Config{}) { return DefaultConfig() From 31c3da472ad31f230d7df1b6000316bb4b03df77 Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Thu, 27 Jun 2024 15:46:36 +0700 Subject: [PATCH 36/62] go mod tidy all --- collections/go.mod | 1 - collections/go.sum | 1 - core/go.mod | 21 ++------------ core/go.sum | 58 ++++--------------------------------- core/testing/go.mod | 2 +- core/testing/go.sum | 3 -- orm/go.sum | 3 +- server/v2/appmanager/go.sum | 4 +-- server/v2/stf/go.mod | 2 +- server/v2/stf/go.sum | 2 -- 10 files changed, 13 insertions(+), 84 deletions(-) diff --git a/collections/go.mod b/collections/go.mod index 09be32626a75..ff0ba0e864e1 100644 --- a/collections/go.mod +++ b/collections/go.mod @@ -13,7 +13,6 @@ require ( github.com/cosmos/gogoproto v1.5.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/google/go-cmp v0.6.0 // indirect - github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/tidwall/btree v1.7.0 // indirect diff --git a/collections/go.sum b/collections/go.sum index 2b6eb8552488..2f4c1b76e57e 100644 --- a/collections/go.sum +++ b/collections/go.sum @@ -1,6 +1,5 @@ github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= diff --git a/core/go.mod b/core/go.mod index 73abc332a58f..5adbe9d79219 100644 --- a/core/go.mod +++ b/core/go.mod @@ -4,8 +4,6 @@ go 1.20 require ( github.com/cosmos/gogoproto v1.5.0 - github.com/spf13/cobra v1.8.1 - github.com/spf13/viper v1.19.0 github.com/stretchr/testify v1.9.0 google.golang.org/grpc v1.64.0 google.golang.org/protobuf v1.34.2 @@ -13,30 +11,15 @@ require ( require ( github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/google/go-cmp v0.6.0 // indirect - github.com/hashicorp/hcl v1.0.0 // indirect - github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/magiconair/properties v1.8.7 // indirect - github.com/mitchellh/mapstructure v1.5.0 // indirect - github.com/pelletier/go-toml/v2 v2.2.2 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/kr/pretty v0.3.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect - github.com/sagikazarmark/locafero v0.4.0 // indirect - github.com/sagikazarmark/slog-shim v0.1.0 // indirect - github.com/sourcegraph/conc v0.3.0 // indirect - github.com/spf13/afero v1.11.0 // indirect - github.com/spf13/cast v1.6.0 // indirect - github.com/spf13/pflag v1.0.5 // indirect - github.com/subosito/gotenv v1.6.0 // indirect - go.uber.org/atomic v1.9.0 // indirect - go.uber.org/multierr v1.9.0 // indirect golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect golang.org/x/net v0.25.0 // indirect golang.org/x/sys v0.20.0 // indirect golang.org/x/text v0.15.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240513163218-0867130af1f8 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect - gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/core/go.sum b/core/go.sum index a3a0b7dccd2c..554ff253ccf6 100644 --- a/core/go.sum +++ b/core/go.sum @@ -1,69 +1,26 @@ github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= -github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= -github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= -github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= -github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= -github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= -github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= -github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= -github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= -github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= -github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= -github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= -github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= -github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= -github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= -github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= -github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= -github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= -github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= -github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI= -github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= -github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= -go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= -go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= -go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI= golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo= golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= @@ -81,8 +38,5 @@ google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWn gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= -gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/core/testing/go.mod b/core/testing/go.mod index d5d3413aa5b8..8f37590a8c35 100644 --- a/core/testing/go.mod +++ b/core/testing/go.mod @@ -13,7 +13,7 @@ require ( require ( github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/kr/pretty v0.3.1 // indirect + github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/core/testing/go.sum b/core/testing/go.sum index ed40432f2ed1..cba2135c28c3 100644 --- a/core/testing/go.sum +++ b/core/testing/go.sum @@ -3,13 +3,10 @@ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1 github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= diff --git a/orm/go.sum b/orm/go.sum index 133016fee65a..cb36dbece173 100644 --- a/orm/go.sum +++ b/orm/go.sum @@ -48,9 +48,8 @@ github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHk github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI= github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= -github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= -github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/getsentry/sentry-go v0.27.0 h1:Pv98CIbtB3LkMWmXi4Joa5OOcwbmnX88sF5qbK3r3Ps= github.com/getsentry/sentry-go v0.27.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= diff --git a/server/v2/appmanager/go.sum b/server/v2/appmanager/go.sum index 174f840d47d0..4cf46e5c9ee9 100644 --- a/server/v2/appmanager/go.sum +++ b/server/v2/appmanager/go.sum @@ -6,8 +6,8 @@ github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= golang.org/x/exp v0.0.0-20240314144324-c7f7c6466f7f h1:3CW0unweImhOzd5FmYuRsD4Y4oQFKZIjAnKbjV4WIrw= diff --git a/server/v2/stf/go.mod b/server/v2/stf/go.mod index 8e38092de16a..60a32a720850 100644 --- a/server/v2/stf/go.mod +++ b/server/v2/stf/go.mod @@ -16,7 +16,7 @@ require ( require ( github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/google/go-cmp v0.6.0 // indirect - github.com/kr/pretty v0.3.1 // indirect + github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/server/v2/stf/go.sum b/server/v2/stf/go.sum index 74a8907df971..61a714a703da 100644 --- a/server/v2/stf/go.sum +++ b/server/v2/stf/go.sum @@ -11,10 +11,8 @@ github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= From 7ca4458cb2a90e9be717d3a6595418a9fd47167b Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Thu, 27 Jun 2024 16:28:39 +0700 Subject: [PATCH 37/62] lint --- core/server/types.go | 1 - server/v2/config.go | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/core/server/types.go b/core/server/types.go index 225bc4d6fba6..9486bda034ae 100644 --- a/core/server/types.go +++ b/core/server/types.go @@ -18,4 +18,3 @@ type AppI[T transaction.Tx] interface { InterfaceRegistry() coreapp.InterfaceRegistry GetStore() any } - diff --git a/server/v2/config.go b/server/v2/config.go index d6c3926a61d5..1a753df6481d 100644 --- a/server/v2/config.go +++ b/server/v2/config.go @@ -21,4 +21,4 @@ type CLIConfig struct { // Txs defines the tx commands of a module server. // Those commands are meant to be added in the root tx command. Txs []*cobra.Command -} \ No newline at end of file +} From f1d40fcd9ea923f4d77253dfa59ca0c0080b8e85 Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Thu, 27 Jun 2024 17:02:59 +0700 Subject: [PATCH 38/62] update x/tx go mod --- x/tx/go.mod | 2 +- x/tx/go.sum | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/x/tx/go.mod b/x/tx/go.mod index cc8b9c868510..717d2c99ef89 100644 --- a/x/tx/go.mod +++ b/x/tx/go.mod @@ -23,7 +23,7 @@ require ( require ( github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/kr/text v0.2.0 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect golang.org/x/net v0.25.0 // indirect golang.org/x/sys v0.20.0 // indirect diff --git a/x/tx/go.sum b/x/tx/go.sum index c94dfc7bc954..8fcd940caa9c 100644 --- a/x/tx/go.sum +++ b/x/tx/go.sum @@ -29,9 +29,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= From 4e871f16d97c968b7fa410b360c4814626392194 Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Mon, 8 Jul 2024 17:06:20 +0700 Subject: [PATCH 39/62] create root store without app instance --- store/v2/commands.go | 15 +++++++++------ store/v2/root/factory.go | 25 +++++++++++++++++++++++++ store/v2/server.go | 8 ++++---- store/v2/store.go | 3 +++ 4 files changed, 41 insertions(+), 10 deletions(-) diff --git a/store/v2/commands.go b/store/v2/commands.go index 0e139876c7dd..642a8d9d8160 100644 --- a/store/v2/commands.go +++ b/store/v2/commands.go @@ -12,7 +12,7 @@ import ( ) // QueryBlockResultsCmd implements the default command for a BlockResults query. -func (s *StoreComponent[AppT, T]) PrunesCmd(appCreator serverv2.AppCreator[AppT, T]) *cobra.Command { +func (s *StoreComponent[AppT, T]) PrunesCmd() *cobra.Command { cmd := &cobra.Command{ Use: "prune [pruning-method]", Short: "Prune app history states by keeping the recent heights and deleting old heights", @@ -49,13 +49,16 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, ) logger := log.NewLogger(cmd.OutOrStdout()) - app := appCreator(logger, vp) - store := app.GetStore() + home, err := cmd.Flags().GetString("home") // should be FlagHome + if err != nil { + return err + } - rootStore, ok := store.(RootStore) - if !ok { - return fmt.Errorf("currently only support the pruning of rootmulti.Store type") + rootStore, err := CreateRootStore(home, logger) + if err != nil { + return fmt.Errorf("Can not create root store", err) } + latestHeight, err := rootStore.GetLatestVersion() if err != nil { return err diff --git a/store/v2/root/factory.go b/store/v2/root/factory.go index ced6ee91276c..3113aa01c395 100644 --- a/store/v2/root/factory.go +++ b/store/v2/root/factory.go @@ -3,6 +3,7 @@ package root import ( "fmt" "os" + "path/filepath" "cosmossdk.io/core/log" corestore "cosmossdk.io/core/store" @@ -43,6 +44,30 @@ type FactoryOptions struct { SCRawDB corestore.KVStoreWithBatch } +func init() { + store.CreateRootStore = func(rootDir string, logger log.Logger) (store.RootStore, error) { + scRawDb, err := db.NewGoLevelDB("application", filepath.Join(rootDir, "data"), nil) + if err != nil { + panic(err) + } + return CreateRootStore(&FactoryOptions{ + Logger: logger, + RootDir: rootDir, + SSType: 0, + SCType: 0, + SCPruningOption: &store.PruningOption{ + KeepRecent: 0, + Interval: 0, + }, + IavlConfig: &iavl.Config{ + CacheSize: 100_000, + SkipFastStorageUpgrade: true, + }, + SCRawDB: scRawDb, + }) + } +} + // CreateRootStore is a convenience function to create a root store based on the // provided FactoryOptions. Strictly speaking app developers can create the root // store directly by calling root.New, so this function is not diff --git a/store/v2/server.go b/store/v2/server.go index a84cd4604f78..01c46aec6d73 100644 --- a/store/v2/server.go +++ b/store/v2/server.go @@ -9,7 +9,7 @@ import ( servercore "cosmossdk.io/core/server" "cosmossdk.io/core/transaction" - "cosmossdk.io/log" + "cosmossdk.io/core/log" ) type StoreComponent[AppT servercore.AppI[T], T transaction.Tx] struct { @@ -20,7 +20,7 @@ func New[AppT servercore.AppI[T], T transaction.Tx]() *StoreComponent[AppT, T] { return &StoreComponent[AppT, T]{} } -func (s *StoreComponent[AppT, T]) Init(appI servercore.AppI[transaction.Tx], v *viper.Viper, logger log.Logger) error { +func (s *StoreComponent[AppT, T]) Init(appI AppT, v *viper.Viper, logger log.Logger) error { cfg := DefaultConfig() if v != nil { if err := v.Sub(s.Name()).Unmarshal(&cfg); err != nil { @@ -43,9 +43,9 @@ func (s *StoreComponent[AppT, T]) Stop(ctx context.Context) error { return nil } -func (s *StoreComponent[AppT, T]) GetCommands(appCreator servercore.AppCreator[AppT, T]) []*cobra.Command { +func (s *StoreComponent[AppT, T]) GetCommands() []*cobra.Command { return []*cobra.Command{ - s.PrunesCmd(appCreator), + s.PrunesCmd(), } } diff --git a/store/v2/store.go b/store/v2/store.go index 71a3cc48bcad..a30bbc508f4d 100644 --- a/store/v2/store.go +++ b/store/v2/store.go @@ -4,6 +4,7 @@ import ( "io" coreheader "cosmossdk.io/core/header" + "cosmossdk.io/core/log" corestore "cosmossdk.io/core/store" "cosmossdk.io/store/v2/metrics" "cosmossdk.io/store/v2/proof" @@ -109,3 +110,5 @@ type QueryResult struct { Version uint64 ProofOps []proof.CommitmentOp } + +var CreateRootStore func(rootDir string, logger log.Logger) (RootStore, error) From ad013c5a9c595657498dc906d9ee82d95c44f18e Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Mon, 8 Jul 2024 17:06:30 +0700 Subject: [PATCH 40/62] update --- runtime/v2/app.go | 2 +- server/v2/api/grpc/server.go | 6 +++--- server/v2/api/grpcgateway/server.go | 9 +++++---- server/v2/cometbft/server.go | 21 ++++++++++++--------- server/v2/commands.go | 9 +++++---- server/v2/go.mod | 1 - server/v2/server.go | 17 +++++++++-------- server/v2/server_mock_test.go | 4 ++-- server/v2/server_test.go | 7 ++++--- server/v2/types.go | 12 ++---------- simapp/v2/simdv2/cmd/commands.go | 10 ++++++---- simapp/v2/simdv2/cmd/root_di.go | 4 ++-- simapp/v2/simdv2/cmd/root_test.go | 6 +++--- simapp/v2/simdv2/cmd/testnet.go | 7 ++++--- simapp/v2/simdv2/main.go | 3 ++- 15 files changed, 60 insertions(+), 58 deletions(-) diff --git a/runtime/v2/app.go b/runtime/v2/app.go index 59ede48711c2..5a868ddad05b 100644 --- a/runtime/v2/app.go +++ b/runtime/v2/app.go @@ -127,6 +127,6 @@ func (a *App[T]) ExecuteGenesisTx(_ []byte) error { panic("App.ExecuteGenesisTx not supported in runtime/v2") } -func (a *App[T]) GetAppManager() *appmanager.AppManager[T] { +func (a *App[T]) GetAppManager() any { return a.AppManager } diff --git a/server/v2/api/grpc/server.go b/server/v2/api/grpc/server.go index 764667222f53..c122c9e07303 100644 --- a/server/v2/api/grpc/server.go +++ b/server/v2/api/grpc/server.go @@ -8,13 +8,13 @@ import ( "github.com/spf13/viper" "google.golang.org/grpc" + servercore "cosmossdk.io/core/server" "cosmossdk.io/core/transaction" "cosmossdk.io/log" - "cosmossdk.io/server/v2" "cosmossdk.io/server/v2/api/grpc/gogoreflection" ) -type GRPCServer[AppT serverv2.AppI[T], T transaction.Tx] struct { +type GRPCServer[AppT servercore.AppI[T], T transaction.Tx] struct { logger log.Logger config *Config cfgOptions []CfgOption @@ -23,7 +23,7 @@ type GRPCServer[AppT serverv2.AppI[T], T transaction.Tx] struct { } // New creates a new grpc server. -func New[AppT serverv2.AppI[T], T transaction.Tx](cfgOptions ...CfgOption) *GRPCServer[AppT, T] { +func New[AppT servercore.AppI[T], T transaction.Tx](cfgOptions ...CfgOption) *GRPCServer[AppT, T] { return &GRPCServer[AppT, T]{ cfgOptions: cfgOptions, } diff --git a/server/v2/api/grpcgateway/server.go b/server/v2/api/grpcgateway/server.go index 220e8b32f617..180ace3b5594 100644 --- a/server/v2/api/grpcgateway/server.go +++ b/server/v2/api/grpcgateway/server.go @@ -16,18 +16,19 @@ import ( "cosmossdk.io/core/transaction" "cosmossdk.io/log" serverv2 "cosmossdk.io/server/v2" + servercore "cosmossdk.io/core/server" ) var _ serverv2.ServerComponent[ - serverv2.AppI[transaction.Tx], transaction.Tx, -] = (*GRPCGatewayServer[serverv2.AppI[transaction.Tx], transaction.Tx])(nil) + servercore.AppI[transaction.Tx], transaction.Tx, +] = (*GRPCGatewayServer[servercore.AppI[transaction.Tx], transaction.Tx])(nil) const ( // GRPCBlockHeightHeader is the gRPC header for block height. GRPCBlockHeightHeader = "x-cosmos-block-height" ) -type GRPCGatewayServer[AppT serverv2.AppI[T], T transaction.Tx] struct { +type GRPCGatewayServer[AppT servercore.AppI[T], T transaction.Tx] struct { logger log.Logger config *Config cfgOptions []CfgOption @@ -37,7 +38,7 @@ type GRPCGatewayServer[AppT serverv2.AppI[T], T transaction.Tx] struct { } // New creates a new gRPC-gateway server. -func New[AppT serverv2.AppI[T], T transaction.Tx](grpcSrv *grpc.Server, ir jsonpb.AnyResolver, cfgOptions ...CfgOption) *GRPCGatewayServer[AppT, T] { +func New[AppT servercore.AppI[T], T transaction.Tx](grpcSrv *grpc.Server, ir jsonpb.AnyResolver, cfgOptions ...CfgOption) *GRPCGatewayServer[AppT, T] { // The default JSON marshaller used by the gRPC-Gateway is unable to marshal non-nullable non-scalar fields. // Using the gogo/gateway package with the gRPC-Gateway WithMarshaler option fixes the scalar field marshaling issue. marshalerOption := &gateway.JSONPb{ diff --git a/server/v2/cometbft/server.go b/server/v2/cometbft/server.go index f77ce54804d4..37735899c37a 100644 --- a/server/v2/cometbft/server.go +++ b/server/v2/cometbft/server.go @@ -20,8 +20,10 @@ import ( corectx "cosmossdk.io/core/context" "cosmossdk.io/core/log" + servercore "cosmossdk.io/core/server" "cosmossdk.io/core/transaction" serverv2 "cosmossdk.io/server/v2" + "cosmossdk.io/server/v2/appmanager" cometlog "cosmossdk.io/server/v2/cometbft/log" "cosmossdk.io/server/v2/cometbft/types" "cosmossdk.io/store/v2/snapshots" @@ -31,15 +33,15 @@ import ( var ( _ serverv2.ServerComponent[ - serverv2.AppI[transaction.Tx], transaction.Tx, - ] = (*CometBFTServer[serverv2.AppI[transaction.Tx], transaction.Tx])(nil) + servercore.AppI[transaction.Tx], transaction.Tx, + ] = (*CometBFTServer[servercore.AppI[transaction.Tx], transaction.Tx])(nil) _ serverv2.HasCLICommands[ - serverv2.AppI[transaction.Tx], transaction.Tx, - ] = (*CometBFTServer[serverv2.AppI[transaction.Tx], transaction.Tx])(nil) - _ serverv2.HasStartFlags = (*CometBFTServer[serverv2.AppI[transaction.Tx], transaction.Tx])(nil) + servercore.AppI[transaction.Tx], transaction.Tx, + ] = (*CometBFTServer[servercore.AppI[transaction.Tx], transaction.Tx])(nil) + _ serverv2.HasStartFlags = (*CometBFTServer[servercore.AppI[transaction.Tx], transaction.Tx])(nil) ) -type CometBFTServer[AppT serverv2.AppI[T], T transaction.Tx] struct { +type CometBFTServer[AppT servercore.AppI[T], T transaction.Tx] struct { Node *node.Node Consensus *Consensus[T] @@ -50,7 +52,7 @@ type CometBFTServer[AppT serverv2.AppI[T], T transaction.Tx] struct { cmtConfigOptions []CmtCfgOption } -func New[AppT serverv2.AppI[T], T transaction.Tx](txCodec transaction.Codec[T], options ServerOptions[T], cfgOptions ...CmtCfgOption) *CometBFTServer[AppT, T] { +func New[AppT servercore.AppI[T], T transaction.Tx](txCodec transaction.Codec[T], options ServerOptions[T], cfgOptions ...CmtCfgOption) *CometBFTServer[AppT, T] { return &CometBFTServer[AppT, T]{ initTxCodec: txCodec, options: options, @@ -64,7 +66,8 @@ func (s *CometBFTServer[AppT, T]) Init(appI AppT, v *viper.Viper, logger log.Log // create consensus store := appI.GetStore().(types.Store) - consensus := NewConsensus[T](appI.GetAppManager(), s.options.Mempool, store, s.config, s.initTxCodec, s.logger) + appManager := appI.GetAppManager().(*appmanager.AppManager[T]) + consensus := NewConsensus[T](appManager, s.options.Mempool, store, s.config, s.initTxCodec, s.logger) consensus.prepareProposalHandler = s.options.PrepareProposalHandler consensus.processProposalHandler = s.options.ProcessProposalHandler @@ -191,7 +194,7 @@ func (s *CometBFTServer[AppT, T]) StartCmdFlags() *pflag.FlagSet { return flags } -func (s *CometBFTServer[AppT, T]) GetCommands(_ serverv2.AppCreator[AppT, T]) []*cobra.Command { +func (s *CometBFTServer[AppT, T]) GetCommands() []*cobra.Command { return []*cobra.Command{ s.StatusCommand(), s.ShowNodeIDCmd(), diff --git a/server/v2/commands.go b/server/v2/commands.go index 8fd8a69b9e5a..f06ed77fb05e 100644 --- a/server/v2/commands.go +++ b/server/v2/commands.go @@ -15,6 +15,7 @@ import ( "cosmossdk.io/core/transaction" "cosmossdk.io/log" + servercore "cosmossdk.io/core/server" ) // Execute executes the root command of an application. @@ -35,7 +36,7 @@ func Execute(rootCmd *cobra.Command, envPrefix, defaultHome string) error { // AddCommands add the server commands to the root command // It configure the config handling and the logger handling -func AddCommands[AppT AppI[T], T transaction.Tx]( +func AddCommands[AppT servercore.AppI[T], T transaction.Tx]( rootCmd *cobra.Command, newApp AppCreator[AppT, T], logger log.Logger, @@ -65,7 +66,7 @@ func AddCommands[AppT AppI[T], T transaction.Tx]( return originalPersistentPreRunE(cmd, args) } - cmds := server.CLICommands(newApp) + cmds := server.CLICommands() startCmd := createStartCommand(server, newApp) startCmd.SetContext(rootCmd.Context()) cmds.Commands = append(cmds.Commands, startCmd) @@ -96,7 +97,7 @@ func AddCommands[AppT AppI[T], T transaction.Tx]( } // createStartCommand creates the start command for the application. -func createStartCommand[AppT AppI[T], T transaction.Tx]( +func createStartCommand[AppT servercore.AppI[T], T transaction.Tx]( server *Server[AppT, T], newApp AppCreator[AppT, T], ) *cobra.Command { @@ -146,7 +147,7 @@ func createStartCommand[AppT AppI[T], T transaction.Tx]( } // configHandle writes the default config to the home directory if it does not exist and sets the server context -func configHandle[AppT AppI[T], T transaction.Tx](s *Server[AppT, T], cmd *cobra.Command) error { +func configHandle[AppT servercore.AppI[T], T transaction.Tx](s *Server[AppT, T], cmd *cobra.Command) error { home, err := cmd.Flags().GetString(FlagHome) if err != nil { return err diff --git a/server/v2/go.mod b/server/v2/go.mod index 96caa77d1627..dd3f14b4469b 100644 --- a/server/v2/go.mod +++ b/server/v2/go.mod @@ -17,7 +17,6 @@ require ( cosmossdk.io/api v0.7.5 cosmossdk.io/core v0.12.1-0.20231114100755-569e3ff6a0d7 cosmossdk.io/log v1.3.1 - cosmossdk.io/server/v2/appmanager v0.0.0-00010101000000-000000000000 github.com/cosmos/cosmos-proto v1.0.0-beta.5 github.com/cosmos/gogogateway v1.2.0 github.com/cosmos/gogoproto v1.5.0 diff --git a/server/v2/server.go b/server/v2/server.go index 4cc2c907e068..3009744462a8 100644 --- a/server/v2/server.go +++ b/server/v2/server.go @@ -13,12 +13,13 @@ import ( "github.com/spf13/viper" "golang.org/x/sync/errgroup" + servercore "cosmossdk.io/core/server" "cosmossdk.io/core/transaction" "cosmossdk.io/log" ) // ServerComponent is a server module that can be started and stopped. -type ServerComponent[AppT AppI[T], T transaction.Tx] interface { +type ServerComponent[AppT servercore.AppI[T], T transaction.Tx] interface { Name() string Start(context.Context) error @@ -27,8 +28,8 @@ type ServerComponent[AppT AppI[T], T transaction.Tx] interface { } // HasCLICommands is a server module that has CLI commands. -type HasCLICommands[AppT AppI[T], T transaction.Tx] interface { - GetCommands(AppCreator[AppT, T]) []*cobra.Command +type HasCLICommands[AppT servercore.AppI[T], T transaction.Tx] interface { + GetCommands() []*cobra.Command GetTxs() []*cobra.Command GetQueries() []*cobra.Command } @@ -43,7 +44,7 @@ type HasStartFlags interface { StartCmdFlags() *pflag.FlagSet } -var _ ServerComponent[AppI[transaction.Tx], transaction.Tx] = (*Server[AppI[transaction.Tx], transaction.Tx])(nil) +var _ ServerComponent[servercore.AppI[transaction.Tx], transaction.Tx] = (*Server[servercore.AppI[transaction.Tx], transaction.Tx])(nil) // Configs returns a viper instance of the config file func ReadConfig(configPath string) (*viper.Viper, error) { @@ -65,12 +66,12 @@ func ReadConfig(configPath string) (*viper.Viper, error) { return v, nil } -type Server[AppT AppI[T], T transaction.Tx] struct { +type Server[AppT servercore.AppI[T], T transaction.Tx] struct { logger log.Logger components []ServerComponent[AppT, T] } -func NewServer[AppT AppI[T], T transaction.Tx]( +func NewServer[AppT servercore.AppI[T], T transaction.Tx]( logger log.Logger, components ...ServerComponent[AppT, T], ) *Server[AppT, T] { return &Server[AppT, T]{ @@ -120,7 +121,7 @@ func (s *Server[AppT, T]) Stop(ctx context.Context) error { } // CLICommands returns all CLI commands of all components. -func (s *Server[AppT, T]) CLICommands(appCreator AppCreator[AppT, T]) CLIConfig { +func (s *Server[AppT, T]) CLICommands() CLIConfig { compart := func(name string, cmds ...*cobra.Command) *cobra.Command { if len(cmds) == 1 && strings.HasPrefix(cmds[0].Use, name) { return cmds[0] @@ -138,7 +139,7 @@ func (s *Server[AppT, T]) CLICommands(appCreator AppCreator[AppT, T]) CLIConfig commands := CLIConfig{} for _, mod := range s.components { if climod, ok := mod.(HasCLICommands[AppT, T]); ok { - commands.Commands = append(commands.Commands, compart(mod.Name(), climod.GetCommands(appCreator)...)) + commands.Commands = append(commands.Commands, compart(mod.Name(), climod.GetCommands()...)) commands.Txs = append(commands.Txs, compart(mod.Name(), climod.GetTxs()...)) commands.Queries = append(commands.Queries, compart(mod.Name(), climod.GetQueries()...)) } diff --git a/server/v2/server_mock_test.go b/server/v2/server_mock_test.go index a79d45584ba7..8b2294c415ba 100644 --- a/server/v2/server_mock_test.go +++ b/server/v2/server_mock_test.go @@ -7,8 +7,8 @@ import ( "github.com/spf13/viper" - serverv2 "cosmossdk.io/server/v2" "cosmossdk.io/core/transaction" + servercore "cosmossdk.io/core/server" "cosmossdk.io/log" ) @@ -33,7 +33,7 @@ func (s *mockServer) Name() string { return s.name } -func (s *mockServer) Init(appI serverv2.AppI[transaction.Tx], v *viper.Viper, logger log.Logger) error { +func (s *mockServer) Init(appI servercore.AppI[transaction.Tx], v *viper.Viper, logger log.Logger) error { return nil } diff --git a/server/v2/server_test.go b/server/v2/server_test.go index 2155e0e1af8e..1bafef3028c3 100644 --- a/server/v2/server_test.go +++ b/server/v2/server_test.go @@ -15,6 +15,7 @@ import ( "cosmossdk.io/core/transaction" "cosmossdk.io/log" serverv2 "cosmossdk.io/server/v2" + servercore "cosmossdk.io/core/server" grpc "cosmossdk.io/server/v2/api/grpc" ) @@ -30,7 +31,7 @@ func (*mockInterfaceRegistry) ListImplementations(ifaceTypeURL string) []string func (*mockInterfaceRegistry) ListAllInterfaces() []string { panic("not implemented") } type mockApp[T transaction.Tx] struct { - serverv2.AppI[T] + servercore.AppI[T] } func (*mockApp[T]) InterfaceRegistry() coreapp.InterfaceRegistry { @@ -58,7 +59,7 @@ func TestServer(t *testing.T) { } logger := log.NewLogger(os.Stdout) - grpcServer := grpc.New[serverv2.AppI[transaction.Tx], transaction.Tx]() + grpcServer := grpc.New[servercore.AppI[transaction.Tx], transaction.Tx]() if err := grpcServer.Init(&mockApp[transaction.Tx]{}, v, logger); err != nil { t.Log(err) t.Fail() @@ -66,7 +67,7 @@ func TestServer(t *testing.T) { mockServer := &mockServer{name: "mock-server-1", ch: make(chan string, 100)} - server := serverv2.NewServer( + server := serverv2.NewServer[servercore.AppI[transaction.Tx], transaction.Tx]( logger, grpcServer, mockServer, diff --git a/server/v2/types.go b/server/v2/types.go index 1a22abf8e16f..3ec0936fada7 100644 --- a/server/v2/types.go +++ b/server/v2/types.go @@ -3,17 +3,9 @@ package serverv2 import ( "github.com/spf13/viper" - coreapp "cosmossdk.io/core/app" + servercore "cosmossdk.io/core/server" "cosmossdk.io/core/transaction" "cosmossdk.io/log" - "cosmossdk.io/server/v2/appmanager" ) -type AppCreator[AppT AppI[T], T transaction.Tx] func(log.Logger, *viper.Viper) AppT - -type AppI[T transaction.Tx] interface { - GetAppManager() *appmanager.AppManager[T] - GetConsensusAuthority() string - InterfaceRegistry() coreapp.InterfaceRegistry - GetStore() any -} +type AppCreator[AppT servercore.AppI[T], T transaction.Tx] func(log.Logger, *viper.Viper) AppT diff --git a/simapp/v2/simdv2/cmd/commands.go b/simapp/v2/simdv2/cmd/commands.go index 6aeadbdfb08a..eb8856227480 100644 --- a/simapp/v2/simdv2/cmd/commands.go +++ b/simapp/v2/simdv2/cmd/commands.go @@ -14,10 +14,11 @@ import ( "cosmossdk.io/log" runtimev2 "cosmossdk.io/runtime/v2" serverv2 "cosmossdk.io/server/v2" + servercore "cosmossdk.io/core/server" "cosmossdk.io/server/v2/api/grpc" "cosmossdk.io/server/v2/cometbft" "cosmossdk.io/simapp/v2" - // storev2 "cosmossdk.io/store/v2" + storev2 "cosmossdk.io/store/v2" confixcmd "cosmossdk.io/tools/confix/cmd" authcmd "cosmossdk.io/x/auth/client/cli" @@ -73,13 +74,13 @@ func (t *temporaryTxDecoder[T]) DecodeJSON(bz []byte) (T, error) { return out, nil } -func newApp[AppT serverv2.AppI[T], T transaction.Tx]( +func newApp[AppT servercore.AppI[T], T transaction.Tx]( logger log.Logger, viper *viper.Viper, ) AppT { - return serverv2.AppI[T](simapp.NewSimApp[T](logger, viper)).(AppT) + return servercore.AppI[T](simapp.NewSimApp[T](logger, viper)).(AppT) } -func initRootCmd[AppT serverv2.AppI[T], T transaction.Tx]( +func initRootCmd[AppT servercore.AppI[T], T transaction.Tx]( rootCmd *cobra.Command, txConfig client.TxConfig, moduleManager *runtimev2.MM[T], @@ -117,6 +118,7 @@ func initRootCmd[AppT serverv2.AppI[T], T transaction.Tx]( logger, cometbft.New[AppT, T](&temporaryTxDecoder[T]{txConfig}, cometbft.DefaultServerOptions[T]()), grpc.New[AppT, T](), + storev2.New[AppT, T](), ); err != nil { panic(err) } diff --git a/simapp/v2/simdv2/cmd/root_di.go b/simapp/v2/simdv2/cmd/root_di.go index 61c355180386..ce010a3059bd 100644 --- a/simapp/v2/simdv2/cmd/root_di.go +++ b/simapp/v2/simdv2/cmd/root_di.go @@ -8,11 +8,11 @@ import ( "cosmossdk.io/client/v2/autocli" "cosmossdk.io/core/address" "cosmossdk.io/core/legacy" + servercore "cosmossdk.io/core/server" "cosmossdk.io/core/transaction" "cosmossdk.io/depinject" "cosmossdk.io/log" "cosmossdk.io/runtime/v2" - serverv2 "cosmossdk.io/server/v2" "cosmossdk.io/simapp/v2" "cosmossdk.io/x/auth/tx" authtxconfig "cosmossdk.io/x/auth/tx/config" @@ -26,7 +26,7 @@ import ( ) // NewRootCmd creates a new root command for simd. It is called once in the main function. -func NewRootCmd[AppT serverv2.AppI[T], T transaction.Tx]() *cobra.Command { +func NewRootCmd[AppT servercore.AppI[T], T transaction.Tx]() *cobra.Command { var ( autoCliOpts autocli.AppOptions moduleManager *runtime.MM[T] diff --git a/simapp/v2/simdv2/cmd/root_test.go b/simapp/v2/simdv2/cmd/root_test.go index ebca74ba70b9..e7dfd94d7033 100644 --- a/simapp/v2/simdv2/cmd/root_test.go +++ b/simapp/v2/simdv2/cmd/root_test.go @@ -7,17 +7,17 @@ import ( "github.com/stretchr/testify/require" "cosmossdk.io/core/transaction" - serverv2 "cosmossdk.io/server/v2" "cosmossdk.io/simapp/v2" "cosmossdk.io/simapp/v2/simdv2/cmd" + servercore "cosmossdk.io/core/server" "github.com/cosmos/cosmos-sdk/client/flags" svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" ) func TestInitCmd(t *testing.T) { - rootCmd := cmd.NewRootCmd[serverv2.AppI[transaction.Tx], transaction.Tx]() + rootCmd := cmd.NewRootCmd[servercore.AppI[transaction.Tx], transaction.Tx]() rootCmd.SetArgs([]string{ "init", // Test the init cmd "simapp-test", // Moniker @@ -30,7 +30,7 @@ func TestInitCmd(t *testing.T) { func TestHomeFlagRegistration(t *testing.T) { homeDir := "/tmp/foo" - rootCmd := cmd.NewRootCmd[serverv2.AppI[transaction.Tx], transaction.Tx]() + rootCmd := cmd.NewRootCmd[servercore.AppI[transaction.Tx], transaction.Tx]() rootCmd.SetArgs([]string{ "query", fmt.Sprintf("--%s", flags.FlagHome), diff --git a/simapp/v2/simdv2/cmd/testnet.go b/simapp/v2/simdv2/cmd/testnet.go index 61387b42301a..39cedd3d77e8 100644 --- a/simapp/v2/simdv2/cmd/testnet.go +++ b/simapp/v2/simdv2/cmd/testnet.go @@ -20,6 +20,7 @@ import ( "cosmossdk.io/math/unsafe" runtimev2 "cosmossdk.io/runtime/v2" serverv2 "cosmossdk.io/server/v2" + servercore "cosmossdk.io/core/server" "cosmossdk.io/server/v2/api/grpc" "cosmossdk.io/server/v2/cometbft" authtypes "cosmossdk.io/x/auth/types" @@ -336,9 +337,9 @@ func initTestnetFiles[T transaction.Tx]( } // Write server config - cometServer := cometbft.New[serverv2.AppI[T], T](&temporaryTxDecoder[T]{clientCtx.TxConfig}, cometbft.ServerOptions[T]{}, cometbft.OverwriteDefaultCometConfig(nodeConfig)) - grpcServer := grpc.New[serverv2.AppI[T], T](grpc.OverwriteDefaultConfig(grpcConfig)) - server := serverv2.NewServer(log.NewNopLogger(), cometServer, grpcServer) + cometServer := cometbft.New[servercore.AppI[T], T](&temporaryTxDecoder[T]{clientCtx.TxConfig}, cometbft.ServerOptions[T]{}, cometbft.OverwriteDefaultCometConfig(nodeConfig)) + grpcServer := grpc.New[servercore.AppI[T], T](grpc.OverwriteDefaultConfig(grpcConfig)) + server := serverv2.NewServer[servercore.AppI[T], T](log.NewNopLogger(), cometServer, grpcServer) err = server.WriteConfig(filepath.Join(nodeDir, "config")) if err != nil { return err diff --git a/simapp/v2/simdv2/main.go b/simapp/v2/simdv2/main.go index e41ba6ffc13c..980be6c0b3db 100644 --- a/simapp/v2/simdv2/main.go +++ b/simapp/v2/simdv2/main.go @@ -6,12 +6,13 @@ import ( "cosmossdk.io/core/transaction" serverv2 "cosmossdk.io/server/v2" + servercore "cosmossdk.io/core/server" "cosmossdk.io/simapp/v2" "cosmossdk.io/simapp/v2/simdv2/cmd" ) func main() { - rootCmd := cmd.NewRootCmd[serverv2.AppI[transaction.Tx], transaction.Tx]() + rootCmd := cmd.NewRootCmd[servercore.AppI[transaction.Tx], transaction.Tx]() if err := serverv2.Execute(rootCmd, "", simapp.DefaultNodeHome); err != nil { fmt.Fprintln(rootCmd.OutOrStderr(), err) os.Exit(1) From d81532ac5b633e939b94401707b25ddd8b60951a Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Mon, 8 Jul 2024 17:19:32 +0700 Subject: [PATCH 41/62] lint --- server/v2/api/grpcgateway/server.go | 2 +- server/v2/commands.go | 2 +- server/v2/server_mock_test.go | 2 +- server/v2/server_test.go | 2 +- simapp/v2/simdv2/cmd/commands.go | 2 +- simapp/v2/simdv2/cmd/root_test.go | 2 +- simapp/v2/simdv2/cmd/testnet.go | 2 +- simapp/v2/simdv2/main.go | 2 +- store/v2/commands.go | 2 +- store/v2/server.go | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/server/v2/api/grpcgateway/server.go b/server/v2/api/grpcgateway/server.go index 180ace3b5594..6b8d3bd0b6f1 100644 --- a/server/v2/api/grpcgateway/server.go +++ b/server/v2/api/grpcgateway/server.go @@ -13,10 +13,10 @@ import ( "github.com/spf13/viper" "google.golang.org/grpc" + servercore "cosmossdk.io/core/server" "cosmossdk.io/core/transaction" "cosmossdk.io/log" serverv2 "cosmossdk.io/server/v2" - servercore "cosmossdk.io/core/server" ) var _ serverv2.ServerComponent[ diff --git a/server/v2/commands.go b/server/v2/commands.go index f06ed77fb05e..d9ec5dee31bb 100644 --- a/server/v2/commands.go +++ b/server/v2/commands.go @@ -13,9 +13,9 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" + servercore "cosmossdk.io/core/server" "cosmossdk.io/core/transaction" "cosmossdk.io/log" - servercore "cosmossdk.io/core/server" ) // Execute executes the root command of an application. diff --git a/server/v2/server_mock_test.go b/server/v2/server_mock_test.go index 8b2294c415ba..87576b4c7931 100644 --- a/server/v2/server_mock_test.go +++ b/server/v2/server_mock_test.go @@ -7,8 +7,8 @@ import ( "github.com/spf13/viper" - "cosmossdk.io/core/transaction" servercore "cosmossdk.io/core/server" + "cosmossdk.io/core/transaction" "cosmossdk.io/log" ) diff --git a/server/v2/server_test.go b/server/v2/server_test.go index 1bafef3028c3..493284f39970 100644 --- a/server/v2/server_test.go +++ b/server/v2/server_test.go @@ -12,10 +12,10 @@ import ( "github.com/stretchr/testify/require" coreapp "cosmossdk.io/core/app" + servercore "cosmossdk.io/core/server" "cosmossdk.io/core/transaction" "cosmossdk.io/log" serverv2 "cosmossdk.io/server/v2" - servercore "cosmossdk.io/core/server" grpc "cosmossdk.io/server/v2/api/grpc" ) diff --git a/simapp/v2/simdv2/cmd/commands.go b/simapp/v2/simdv2/cmd/commands.go index eb8856227480..451e11d7ba66 100644 --- a/simapp/v2/simdv2/cmd/commands.go +++ b/simapp/v2/simdv2/cmd/commands.go @@ -10,11 +10,11 @@ import ( "github.com/spf13/viper" "cosmossdk.io/client/v2/offchain" + servercore "cosmossdk.io/core/server" "cosmossdk.io/core/transaction" "cosmossdk.io/log" runtimev2 "cosmossdk.io/runtime/v2" serverv2 "cosmossdk.io/server/v2" - servercore "cosmossdk.io/core/server" "cosmossdk.io/server/v2/api/grpc" "cosmossdk.io/server/v2/cometbft" "cosmossdk.io/simapp/v2" diff --git a/simapp/v2/simdv2/cmd/root_test.go b/simapp/v2/simdv2/cmd/root_test.go index e7dfd94d7033..a2fdea816db6 100644 --- a/simapp/v2/simdv2/cmd/root_test.go +++ b/simapp/v2/simdv2/cmd/root_test.go @@ -6,11 +6,11 @@ import ( "github.com/stretchr/testify/require" + servercore "cosmossdk.io/core/server" "cosmossdk.io/core/transaction" "cosmossdk.io/simapp/v2" "cosmossdk.io/simapp/v2/simdv2/cmd" - servercore "cosmossdk.io/core/server" "github.com/cosmos/cosmos-sdk/client/flags" svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" diff --git a/simapp/v2/simdv2/cmd/testnet.go b/simapp/v2/simdv2/cmd/testnet.go index 39cedd3d77e8..e162335e9d2a 100644 --- a/simapp/v2/simdv2/cmd/testnet.go +++ b/simapp/v2/simdv2/cmd/testnet.go @@ -15,12 +15,12 @@ import ( "github.com/spf13/pflag" "cosmossdk.io/core/log" + servercore "cosmossdk.io/core/server" "cosmossdk.io/core/transaction" "cosmossdk.io/math" "cosmossdk.io/math/unsafe" runtimev2 "cosmossdk.io/runtime/v2" serverv2 "cosmossdk.io/server/v2" - servercore "cosmossdk.io/core/server" "cosmossdk.io/server/v2/api/grpc" "cosmossdk.io/server/v2/cometbft" authtypes "cosmossdk.io/x/auth/types" diff --git a/simapp/v2/simdv2/main.go b/simapp/v2/simdv2/main.go index 980be6c0b3db..0ddc15722353 100644 --- a/simapp/v2/simdv2/main.go +++ b/simapp/v2/simdv2/main.go @@ -4,9 +4,9 @@ import ( "fmt" "os" + servercore "cosmossdk.io/core/server" "cosmossdk.io/core/transaction" serverv2 "cosmossdk.io/server/v2" - servercore "cosmossdk.io/core/server" "cosmossdk.io/simapp/v2" "cosmossdk.io/simapp/v2/simdv2/cmd" ) diff --git a/store/v2/commands.go b/store/v2/commands.go index 642a8d9d8160..0acad5d67006 100644 --- a/store/v2/commands.go +++ b/store/v2/commands.go @@ -56,7 +56,7 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, rootStore, err := CreateRootStore(home, logger) if err != nil { - return fmt.Errorf("Can not create root store", err) + return fmt.Errorf("Can not create root store %v", err) } latestHeight, err := rootStore.GetLatestVersion() diff --git a/store/v2/server.go b/store/v2/server.go index 01c46aec6d73..be39065acf4d 100644 --- a/store/v2/server.go +++ b/store/v2/server.go @@ -7,9 +7,9 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" + "cosmossdk.io/core/log" servercore "cosmossdk.io/core/server" "cosmossdk.io/core/transaction" - "cosmossdk.io/core/log" ) type StoreComponent[AppT servercore.AppI[T], T transaction.Tx] struct { From 3dba15dc28d49af82fff69837b8f1de859f52d11 Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Mon, 8 Jul 2024 17:29:32 +0700 Subject: [PATCH 42/62] print err format --- store/v2/commands.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/store/v2/commands.go b/store/v2/commands.go index 0acad5d67006..4c2a892929b0 100644 --- a/store/v2/commands.go +++ b/store/v2/commands.go @@ -56,7 +56,7 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, rootStore, err := CreateRootStore(home, logger) if err != nil { - return fmt.Errorf("Can not create root store %v", err) + return fmt.Errorf("Can not create root store %w", err) } latestHeight, err := rootStore.GetLatestVersion() From ccc37225478b1de60e0ece07871e2cb0d95293ac Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Mon, 8 Jul 2024 17:42:09 +0700 Subject: [PATCH 43/62] reduce go mod change --- orm/go.mod | 3 ++- orm/go.sum | 7 ++++--- server/v2/appmanager/go.mod | 1 + server/v2/appmanager/go.sum | 4 ++-- server/v2/cometbft/go.mod | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/orm/go.mod b/orm/go.mod index 583b03b9f1ea..a646939e3627 100644 --- a/orm/go.mod +++ b/orm/go.mod @@ -37,6 +37,7 @@ require ( github.com/cucumber/messages/go/v22 v22.0.0 // indirect github.com/cucumber/tag-expressions/go/v6 v6.1.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/getsentry/sentry-go v0.27.0 // indirect github.com/gofrs/uuid v4.4.0+incompatible // indirect github.com/gogo/protobuf v1.3.2 // indirect @@ -49,7 +50,7 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/onsi/gomega v1.20.0 // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_golang v1.19.1 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.55.0 // indirect diff --git a/orm/go.sum b/orm/go.sum index c12893443059..d212f2349346 100644 --- a/orm/go.sum +++ b/orm/go.sum @@ -48,8 +48,9 @@ github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHk github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI= github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= +github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= +github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/getsentry/sentry-go v0.27.0 h1:Pv98CIbtB3LkMWmXi4Joa5OOcwbmnX88sF5qbK3r3Ps= github.com/getsentry/sentry-go v0.27.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= @@ -122,9 +123,8 @@ github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTw github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= @@ -195,6 +195,7 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= diff --git a/server/v2/appmanager/go.mod b/server/v2/appmanager/go.mod index 266c4eb8c431..1a68cf395714 100644 --- a/server/v2/appmanager/go.mod +++ b/server/v2/appmanager/go.mod @@ -9,6 +9,7 @@ require cosmossdk.io/core v0.12.0 require ( github.com/cosmos/gogoproto v1.5.0 // indirect github.com/google/go-cmp v0.6.0 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect golang.org/x/exp v0.0.0-20240314144324-c7f7c6466f7f // indirect google.golang.org/protobuf v1.34.2 // indirect ) diff --git a/server/v2/appmanager/go.sum b/server/v2/appmanager/go.sum index 4cf46e5c9ee9..174f840d47d0 100644 --- a/server/v2/appmanager/go.sum +++ b/server/v2/appmanager/go.sum @@ -6,8 +6,8 @@ github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= golang.org/x/exp v0.0.0-20240314144324-c7f7c6466f7f h1:3CW0unweImhOzd5FmYuRsD4Y4oQFKZIjAnKbjV4WIrw= diff --git a/server/v2/cometbft/go.mod b/server/v2/cometbft/go.mod index 3123bfc189d8..b7b51b9287bf 100644 --- a/server/v2/cometbft/go.mod +++ b/server/v2/cometbft/go.mod @@ -28,7 +28,7 @@ require ( cosmossdk.io/errors v1.0.1 cosmossdk.io/server/v2 v2.0.0-00010101000000-000000000000 cosmossdk.io/server/v2/appmanager v0.0.0-00010101000000-000000000000 - cosmossdk.io/store/v2 v2.0.0-20240624103346-720c1086cb3f + cosmossdk.io/store/v2 v2.0.0-00010101000000-000000000000 cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 cosmossdk.io/x/consensus v0.0.0-00010101000000-000000000000 github.com/cometbft/cometbft v1.0.0-rc1 From 6b5b25a70bdac3db05dd6fd95abc13de61f9acdf Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Tue, 16 Jul 2024 15:16:02 +0700 Subject: [PATCH 44/62] bring back to server/v2 --- core/server/types.go | 13 ------- runtime/v2/app.go | 2 +- runtime/v2/go.mod | 17 ---------- runtime/v2/go.sum | 41 ----------------------- server/v2/api/grpc/server.go | 6 ++-- server/v2/api/grpcgateway/server.go | 9 +++-- server/v2/cometbft/server.go | 20 +++++------ server/v2/commands.go | 7 ++-- server/v2/go.mod | 9 +++-- server/v2/go.sum | 10 ++++-- server/v2/server.go | 11 +++--- server/v2/server_mock_test.go | 4 +-- server/v2/server_test.go | 8 ++--- {store/v2 => server/v2/store}/commands.go | 13 +++---- {store/v2 => server/v2/store}/config.go | 6 +++- {store/v2 => server/v2/store}/flags.go | 0 {store/v2 => server/v2/store}/server.go | 7 ++-- server/v2/types.go | 12 +++++-- simapp/v2/simdv2/cmd/commands.go | 12 +++---- simapp/v2/simdv2/cmd/root_di.go | 5 +-- simapp/v2/simdv2/cmd/root_test.go | 6 ++-- simapp/v2/simdv2/cmd/testnet.go | 7 ++-- simapp/v2/simdv2/main.go | 3 +- store/v2/go.mod | 16 --------- store/v2/go.sum | 41 ----------------------- 25 files changed, 87 insertions(+), 198 deletions(-) delete mode 100644 core/server/types.go rename {store/v2 => server/v2/store}/commands.go (92%) rename {store/v2 => server/v2/store}/config.go (83%) rename {store/v2 => server/v2/store}/flags.go (100%) rename {store/v2 => server/v2/store}/server.go (85%) diff --git a/core/server/types.go b/core/server/types.go deleted file mode 100644 index 5721dc41c184..000000000000 --- a/core/server/types.go +++ /dev/null @@ -1,13 +0,0 @@ -package server - -import ( - coreapp "cosmossdk.io/core/app" - "cosmossdk.io/core/transaction" -) - -type AppI[T transaction.Tx] interface { - GetAppManager() any - GetConsensusAuthority() string - InterfaceRegistry() coreapp.InterfaceRegistry - GetStore() any -} diff --git a/runtime/v2/app.go b/runtime/v2/app.go index 5a868ddad05b..59ede48711c2 100644 --- a/runtime/v2/app.go +++ b/runtime/v2/app.go @@ -127,6 +127,6 @@ func (a *App[T]) ExecuteGenesisTx(_ []byte) error { panic("App.ExecuteGenesisTx not supported in runtime/v2") } -func (a *App[T]) GetAppManager() any { +func (a *App[T]) GetAppManager() *appmanager.AppManager[T] { return a.AppManager } diff --git a/runtime/v2/go.mod b/runtime/v2/go.mod index 8d927e4c8e07..28ebe32b1822 100644 --- a/runtime/v2/go.mod +++ b/runtime/v2/go.mod @@ -54,7 +54,6 @@ require ( github.com/cosmos/ics23/go v0.10.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/emicklei/dot v1.6.2 // indirect - github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/getsentry/sentry-go v0.27.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/snappy v0.0.4 // indirect @@ -63,20 +62,15 @@ require ( github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/go-metrics v0.5.3 // indirect github.com/hashicorp/golang-lru v1.0.2 // indirect - github.com/hashicorp/hcl v1.0.0 // indirect - github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/klauspost/compress v1.17.8 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/linxGnu/grocksdb v1.8.14 // indirect - github.com/magiconair/properties v1.8.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-sqlite3 v1.14.22 // indirect - github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/onsi/gomega v1.28.1 // indirect - github.com/pelletier/go-toml/v2 v2.2.2 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.19.1 // indirect @@ -85,20 +79,10 @@ require ( github.com/prometheus/procfs v0.15.1 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/rs/zerolog v1.33.0 // indirect - github.com/sagikazarmark/locafero v0.4.0 // indirect - github.com/sagikazarmark/slog-shim v0.1.0 // indirect - github.com/sourcegraph/conc v0.3.0 // indirect - github.com/spf13/afero v1.11.0 // indirect github.com/spf13/cast v1.6.0 // indirect - github.com/spf13/cobra v1.8.1 // indirect - github.com/spf13/pflag v1.0.5 // indirect - github.com/spf13/viper v1.19.0 // indirect github.com/stretchr/testify v1.9.0 // indirect - github.com/subosito/gotenv v1.6.0 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect github.com/tidwall/btree v1.7.0 // indirect - go.uber.org/atomic v1.9.0 // indirect - go.uber.org/multierr v1.9.0 // indirect golang.org/x/crypto v0.25.0 // indirect golang.org/x/net v0.26.0 // indirect golang.org/x/sync v0.7.0 // indirect @@ -106,7 +90,6 @@ require ( golang.org/x/text v0.16.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240513163218-0867130af1f8 // indirect - gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect sigs.k8s.io/yaml v1.4.0 // indirect ) diff --git a/runtime/v2/go.sum b/runtime/v2/go.sum index 5a456f940a1b..1dcfa0e08342 100644 --- a/runtime/v2/go.sum +++ b/runtime/v2/go.sum @@ -46,7 +46,6 @@ github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= -github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -116,12 +115,8 @@ github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/b github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c= github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= -github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= -github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= @@ -140,8 +135,6 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/linxGnu/grocksdb v1.8.14 h1:HTgyYalNwBSG/1qCQUIott44wU5b2Y9Kr3z7SK5OfGQ= github.com/linxGnu/grocksdb v1.8.14/go.mod h1:QYiYypR2d4v63Wj1adOOfzglnoII0gLj3PNh4fZkcFA= -github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= -github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= @@ -151,8 +144,6 @@ github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= -github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= @@ -177,8 +168,6 @@ github.com/onsi/gomega v1.28.1 h1:MijcGUbfYuznzK/5R4CPNoUP/9Xvuo20sXfEm6XxoTA= github.com/onsi/gomega v1.28.1/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= -github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= @@ -214,42 +203,19 @@ github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99 github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= -github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= -github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= -github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= -github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= -github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= -github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= -github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= -github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= -github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI= -github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= -github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d h1:vfofYNRScrDdvS342BElfbETmL1Aiz3i2t0zfRj16Hs= github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48= github.com/tidwall/btree v1.7.0 h1:L1fkJH/AuEh5zBnnBbmTwQ5Lt+bRJ5A8EWecslvo9iI= @@ -257,10 +223,6 @@ github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EU github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= -go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= -go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -357,8 +319,6 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= -gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -367,7 +327,6 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= diff --git a/server/v2/api/grpc/server.go b/server/v2/api/grpc/server.go index c122c9e07303..20397ea7a89d 100644 --- a/server/v2/api/grpc/server.go +++ b/server/v2/api/grpc/server.go @@ -8,13 +8,13 @@ import ( "github.com/spf13/viper" "google.golang.org/grpc" - servercore "cosmossdk.io/core/server" "cosmossdk.io/core/transaction" "cosmossdk.io/log" + serverv2 "cosmossdk.io/server/v2" "cosmossdk.io/server/v2/api/grpc/gogoreflection" ) -type GRPCServer[AppT servercore.AppI[T], T transaction.Tx] struct { +type GRPCServer[AppT serverv2.AppI[T], T transaction.Tx] struct { logger log.Logger config *Config cfgOptions []CfgOption @@ -23,7 +23,7 @@ type GRPCServer[AppT servercore.AppI[T], T transaction.Tx] struct { } // New creates a new grpc server. -func New[AppT servercore.AppI[T], T transaction.Tx](cfgOptions ...CfgOption) *GRPCServer[AppT, T] { +func New[AppT serverv2.AppI[T], T transaction.Tx](cfgOptions ...CfgOption) *GRPCServer[AppT, T] { return &GRPCServer[AppT, T]{ cfgOptions: cfgOptions, } diff --git a/server/v2/api/grpcgateway/server.go b/server/v2/api/grpcgateway/server.go index 6b8d3bd0b6f1..220e8b32f617 100644 --- a/server/v2/api/grpcgateway/server.go +++ b/server/v2/api/grpcgateway/server.go @@ -13,22 +13,21 @@ import ( "github.com/spf13/viper" "google.golang.org/grpc" - servercore "cosmossdk.io/core/server" "cosmossdk.io/core/transaction" "cosmossdk.io/log" serverv2 "cosmossdk.io/server/v2" ) var _ serverv2.ServerComponent[ - servercore.AppI[transaction.Tx], transaction.Tx, -] = (*GRPCGatewayServer[servercore.AppI[transaction.Tx], transaction.Tx])(nil) + serverv2.AppI[transaction.Tx], transaction.Tx, +] = (*GRPCGatewayServer[serverv2.AppI[transaction.Tx], transaction.Tx])(nil) const ( // GRPCBlockHeightHeader is the gRPC header for block height. GRPCBlockHeightHeader = "x-cosmos-block-height" ) -type GRPCGatewayServer[AppT servercore.AppI[T], T transaction.Tx] struct { +type GRPCGatewayServer[AppT serverv2.AppI[T], T transaction.Tx] struct { logger log.Logger config *Config cfgOptions []CfgOption @@ -38,7 +37,7 @@ type GRPCGatewayServer[AppT servercore.AppI[T], T transaction.Tx] struct { } // New creates a new gRPC-gateway server. -func New[AppT servercore.AppI[T], T transaction.Tx](grpcSrv *grpc.Server, ir jsonpb.AnyResolver, cfgOptions ...CfgOption) *GRPCGatewayServer[AppT, T] { +func New[AppT serverv2.AppI[T], T transaction.Tx](grpcSrv *grpc.Server, ir jsonpb.AnyResolver, cfgOptions ...CfgOption) *GRPCGatewayServer[AppT, T] { // The default JSON marshaller used by the gRPC-Gateway is unable to marshal non-nullable non-scalar fields. // Using the gogo/gateway package with the gRPC-Gateway WithMarshaler option fixes the scalar field marshaling issue. marshalerOption := &gateway.JSONPb{ diff --git a/server/v2/cometbft/server.go b/server/v2/cometbft/server.go index 37735899c37a..e2419294fdee 100644 --- a/server/v2/cometbft/server.go +++ b/server/v2/cometbft/server.go @@ -20,10 +20,9 @@ import ( corectx "cosmossdk.io/core/context" "cosmossdk.io/core/log" - servercore "cosmossdk.io/core/server" + "cosmossdk.io/core/transaction" serverv2 "cosmossdk.io/server/v2" - "cosmossdk.io/server/v2/appmanager" cometlog "cosmossdk.io/server/v2/cometbft/log" "cosmossdk.io/server/v2/cometbft/types" "cosmossdk.io/store/v2/snapshots" @@ -33,15 +32,15 @@ import ( var ( _ serverv2.ServerComponent[ - servercore.AppI[transaction.Tx], transaction.Tx, - ] = (*CometBFTServer[servercore.AppI[transaction.Tx], transaction.Tx])(nil) + serverv2.AppI[transaction.Tx], transaction.Tx, + ] = (*CometBFTServer[serverv2.AppI[transaction.Tx], transaction.Tx])(nil) _ serverv2.HasCLICommands[ - servercore.AppI[transaction.Tx], transaction.Tx, - ] = (*CometBFTServer[servercore.AppI[transaction.Tx], transaction.Tx])(nil) - _ serverv2.HasStartFlags = (*CometBFTServer[servercore.AppI[transaction.Tx], transaction.Tx])(nil) + serverv2.AppI[transaction.Tx], transaction.Tx, + ] = (*CometBFTServer[serverv2.AppI[transaction.Tx], transaction.Tx])(nil) + _ serverv2.HasStartFlags = (*CometBFTServer[serverv2.AppI[transaction.Tx], transaction.Tx])(nil) ) -type CometBFTServer[AppT servercore.AppI[T], T transaction.Tx] struct { +type CometBFTServer[AppT serverv2.AppI[T], T transaction.Tx] struct { Node *node.Node Consensus *Consensus[T] @@ -52,7 +51,7 @@ type CometBFTServer[AppT servercore.AppI[T], T transaction.Tx] struct { cmtConfigOptions []CmtCfgOption } -func New[AppT servercore.AppI[T], T transaction.Tx](txCodec transaction.Codec[T], options ServerOptions[T], cfgOptions ...CmtCfgOption) *CometBFTServer[AppT, T] { +func New[AppT serverv2.AppI[T], T transaction.Tx](txCodec transaction.Codec[T], options ServerOptions[T], cfgOptions ...CmtCfgOption) *CometBFTServer[AppT, T] { return &CometBFTServer[AppT, T]{ initTxCodec: txCodec, options: options, @@ -66,8 +65,7 @@ func (s *CometBFTServer[AppT, T]) Init(appI AppT, v *viper.Viper, logger log.Log // create consensus store := appI.GetStore().(types.Store) - appManager := appI.GetAppManager().(*appmanager.AppManager[T]) - consensus := NewConsensus[T](appManager, s.options.Mempool, store, s.config, s.initTxCodec, s.logger) + consensus := NewConsensus[T](appI.GetAppManager(), s.options.Mempool, store, s.config, s.initTxCodec, s.logger) consensus.prepareProposalHandler = s.options.PrepareProposalHandler consensus.processProposalHandler = s.options.ProcessProposalHandler diff --git a/server/v2/commands.go b/server/v2/commands.go index d9ec5dee31bb..db385a832d81 100644 --- a/server/v2/commands.go +++ b/server/v2/commands.go @@ -13,7 +13,6 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" - servercore "cosmossdk.io/core/server" "cosmossdk.io/core/transaction" "cosmossdk.io/log" ) @@ -36,7 +35,7 @@ func Execute(rootCmd *cobra.Command, envPrefix, defaultHome string) error { // AddCommands add the server commands to the root command // It configure the config handling and the logger handling -func AddCommands[AppT servercore.AppI[T], T transaction.Tx]( +func AddCommands[AppT AppI[T], T transaction.Tx]( rootCmd *cobra.Command, newApp AppCreator[AppT, T], logger log.Logger, @@ -97,7 +96,7 @@ func AddCommands[AppT servercore.AppI[T], T transaction.Tx]( } // createStartCommand creates the start command for the application. -func createStartCommand[AppT servercore.AppI[T], T transaction.Tx]( +func createStartCommand[AppT AppI[T], T transaction.Tx]( server *Server[AppT, T], newApp AppCreator[AppT, T], ) *cobra.Command { @@ -147,7 +146,7 @@ func createStartCommand[AppT servercore.AppI[T], T transaction.Tx]( } // configHandle writes the default config to the home directory if it does not exist and sets the server context -func configHandle[AppT servercore.AppI[T], T transaction.Tx](s *Server[AppT, T], cmd *cobra.Command) error { +func configHandle[AppT AppI[T], T transaction.Tx](s *Server[AppT, T], cmd *cobra.Command) error { home, err := cmd.Flags().GetString(FlagHome) if err != nil { return err diff --git a/server/v2/go.mod b/server/v2/go.mod index dd3f14b4469b..1bb6e10ea55e 100644 --- a/server/v2/go.mod +++ b/server/v2/go.mod @@ -17,6 +17,8 @@ require ( cosmossdk.io/api v0.7.5 cosmossdk.io/core v0.12.1-0.20231114100755-569e3ff6a0d7 cosmossdk.io/log v1.3.1 + cosmossdk.io/server/v2/appmanager v0.0.0-00010101000000-000000000000 + cosmossdk.io/store/v2 v2.0.0-00010101000000-000000000000 github.com/cosmos/cosmos-proto v1.0.0-beta.5 github.com/cosmos/gogogateway v1.2.0 github.com/cosmos/gogoproto v1.5.0 @@ -40,9 +42,11 @@ require ( ) require ( + cosmossdk.io/errors v1.0.1 // indirect github.com/DataDog/datadog-go v3.2.0+incompatible // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect + github.com/cosmos/ics23/go v0.10.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/fatih/color v1.15.0 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect @@ -50,7 +54,6 @@ require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect - github.com/hashicorp/go-uuid v1.0.1 // indirect github.com/hashicorp/golang-lru v1.0.2 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/hashicorp/yamux v0.1.1 // indirect @@ -67,7 +70,6 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/procfs v0.15.1 // indirect - github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/sagikazarmark/locafero v0.4.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/sourcegraph/conc v0.3.0 // indirect @@ -75,9 +77,10 @@ require ( github.com/spf13/cast v1.6.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect go.uber.org/multierr v1.11.0 // indirect + golang.org/x/crypto v0.25.0 // indirect golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect golang.org/x/net v0.26.0 // indirect - golang.org/x/sys v0.21.0 // indirect + golang.org/x/sys v0.22.0 // indirect golang.org/x/text v0.16.0 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237 // indirect diff --git a/server/v2/go.sum b/server/v2/go.sum index 41402e41e0e6..ccd41482dbcf 100644 --- a/server/v2/go.sum +++ b/server/v2/go.sum @@ -1,5 +1,7 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= +cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/DataDog/datadog-go v3.2.0+incompatible h1:qSG2N4FghB1He/r2mFrWKCaL7dXCilEuNEeAn20fdD4= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= @@ -36,6 +38,8 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= +github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= +github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -253,6 +257,8 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= +golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc h1:O9NuF4s+E/PvMIy+9IUZB9znFwUIXEWSstNjek6VpVg= golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc= @@ -311,8 +317,8 @@ golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= -golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= +golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/server/v2/server.go b/server/v2/server.go index 3009744462a8..a1f272846fc0 100644 --- a/server/v2/server.go +++ b/server/v2/server.go @@ -13,13 +13,12 @@ import ( "github.com/spf13/viper" "golang.org/x/sync/errgroup" - servercore "cosmossdk.io/core/server" "cosmossdk.io/core/transaction" "cosmossdk.io/log" ) // ServerComponent is a server module that can be started and stopped. -type ServerComponent[AppT servercore.AppI[T], T transaction.Tx] interface { +type ServerComponent[AppT AppI[T], T transaction.Tx] interface { Name() string Start(context.Context) error @@ -28,7 +27,7 @@ type ServerComponent[AppT servercore.AppI[T], T transaction.Tx] interface { } // HasCLICommands is a server module that has CLI commands. -type HasCLICommands[AppT servercore.AppI[T], T transaction.Tx] interface { +type HasCLICommands[AppT AppI[T], T transaction.Tx] interface { GetCommands() []*cobra.Command GetTxs() []*cobra.Command GetQueries() []*cobra.Command @@ -44,7 +43,7 @@ type HasStartFlags interface { StartCmdFlags() *pflag.FlagSet } -var _ ServerComponent[servercore.AppI[transaction.Tx], transaction.Tx] = (*Server[servercore.AppI[transaction.Tx], transaction.Tx])(nil) +var _ ServerComponent[AppI[transaction.Tx], transaction.Tx] = (*Server[AppI[transaction.Tx], transaction.Tx])(nil) // Configs returns a viper instance of the config file func ReadConfig(configPath string) (*viper.Viper, error) { @@ -66,12 +65,12 @@ func ReadConfig(configPath string) (*viper.Viper, error) { return v, nil } -type Server[AppT servercore.AppI[T], T transaction.Tx] struct { +type Server[AppT AppI[T], T transaction.Tx] struct { logger log.Logger components []ServerComponent[AppT, T] } -func NewServer[AppT servercore.AppI[T], T transaction.Tx]( +func NewServer[AppT AppI[T], T transaction.Tx]( logger log.Logger, components ...ServerComponent[AppT, T], ) *Server[AppT, T] { return &Server[AppT, T]{ diff --git a/server/v2/server_mock_test.go b/server/v2/server_mock_test.go index 87576b4c7931..ae238d66a57a 100644 --- a/server/v2/server_mock_test.go +++ b/server/v2/server_mock_test.go @@ -7,9 +7,9 @@ import ( "github.com/spf13/viper" - servercore "cosmossdk.io/core/server" "cosmossdk.io/core/transaction" "cosmossdk.io/log" + serverv2 "cosmossdk.io/server/v2" ) type mockServerConfig struct { @@ -33,7 +33,7 @@ func (s *mockServer) Name() string { return s.name } -func (s *mockServer) Init(appI servercore.AppI[transaction.Tx], v *viper.Viper, logger log.Logger) error { +func (s *mockServer) Init(appI serverv2.AppI[transaction.Tx], v *viper.Viper, logger log.Logger) error { return nil } diff --git a/server/v2/server_test.go b/server/v2/server_test.go index 493284f39970..7d466d24f98e 100644 --- a/server/v2/server_test.go +++ b/server/v2/server_test.go @@ -12,7 +12,7 @@ import ( "github.com/stretchr/testify/require" coreapp "cosmossdk.io/core/app" - servercore "cosmossdk.io/core/server" + "cosmossdk.io/core/transaction" "cosmossdk.io/log" serverv2 "cosmossdk.io/server/v2" @@ -31,7 +31,7 @@ func (*mockInterfaceRegistry) ListImplementations(ifaceTypeURL string) []string func (*mockInterfaceRegistry) ListAllInterfaces() []string { panic("not implemented") } type mockApp[T transaction.Tx] struct { - servercore.AppI[T] + serverv2.AppI[T] } func (*mockApp[T]) InterfaceRegistry() coreapp.InterfaceRegistry { @@ -59,7 +59,7 @@ func TestServer(t *testing.T) { } logger := log.NewLogger(os.Stdout) - grpcServer := grpc.New[servercore.AppI[transaction.Tx], transaction.Tx]() + grpcServer := grpc.New[serverv2.AppI[transaction.Tx], transaction.Tx]() if err := grpcServer.Init(&mockApp[transaction.Tx]{}, v, logger); err != nil { t.Log(err) t.Fail() @@ -67,7 +67,7 @@ func TestServer(t *testing.T) { mockServer := &mockServer{name: "mock-server-1", ch: make(chan string, 100)} - server := serverv2.NewServer[servercore.AppI[transaction.Tx], transaction.Tx]( + server := serverv2.NewServer[serverv2.AppI[transaction.Tx], transaction.Tx]( logger, grpcServer, mockServer, diff --git a/store/v2/commands.go b/server/v2/store/commands.go similarity index 92% rename from store/v2/commands.go rename to server/v2/store/commands.go index 4c2a892929b0..203b791223cf 100644 --- a/store/v2/commands.go +++ b/server/v2/store/commands.go @@ -9,6 +9,7 @@ import ( corectx "cosmossdk.io/core/context" "cosmossdk.io/log" + storev2 "cosmossdk.io/store/v2" ) // QueryBlockResultsCmd implements the default command for a BlockResults query. @@ -54,7 +55,7 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, return err } - rootStore, err := CreateRootStore(home, logger) + rootStore, err := storev2.CreateRootStore(home, logger) if err != nil { return fmt.Errorf("Can not create root store %w", err) } @@ -91,7 +92,7 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, return cmd } -func getPruningOptionsFromCmd(cmd *cobra.Command, args []string) (*PruningOption, error) { +func getPruningOptionsFromCmd(cmd *cobra.Command, args []string) (*storev2.PruningOption, error) { // Get viper from cmd context var rootViper *viper.Viper value := cmd.Context().Value(corectx.ViperContextKey) @@ -114,10 +115,10 @@ func getPruningOptionsFromCmd(cmd *cobra.Command, args []string) (*PruningOption strategy := strings.ToLower(pruning) switch strategy { - case PruningOptionDefault, PruningOptionNothing, PruningOptionEverything: - return NewPruningOptionFromString(strategy), nil + case storev2.PruningOptionDefault, storev2.PruningOptionNothing, storev2.PruningOptionEverything: + return storev2.NewPruningOptionFromString(strategy), nil - case PruningOptionCustom: + case storev2.PruningOptionCustom: var ( pruningKeepRecent uint64 pruningInterval uint64 @@ -142,7 +143,7 @@ func getPruningOptionsFromCmd(cmd *cobra.Command, args []string) (*PruningOption pruningInterval = rootViper.GetUint64(FlagPruningInterval) } - opts := NewPruningOptionWithCustom( + opts := storev2.NewPruningOptionWithCustom( pruningKeepRecent, pruningInterval, ) diff --git a/store/v2/config.go b/server/v2/store/config.go similarity index 83% rename from store/v2/config.go rename to server/v2/store/config.go index b53aa8751adb..a6947af4bd59 100644 --- a/store/v2/config.go +++ b/server/v2/store/config.go @@ -1,8 +1,12 @@ package store +import ( + storev2 "cosmossdk.io/store/v2" +) + func DefaultConfig() *Config { return &Config{ - Pruning: PruningOptionDefault, + Pruning: storev2.PruningOptionDefault, AppDBBackend: "", PruningKeepRecent: 0, PruningInterval: 0, diff --git a/store/v2/flags.go b/server/v2/store/flags.go similarity index 100% rename from store/v2/flags.go rename to server/v2/store/flags.go diff --git a/store/v2/server.go b/server/v2/store/server.go similarity index 85% rename from store/v2/server.go rename to server/v2/store/server.go index be39065acf4d..ee4f3a958d3c 100644 --- a/store/v2/server.go +++ b/server/v2/store/server.go @@ -8,15 +8,16 @@ import ( "github.com/spf13/viper" "cosmossdk.io/core/log" - servercore "cosmossdk.io/core/server" + "cosmossdk.io/core/transaction" + serverv2 "cosmossdk.io/server/v2" ) -type StoreComponent[AppT servercore.AppI[T], T transaction.Tx] struct { +type StoreComponent[AppT serverv2.AppI[T], T transaction.Tx] struct { config *Config } -func New[AppT servercore.AppI[T], T transaction.Tx]() *StoreComponent[AppT, T] { +func New[AppT serverv2.AppI[T], T transaction.Tx]() *StoreComponent[AppT, T] { return &StoreComponent[AppT, T]{} } diff --git a/server/v2/types.go b/server/v2/types.go index 3ec0936fada7..1a22abf8e16f 100644 --- a/server/v2/types.go +++ b/server/v2/types.go @@ -3,9 +3,17 @@ package serverv2 import ( "github.com/spf13/viper" - servercore "cosmossdk.io/core/server" + coreapp "cosmossdk.io/core/app" "cosmossdk.io/core/transaction" "cosmossdk.io/log" + "cosmossdk.io/server/v2/appmanager" ) -type AppCreator[AppT servercore.AppI[T], T transaction.Tx] func(log.Logger, *viper.Viper) AppT +type AppCreator[AppT AppI[T], T transaction.Tx] func(log.Logger, *viper.Viper) AppT + +type AppI[T transaction.Tx] interface { + GetAppManager() *appmanager.AppManager[T] + GetConsensusAuthority() string + InterfaceRegistry() coreapp.InterfaceRegistry + GetStore() any +} diff --git a/simapp/v2/simdv2/cmd/commands.go b/simapp/v2/simdv2/cmd/commands.go index 451e11d7ba66..0b0bab23f15f 100644 --- a/simapp/v2/simdv2/cmd/commands.go +++ b/simapp/v2/simdv2/cmd/commands.go @@ -10,15 +10,15 @@ import ( "github.com/spf13/viper" "cosmossdk.io/client/v2/offchain" - servercore "cosmossdk.io/core/server" + "cosmossdk.io/core/transaction" "cosmossdk.io/log" runtimev2 "cosmossdk.io/runtime/v2" serverv2 "cosmossdk.io/server/v2" "cosmossdk.io/server/v2/api/grpc" "cosmossdk.io/server/v2/cometbft" + "cosmossdk.io/server/v2/store" "cosmossdk.io/simapp/v2" - storev2 "cosmossdk.io/store/v2" confixcmd "cosmossdk.io/tools/confix/cmd" authcmd "cosmossdk.io/x/auth/client/cli" @@ -74,13 +74,13 @@ func (t *temporaryTxDecoder[T]) DecodeJSON(bz []byte) (T, error) { return out, nil } -func newApp[AppT servercore.AppI[T], T transaction.Tx]( +func newApp[AppT serverv2.AppI[T], T transaction.Tx]( logger log.Logger, viper *viper.Viper, ) AppT { - return servercore.AppI[T](simapp.NewSimApp[T](logger, viper)).(AppT) + return serverv2.AppI[T](simapp.NewSimApp[T](logger, viper)).(AppT) } -func initRootCmd[AppT servercore.AppI[T], T transaction.Tx]( +func initRootCmd[AppT serverv2.AppI[T], T transaction.Tx]( rootCmd *cobra.Command, txConfig client.TxConfig, moduleManager *runtimev2.MM[T], @@ -118,7 +118,7 @@ func initRootCmd[AppT servercore.AppI[T], T transaction.Tx]( logger, cometbft.New[AppT, T](&temporaryTxDecoder[T]{txConfig}, cometbft.DefaultServerOptions[T]()), grpc.New[AppT, T](), - storev2.New[AppT, T](), + store.New[AppT, T](), ); err != nil { panic(err) } diff --git a/simapp/v2/simdv2/cmd/root_di.go b/simapp/v2/simdv2/cmd/root_di.go index ce010a3059bd..c6ebcc28648b 100644 --- a/simapp/v2/simdv2/cmd/root_di.go +++ b/simapp/v2/simdv2/cmd/root_di.go @@ -8,7 +8,7 @@ import ( "cosmossdk.io/client/v2/autocli" "cosmossdk.io/core/address" "cosmossdk.io/core/legacy" - servercore "cosmossdk.io/core/server" + "cosmossdk.io/core/transaction" "cosmossdk.io/depinject" "cosmossdk.io/log" @@ -18,6 +18,7 @@ import ( authtxconfig "cosmossdk.io/x/auth/tx/config" "cosmossdk.io/x/auth/types" + serverv2 "cosmossdk.io/server/v2" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/config" "github.com/cosmos/cosmos-sdk/codec" @@ -26,7 +27,7 @@ import ( ) // NewRootCmd creates a new root command for simd. It is called once in the main function. -func NewRootCmd[AppT servercore.AppI[T], T transaction.Tx]() *cobra.Command { +func NewRootCmd[AppT serverv2.AppI[T], T transaction.Tx]() *cobra.Command { var ( autoCliOpts autocli.AppOptions moduleManager *runtime.MM[T] diff --git a/simapp/v2/simdv2/cmd/root_test.go b/simapp/v2/simdv2/cmd/root_test.go index a2fdea816db6..a8af19befb06 100644 --- a/simapp/v2/simdv2/cmd/root_test.go +++ b/simapp/v2/simdv2/cmd/root_test.go @@ -6,18 +6,18 @@ import ( "github.com/stretchr/testify/require" - servercore "cosmossdk.io/core/server" "cosmossdk.io/core/transaction" "cosmossdk.io/simapp/v2" "cosmossdk.io/simapp/v2/simdv2/cmd" + serverv2 "cosmossdk.io/server/v2" "github.com/cosmos/cosmos-sdk/client/flags" svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" ) func TestInitCmd(t *testing.T) { - rootCmd := cmd.NewRootCmd[servercore.AppI[transaction.Tx], transaction.Tx]() + rootCmd := cmd.NewRootCmd[serverv2.AppI[transaction.Tx], transaction.Tx]() rootCmd.SetArgs([]string{ "init", // Test the init cmd "simapp-test", // Moniker @@ -30,7 +30,7 @@ func TestInitCmd(t *testing.T) { func TestHomeFlagRegistration(t *testing.T) { homeDir := "/tmp/foo" - rootCmd := cmd.NewRootCmd[servercore.AppI[transaction.Tx], transaction.Tx]() + rootCmd := cmd.NewRootCmd[serverv2.AppI[transaction.Tx], transaction.Tx]() rootCmd.SetArgs([]string{ "query", fmt.Sprintf("--%s", flags.FlagHome), diff --git a/simapp/v2/simdv2/cmd/testnet.go b/simapp/v2/simdv2/cmd/testnet.go index e162335e9d2a..c83321735180 100644 --- a/simapp/v2/simdv2/cmd/testnet.go +++ b/simapp/v2/simdv2/cmd/testnet.go @@ -15,7 +15,6 @@ import ( "github.com/spf13/pflag" "cosmossdk.io/core/log" - servercore "cosmossdk.io/core/server" "cosmossdk.io/core/transaction" "cosmossdk.io/math" "cosmossdk.io/math/unsafe" @@ -337,9 +336,9 @@ func initTestnetFiles[T transaction.Tx]( } // Write server config - cometServer := cometbft.New[servercore.AppI[T], T](&temporaryTxDecoder[T]{clientCtx.TxConfig}, cometbft.ServerOptions[T]{}, cometbft.OverwriteDefaultCometConfig(nodeConfig)) - grpcServer := grpc.New[servercore.AppI[T], T](grpc.OverwriteDefaultConfig(grpcConfig)) - server := serverv2.NewServer[servercore.AppI[T], T](log.NewNopLogger(), cometServer, grpcServer) + cometServer := cometbft.New[serverv2.AppI[T], T](&temporaryTxDecoder[T]{clientCtx.TxConfig}, cometbft.ServerOptions[T]{}, cometbft.OverwriteDefaultCometConfig(nodeConfig)) + grpcServer := grpc.New[serverv2.AppI[T], T](grpc.OverwriteDefaultConfig(grpcConfig)) + server := serverv2.NewServer[serverv2.AppI[T], T](log.NewNopLogger(), cometServer, grpcServer) err = server.WriteConfig(filepath.Join(nodeDir, "config")) if err != nil { return err diff --git a/simapp/v2/simdv2/main.go b/simapp/v2/simdv2/main.go index 0ddc15722353..e41ba6ffc13c 100644 --- a/simapp/v2/simdv2/main.go +++ b/simapp/v2/simdv2/main.go @@ -4,7 +4,6 @@ import ( "fmt" "os" - servercore "cosmossdk.io/core/server" "cosmossdk.io/core/transaction" serverv2 "cosmossdk.io/server/v2" "cosmossdk.io/simapp/v2" @@ -12,7 +11,7 @@ import ( ) func main() { - rootCmd := cmd.NewRootCmd[servercore.AppI[transaction.Tx], transaction.Tx]() + rootCmd := cmd.NewRootCmd[serverv2.AppI[transaction.Tx], transaction.Tx]() if err := serverv2.Execute(rootCmd, "", simapp.DefaultNodeHome); err != nil { fmt.Fprintln(rootCmd.OutOrStderr(), err) os.Exit(1) diff --git a/store/v2/go.mod b/store/v2/go.mod index d68f8b910caa..19d8676cfcff 100644 --- a/store/v2/go.mod +++ b/store/v2/go.mod @@ -15,8 +15,6 @@ require ( github.com/linxGnu/grocksdb v1.8.14 github.com/mattn/go-sqlite3 v1.14.22 github.com/spf13/cast v1.6.0 - github.com/spf13/cobra v1.8.1 - github.com/spf13/viper v1.19.0 github.com/stretchr/testify v1.9.0 github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d golang.org/x/sync v0.7.0 @@ -41,17 +39,12 @@ require ( github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/go-uuid v1.0.1 // indirect github.com/hashicorp/golang-lru v1.0.2 // indirect - github.com/hashicorp/hcl v1.0.0 // indirect - github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/klauspost/compress v1.17.7 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect - github.com/magiconair/properties v1.8.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect - github.com/pelletier/go-toml/v2 v2.2.2 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.19.1 // indirect @@ -60,14 +53,6 @@ require ( github.com/prometheus/procfs v0.15.1 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/rs/zerolog v1.33.0 // indirect - github.com/sagikazarmark/locafero v0.4.0 // indirect - github.com/sagikazarmark/slog-shim v0.1.0 // indirect - github.com/sourcegraph/conc v0.3.0 // indirect - github.com/spf13/afero v1.11.0 // indirect - github.com/spf13/pflag v1.0.5 // indirect - github.com/subosito/gotenv v1.6.0 // indirect - go.uber.org/atomic v1.9.0 // indirect - go.uber.org/multierr v1.9.0 // indirect golang.org/x/crypto v0.25.0 // indirect golang.org/x/exp v0.0.0-20240314144324-c7f7c6466f7f // indirect golang.org/x/sys v0.22.0 // indirect @@ -75,7 +60,6 @@ require ( google.golang.org/genproto/googleapis/rpc v0.0.0-20240513163218-0867130af1f8 // indirect google.golang.org/grpc v1.64.0 // indirect google.golang.org/protobuf v1.34.2 // indirect - gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/store/v2/go.sum b/store/v2/go.sum index 6c700593c17c..9687da5f71fd 100644 --- a/store/v2/go.sum +++ b/store/v2/go.sum @@ -40,7 +40,6 @@ github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= -github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -109,12 +108,8 @@ github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/b github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c= github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= -github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= -github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= @@ -133,8 +128,6 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/linxGnu/grocksdb v1.8.14 h1:HTgyYalNwBSG/1qCQUIott44wU5b2Y9Kr3z7SK5OfGQ= github.com/linxGnu/grocksdb v1.8.14/go.mod h1:QYiYypR2d4v63Wj1adOOfzglnoII0gLj3PNh4fZkcFA= -github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= -github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= @@ -144,8 +137,6 @@ github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= -github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= @@ -170,8 +161,6 @@ github.com/onsi/gomega v1.26.0 h1:03cDLK28U6hWvCAns6NeydX3zIm4SF3ci69ulidS32Q= github.com/onsi/gomega v1.26.0/go.mod h1:r+zV744Re+DiYCIPRlYOTxn0YkOLcAnW8k1xXdMPGhM= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= -github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= @@ -207,51 +196,24 @@ github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99 github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= -github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= -github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= -github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= -github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= -github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= -github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= -github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= -github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= -github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI= -github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= -github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d h1:vfofYNRScrDdvS342BElfbETmL1Aiz3i2t0zfRj16Hs= github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= -go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= -go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -346,8 +308,6 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= -gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -356,7 +316,6 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= From 9a992b75ef2820e98da169f3edd86affbed3609c Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Tue, 16 Jul 2024 15:33:43 +0700 Subject: [PATCH 45/62] lint --- server/v2/cometbft/server.go | 44 +++++++++++++------------------ server/v2/server.go | 24 +++++++++++------ server/v2/server_test.go | 3 +-- server/v2/store/commands.go | 2 +- server/v2/store/server.go | 1 - simapp/v2/simdv2/cmd/commands.go | 3 +-- simapp/v2/simdv2/cmd/root_di.go | 3 +-- simapp/v2/simdv2/cmd/root_test.go | 2 +- simapp/v2/simdv2/cmd/testnet.go | 2 +- 9 files changed, 40 insertions(+), 44 deletions(-) diff --git a/server/v2/cometbft/server.go b/server/v2/cometbft/server.go index e2419294fdee..1b1f0ff6637e 100644 --- a/server/v2/cometbft/server.go +++ b/server/v2/cometbft/server.go @@ -20,7 +20,6 @@ import ( corectx "cosmossdk.io/core/context" "cosmossdk.io/core/log" - "cosmossdk.io/core/transaction" serverv2 "cosmossdk.io/server/v2" cometlog "cosmossdk.io/server/v2/cometbft/log" @@ -34,10 +33,8 @@ var ( _ serverv2.ServerComponent[ serverv2.AppI[transaction.Tx], transaction.Tx, ] = (*CometBFTServer[serverv2.AppI[transaction.Tx], transaction.Tx])(nil) - _ serverv2.HasCLICommands[ - serverv2.AppI[transaction.Tx], transaction.Tx, - ] = (*CometBFTServer[serverv2.AppI[transaction.Tx], transaction.Tx])(nil) - _ serverv2.HasStartFlags = (*CometBFTServer[serverv2.AppI[transaction.Tx], transaction.Tx])(nil) + _ serverv2.HasCLICommands = (*CometBFTServer[serverv2.AppI[transaction.Tx], transaction.Tx])(nil) + _ serverv2.HasStartFlags = (*CometBFTServer[serverv2.AppI[transaction.Tx], transaction.Tx])(nil) ) type CometBFTServer[AppT serverv2.AppI[T], T transaction.Tx] struct { @@ -192,27 +189,22 @@ func (s *CometBFTServer[AppT, T]) StartCmdFlags() *pflag.FlagSet { return flags } -func (s *CometBFTServer[AppT, T]) GetCommands() []*cobra.Command { - return []*cobra.Command{ - s.StatusCommand(), - s.ShowNodeIDCmd(), - s.ShowValidatorCmd(), - s.ShowAddressCmd(), - s.VersionCmd(), - cmtcmd.ResetAllCmd, - cmtcmd.ResetStateCmd, - } -} - -func (s *CometBFTServer[AppT, T]) GetTxs() []*cobra.Command { - return nil -} - -func (s *CometBFTServer[AppT, T]) GetQueries() []*cobra.Command { - return []*cobra.Command{ - s.QueryBlockCmd(), - s.QueryBlocksCmd(), - s.QueryBlockResultsCmd(), +func (s *CometBFTServer[AppT, T]) CLICommands() serverv2.CLIConfig { + return serverv2.CLIConfig{ + Commands: []*cobra.Command{ + s.StatusCommand(), + s.ShowNodeIDCmd(), + s.ShowValidatorCmd(), + s.ShowAddressCmd(), + s.VersionCmd(), + cmtcmd.ResetAllCmd, + cmtcmd.ResetStateCmd, + }, + Queries: []*cobra.Command{ + s.QueryBlockCmd(), + s.QueryBlocksCmd(), + s.QueryBlockResultsCmd(), + }, } } diff --git a/server/v2/server.go b/server/v2/server.go index a1f272846fc0..5e6c790d0f70 100644 --- a/server/v2/server.go +++ b/server/v2/server.go @@ -27,10 +27,8 @@ type ServerComponent[AppT AppI[T], T transaction.Tx] interface { } // HasCLICommands is a server module that has CLI commands. -type HasCLICommands[AppT AppI[T], T transaction.Tx] interface { - GetCommands() []*cobra.Command - GetTxs() []*cobra.Command - GetQueries() []*cobra.Command +type HasCLICommands interface { + CLICommands() CLIConfig } // HasConfig is a server module that has a config. @@ -137,10 +135,20 @@ func (s *Server[AppT, T]) CLICommands() CLIConfig { commands := CLIConfig{} for _, mod := range s.components { - if climod, ok := mod.(HasCLICommands[AppT, T]); ok { - commands.Commands = append(commands.Commands, compart(mod.Name(), climod.GetCommands()...)) - commands.Txs = append(commands.Txs, compart(mod.Name(), climod.GetTxs()...)) - commands.Queries = append(commands.Queries, compart(mod.Name(), climod.GetQueries()...)) + if climod, ok := mod.(HasCLICommands); ok { + srvCmd := climod.CLICommands() + + if len(srvCmd.Commands) > 0 { + commands.Commands = append(commands.Commands, compart(mod.Name(), srvCmd.Commands...)) + } + + if len(srvCmd.Txs) > 0 { + commands.Txs = append(commands.Txs, compart(mod.Name(), srvCmd.Txs...)) + } + + if len(srvCmd.Queries) > 0 { + commands.Queries = append(commands.Queries, compart(mod.Name(), srvCmd.Queries...)) + } } } diff --git a/server/v2/server_test.go b/server/v2/server_test.go index 7d466d24f98e..2155e0e1af8e 100644 --- a/server/v2/server_test.go +++ b/server/v2/server_test.go @@ -12,7 +12,6 @@ import ( "github.com/stretchr/testify/require" coreapp "cosmossdk.io/core/app" - "cosmossdk.io/core/transaction" "cosmossdk.io/log" serverv2 "cosmossdk.io/server/v2" @@ -67,7 +66,7 @@ func TestServer(t *testing.T) { mockServer := &mockServer{name: "mock-server-1", ch: make(chan string, 100)} - server := serverv2.NewServer[serverv2.AppI[transaction.Tx], transaction.Tx]( + server := serverv2.NewServer( logger, grpcServer, mockServer, diff --git a/server/v2/store/commands.go b/server/v2/store/commands.go index 203b791223cf..4f361bf4010b 100644 --- a/server/v2/store/commands.go +++ b/server/v2/store/commands.go @@ -57,7 +57,7 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, rootStore, err := storev2.CreateRootStore(home, logger) if err != nil { - return fmt.Errorf("Can not create root store %w", err) + return fmt.Errorf("can not create root store %w", err) } latestHeight, err := rootStore.GetLatestVersion() diff --git a/server/v2/store/server.go b/server/v2/store/server.go index ee4f3a958d3c..4d3ddc75b2b8 100644 --- a/server/v2/store/server.go +++ b/server/v2/store/server.go @@ -8,7 +8,6 @@ import ( "github.com/spf13/viper" "cosmossdk.io/core/log" - "cosmossdk.io/core/transaction" serverv2 "cosmossdk.io/server/v2" ) diff --git a/simapp/v2/simdv2/cmd/commands.go b/simapp/v2/simdv2/cmd/commands.go index 0b0bab23f15f..5b8aeb41ba1a 100644 --- a/simapp/v2/simdv2/cmd/commands.go +++ b/simapp/v2/simdv2/cmd/commands.go @@ -10,7 +10,6 @@ import ( "github.com/spf13/viper" "cosmossdk.io/client/v2/offchain" - "cosmossdk.io/core/transaction" "cosmossdk.io/log" runtimev2 "cosmossdk.io/runtime/v2" @@ -114,7 +113,7 @@ func initRootCmd[AppT serverv2.AppI[T], T transaction.Tx]( // Add empty server struct here for writing default config if err = serverv2.AddCommands[AppT, T]( rootCmd, - newApp[AppT, T], + newApp, logger, cometbft.New[AppT, T](&temporaryTxDecoder[T]{txConfig}, cometbft.DefaultServerOptions[T]()), grpc.New[AppT, T](), diff --git a/simapp/v2/simdv2/cmd/root_di.go b/simapp/v2/simdv2/cmd/root_di.go index c6ebcc28648b..61c355180386 100644 --- a/simapp/v2/simdv2/cmd/root_di.go +++ b/simapp/v2/simdv2/cmd/root_di.go @@ -8,17 +8,16 @@ import ( "cosmossdk.io/client/v2/autocli" "cosmossdk.io/core/address" "cosmossdk.io/core/legacy" - "cosmossdk.io/core/transaction" "cosmossdk.io/depinject" "cosmossdk.io/log" "cosmossdk.io/runtime/v2" + serverv2 "cosmossdk.io/server/v2" "cosmossdk.io/simapp/v2" "cosmossdk.io/x/auth/tx" authtxconfig "cosmossdk.io/x/auth/tx/config" "cosmossdk.io/x/auth/types" - serverv2 "cosmossdk.io/server/v2" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/config" "github.com/cosmos/cosmos-sdk/codec" diff --git a/simapp/v2/simdv2/cmd/root_test.go b/simapp/v2/simdv2/cmd/root_test.go index a8af19befb06..ebca74ba70b9 100644 --- a/simapp/v2/simdv2/cmd/root_test.go +++ b/simapp/v2/simdv2/cmd/root_test.go @@ -7,10 +7,10 @@ import ( "github.com/stretchr/testify/require" "cosmossdk.io/core/transaction" + serverv2 "cosmossdk.io/server/v2" "cosmossdk.io/simapp/v2" "cosmossdk.io/simapp/v2/simdv2/cmd" - serverv2 "cosmossdk.io/server/v2" "github.com/cosmos/cosmos-sdk/client/flags" svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" diff --git a/simapp/v2/simdv2/cmd/testnet.go b/simapp/v2/simdv2/cmd/testnet.go index c83321735180..61387b42301a 100644 --- a/simapp/v2/simdv2/cmd/testnet.go +++ b/simapp/v2/simdv2/cmd/testnet.go @@ -338,7 +338,7 @@ func initTestnetFiles[T transaction.Tx]( // Write server config cometServer := cometbft.New[serverv2.AppI[T], T](&temporaryTxDecoder[T]{clientCtx.TxConfig}, cometbft.ServerOptions[T]{}, cometbft.OverwriteDefaultCometConfig(nodeConfig)) grpcServer := grpc.New[serverv2.AppI[T], T](grpc.OverwriteDefaultConfig(grpcConfig)) - server := serverv2.NewServer[serverv2.AppI[T], T](log.NewNopLogger(), cometServer, grpcServer) + server := serverv2.NewServer(log.NewNopLogger(), cometServer, grpcServer) err = server.WriteConfig(filepath.Join(nodeDir, "config")) if err != nil { return err From a7a38edc4652d9c454fc26ff6002ade915b9adf4 Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Wed, 17 Jul 2024 16:25:13 +0700 Subject: [PATCH 46/62] Factory options take viper as store options --- runtime/v2/go.mod | 15 +++++ runtime/v2/go.sum | 35 ++++++++++++ server/v2/go.mod | 20 +++++++ server/v2/go.sum | 89 ++++++++++++++++++++++++++++++ server/v2/store/commands.go | 36 ++++++++++-- server/v2/store/config.go | 27 ++++++--- server/v2/store/server.go | 8 +++ simapp/v2/app_di.go | 13 +---- store/v2/commitment/iavl/config.go | 4 +- store/v2/go.mod | 14 +++++ store/v2/go.sum | 35 ++++++++++++ store/v2/options.go | 4 +- store/v2/root/factory.go | 62 +++++++++------------ store/v2/store.go | 3 - 14 files changed, 296 insertions(+), 69 deletions(-) diff --git a/runtime/v2/go.mod b/runtime/v2/go.mod index 28ebe32b1822..21e45a162802 100644 --- a/runtime/v2/go.mod +++ b/runtime/v2/go.mod @@ -54,6 +54,7 @@ require ( github.com/cosmos/ics23/go v0.10.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/emicklei/dot v1.6.2 // indirect + github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/getsentry/sentry-go v0.27.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/snappy v0.0.4 // indirect @@ -62,15 +63,19 @@ require ( github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/go-metrics v0.5.3 // indirect github.com/hashicorp/golang-lru v1.0.2 // indirect + github.com/hashicorp/hcl v1.0.0 // indirect github.com/klauspost/compress v1.17.8 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/linxGnu/grocksdb v1.8.14 // indirect + github.com/magiconair/properties v1.8.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-sqlite3 v1.14.22 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/onsi/gomega v1.28.1 // indirect + github.com/pelletier/go-toml/v2 v2.2.2 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.19.1 // indirect @@ -79,10 +84,19 @@ require ( github.com/prometheus/procfs v0.15.1 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/rs/zerolog v1.33.0 // indirect + github.com/sagikazarmark/locafero v0.4.0 // indirect + github.com/sagikazarmark/slog-shim v0.1.0 // indirect + github.com/sourcegraph/conc v0.3.0 // indirect + github.com/spf13/afero v1.11.0 // indirect github.com/spf13/cast v1.6.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect + github.com/spf13/viper v1.19.0 // indirect github.com/stretchr/testify v1.9.0 // indirect + github.com/subosito/gotenv v1.6.0 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect github.com/tidwall/btree v1.7.0 // indirect + go.uber.org/atomic v1.9.0 // indirect + go.uber.org/multierr v1.9.0 // indirect golang.org/x/crypto v0.25.0 // indirect golang.org/x/net v0.26.0 // indirect golang.org/x/sync v0.7.0 // indirect @@ -90,6 +104,7 @@ require ( golang.org/x/text v0.16.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240513163218-0867130af1f8 // indirect + gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect sigs.k8s.io/yaml v1.4.0 // indirect ) diff --git a/runtime/v2/go.sum b/runtime/v2/go.sum index 1dcfa0e08342..f89701582781 100644 --- a/runtime/v2/go.sum +++ b/runtime/v2/go.sum @@ -115,6 +115,8 @@ github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/b github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c= github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= @@ -135,6 +137,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/linxGnu/grocksdb v1.8.14 h1:HTgyYalNwBSG/1qCQUIott44wU5b2Y9Kr3z7SK5OfGQ= github.com/linxGnu/grocksdb v1.8.14/go.mod h1:QYiYypR2d4v63Wj1adOOfzglnoII0gLj3PNh4fZkcFA= +github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= +github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= @@ -144,6 +148,8 @@ github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= @@ -168,6 +174,8 @@ github.com/onsi/gomega v1.28.1 h1:MijcGUbfYuznzK/5R4CPNoUP/9Xvuo20sXfEm6XxoTA= github.com/onsi/gomega v1.28.1/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= +github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= @@ -203,19 +211,39 @@ github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99 github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= +github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= +github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= +github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= +github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= +github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= +github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= +github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI= +github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= +github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d h1:vfofYNRScrDdvS342BElfbETmL1Aiz3i2t0zfRj16Hs= github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48= github.com/tidwall/btree v1.7.0 h1:L1fkJH/AuEh5zBnnBbmTwQ5Lt+bRJ5A8EWecslvo9iI= @@ -223,6 +251,10 @@ github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EU github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= +go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= +go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -319,6 +351,8 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= +gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -327,6 +361,7 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= diff --git a/server/v2/go.mod b/server/v2/go.mod index 1bb6e10ea55e..e732d20a8b52 100644 --- a/server/v2/go.mod +++ b/server/v2/go.mod @@ -10,6 +10,7 @@ replace ( cosmossdk.io/server/v2/appmanager => ./appmanager cosmossdk.io/server/v2/stf => ./stf cosmossdk.io/store/v2 => ../../store/v2 + cosmossdk.io/store/v2/db => ../../store/v2/db cosmossdk.io/x/tx => ../../x/tx ) @@ -44,14 +45,26 @@ require ( require ( cosmossdk.io/errors v1.0.1 // indirect github.com/DataDog/datadog-go v3.2.0+incompatible // indirect + github.com/DataDog/zstd v1.5.5 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect + github.com/cockroachdb/errors v1.11.1 // indirect + github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect + github.com/cockroachdb/pebble v1.1.0 // indirect + github.com/cockroachdb/redact v1.1.5 // indirect + github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect + github.com/cosmos/cosmos-db v1.0.2 // indirect + github.com/cosmos/iavl v1.2.0 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + github.com/emicklei/dot v1.6.1 // indirect github.com/fatih/color v1.15.0 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect + github.com/getsentry/sentry-go v0.27.0 // indirect github.com/gogo/googleapis v1.4.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang/snappy v0.0.4 // indirect + github.com/google/btree v1.1.2 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/golang-lru v1.0.2 // indirect @@ -59,9 +72,14 @@ require ( github.com/hashicorp/yamux v0.1.1 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jhump/protoreflect v1.15.3 // indirect + github.com/klauspost/compress v1.17.7 // indirect + github.com/kr/pretty v0.3.1 // indirect + github.com/kr/text v0.2.0 // indirect + github.com/linxGnu/grocksdb v1.8.14 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect + github.com/mattn/go-sqlite3 v1.14.22 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect @@ -70,12 +88,14 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/procfs v0.15.1 // indirect + github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/sagikazarmark/locafero v0.4.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/sourcegraph/conc v0.3.0 // indirect github.com/spf13/afero v1.11.0 // indirect github.com/spf13/cast v1.6.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect + github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.25.0 // indirect golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect diff --git a/server/v2/go.sum b/server/v2/go.sum index ccd41482dbcf..3338b3e39c1c 100644 --- a/server/v2/go.sum +++ b/server/v2/go.sum @@ -5,6 +5,8 @@ cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/DataDog/datadog-go v3.2.0+incompatible h1:qSG2N4FghB1He/r2mFrWKCaL7dXCilEuNEeAn20fdD4= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= +github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= @@ -20,6 +22,9 @@ github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= @@ -30,7 +35,21 @@ github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f h1:otljaYPt5hWxV3MUfO5dFPFiOXg9CyG5/kCfayTqsJ4= +github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= +github.com/cockroachdb/errors v1.11.1 h1:xSEW75zKaKCWzR3OfxXUxgrk/NtT4G1MiOv5lWZazG8= +github.com/cockroachdb/errors v1.11.1/go.mod h1:8MUxA3Gi6b25tYlFEBGLf+D8aISL+M4MIpiWMSNRfxw= +github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= +github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= +github.com/cockroachdb/pebble v1.1.0 h1:pcFh8CdCIt2kmEpK0OIatq67Ln9uGDYY3d5XnE0LJG4= +github.com/cockroachdb/pebble v1.1.0/go.mod h1:sEHm5NOXxyiAoKWhoFxT8xMgd/f3RA6qUqQ1BXKrh2E= +github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= +github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= +github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= +github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAKs= +github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= @@ -38,13 +57,18 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= +github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= +github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/emicklei/dot v1.6.1 h1:ujpDlBkkwgWUY+qPId5IwapRW/xEoligRSYjioR6DFI= +github.com/emicklei/dot v1.6.1/go.mod h1:DeV7GvQtIw4h2u73RKBkkFdvVAz0D9fzeJrgPW6gy/s= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= @@ -57,14 +81,22 @@ github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= +github.com/getsentry/sentry-go v0.27.0 h1:Pv98CIbtB3LkMWmXi4Joa5OOcwbmnX88sF5qbK3r3Ps= +github.com/getsentry/sentry-go v0.27.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= +github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gogo/googleapis v1.4.1-0.20201022092350-68b0159b7869/go.mod h1:5YRNX2z1oM5gXdAkurHa942MDgEJyk02w4OecKY87+c= github.com/gogo/googleapis v1.4.1 h1:1Yx4Myt7BxzvUr5ldGSbwYiZG6t9wGBZ+8/fX3Wvtq0= @@ -75,6 +107,8 @@ github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= +github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -91,6 +125,10 @@ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaS github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= +github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= +github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -101,6 +139,7 @@ github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= @@ -127,6 +166,8 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/jhump/protoreflect v1.15.3 h1:6SFRuqU45u9hIZPJAoZ8c28T3nK64BNdp9w6jFonzls= @@ -137,6 +178,8 @@ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7V github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/compress v1.17.7 h1:ehO88t2UGzQK66LMdE8tibEd1ErmzZjNEqWkjLAKQQg= +github.com/klauspost/compress v1.17.7/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -146,6 +189,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/linxGnu/grocksdb v1.8.14 h1:HTgyYalNwBSG/1qCQUIott44wU5b2Y9Kr3z7SK5OfGQ= +github.com/linxGnu/grocksdb v1.8.14/go.mod h1:QYiYypR2d4v63Wj1adOOfzglnoII0gLj3PNh4fZkcFA= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= @@ -158,6 +203,8 @@ github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/ github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= +github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= @@ -170,12 +217,30 @@ github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3Rllmb github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA= github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= +github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= +github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= +github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= +github.com/onsi/gomega v1.26.0 h1:03cDLK28U6hWvCAns6NeydX3zIm4SF3ci69ulidS32Q= +github.com/onsi/gomega v1.26.0/go.mod h1:r+zV744Re+DiYCIPRlYOTxn0YkOLcAnW8k1xXdMPGhM= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= +github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -204,6 +269,7 @@ github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+Gx github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= @@ -247,6 +313,8 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= +github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d h1:vfofYNRScrDdvS342BElfbETmL1Aiz3i2t0zfRj16Hs= +github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -269,6 +337,7 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -277,10 +346,13 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -295,25 +367,34 @@ golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220315194320-039c03cc5b86/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -324,6 +405,7 @@ golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuX golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= @@ -335,11 +417,13 @@ golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3 golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= @@ -383,13 +467,18 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/server/v2/store/commands.go b/server/v2/store/commands.go index 4f361bf4010b..07ea0cea93b1 100644 --- a/server/v2/store/commands.go +++ b/server/v2/store/commands.go @@ -2,6 +2,7 @@ package store import ( "fmt" + "path/filepath" "strings" "github.com/spf13/cobra" @@ -9,7 +10,10 @@ import ( corectx "cosmossdk.io/core/context" "cosmossdk.io/log" + serverv2 "cosmossdk.io/server/v2" storev2 "cosmossdk.io/store/v2" + "cosmossdk.io/store/v2/db" + "cosmossdk.io/store/v2/root" ) // QueryBlockResultsCmd implements the default command for a BlockResults query. @@ -31,7 +35,7 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, Args: cobra.RangeArgs(0, 1), RunE: func(cmd *cobra.Command, args []string) error { // bind flags to the Context's Viper so we can get pruning options. - vp := viper.New() + vp := serverv2.GetViperFromCmd(cmd) if err := vp.BindPFlags(cmd.Flags()); err != nil { return err } @@ -50,12 +54,12 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, ) logger := log.NewLogger(cmd.OutOrStdout()) - home, err := cmd.Flags().GetString("home") // should be FlagHome + home, err := cmd.Flags().GetString(serverv2.FlagHome) // should be FlagHome if err != nil { return err } - rootStore, err := storev2.CreateRootStore(home, logger) + rootStore, err := createRootStore(home, vp, logger) if err != nil { return fmt.Errorf("can not create root store %w", err) } @@ -70,14 +74,22 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, return fmt.Errorf("the database has no valid heights to prune, the latest height: %v", latestHeight) } - pruningHeight := latestHeight - pruningOptions.KeepRecent + pruningHeight := int64(latestHeight) - int64(pruningOptions.KeepRecent) + cmd.Println("heights", latestHeight, pruningOptions.KeepRecent) cmd.Printf("pruning heights up to %v\n", pruningHeight) - err = rootStore.Prune(pruningHeight) + if pruningHeight <= 0 { + return fmt.Errorf("pruning skipped, height is less than or equal to 0") + } + + err = rootStore.Prune(uint64(pruningHeight)) if err != nil { return err } + err = rootStore.LoadVersion(5) + cmd.Println("load old version", err) + cmd.Println("successfully pruned the application root multi stores") return nil }, @@ -158,3 +170,17 @@ func getPruningOptionsFromCmd(cmd *cobra.Command, args []string) (*storev2.Pruni return nil, fmt.Errorf("unknown pruning strategy %s", strategy) } } + +func createRootStore(rootDir string, v *viper.Viper, logger log.Logger) (storev2.RootStore, error) { + fmt.Println("prune root dir", rootDir) + scRawDb, err := db.NewGoLevelDB("application", filepath.Join(rootDir, "data"), nil) + if err != nil { + panic(err) + } + return root.CreateRootStore(&root.FactoryOptions{ + Logger: logger, + RootDir: rootDir, + Options: v, + SCRawDB: scRawDb, + }) +} diff --git a/server/v2/store/config.go b/server/v2/store/config.go index a6947af4bd59..079fda4e04d4 100644 --- a/server/v2/store/config.go +++ b/server/v2/store/config.go @@ -2,20 +2,31 @@ package store import ( storev2 "cosmossdk.io/store/v2" + "cosmossdk.io/store/v2/commitment/iavl" + "cosmossdk.io/store/v2/root" ) func DefaultConfig() *Config { return &Config{ - Pruning: storev2.PruningOptionDefault, - AppDBBackend: "", - PruningKeepRecent: 0, - PruningInterval: 0, + Pruning: storev2.PruningOptionDefault, + AppDBBackend: "", + Options: root.Options{ + SSType: 0, + SCType: 0, + SCPruningOption: &storev2.PruningOption{ + KeepRecent: 0, + Interval: 0, + }, + IavlConfig: &iavl.Config{ + CacheSize: 100_000, + SkipFastStorageUpgrade: true, + }, + }, } } type Config struct { - Pruning string `mapstructure:"pruning" toml:"pruning"` - AppDBBackend string `mapstructure:"app-db-backend" toml:"app-db-backend"` - PruningKeepRecent uint64 `mapstructure:"pruning-keep-recent" toml:"pruning-keep-recent"` - PruningInterval uint64 `mapstructure:"pruning-interval" toml:"pruning-interval"` + Pruning string `mapstructure:"pruning" toml:"pruning"` + AppDBBackend string `mapstructure:"app-db-backend" toml:"app-db-backend"` + Options root.Options `mapstructure:"options" toml:"options"` } diff --git a/server/v2/store/server.go b/server/v2/store/server.go index 4d3ddc75b2b8..3d86b92a9cb4 100644 --- a/server/v2/store/server.go +++ b/server/v2/store/server.go @@ -57,6 +57,14 @@ func (s *StoreComponent[AppT, T]) GetQueries() []*cobra.Command { return nil } +func (s *StoreComponent[AppT, T]) CLICommands() serverv2.CLIConfig { + return serverv2.CLIConfig{ + Commands: []*cobra.Command{ + s.PrunesCmd(), + }, + } +} + func (g *StoreComponent[AppT, T]) Config() any { if g.config == nil || g.config == (&Config{}) { return DefaultConfig() diff --git a/simapp/v2/app_di.go b/simapp/v2/app_di.go index b1e05095d904..6ac798742d8c 100644 --- a/simapp/v2/app_di.go +++ b/simapp/v2/app_di.go @@ -14,8 +14,6 @@ import ( "cosmossdk.io/depinject" "cosmossdk.io/runtime/v2" serverv2 "cosmossdk.io/server/v2" - "cosmossdk.io/store/v2" - "cosmossdk.io/store/v2/commitment/iavl" "cosmossdk.io/store/v2/db" "cosmossdk.io/store/v2/root" "cosmossdk.io/x/accounts" @@ -113,16 +111,7 @@ func NewSimApp[T transaction.Tx]( &root.FactoryOptions{ Logger: logger, RootDir: DefaultNodeHome, - SSType: 0, - SCType: 0, - SCPruningOption: &store.PruningOption{ - KeepRecent: 0, - Interval: 0, - }, - IavlConfig: &iavl.Config{ - CacheSize: 100_000, - SkipFastStorageUpgrade: true, - }, + Options: viper, SCRawDB: scRawDb, }, viper, diff --git a/store/v2/commitment/iavl/config.go b/store/v2/commitment/iavl/config.go index 7e386b3a46c4..ac30444a02ac 100644 --- a/store/v2/commitment/iavl/config.go +++ b/store/v2/commitment/iavl/config.go @@ -2,8 +2,8 @@ package iavl // Config is the configuration for the IAVL tree. type Config struct { - CacheSize int `mapstructure:"cache_size"` - SkipFastStorageUpgrade bool `mapstructure:"skip_fast_storage_upgrade"` + CacheSize int `mapstructure:"cache_size" toml:"cache_size"` + SkipFastStorageUpgrade bool `mapstructure:"skip_fast_storage_upgrade" toml:"skip_fast_storage_upgrade"` } // DefaultConfig returns the default configuration for the IAVL tree. diff --git a/store/v2/go.mod b/store/v2/go.mod index 19d8676cfcff..2f4b8d9d0c82 100644 --- a/store/v2/go.mod +++ b/store/v2/go.mod @@ -15,6 +15,7 @@ require ( github.com/linxGnu/grocksdb v1.8.14 github.com/mattn/go-sqlite3 v1.14.22 github.com/spf13/cast v1.6.0 + github.com/spf13/viper v1.19.0 github.com/stretchr/testify v1.9.0 github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d golang.org/x/sync v0.7.0 @@ -39,12 +40,16 @@ require ( github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/go-uuid v1.0.1 // indirect github.com/hashicorp/golang-lru v1.0.2 // indirect + github.com/hashicorp/hcl v1.0.0 // indirect github.com/klauspost/compress v1.17.7 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect + github.com/magiconair/properties v1.8.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect + github.com/pelletier/go-toml/v2 v2.2.2 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.19.1 // indirect @@ -53,6 +58,14 @@ require ( github.com/prometheus/procfs v0.15.1 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/rs/zerolog v1.33.0 // indirect + github.com/sagikazarmark/locafero v0.4.0 // indirect + github.com/sagikazarmark/slog-shim v0.1.0 // indirect + github.com/sourcegraph/conc v0.3.0 // indirect + github.com/spf13/afero v1.11.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect + github.com/subosito/gotenv v1.6.0 // indirect + go.uber.org/atomic v1.9.0 // indirect + go.uber.org/multierr v1.9.0 // indirect golang.org/x/crypto v0.25.0 // indirect golang.org/x/exp v0.0.0-20240314144324-c7f7c6466f7f // indirect golang.org/x/sys v0.22.0 // indirect @@ -60,6 +73,7 @@ require ( google.golang.org/genproto/googleapis/rpc v0.0.0-20240513163218-0867130af1f8 // indirect google.golang.org/grpc v1.64.0 // indirect google.golang.org/protobuf v1.34.2 // indirect + gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/store/v2/go.sum b/store/v2/go.sum index 9687da5f71fd..32897051953a 100644 --- a/store/v2/go.sum +++ b/store/v2/go.sum @@ -108,6 +108,8 @@ github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/b github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c= github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= @@ -128,6 +130,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/linxGnu/grocksdb v1.8.14 h1:HTgyYalNwBSG/1qCQUIott44wU5b2Y9Kr3z7SK5OfGQ= github.com/linxGnu/grocksdb v1.8.14/go.mod h1:QYiYypR2d4v63Wj1adOOfzglnoII0gLj3PNh4fZkcFA= +github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= +github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= @@ -137,6 +141,8 @@ github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= @@ -161,6 +167,8 @@ github.com/onsi/gomega v1.26.0 h1:03cDLK28U6hWvCAns6NeydX3zIm4SF3ci69ulidS32Q= github.com/onsi/gomega v1.26.0/go.mod h1:r+zV744Re+DiYCIPRlYOTxn0YkOLcAnW8k1xXdMPGhM= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= +github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= @@ -196,24 +204,48 @@ github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99 github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= +github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= +github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= +github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= +github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= +github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= +github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= +github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI= +github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= +github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d h1:vfofYNRScrDdvS342BElfbETmL1Aiz3i2t0zfRj16Hs= github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= +go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= +go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -308,6 +340,8 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= +gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -316,6 +350,7 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= diff --git a/store/v2/options.go b/store/v2/options.go index 8a21f02d539a..0f9acd4fd5f1 100644 --- a/store/v2/options.go +++ b/store/v2/options.go @@ -25,11 +25,11 @@ const ( // PruningOption defines the pruning configuration. type PruningOption struct { // KeepRecent sets the number of recent versions to keep. - KeepRecent uint64 + KeepRecent uint64 `mapstructure:"keep-recent" toml:"keep-recent"` // Interval sets the number of how often to prune. // If set to 0, no pruning will be done. - Interval uint64 + Interval uint64 `mapstructure:"interval" toml:"interval"` } // Pruning option string constants diff --git a/store/v2/root/factory.go b/store/v2/root/factory.go index 3113aa01c395..97a154d2fee4 100644 --- a/store/v2/root/factory.go +++ b/store/v2/root/factory.go @@ -3,7 +3,6 @@ package root import ( "fmt" "os" - "path/filepath" "cosmossdk.io/core/log" corestore "cosmossdk.io/core/store" @@ -17,6 +16,7 @@ import ( "cosmossdk.io/store/v2/storage" "cosmossdk.io/store/v2/storage/pebbledb" "cosmossdk.io/store/v2/storage/sqlite" + "github.com/spf13/viper" ) type ( @@ -32,40 +32,20 @@ const ( SCTypeIavlV2 SCType = 1 ) -type FactoryOptions struct { - Logger log.Logger - RootDir string - SSType SSType - SCType SCType - SSPruningOption *store.PruningOption - SCPruningOption *store.PruningOption - IavlConfig *iavl.Config - StoreKeys []string - SCRawDB corestore.KVStoreWithBatch +type Options struct { + SSType SSType `mapstructure:"ss-type" toml:"ss-type"` + SCType SCType `mapstructure:"sc-type" toml:"sc-type"` + SSPruningOption *store.PruningOption `mapstructure:"ss-pruning-option" toml:"ss-pruning-option"` + SCPruningOption *store.PruningOption `mapstructure:"sc-pruning-option" toml:"sc-pruning-option"` + IavlConfig *iavl.Config `mapstructure:"iavl-config" toml:"iavl-config"` } -func init() { - store.CreateRootStore = func(rootDir string, logger log.Logger) (store.RootStore, error) { - scRawDb, err := db.NewGoLevelDB("application", filepath.Join(rootDir, "data"), nil) - if err != nil { - panic(err) - } - return CreateRootStore(&FactoryOptions{ - Logger: logger, - RootDir: rootDir, - SSType: 0, - SCType: 0, - SCPruningOption: &store.PruningOption{ - KeepRecent: 0, - Interval: 0, - }, - IavlConfig: &iavl.Config{ - CacheSize: 100_000, - SkipFastStorageUpgrade: true, - }, - SCRawDB: scRawDb, - }) - } +type FactoryOptions struct { + Logger log.Logger + RootDir string + Options *viper.Viper + StoreKeys []string + SCRawDB corestore.KVStoreWithBatch } // CreateRootStore is a convenience function to create a root store based on the @@ -86,7 +66,15 @@ func CreateRootStore(opts *FactoryOptions) (store.RootStore, error) { } ) - switch opts.SSType { + v := opts.Options + storeOpts:= Options{} + if v != nil { + if err := v.Sub("store.options").Unmarshal(&storeOpts); err != nil { + return nil, fmt.Errorf("failed to store options: %w", err) + } + } + + switch storeOpts.SSType { case SSTypeSQLite: dir := fmt.Sprintf("%s/data/ss/sqlite", opts.RootDir) if err = ensureDir(dir); err != nil { @@ -131,9 +119,9 @@ func CreateRootStore(opts *FactoryOptions) (store.RootStore, error) { if internal.IsMemoryStoreKey(key) { trees[key] = mem.New() } else { - switch opts.SCType { + switch storeOpts.SCType { case SCTypeIavl: - trees[key] = iavl.NewIavlTree(db.NewPrefixDB(opts.SCRawDB, []byte(key)), opts.Logger, opts.IavlConfig) + trees[key] = iavl.NewIavlTree(db.NewPrefixDB(opts.SCRawDB, []byte(key)), opts.Logger, storeOpts.IavlConfig) case SCTypeIavlV2: return nil, fmt.Errorf("iavl v2 not supported") } @@ -144,7 +132,7 @@ func CreateRootStore(opts *FactoryOptions) (store.RootStore, error) { return nil, err } - pm := pruning.NewManager(sc, ss, opts.SCPruningOption, opts.SSPruningOption) + pm := pruning.NewManager(sc, ss, storeOpts.SCPruningOption, storeOpts.SSPruningOption) return New(opts.Logger, ss, sc, pm, nil, nil) } diff --git a/store/v2/store.go b/store/v2/store.go index a30bbc508f4d..71a3cc48bcad 100644 --- a/store/v2/store.go +++ b/store/v2/store.go @@ -4,7 +4,6 @@ import ( "io" coreheader "cosmossdk.io/core/header" - "cosmossdk.io/core/log" corestore "cosmossdk.io/core/store" "cosmossdk.io/store/v2/metrics" "cosmossdk.io/store/v2/proof" @@ -110,5 +109,3 @@ type QueryResult struct { Version uint64 ProofOps []proof.CommitmentOp } - -var CreateRootStore func(rootDir string, logger log.Logger) (RootStore, error) From 786995a35f2447fa46bbc28ca5de5cfc74c5d07a Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Wed, 17 Jul 2024 21:29:33 +0700 Subject: [PATCH 47/62] should work --- server/v2/store/commands.go | 92 +------------------------------------ server/v2/store/config.go | 5 +- server/v2/store/flags.go | 4 +- store/v2/options.go | 62 +------------------------ 4 files changed, 6 insertions(+), 157 deletions(-) diff --git a/server/v2/store/commands.go b/server/v2/store/commands.go index 07ea0cea93b1..2821b4c0925d 100644 --- a/server/v2/store/commands.go +++ b/server/v2/store/commands.go @@ -3,12 +3,10 @@ package store import ( "fmt" "path/filepath" - "strings" "github.com/spf13/cobra" "github.com/spf13/viper" - corectx "cosmossdk.io/core/context" "cosmossdk.io/log" serverv2 "cosmossdk.io/server/v2" storev2 "cosmossdk.io/store/v2" @@ -43,16 +41,6 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, return err } - pruningOptions, err := getPruningOptionsFromCmd(cmd, args) - if err != nil { - return err - } - - cmd.Printf("get pruning options from command flags, strategy: %v, keep-recent: %v\n", - args[0], - pruningOptions.KeepRecent, - ) - logger := log.NewLogger(cmd.OutOrStdout()) home, err := cmd.Flags().GetString(serverv2.FlagHome) // should be FlagHome if err != nil { @@ -74,22 +62,11 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, return fmt.Errorf("the database has no valid heights to prune, the latest height: %v", latestHeight) } - pruningHeight := int64(latestHeight) - int64(pruningOptions.KeepRecent) - cmd.Println("heights", latestHeight, pruningOptions.KeepRecent) - cmd.Printf("pruning heights up to %v\n", pruningHeight) - - if pruningHeight <= 0 { - return fmt.Errorf("pruning skipped, height is less than or equal to 0") - } - - err = rootStore.Prune(uint64(pruningHeight)) + err = rootStore.Prune(latestHeight) if err != nil { return err } - err = rootStore.LoadVersion(5) - cmd.Println("load old version", err) - cmd.Println("successfully pruned the application root multi stores") return nil }, @@ -104,73 +81,6 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, return cmd } -func getPruningOptionsFromCmd(cmd *cobra.Command, args []string) (*storev2.PruningOption, error) { - // Get viper from cmd context - var rootViper *viper.Viper - value := cmd.Context().Value(corectx.ViperContextKey) - rootViper, ok := value.(*viper.Viper) - if !ok { - rootViper = viper.New() - } - - var pruning string - if len(args) > 0 { - // use the first argument if present to set the pruning method - pruning = args[0] - } else { - // If we not pass pruning option to the first argument, - // Get it from app.toml - // If we not do any modify to app.toml, should be default prune in there. - pruning = rootViper.GetString(FlagPruning) - } - - strategy := strings.ToLower(pruning) - - switch strategy { - case storev2.PruningOptionDefault, storev2.PruningOptionNothing, storev2.PruningOptionEverything: - return storev2.NewPruningOptionFromString(strategy), nil - - case storev2.PruningOptionCustom: - var ( - pruningKeepRecent uint64 - pruningInterval uint64 - err error - ) - - if cmd.Flags().Changed(FlagPruningKeepRecent) { - pruningKeepRecent, err = cmd.Flags().GetUint64(FlagPruningKeepRecent) - if err != nil { - return nil, err - } - } else { - pruningKeepRecent = rootViper.GetUint64(FlagPruningKeepRecent) - } - - if cmd.Flags().Changed(FlagPruningInterval) { - pruningInterval, err = cmd.Flags().GetUint64(FlagPruningInterval) - if err != nil { - return nil, err - } - } else { - pruningInterval = rootViper.GetUint64(FlagPruningInterval) - } - - opts := storev2.NewPruningOptionWithCustom( - pruningKeepRecent, - pruningInterval, - ) - - if err := opts.Validate(); err != nil { - return opts, fmt.Errorf("invalid custom pruning options: %w", err) - } - - return opts, nil - - default: - return nil, fmt.Errorf("unknown pruning strategy %s", strategy) - } -} - func createRootStore(rootDir string, v *viper.Viper, logger log.Logger) (storev2.RootStore, error) { fmt.Println("prune root dir", rootDir) scRawDb, err := db.NewGoLevelDB("application", filepath.Join(rootDir, "data"), nil) diff --git a/server/v2/store/config.go b/server/v2/store/config.go index 079fda4e04d4..4899a4509ded 100644 --- a/server/v2/store/config.go +++ b/server/v2/store/config.go @@ -8,14 +8,13 @@ import ( func DefaultConfig() *Config { return &Config{ - Pruning: storev2.PruningOptionDefault, AppDBBackend: "", Options: root.Options{ SSType: 0, SCType: 0, SCPruningOption: &storev2.PruningOption{ - KeepRecent: 0, - Interval: 0, + KeepRecent: 2, + Interval: 1, }, IavlConfig: &iavl.Config{ CacheSize: 100_000, diff --git a/server/v2/store/flags.go b/server/v2/store/flags.go index 24a8a3f8948d..aca26df5992b 100644 --- a/server/v2/store/flags.go +++ b/server/v2/store/flags.go @@ -3,6 +3,6 @@ package store const ( FlagPruning = "pruning" FlagAppDBBackend = "app-db-backend" - FlagPruningKeepRecent = "pruning-keep-recent" - FlagPruningInterval = "pruning-interval" + FlagPruningKeepRecent = "keep-recent" + FlagPruningInterval = "interval" ) diff --git a/store/v2/options.go b/store/v2/options.go index 0f9acd4fd5f1..9a77d5e3f76e 100644 --- a/store/v2/options.go +++ b/store/v2/options.go @@ -1,10 +1,5 @@ package store -import ( - "errors" - "fmt" -) - type PruningStrategy int const ( @@ -29,28 +24,9 @@ type PruningOption struct { // Interval sets the number of how often to prune. // If set to 0, no pruning will be done. - Interval uint64 `mapstructure:"interval" toml:"interval"` + Interval uint64 `mapstructure:"interval" toml:"interval"` } -// Pruning option string constants -const ( - PruningOptionDefault = "default" - PruningOptionEverything = "everything" - PruningOptionNothing = "nothing" - PruningOptionCustom = "custom" -) - -const ( - pruneEverythingKeepRecent = 2 - pruneEverythingInterval = 10 -) - -var ( - ErrPruningIntervalZero = errors.New("'pruning-interval' must not be 0. If you want to disable pruning, select pruning = \"nothing\"") - ErrPruningIntervalTooSmall = fmt.Errorf("'pruning-interval' must not be less than %d. For the most aggressive pruning, select pruning = \"everything\"", pruneEverythingInterval) - ErrPruningKeepRecentTooSmall = fmt.Errorf("'pruning-keep-recent' must not be less than %d. For the most aggressive pruning, select pruning = \"everything\"", pruneEverythingKeepRecent) -) - // NewPruningOption returns a new PruningOption instance based on the given pruning strategy. func NewPruningOption(pruningStrategy PruningStrategy) *PruningOption { switch pruningStrategy { @@ -74,29 +50,6 @@ func NewPruningOption(pruningStrategy PruningStrategy) *PruningOption { } } -// NewPruningOption returns a new PruningOption instance based on the given pruning strategy. -func NewPruningOptionFromString(pruningStrategy string) *PruningOption { - switch pruningStrategy { - case PruningOptionDefault: - return &PruningOption{ - KeepRecent: 362880, - Interval: 10, - } - case PruningOptionEverything: - return &PruningOption{ - KeepRecent: 2, - Interval: 10, - } - case PruningOptionNothing: - return &PruningOption{ - KeepRecent: 0, - Interval: 0, - } - default: - return nil - } -} - // NewPruningOptionWithCustom returns a new PruningOption based on the given parameters. func NewPruningOptionWithCustom(keepRecent, interval uint64) *PruningOption { return &PruningOption{ @@ -105,19 +58,6 @@ func NewPruningOptionWithCustom(keepRecent, interval uint64) *PruningOption { } } -func (po *PruningOption) Validate() error { - if po.Interval == 0 { - return ErrPruningIntervalZero - } - if po.Interval < pruneEverythingInterval { - return ErrPruningIntervalTooSmall - } - if po.KeepRecent < pruneEverythingKeepRecent { - return ErrPruningKeepRecentTooSmall - } - return nil -} - // ShouldPrune returns true if the given version should be pruned. // If true, it also returns the version to prune up to. // NOTE: The current version is not pruned. From 43b23c13f7bfd26cafb08de6ace08df864cc3309 Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Thu, 18 Jul 2024 20:16:31 +0700 Subject: [PATCH 48/62] handle flags & print --- server/v2/store/commands.go | 35 +++++++++++++++++++++++++++++++---- server/v2/store/config.go | 5 ++++- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/server/v2/store/commands.go b/server/v2/store/commands.go index 521343f4e221..39aa5122aac7 100644 --- a/server/v2/store/commands.go +++ b/server/v2/store/commands.go @@ -47,7 +47,7 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, return err } - rootStore, err := createRootStore(home, vp, logger) + rootStore, err, interval := createRootStore(cmd, home, vp, logger) if err != nil { return fmt.Errorf("can not create root store %w", err) } @@ -62,6 +62,9 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, return fmt.Errorf("the database has no valid heights to prune, the latest height: %v", latestHeight) } + upTo := latestHeight - interval + cmd.Printf("pruning heights up to %v\n", upTo) + err = rootStore.Prune(latestHeight) if err != nil { return err @@ -81,16 +84,40 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, return cmd } -func createRootStore(rootDir string, v *viper.Viper, logger log.Logger) (storev2.RootStore, error) { - fmt.Println("prune root dir", rootDir) +func createRootStore(cmd *cobra.Command, rootDir string, v *viper.Viper, logger log.Logger) (storev2.RootStore, error, uint64) { scRawDb, err := db.NewGoLevelDB("application", filepath.Join(rootDir, "data"), nil) if err != nil { panic(err) } - return root.CreateRootStore(&root.FactoryOptions{ + + // handle KeepRecent & Interval flags + if cmd.Flags().Changed(FlagPruningKeepRecent) { + keepRecent, err := cmd.Flags().GetUint64(FlagPruningKeepRecent) + if err != nil { + return nil, err, 0 + } + + // Expect ss & sc have same pruning options + viper.Set("store.options.sc-pruning-option.keep-recent", keepRecent) // entry that read from app.toml + viper.Set("store.options.ss-pruning-option.keep-recent", keepRecent) + } + + if cmd.Flags().Changed(FlagPruningInterval) { + interval, err := cmd.Flags().GetUint64(FlagPruningInterval) + if err != nil { + return nil, err, 0 + } + + viper.Set("store.options.sc-pruning-option.interval", interval) + viper.Set("store.options.ss-pruning-option.interval", interval) + } + + store, err := root.CreateRootStore(&root.FactoryOptions{ Logger: logger, RootDir: rootDir, Options: v, SCRawDB: scRawDb, }) + + return store, err, viper.GetUint64("store.options.sc-pruning-option.keep-recent") } diff --git a/server/v2/store/config.go b/server/v2/store/config.go index 4899a4509ded..2403d2dd5922 100644 --- a/server/v2/store/config.go +++ b/server/v2/store/config.go @@ -16,6 +16,10 @@ func DefaultConfig() *Config { KeepRecent: 2, Interval: 1, }, + SSPruningOption: &storev2.PruningOption{ + KeepRecent: 2, + Interval: 1, + }, IavlConfig: &iavl.Config{ CacheSize: 100_000, SkipFastStorageUpgrade: true, @@ -25,7 +29,6 @@ func DefaultConfig() *Config { } type Config struct { - Pruning string `mapstructure:"pruning" toml:"pruning"` AppDBBackend string `mapstructure:"app-db-backend" toml:"app-db-backend"` Options root.Options `mapstructure:"options" toml:"options"` } From 158f3e5899935a6793b77cd34d38120b67e6c731 Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Thu, 18 Jul 2024 21:30:40 +0700 Subject: [PATCH 49/62] remove FactoryOptions from AppInputs & Build from viper --- runtime/v2/builder.go | 21 ++++++++++++++++++++- runtime/v2/go.mod | 11 +++++++---- runtime/v2/go.sum | 16 ++++++++++------ runtime/v2/module.go | 8 -------- server/v2/store/commands.go | 6 ++++++ simapp/v2/app_di.go | 17 +++-------------- simapp/v2/go.mod | 2 +- 7 files changed, 47 insertions(+), 34 deletions(-) diff --git a/runtime/v2/builder.go b/runtime/v2/builder.go index 0bdf5992d6c5..162645eb4c10 100644 --- a/runtime/v2/builder.go +++ b/runtime/v2/builder.go @@ -5,15 +5,19 @@ import ( "encoding/json" "fmt" "io" + "path/filepath" "cosmossdk.io/core/appmodule" appmodulev2 "cosmossdk.io/core/appmodule/v2" "cosmossdk.io/core/store" "cosmossdk.io/core/transaction" + serverv2 "cosmossdk.io/server/v2" "cosmossdk.io/server/v2/appmanager" "cosmossdk.io/server/v2/stf" "cosmossdk.io/server/v2/stf/branch" + "cosmossdk.io/store/v2/db" rootstore "cosmossdk.io/store/v2/root" + "github.com/spf13/viper" ) // AppBuilder is a type that is injected into a container by the runtime/v2 module @@ -70,7 +74,7 @@ func (a *AppBuilder[T]) RegisterStores(keys ...string) { } // Build builds an *App instance. -func (a *AppBuilder[T]) Build(opts ...AppBuilderOption[T]) (*App[T], error) { +func (a *AppBuilder[T]) Build(viper *viper.Viper, opts ...AppBuilderOption[T]) (*App[T], error) { for _, opt := range opts { opt(a) } @@ -116,6 +120,21 @@ func (a *AppBuilder[T]) Build(opts ...AppBuilderOption[T]) (*App[T], error) { a.app.stf = stf + home := viper.GetString(serverv2.FlagHome) + scRawDb, err := db.NewGoLevelDB("application", filepath.Join(home, "data"), nil) + if err != nil { + panic(err) + } + + storeOptions := &rootstore.FactoryOptions{ + Logger: a.app.logger, + RootDir: home, + Options: viper, + StoreKeys: append(a.app.storeKeys, "stf"), + SCRawDB: scRawDb, + } + a.storeOptions = storeOptions + rs, err := rootstore.CreateRootStore(a.storeOptions) if err != nil { return nil, fmt.Errorf("failed to create root store: %w", err) diff --git a/runtime/v2/go.mod b/runtime/v2/go.mod index 984eed9b5a66..b7b345e1556a 100644 --- a/runtime/v2/go.mod +++ b/runtime/v2/go.mod @@ -8,6 +8,7 @@ replace ( cosmossdk.io/core => ../../core cosmossdk.io/depinject => ../../depinject cosmossdk.io/log => ../../log + cosmossdk.io/server/v2 => ../../server/v2 cosmossdk.io/server/v2/appmanager => ../../server/v2/appmanager cosmossdk.io/server/v2/stf => ../../server/v2/stf cosmossdk.io/store/v2 => ../../store/v2 @@ -25,12 +26,14 @@ require ( cosmossdk.io/api v0.7.5 cosmossdk.io/core v0.12.1-0.20231114100755-569e3ff6a0d7 cosmossdk.io/depinject v1.0.0-alpha.4 + cosmossdk.io/server/v2 v2.0.0-20240718121635-a877e3e8048a cosmossdk.io/server/v2/appmanager v0.0.0-00010101000000-000000000000 cosmossdk.io/server/v2/stf v0.0.0-00010101000000-000000000000 cosmossdk.io/store/v2 v2.0.0-00010101000000-000000000000 cosmossdk.io/x/tx v0.13.3 github.com/cosmos/gogoproto v1.5.0 - golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 + github.com/spf13/viper v1.19.0 + golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc google.golang.org/grpc v1.64.1 google.golang.org/protobuf v1.34.2 ) @@ -64,6 +67,7 @@ require ( github.com/hashicorp/go-metrics v0.5.3 // indirect github.com/hashicorp/golang-lru v1.0.2 // indirect github.com/hashicorp/hcl v1.0.0 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/klauspost/compress v1.17.8 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect @@ -89,14 +93,13 @@ require ( github.com/sourcegraph/conc v0.3.0 // indirect github.com/spf13/afero v1.11.0 // indirect github.com/spf13/cast v1.6.0 // indirect + github.com/spf13/cobra v1.8.1 // indirect github.com/spf13/pflag v1.0.5 // indirect - github.com/spf13/viper v1.19.0 // indirect github.com/stretchr/testify v1.9.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect github.com/tidwall/btree v1.7.0 // indirect - go.uber.org/atomic v1.9.0 // indirect - go.uber.org/multierr v1.9.0 // indirect + go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.25.0 // indirect golang.org/x/net v0.27.0 // indirect golang.org/x/sync v0.7.0 // indirect diff --git a/runtime/v2/go.sum b/runtime/v2/go.sum index b75c2581b803..fc667e6eca73 100644 --- a/runtime/v2/go.sum +++ b/runtime/v2/go.sum @@ -46,6 +46,7 @@ github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= +github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -119,6 +120,8 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= @@ -211,6 +214,7 @@ github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99 github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= @@ -223,6 +227,8 @@ github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= +github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= +github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI= @@ -251,18 +257,16 @@ github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EU github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= -go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= -go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= -golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 h1:vr/HnozRka3pE4EsMEg1lgkXJkTFJCVUX+S/ZT6wYzM= -golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc= +golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc h1:O9NuF4s+E/PvMIy+9IUZB9znFwUIXEWSstNjek6VpVg= +golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= diff --git a/runtime/v2/module.go b/runtime/v2/module.go index ffc5632f9403..fdbbe141932d 100644 --- a/runtime/v2/module.go +++ b/runtime/v2/module.go @@ -28,7 +28,6 @@ import ( "cosmossdk.io/depinject/appconfig" "cosmossdk.io/runtime/v2/services" "cosmossdk.io/server/v2/stf" - rootstorev2 "cosmossdk.io/store/v2/root" ) var ( @@ -151,7 +150,6 @@ type AppInputs struct { InterfaceRegistrar registry.InterfaceRegistrar LegacyAmino legacy.Amino Logger log.Logger - StoreOptions *rootstorev2.FactoryOptions `optional:"true"` } func SetupAppBuilder(inputs AppInputs) { @@ -162,12 +160,6 @@ func SetupAppBuilder(inputs AppInputs) { app.moduleManager = inputs.ModuleManager app.moduleManager.RegisterInterfaces(inputs.InterfaceRegistrar) app.moduleManager.RegisterLegacyAminoCodec(inputs.LegacyAmino) - - if inputs.StoreOptions != nil { - inputs.AppBuilder.storeOptions = inputs.StoreOptions - inputs.AppBuilder.storeOptions.StoreKeys = inputs.AppBuilder.app.storeKeys - inputs.AppBuilder.storeOptions.StoreKeys = append(inputs.AppBuilder.storeOptions.StoreKeys, "stf") - } } func ProvideModuleManager[T transaction.Tx]( diff --git a/server/v2/store/commands.go b/server/v2/store/commands.go index 39aa5122aac7..5f8f60351a79 100644 --- a/server/v2/store/commands.go +++ b/server/v2/store/commands.go @@ -65,11 +65,17 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, upTo := latestHeight - interval cmd.Printf("pruning heights up to %v\n", upTo) + before, err := rootStore.GetStateCommitment().GetCommitInfo(2) + fmt.Println("before", before, err) + err = rootStore.Prune(latestHeight) if err != nil { return err } + after, err := rootStore.GetStateCommitment().GetCommitInfo(2) + fmt.Println("after", after, err) + cmd.Println("successfully pruned the application root multi stores") return nil }, diff --git a/simapp/v2/app_di.go b/simapp/v2/app_di.go index 3e2d03541729..bb46b9d2c640 100644 --- a/simapp/v2/app_di.go +++ b/simapp/v2/app_di.go @@ -2,7 +2,6 @@ package simapp import ( _ "embed" - "path/filepath" "github.com/spf13/viper" @@ -14,8 +13,6 @@ import ( "cosmossdk.io/depinject" "cosmossdk.io/runtime/v2" serverv2 "cosmossdk.io/server/v2" - "cosmossdk.io/store/v2/db" - "cosmossdk.io/store/v2/root" "cosmossdk.io/x/accounts" authkeeper "cosmossdk.io/x/auth/keeper" authzkeeper "cosmossdk.io/x/authz/keeper" @@ -95,10 +92,6 @@ func NewSimApp[T transaction.Tx]( viper *viper.Viper, ) *SimApp[T] { viper.Set(serverv2.FlagHome, DefaultNodeHome) // TODO possibly set earlier when viper is created - scRawDb, err := db.NewGoLevelDB("application", filepath.Join(DefaultNodeHome, "data"), nil) - if err != nil { - panic(err) - } var ( app = &SimApp[T]{} appBuilder *runtime.AppBuilder[T] @@ -108,12 +101,6 @@ func NewSimApp[T transaction.Tx]( AppConfig(), depinject.Supply( logger, - &root.FactoryOptions{ - Logger: logger, - RootDir: DefaultNodeHome, - Options: viper, - SCRawDB: scRawDb, - }, viper, // ADVANCED CONFIGURATION @@ -195,11 +182,13 @@ func NewSimApp[T transaction.Tx]( panic(err) } - app.App, err = appBuilder.Build() + buildedApp, err := appBuilder.Build(viper) if err != nil { panic(err) } + app.App = buildedApp + /**** Module Options ****/ // RegisterUpgradeHandlers is used for registering any on-chain upgrades. diff --git a/simapp/v2/go.mod b/simapp/v2/go.mod index 1d641dca6ca7..2f730783de62 100644 --- a/simapp/v2/go.mod +++ b/simapp/v2/go.mod @@ -10,7 +10,7 @@ require ( cosmossdk.io/log v1.3.1 cosmossdk.io/math v1.3.0 cosmossdk.io/runtime/v2 v2.0.0-00010101000000-000000000000 - cosmossdk.io/server/v2 v2.0.0-00010101000000-000000000000 + cosmossdk.io/server/v2 v2.0.0-20240718121635-a877e3e8048a cosmossdk.io/server/v2/cometbft v0.0.0-00010101000000-000000000000 cosmossdk.io/store/v2 v2.0.0 cosmossdk.io/tools/confix v0.0.0-00010101000000-000000000000 From 3fa11872c28ae6ccc8124eb364342458ee5c906c Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Thu, 18 Jul 2024 22:03:31 +0700 Subject: [PATCH 50/62] refactor --- server/v2/store/commands.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/server/v2/store/commands.go b/server/v2/store/commands.go index 5f8f60351a79..cf69e2d8b2a7 100644 --- a/server/v2/store/commands.go +++ b/server/v2/store/commands.go @@ -65,17 +65,11 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, upTo := latestHeight - interval cmd.Printf("pruning heights up to %v\n", upTo) - before, err := rootStore.GetStateCommitment().GetCommitInfo(2) - fmt.Println("before", before, err) - err = rootStore.Prune(latestHeight) if err != nil { return err } - after, err := rootStore.GetStateCommitment().GetCommitInfo(2) - fmt.Println("after", after, err) - cmd.Println("successfully pruned the application root multi stores") return nil }, @@ -124,6 +118,6 @@ func createRootStore(cmd *cobra.Command, rootDir string, v *viper.Viper, logger Options: v, SCRawDB: scRawDb, }) - + return store, err, viper.GetUint64("store.options.sc-pruning-option.keep-recent") } From 5dcd3c4235a9a85db9f18e832f7c0a9ab20a1546 Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Fri, 19 Jul 2024 00:05:18 +0700 Subject: [PATCH 51/62] handle keep-recent flag --- server/v2/store/commands.go | 49 ++++++++++++++++++++++++++----------- server/v2/store/flags.go | 2 -- 2 files changed, 35 insertions(+), 16 deletions(-) diff --git a/server/v2/store/commands.go b/server/v2/store/commands.go index cf69e2d8b2a7..0b1c8a798320 100644 --- a/server/v2/store/commands.go +++ b/server/v2/store/commands.go @@ -2,7 +2,9 @@ package store import ( "fmt" + "os" "path/filepath" + "strings" "github.com/spf13/cobra" "github.com/spf13/viper" @@ -77,14 +79,12 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, cmd.Flags().String(FlagAppDBBackend, "", "The type of database for application and snapshots databases") cmd.Flags().Uint64(FlagPruningKeepRecent, 0, "Number of recent heights to keep on disk (ignored if pruning is not 'custom')") - cmd.Flags().Uint64(FlagPruningInterval, 10, - `Height interval at which pruned heights are removed from disk (ignored if pruning is not 'custom'), - this is not used by this command but kept for compatibility with the complete pruning options`) - + return cmd } func createRootStore(cmd *cobra.Command, rootDir string, v *viper.Viper, logger log.Logger) (storev2.RootStore, error, uint64) { + tempViper := v scRawDb, err := db.NewGoLevelDB("application", filepath.Join(rootDir, "data"), nil) if err != nil { panic(err) @@ -97,27 +97,48 @@ func createRootStore(cmd *cobra.Command, rootDir string, v *viper.Viper, logger return nil, err, 0 } - // Expect ss & sc have same pruning options - viper.Set("store.options.sc-pruning-option.keep-recent", keepRecent) // entry that read from app.toml - viper.Set("store.options.ss-pruning-option.keep-recent", keepRecent) - } + // viper has an issue that we could not override subitem then Unmarshal key + // so we can not do viper.Set() as comment below + // https://github.com/spf13/viper/issues/1106 + // Do it by a hacky: overwrite app.toml file then read config again. + + // v.Set("store.options.sc-pruning-option.keep-recent", keepRecent) // entry that read from app.toml + // v.Set("store.options.ss-pruning-option.keep-recent", keepRecent) - if cmd.Flags().Changed(FlagPruningInterval) { - interval, err := cmd.Flags().GetUint64(FlagPruningInterval) + err = overrideKeepRecent(filepath.Join(rootDir, "config"), keepRecent) if err != nil { return nil, err, 0 } - viper.Set("store.options.sc-pruning-option.interval", interval) - viper.Set("store.options.ss-pruning-option.interval", interval) + tempViper, err = serverv2.ReadConfig(filepath.Join(rootDir, "config")) + if err != nil { + return nil, err, 0 + } } store, err := root.CreateRootStore(&root.FactoryOptions{ Logger: logger, RootDir: rootDir, - Options: v, + Options: tempViper, SCRawDB: scRawDb, }) - return store, err, viper.GetUint64("store.options.sc-pruning-option.keep-recent") + return store, err, tempViper.GetUint64("store.options.sc-pruning-option.keep-recent") +} + +func overrideKeepRecent(configPath string, keepRecent uint64) error { + bz, err := os.ReadFile(filepath.Join(configPath, "app.toml")) + if err != nil { + return err + } + lines := strings.Split(string(bz), "\n") + + for i, line := range lines { + if strings.Contains(line, "keep-recent") { + lines[i] = fmt.Sprintf("keep-recent = %d", keepRecent) + } + } + output := strings.Join(lines, "\n") + + return os.WriteFile(filepath.Join(configPath, "app.toml"), []byte(output), 0o600) } diff --git a/server/v2/store/flags.go b/server/v2/store/flags.go index aca26df5992b..9bf1af5282f4 100644 --- a/server/v2/store/flags.go +++ b/server/v2/store/flags.go @@ -1,8 +1,6 @@ package store const ( - FlagPruning = "pruning" FlagAppDBBackend = "app-db-backend" FlagPruningKeepRecent = "keep-recent" - FlagPruningInterval = "interval" ) From c6021989ed58d1f81a1aad0ce7eef27561ed8532 Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Fri, 19 Jul 2024 00:08:22 +0700 Subject: [PATCH 52/62] home flag --- runtime/v2/builder.go | 3 +-- runtime/v2/go.mod | 3 --- runtime/v2/go.sum | 6 ------ 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/runtime/v2/builder.go b/runtime/v2/builder.go index 162645eb4c10..c7c9ebb3c717 100644 --- a/runtime/v2/builder.go +++ b/runtime/v2/builder.go @@ -11,7 +11,6 @@ import ( appmodulev2 "cosmossdk.io/core/appmodule/v2" "cosmossdk.io/core/store" "cosmossdk.io/core/transaction" - serverv2 "cosmossdk.io/server/v2" "cosmossdk.io/server/v2/appmanager" "cosmossdk.io/server/v2/stf" "cosmossdk.io/server/v2/stf/branch" @@ -120,7 +119,7 @@ func (a *AppBuilder[T]) Build(viper *viper.Viper, opts ...AppBuilderOption[T]) ( a.app.stf = stf - home := viper.GetString(serverv2.FlagHome) + home := viper.GetString(FlagHome) scRawDb, err := db.NewGoLevelDB("application", filepath.Join(home, "data"), nil) if err != nil { panic(err) diff --git a/runtime/v2/go.mod b/runtime/v2/go.mod index b7b345e1556a..67a84c054075 100644 --- a/runtime/v2/go.mod +++ b/runtime/v2/go.mod @@ -26,7 +26,6 @@ require ( cosmossdk.io/api v0.7.5 cosmossdk.io/core v0.12.1-0.20231114100755-569e3ff6a0d7 cosmossdk.io/depinject v1.0.0-alpha.4 - cosmossdk.io/server/v2 v2.0.0-20240718121635-a877e3e8048a cosmossdk.io/server/v2/appmanager v0.0.0-00010101000000-000000000000 cosmossdk.io/server/v2/stf v0.0.0-00010101000000-000000000000 cosmossdk.io/store/v2 v2.0.0-00010101000000-000000000000 @@ -67,7 +66,6 @@ require ( github.com/hashicorp/go-metrics v0.5.3 // indirect github.com/hashicorp/golang-lru v1.0.2 // indirect github.com/hashicorp/hcl v1.0.0 // indirect - github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/klauspost/compress v1.17.8 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect @@ -93,7 +91,6 @@ require ( github.com/sourcegraph/conc v0.3.0 // indirect github.com/spf13/afero v1.11.0 // indirect github.com/spf13/cast v1.6.0 // indirect - github.com/spf13/cobra v1.8.1 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/stretchr/testify v1.9.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect diff --git a/runtime/v2/go.sum b/runtime/v2/go.sum index fc667e6eca73..89de5c6e38dc 100644 --- a/runtime/v2/go.sum +++ b/runtime/v2/go.sum @@ -46,7 +46,6 @@ github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= -github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -120,8 +119,6 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= -github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= @@ -214,7 +211,6 @@ github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99 github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= -github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= @@ -227,8 +223,6 @@ github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= -github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= -github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI= From f833ca44310ee0f6b1a20e10b6fab204bddea3a7 Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Fri, 19 Jul 2024 12:45:25 +0700 Subject: [PATCH 53/62] runtime AppInputs take a viper --- runtime/v2/builder.go | 8 +++++--- runtime/v2/module.go | 6 ++++++ runtime/v2/types.go | 5 ++++- simapp/v2/app_di.go | 5 ++--- simapp/v2/go.mod | 2 +- 5 files changed, 18 insertions(+), 8 deletions(-) diff --git a/runtime/v2/builder.go b/runtime/v2/builder.go index c7c9ebb3c717..3d4e16f51b2c 100644 --- a/runtime/v2/builder.go +++ b/runtime/v2/builder.go @@ -25,6 +25,7 @@ import ( type AppBuilder[T transaction.Tx] struct { app *App[T] storeOptions *rootstore.FactoryOptions + viper *viper.Viper // the following fields are used to overwrite the default branch func(state store.ReaderMap) store.WriterMap @@ -73,7 +74,7 @@ func (a *AppBuilder[T]) RegisterStores(keys ...string) { } // Build builds an *App instance. -func (a *AppBuilder[T]) Build(viper *viper.Viper, opts ...AppBuilderOption[T]) (*App[T], error) { +func (a *AppBuilder[T]) Build(opts ...AppBuilderOption[T]) (*App[T], error) { for _, opt := range opts { opt(a) } @@ -119,7 +120,8 @@ func (a *AppBuilder[T]) Build(viper *viper.Viper, opts ...AppBuilderOption[T]) ( a.app.stf = stf - home := viper.GetString(FlagHome) + v := a.viper + home := v.GetString(FlagHome) scRawDb, err := db.NewGoLevelDB("application", filepath.Join(home, "data"), nil) if err != nil { panic(err) @@ -128,7 +130,7 @@ func (a *AppBuilder[T]) Build(viper *viper.Viper, opts ...AppBuilderOption[T]) ( storeOptions := &rootstore.FactoryOptions{ Logger: a.app.logger, RootDir: home, - Options: viper, + Options: v, StoreKeys: append(a.app.storeKeys, "stf"), SCRawDB: scRawDb, } diff --git a/runtime/v2/module.go b/runtime/v2/module.go index fdbbe141932d..cb0ec169d315 100644 --- a/runtime/v2/module.go +++ b/runtime/v2/module.go @@ -6,6 +6,7 @@ import ( "slices" "github.com/cosmos/gogoproto/proto" + "github.com/spf13/viper" "google.golang.org/grpc" "google.golang.org/protobuf/reflect/protodesc" "google.golang.org/protobuf/reflect/protoregistry" @@ -150,6 +151,7 @@ type AppInputs struct { InterfaceRegistrar registry.InterfaceRegistrar LegacyAmino legacy.Amino Logger log.Logger + Viper *viper.Viper `optional:"true"` } func SetupAppBuilder(inputs AppInputs) { @@ -160,6 +162,10 @@ func SetupAppBuilder(inputs AppInputs) { app.moduleManager = inputs.ModuleManager app.moduleManager.RegisterInterfaces(inputs.InterfaceRegistrar) app.moduleManager.RegisterLegacyAminoCodec(inputs.LegacyAmino) + + if inputs.Viper != nil { + inputs.AppBuilder.viper = inputs.Viper + } } func ProvideModuleManager[T transaction.Tx]( diff --git a/runtime/v2/types.go b/runtime/v2/types.go index ac606cbd5457..0138dd802c82 100644 --- a/runtime/v2/types.go +++ b/runtime/v2/types.go @@ -12,7 +12,10 @@ import ( "cosmossdk.io/x/tx/signing" ) -const ModuleName = "runtime" +const ( + ModuleName = "runtime" + FlagHome = "home" +) // ValidateProtoAnnotations validates that the proto annotations are correct. // More specifically, it verifies: diff --git a/simapp/v2/app_di.go b/simapp/v2/app_di.go index bb46b9d2c640..7219193935f7 100644 --- a/simapp/v2/app_di.go +++ b/simapp/v2/app_di.go @@ -182,13 +182,12 @@ func NewSimApp[T transaction.Tx]( panic(err) } - buildedApp, err := appBuilder.Build(viper) + var err error + app.App, err = appBuilder.Build() if err != nil { panic(err) } - app.App = buildedApp - /**** Module Options ****/ // RegisterUpgradeHandlers is used for registering any on-chain upgrades. diff --git a/simapp/v2/go.mod b/simapp/v2/go.mod index 2f730783de62..0924c87d6df8 100644 --- a/simapp/v2/go.mod +++ b/simapp/v2/go.mod @@ -12,7 +12,7 @@ require ( cosmossdk.io/runtime/v2 v2.0.0-00010101000000-000000000000 cosmossdk.io/server/v2 v2.0.0-20240718121635-a877e3e8048a cosmossdk.io/server/v2/cometbft v0.0.0-00010101000000-000000000000 - cosmossdk.io/store/v2 v2.0.0 + cosmossdk.io/store/v2 v2.0.0 // indirect cosmossdk.io/tools/confix v0.0.0-00010101000000-000000000000 cosmossdk.io/x/accounts v0.0.0-20240226161501-23359a0b6d91 cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 From 1a56ec6b618db84cf5ffd65bd53e77aafd584bba Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Fri, 19 Jul 2024 12:52:26 +0700 Subject: [PATCH 54/62] refactor --- scripts/prune.sh | 12 ------------ scripts/simapp-v2-init.sh | 2 +- 2 files changed, 1 insertion(+), 13 deletions(-) delete mode 100755 scripts/prune.sh diff --git a/scripts/prune.sh b/scripts/prune.sh deleted file mode 100755 index 9e7f052d71fa..000000000000 --- a/scripts/prune.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit -set -o nounset -set -x - -ROOT=$PWD - -SIMD="$ROOT/build/simdv2" - - -$SIMD store prune --keep-recent 3 diff --git a/scripts/simapp-v2-init.sh b/scripts/simapp-v2-init.sh index 7dbc671af5fd..7d22970e4605 100755 --- a/scripts/simapp-v2-init.sh +++ b/scripts/simapp-v2-init.sh @@ -27,7 +27,7 @@ $SIMD config set client chain-id simapp-v2-chain $SIMD keys add test_validator --indiscreet VALIDATOR_ADDRESS=$($SIMD keys show test_validator -a --keyring-backend test) -$SIMD genesis add-genesis-account test_validator 1000000000stake +$SIMD genesis add-genesis-account "$VALIDATOR_ADDRESS" 1000000000stake $SIMD genesis gentx test_validator 1000000000stake --keyring-backend test $SIMD genesis collect-gentxs From 67cf8b44f3393b102c6db28058a6ccfa3acb1de1 Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Fri, 19 Jul 2024 13:02:46 +0700 Subject: [PATCH 55/62] lint --- runtime/v2/builder.go | 3 ++- server/v2/store/commands.go | 6 +++--- store/v2/root/factory.go | 5 +++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/runtime/v2/builder.go b/runtime/v2/builder.go index 3d4e16f51b2c..1bd651fb0196 100644 --- a/runtime/v2/builder.go +++ b/runtime/v2/builder.go @@ -7,6 +7,8 @@ import ( "io" "path/filepath" + "github.com/spf13/viper" + "cosmossdk.io/core/appmodule" appmodulev2 "cosmossdk.io/core/appmodule/v2" "cosmossdk.io/core/store" @@ -16,7 +18,6 @@ import ( "cosmossdk.io/server/v2/stf/branch" "cosmossdk.io/store/v2/db" rootstore "cosmossdk.io/store/v2/root" - "github.com/spf13/viper" ) // AppBuilder is a type that is injected into a container by the runtime/v2 module diff --git a/server/v2/store/commands.go b/server/v2/store/commands.go index 0b1c8a798320..21cb15d29ade 100644 --- a/server/v2/store/commands.go +++ b/server/v2/store/commands.go @@ -79,7 +79,7 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, cmd.Flags().String(FlagAppDBBackend, "", "The type of database for application and snapshots databases") cmd.Flags().Uint64(FlagPruningKeepRecent, 0, "Number of recent heights to keep on disk (ignored if pruning is not 'custom')") - + return cmd } @@ -122,7 +122,7 @@ func createRootStore(cmd *cobra.Command, rootDir string, v *viper.Viper, logger Options: tempViper, SCRawDB: scRawDb, }) - + return store, err, tempViper.GetUint64("store.options.sc-pruning-option.keep-recent") } @@ -135,7 +135,7 @@ func overrideKeepRecent(configPath string, keepRecent uint64) error { for i, line := range lines { if strings.Contains(line, "keep-recent") { - lines[i] = fmt.Sprintf("keep-recent = %d", keepRecent) + lines[i] = fmt.Sprintf("keep-recent = %d", keepRecent) } } output := strings.Join(lines, "\n") diff --git a/store/v2/root/factory.go b/store/v2/root/factory.go index 21600f86a457..a12060ea8de8 100644 --- a/store/v2/root/factory.go +++ b/store/v2/root/factory.go @@ -5,6 +5,8 @@ import ( "fmt" "os" + "github.com/spf13/viper" + "cosmossdk.io/core/log" corestore "cosmossdk.io/core/store" "cosmossdk.io/store/v2" @@ -17,7 +19,6 @@ import ( "cosmossdk.io/store/v2/storage" "cosmossdk.io/store/v2/storage/pebbledb" "cosmossdk.io/store/v2/storage/sqlite" - "github.com/spf13/viper" ) type ( @@ -68,7 +69,7 @@ func CreateRootStore(opts *FactoryOptions) (store.RootStore, error) { ) v := opts.Options - storeOpts:= Options{} + storeOpts := Options{} if v != nil { if err := v.Sub("store.options").Unmarshal(&storeOpts); err != nil { return nil, fmt.Errorf("failed to store options: %w", err) From 237ef66d6f1e3385c967ccafec9ad3a4ddb29527 Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Fri, 19 Jul 2024 13:40:23 +0700 Subject: [PATCH 56/62] godoc --- server/v2/store/commands.go | 14 +++++++------- server/v2/store/server.go | 2 ++ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/server/v2/store/commands.go b/server/v2/store/commands.go index 21cb15d29ade..1564960599b4 100644 --- a/server/v2/store/commands.go +++ b/server/v2/store/commands.go @@ -49,7 +49,7 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, return err } - rootStore, err, interval := createRootStore(cmd, home, vp, logger) + rootStore, keepRecent, err := createRootStore(cmd, home, vp, logger) if err != nil { return fmt.Errorf("can not create root store %w", err) } @@ -64,7 +64,7 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, return fmt.Errorf("the database has no valid heights to prune, the latest height: %v", latestHeight) } - upTo := latestHeight - interval + upTo := latestHeight - keepRecent cmd.Printf("pruning heights up to %v\n", upTo) err = rootStore.Prune(latestHeight) @@ -83,7 +83,7 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, return cmd } -func createRootStore(cmd *cobra.Command, rootDir string, v *viper.Viper, logger log.Logger) (storev2.RootStore, error, uint64) { +func createRootStore(cmd *cobra.Command, rootDir string, v *viper.Viper, logger log.Logger) (storev2.RootStore, uint64, error) { tempViper := v scRawDb, err := db.NewGoLevelDB("application", filepath.Join(rootDir, "data"), nil) if err != nil { @@ -94,7 +94,7 @@ func createRootStore(cmd *cobra.Command, rootDir string, v *viper.Viper, logger if cmd.Flags().Changed(FlagPruningKeepRecent) { keepRecent, err := cmd.Flags().GetUint64(FlagPruningKeepRecent) if err != nil { - return nil, err, 0 + return nil, 0, err } // viper has an issue that we could not override subitem then Unmarshal key @@ -107,12 +107,12 @@ func createRootStore(cmd *cobra.Command, rootDir string, v *viper.Viper, logger err = overrideKeepRecent(filepath.Join(rootDir, "config"), keepRecent) if err != nil { - return nil, err, 0 + return nil, 0, err } tempViper, err = serverv2.ReadConfig(filepath.Join(rootDir, "config")) if err != nil { - return nil, err, 0 + return nil, 0, err } } @@ -123,7 +123,7 @@ func createRootStore(cmd *cobra.Command, rootDir string, v *viper.Viper, logger SCRawDB: scRawDb, }) - return store, err, tempViper.GetUint64("store.options.sc-pruning-option.keep-recent") + return store, tempViper.GetUint64("store.options.sc-pruning-option.keep-recent"), err } func overrideKeepRecent(configPath string, keepRecent uint64) error { diff --git a/server/v2/store/server.go b/server/v2/store/server.go index 32219fe9dbcf..2adaa8b7ef8e 100644 --- a/server/v2/store/server.go +++ b/server/v2/store/server.go @@ -12,6 +12,8 @@ import ( serverv2 "cosmossdk.io/server/v2" ) +// StoreComponent manages store config +// and contains prune & snapshot commands type StoreComponent[T transaction.Tx] struct { config *Config } From ded5c63cd5caed146a15d2f4cd9435153f77dad6 Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Mon, 22 Jul 2024 21:28:13 +0700 Subject: [PATCH 57/62] remove viper dep --- runtime/v2/builder.go | 10 +++++++++- store/v2/go.mod | 14 -------------- store/v2/go.sum | 35 ----------------------------------- store/v2/root/factory.go | 13 ++----------- 4 files changed, 11 insertions(+), 61 deletions(-) diff --git a/runtime/v2/builder.go b/runtime/v2/builder.go index 1bd651fb0196..bf56f861e16f 100644 --- a/runtime/v2/builder.go +++ b/runtime/v2/builder.go @@ -123,6 +123,14 @@ func (a *AppBuilder[T]) Build(opts ...AppBuilderOption[T]) (*App[T], error) { v := a.viper home := v.GetString(FlagHome) + + storeOpts := rootstore.Options{} + if v != nil { + if err := v.Sub("store.options").Unmarshal(&storeOpts); err != nil { + return nil, fmt.Errorf("failed to store options: %w", err) + } + } + scRawDb, err := db.NewGoLevelDB("application", filepath.Join(home, "data"), nil) if err != nil { panic(err) @@ -131,7 +139,7 @@ func (a *AppBuilder[T]) Build(opts ...AppBuilderOption[T]) (*App[T], error) { storeOptions := &rootstore.FactoryOptions{ Logger: a.app.logger, RootDir: home, - Options: v, + Options: storeOpts, StoreKeys: append(a.app.storeKeys, "stf"), SCRawDB: scRawDb, } diff --git a/store/v2/go.mod b/store/v2/go.mod index 1722b2f796a0..6bfc165ca32e 100644 --- a/store/v2/go.mod +++ b/store/v2/go.mod @@ -16,7 +16,6 @@ require ( github.com/linxGnu/grocksdb v1.8.14 github.com/mattn/go-sqlite3 v1.14.22 github.com/spf13/cast v1.6.0 - github.com/spf13/viper v1.19.0 github.com/stretchr/testify v1.9.0 github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d golang.org/x/sync v0.7.0 @@ -41,16 +40,12 @@ require ( github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/go-uuid v1.0.1 // indirect github.com/hashicorp/golang-lru v1.0.2 // indirect - github.com/hashicorp/hcl v1.0.0 // indirect github.com/klauspost/compress v1.17.7 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect - github.com/magiconair/properties v1.8.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect - github.com/pelletier/go-toml/v2 v2.2.2 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.19.1 // indirect @@ -59,15 +54,7 @@ require ( github.com/prometheus/procfs v0.15.1 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/rs/zerolog v1.33.0 // indirect - github.com/sagikazarmark/locafero v0.4.0 // indirect - github.com/sagikazarmark/slog-shim v0.1.0 // indirect - github.com/sourcegraph/conc v0.3.0 // indirect - github.com/spf13/afero v1.11.0 // indirect - github.com/spf13/pflag v1.0.5 // indirect - github.com/subosito/gotenv v1.6.0 // indirect github.com/tidwall/btree v1.7.0 // indirect - go.uber.org/atomic v1.9.0 // indirect - go.uber.org/multierr v1.9.0 // indirect golang.org/x/crypto v0.25.0 // indirect golang.org/x/exp v0.0.0-20240314144324-c7f7c6466f7f // indirect golang.org/x/sys v0.22.0 // indirect @@ -75,7 +62,6 @@ require ( google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5 // indirect google.golang.org/grpc v1.64.1 // indirect google.golang.org/protobuf v1.34.2 // indirect - gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/store/v2/go.sum b/store/v2/go.sum index 5fb0b211d215..ac521df72272 100644 --- a/store/v2/go.sum +++ b/store/v2/go.sum @@ -108,8 +108,6 @@ github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/b github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c= github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= -github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= @@ -130,8 +128,6 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/linxGnu/grocksdb v1.8.14 h1:HTgyYalNwBSG/1qCQUIott44wU5b2Y9Kr3z7SK5OfGQ= github.com/linxGnu/grocksdb v1.8.14/go.mod h1:QYiYypR2d4v63Wj1adOOfzglnoII0gLj3PNh4fZkcFA= -github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= -github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= @@ -141,8 +137,6 @@ github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= -github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= @@ -167,8 +161,6 @@ github.com/onsi/gomega v1.26.0 h1:03cDLK28U6hWvCAns6NeydX3zIm4SF3ci69ulidS32Q= github.com/onsi/gomega v1.26.0/go.mod h1:r+zV744Re+DiYCIPRlYOTxn0YkOLcAnW8k1xXdMPGhM= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= -github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= @@ -204,39 +196,19 @@ github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99 github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= -github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= -github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= -github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= -github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= -github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= -github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= -github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI= -github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= -github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d h1:vfofYNRScrDdvS342BElfbETmL1Aiz3i2t0zfRj16Hs= github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48= github.com/tidwall/btree v1.7.0 h1:L1fkJH/AuEh5zBnnBbmTwQ5Lt+bRJ5A8EWecslvo9iI= @@ -244,10 +216,6 @@ github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EU github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= -go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= -go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -342,8 +310,6 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= -gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -352,7 +318,6 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= diff --git a/store/v2/root/factory.go b/store/v2/root/factory.go index a12060ea8de8..e545c2cc40a5 100644 --- a/store/v2/root/factory.go +++ b/store/v2/root/factory.go @@ -5,8 +5,6 @@ import ( "fmt" "os" - "github.com/spf13/viper" - "cosmossdk.io/core/log" corestore "cosmossdk.io/core/store" "cosmossdk.io/store/v2" @@ -45,7 +43,7 @@ type Options struct { type FactoryOptions struct { Logger log.Logger RootDir string - Options *viper.Viper + Options Options StoreKeys []string SCRawDB corestore.KVStoreWithBatch } @@ -68,14 +66,7 @@ func CreateRootStore(opts *FactoryOptions) (store.RootStore, error) { } ) - v := opts.Options - storeOpts := Options{} - if v != nil { - if err := v.Sub("store.options").Unmarshal(&storeOpts); err != nil { - return nil, fmt.Errorf("failed to store options: %w", err) - } - } - + storeOpts := opts.Options switch storeOpts.SSType { case SSTypeSQLite: dir := fmt.Sprintf("%s/data/ss/sqlite", opts.RootDir) From 30e521f495c05304971cdde1abb9f6cda7c29e0c Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Tue, 23 Jul 2024 20:49:40 +0700 Subject: [PATCH 58/62] multiple db back end --- runtime/v2/builder.go | 4 ++-- server/v2/store/commands.go | 23 +++++++++++++++++++++-- server/v2/store/config.go | 36 ++++++++++++++++++++---------------- 3 files changed, 43 insertions(+), 20 deletions(-) diff --git a/runtime/v2/builder.go b/runtime/v2/builder.go index bf56f861e16f..148c14a2a120 100644 --- a/runtime/v2/builder.go +++ b/runtime/v2/builder.go @@ -130,8 +130,8 @@ func (a *AppBuilder[T]) Build(opts ...AppBuilderOption[T]) (*App[T], error) { return nil, fmt.Errorf("failed to store options: %w", err) } } - - scRawDb, err := db.NewGoLevelDB("application", filepath.Join(home, "data"), nil) + + scRawDb, err := db.NewDB(db.DBType(v.GetString("store.app-db-backend")), "application", filepath.Join(home, "data"), nil) if err != nil { panic(err) } diff --git a/server/v2/store/commands.go b/server/v2/store/commands.go index 1564960599b4..e67b8b338d59 100644 --- a/server/v2/store/commands.go +++ b/server/v2/store/commands.go @@ -85,7 +85,19 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, func createRootStore(cmd *cobra.Command, rootDir string, v *viper.Viper, logger log.Logger) (storev2.RootStore, uint64, error) { tempViper := v - scRawDb, err := db.NewGoLevelDB("application", filepath.Join(rootDir, "data"), nil) + + // handle FlagAppDBBackend + var dbType db.DBType + if cmd.Flags().Changed(FlagAppDBBackend) { + dbStr, err := cmd.Flags().GetString(FlagAppDBBackend) + if err != nil { + return nil, 0, err + } + dbType = db.DBType(dbStr) + } else { + dbType = db.DBType(v.GetString("store.app-db-backend")) + } + scRawDb, err := db.NewDB(dbType, "application", filepath.Join(rootDir, "data"), nil) if err != nil { panic(err) } @@ -116,10 +128,17 @@ func createRootStore(cmd *cobra.Command, rootDir string, v *viper.Viper, logger } } + storeOpts := DefaultStoreOptions() + if v != nil { + if err := v.Sub("store.options").Unmarshal(&storeOpts); err != nil { + return nil, 0, fmt.Errorf("failed to store options: %w", err) + } + } + store, err := root.CreateRootStore(&root.FactoryOptions{ Logger: logger, RootDir: rootDir, - Options: tempViper, + Options: storeOpts, SCRawDB: scRawDb, }) diff --git a/server/v2/store/config.go b/server/v2/store/config.go index 2403d2dd5922..88f8085f2c57 100644 --- a/server/v2/store/config.go +++ b/server/v2/store/config.go @@ -8,22 +8,26 @@ import ( func DefaultConfig() *Config { return &Config{ - AppDBBackend: "", - Options: root.Options{ - SSType: 0, - SCType: 0, - SCPruningOption: &storev2.PruningOption{ - KeepRecent: 2, - Interval: 1, - }, - SSPruningOption: &storev2.PruningOption{ - KeepRecent: 2, - Interval: 1, - }, - IavlConfig: &iavl.Config{ - CacheSize: 100_000, - SkipFastStorageUpgrade: true, - }, + AppDBBackend: "goleveldb", + Options: DefaultStoreOptions(), + } +} + +func DefaultStoreOptions() root.Options { + return root.Options{ + SSType: 0, + SCType: 0, + SCPruningOption: &storev2.PruningOption{ + KeepRecent: 2, + Interval: 1, + }, + SSPruningOption: &storev2.PruningOption{ + KeepRecent: 2, + Interval: 1, + }, + IavlConfig: &iavl.Config{ + CacheSize: 100_000, + SkipFastStorageUpgrade: true, }, } } From 700d59c5f79afd844140591719d6d471daadca2b Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Tue, 23 Jul 2024 20:56:06 +0700 Subject: [PATCH 59/62] lint --- runtime/v2/builder.go | 2 +- server/v2/store/commands.go | 2 +- server/v2/store/config.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime/v2/builder.go b/runtime/v2/builder.go index 148c14a2a120..dad45eaab9e8 100644 --- a/runtime/v2/builder.go +++ b/runtime/v2/builder.go @@ -131,7 +131,7 @@ func (a *AppBuilder[T]) Build(opts ...AppBuilderOption[T]) (*App[T], error) { } } - scRawDb, err := db.NewDB(db.DBType(v.GetString("store.app-db-backend")), "application", filepath.Join(home, "data"), nil) + scRawDb, err := db.NewDB(db.DBType(v.GetString("store.app-db-backend")), "application", filepath.Join(home, "data"), nil) if err != nil { panic(err) } diff --git a/server/v2/store/commands.go b/server/v2/store/commands.go index e67b8b338d59..562d3f466096 100644 --- a/server/v2/store/commands.go +++ b/server/v2/store/commands.go @@ -85,7 +85,7 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, func createRootStore(cmd *cobra.Command, rootDir string, v *viper.Viper, logger log.Logger) (storev2.RootStore, uint64, error) { tempViper := v - + // handle FlagAppDBBackend var dbType db.DBType if cmd.Flags().Changed(FlagAppDBBackend) { diff --git a/server/v2/store/config.go b/server/v2/store/config.go index 88f8085f2c57..0cf4adc05733 100644 --- a/server/v2/store/config.go +++ b/server/v2/store/config.go @@ -9,7 +9,7 @@ import ( func DefaultConfig() *Config { return &Config{ AppDBBackend: "goleveldb", - Options: DefaultStoreOptions(), + Options: DefaultStoreOptions(), } } From 7d6bdaa0a43f6c27e3e4b8f4226bda4d9562e796 Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Tue, 23 Jul 2024 21:14:57 +0700 Subject: [PATCH 60/62] add comment --- store/v2/commitment/iavl/config.go | 1 + store/v2/options.go | 1 + store/v2/root/factory.go | 1 + 3 files changed, 3 insertions(+) diff --git a/store/v2/commitment/iavl/config.go b/store/v2/commitment/iavl/config.go index ac30444a02ac..5fef2f1c1485 100644 --- a/store/v2/commitment/iavl/config.go +++ b/store/v2/commitment/iavl/config.go @@ -1,6 +1,7 @@ package iavl // Config is the configuration for the IAVL tree. +// app.toml config options type Config struct { CacheSize int `mapstructure:"cache_size" toml:"cache_size"` SkipFastStorageUpgrade bool `mapstructure:"skip_fast_storage_upgrade" toml:"skip_fast_storage_upgrade"` diff --git a/store/v2/options.go b/store/v2/options.go index 9a77d5e3f76e..99b18d59ff03 100644 --- a/store/v2/options.go +++ b/store/v2/options.go @@ -18,6 +18,7 @@ const ( ) // PruningOption defines the pruning configuration. +// app.toml config options type PruningOption struct { // KeepRecent sets the number of recent versions to keep. KeepRecent uint64 `mapstructure:"keep-recent" toml:"keep-recent"` diff --git a/store/v2/root/factory.go b/store/v2/root/factory.go index e545c2cc40a5..1eb549b27823 100644 --- a/store/v2/root/factory.go +++ b/store/v2/root/factory.go @@ -32,6 +32,7 @@ const ( SCTypeIavlV2 SCType = 1 ) +// app.toml config options type Options struct { SSType SSType `mapstructure:"ss-type" toml:"ss-type"` SCType SCType `mapstructure:"sc-type" toml:"sc-type"` From 3d014230938a3bba7fe59c9a2f7800319dd7eec6 Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Tue, 23 Jul 2024 23:27:39 +0700 Subject: [PATCH 61/62] comments --- store/v2/commitment/iavl/config.go | 5 ++--- store/v2/options.go | 4 ++-- store/v2/root/factory.go | 27 +++++++++++++++++++++++---- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/store/v2/commitment/iavl/config.go b/store/v2/commitment/iavl/config.go index 5fef2f1c1485..9d1cb8d788ea 100644 --- a/store/v2/commitment/iavl/config.go +++ b/store/v2/commitment/iavl/config.go @@ -1,10 +1,9 @@ package iavl // Config is the configuration for the IAVL tree. -// app.toml config options type Config struct { - CacheSize int `mapstructure:"cache_size" toml:"cache_size"` - SkipFastStorageUpgrade bool `mapstructure:"skip_fast_storage_upgrade" toml:"skip_fast_storage_upgrade"` + CacheSize int `mapstructure:"cache_size" toml:"cache_size" comment:"CacheSize set the size of the iavl tree cache."` + SkipFastStorageUpgrade bool `mapstructure:"skip_fast_storage_upgrade" toml:"skip_fast_storage_upgrade", comment:"If true, the tree will work like no fast storage and always not upgrade fast storage."` } // DefaultConfig returns the default configuration for the IAVL tree. diff --git a/store/v2/options.go b/store/v2/options.go index 99b18d59ff03..f87475e4a6d2 100644 --- a/store/v2/options.go +++ b/store/v2/options.go @@ -21,11 +21,11 @@ const ( // app.toml config options type PruningOption struct { // KeepRecent sets the number of recent versions to keep. - KeepRecent uint64 `mapstructure:"keep-recent" toml:"keep-recent"` + KeepRecent uint64 `mapstructure:"keep-recent" toml:"keep-recent" comment:"Number of recent heights to keep on disk."` // Interval sets the number of how often to prune. // If set to 0, no pruning will be done. - Interval uint64 `mapstructure:"interval" toml:"interval"` + Interval uint64 `mapstructure:"interval" toml:"interval" comment:"Height interval at which pruned heights are removed from disk."` } // NewPruningOption returns a new PruningOption instance based on the given pruning strategy. diff --git a/store/v2/root/factory.go b/store/v2/root/factory.go index 1eb549b27823..563e439815bc 100644 --- a/store/v2/root/factory.go +++ b/store/v2/root/factory.go @@ -34,10 +34,10 @@ const ( // app.toml config options type Options struct { - SSType SSType `mapstructure:"ss-type" toml:"ss-type"` - SCType SCType `mapstructure:"sc-type" toml:"sc-type"` - SSPruningOption *store.PruningOption `mapstructure:"ss-pruning-option" toml:"ss-pruning-option"` - SCPruningOption *store.PruningOption `mapstructure:"sc-pruning-option" toml:"sc-pruning-option"` + SSType SSType `mapstructure:"ss-type" toml:"ss-type" comment:"State storage database type. Currently we support: 0 for SQLite, 1 for Pebble"` + SCType SCType `mapstructure:"sc-type" toml:"sc-type" comment:"State commitment database type. Currently we support:0 for iavl, 1 for iavl v2"` + SSPruningOption *store.PruningOption `mapstructure:"ss-pruning-option" toml:"ss-pruning-option" comment:"Pruning options for state storage"` + SCPruningOption *store.PruningOption `mapstructure:"sc-pruning-option" toml:"sc-pruning-option" comment:"Pruning options for state commitment"` IavlConfig *iavl.Config `mapstructure:"iavl-config" toml:"iavl-config"` } @@ -49,6 +49,25 @@ type FactoryOptions struct { SCRawDB corestore.KVStoreWithBatch } +func DefaultStoreOptions() Options { + return Options{ + SSType: 0, + SCType: 0, + SCPruningOption: &store.PruningOption{ + KeepRecent: 2, + Interval: 1, + }, + SSPruningOption: &store.PruningOption{ + KeepRecent: 2, + Interval: 1, + }, + IavlConfig: &iavl.Config{ + CacheSize: 100_000, + SkipFastStorageUpgrade: true, + }, + } +} + // CreateRootStore is a convenience function to create a root store based on the // provided FactoryOptions. Strictly speaking app developers can create the root // store directly by calling root.New, so this function is not From 32249d3f0d37297221d38245a8aaeecc37438da2 Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Tue, 23 Jul 2024 23:28:13 +0700 Subject: [PATCH 62/62] DefaultStoreOptions to store/v2/root --- runtime/v2/builder.go | 8 +++----- server/v2/store/commands.go | 4 ++-- server/v2/store/config.go | 25 ++----------------------- store/v2/commitment/iavl/config.go | 2 +- 4 files changed, 8 insertions(+), 31 deletions(-) diff --git a/runtime/v2/builder.go b/runtime/v2/builder.go index a47871ac6832..a073761cbcf1 100644 --- a/runtime/v2/builder.go +++ b/runtime/v2/builder.go @@ -127,11 +127,9 @@ func (a *AppBuilder[T]) Build(opts ...AppBuilderOption[T]) (*App[T], error) { v := a.viper home := v.GetString(FlagHome) - storeOpts := rootstore.Options{} - if v != nil { - if err := v.Sub("store.options").Unmarshal(&storeOpts); err != nil { - return nil, fmt.Errorf("failed to store options: %w", err) - } + storeOpts := rootstore.DefaultStoreOptions() + if err := v.Sub("store.options").Unmarshal(&storeOpts); err != nil { + return nil, fmt.Errorf("failed to store options: %w", err) } scRawDb, err := db.NewDB(db.DBType(v.GetString("store.app-db-backend")), "application", filepath.Join(home, "data"), nil) diff --git a/server/v2/store/commands.go b/server/v2/store/commands.go index 562d3f466096..e1c8a20dfb60 100644 --- a/server/v2/store/commands.go +++ b/server/v2/store/commands.go @@ -44,7 +44,7 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, } logger := log.NewLogger(cmd.OutOrStdout()) - home, err := cmd.Flags().GetString(serverv2.FlagHome) // should be FlagHome + home, err := cmd.Flags().GetString(serverv2.FlagHome) if err != nil { return err } @@ -128,7 +128,7 @@ func createRootStore(cmd *cobra.Command, rootDir string, v *viper.Viper, logger } } - storeOpts := DefaultStoreOptions() + storeOpts := root.DefaultStoreOptions() if v != nil { if err := v.Sub("store.options").Unmarshal(&storeOpts); err != nil { return nil, 0, fmt.Errorf("failed to store options: %w", err) diff --git a/server/v2/store/config.go b/server/v2/store/config.go index 0cf4adc05733..457bfa9383cb 100644 --- a/server/v2/store/config.go +++ b/server/v2/store/config.go @@ -1,38 +1,17 @@ package store import ( - storev2 "cosmossdk.io/store/v2" - "cosmossdk.io/store/v2/commitment/iavl" "cosmossdk.io/store/v2/root" ) func DefaultConfig() *Config { return &Config{ AppDBBackend: "goleveldb", - Options: DefaultStoreOptions(), - } -} - -func DefaultStoreOptions() root.Options { - return root.Options{ - SSType: 0, - SCType: 0, - SCPruningOption: &storev2.PruningOption{ - KeepRecent: 2, - Interval: 1, - }, - SSPruningOption: &storev2.PruningOption{ - KeepRecent: 2, - Interval: 1, - }, - IavlConfig: &iavl.Config{ - CacheSize: 100_000, - SkipFastStorageUpgrade: true, - }, + Options: root.DefaultStoreOptions(), } } type Config struct { - AppDBBackend string `mapstructure:"app-db-backend" toml:"app-db-backend"` + AppDBBackend string `mapstructure:"app-db-backend" toml:"app-db-backend" comment:"The type of database for application and snapshots databases."` Options root.Options `mapstructure:"options" toml:"options"` } diff --git a/store/v2/commitment/iavl/config.go b/store/v2/commitment/iavl/config.go index 9d1cb8d788ea..d4b9b3bd0cbb 100644 --- a/store/v2/commitment/iavl/config.go +++ b/store/v2/commitment/iavl/config.go @@ -3,7 +3,7 @@ package iavl // Config is the configuration for the IAVL tree. type Config struct { CacheSize int `mapstructure:"cache_size" toml:"cache_size" comment:"CacheSize set the size of the iavl tree cache."` - SkipFastStorageUpgrade bool `mapstructure:"skip_fast_storage_upgrade" toml:"skip_fast_storage_upgrade", comment:"If true, the tree will work like no fast storage and always not upgrade fast storage."` + SkipFastStorageUpgrade bool `mapstructure:"skip_fast_storage_upgrade" toml:"skip_fast_storage_upgrade" comment:"If true, the tree will work like no fast storage and always not upgrade fast storage."` } // DefaultConfig returns the default configuration for the IAVL tree.