From f37b91d9b0d17f117667090d839680c8d730d0ad Mon Sep 17 00:00:00 2001 From: huangyi Date: Thu, 18 Jul 2024 14:31:22 +0800 Subject: [PATCH] fix build --- cmd/chain-maind/app/app.go | 34 +++++++++++++++++++++------------- cmd/chain-maind/main.go | 8 +------- go.mod | 4 +++- go.sum | 8 ++++++-- gomod2nix.toml | 12 +++++++++--- 5 files changed, 40 insertions(+), 26 deletions(-) diff --git a/cmd/chain-maind/app/app.go b/cmd/chain-maind/app/app.go index d4e177855..8ab9c54da 100644 --- a/cmd/chain-maind/app/app.go +++ b/cmd/chain-maind/app/app.go @@ -10,6 +10,7 @@ import ( conf "github.com/cosmos/cosmos-sdk/client/config" serverconfig "github.com/cosmos/cosmos-sdk/server/config" + "github.com/cosmos/cosmos-sdk/types/module" "cosmossdk.io/log" tmcfg "github.com/cometbft/cometbft/config" @@ -19,6 +20,7 @@ import ( "github.com/spf13/cast" "github.com/spf13/cobra" + confixcmd "cosmossdk.io/tools/confix/cmd" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/debug" "github.com/cosmos/cosmos-sdk/client/flags" @@ -34,7 +36,6 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" - genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" rosettaCmd "github.com/cosmos/rosetta/cmd" @@ -110,7 +111,6 @@ func initAppConfig() (string, interface{}) { // server config. srvCfg := serverconfig.DefaultConfig() srvCfg.GRPC.Address = "127.0.0.1:9090" - srvCfg.GRPCWeb.Address = "127.0.0.1:9091" customAppConfig := CustomAppConfig{ Config: *srvCfg, @@ -216,16 +216,12 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) { rootCmd.AddCommand( initCmd, - genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome, genutiltypes.DefaultMessageValidator), - genutilcli.MigrateGenesisCmd(), - genutilcli.GenTxCmd(app.ModuleBasics, encodingConfig.TxConfig, banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome), - genutilcli.ValidateGenesisCmd(app.ModuleBasics), chainmaincli.AddGenesisAccountCmd(app.DefaultNodeHome), tmcli.NewCompletionCmd(rootCmd, true), chainmaincli.AddTestnetCmd(app.ModuleBasics, banktypes.GenesisBalancesIterator{}), debug.Cmd(), - conf.Cmd(), - pruning.PruningCmd(newApp), + confixcmd.ConfigCommand(), + pruning.Cmd(newApp, app.DefaultNodeHome), snapshot.Cmd(newApp), ) @@ -233,10 +229,11 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) { // add keybase, auxiliary RPC, query, and tx child commands rootCmd.AddCommand( - rpc.StatusCommand(), + server.StatusCommand(), + genesisCommand(encodingConfig.TxConfig, app.ModuleBasics), queryCommand(), txCommand(), - keys.Commands(app.DefaultNodeHome), + keys.Commands(), ) // add rosetta @@ -249,6 +246,16 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) { } } +// genesisCommand builds genesis-related `simd genesis` command. Users may provide application specific commands as a parameter +func genesisCommand(txConfig client.TxConfig, basicManager module.BasicManager, cmds ...*cobra.Command) *cobra.Command { + cmd := genutilcli.Commands(txConfig, basicManager, app.DefaultNodeHome) + + for _, subCmd := range cmds { + cmd.AddCommand(subCmd) + } + return cmd +} + func addModuleInitFlags(startCmd *cobra.Command) { } @@ -263,13 +270,14 @@ func queryCommand() *cobra.Command { } cmd.AddCommand( - authcmd.GetAccountCmd(), + rpc.QueryEventForTxCmd(), rpc.ValidatorCommand(), - rpc.BlockCommand(), + server.QueryBlockCmd(), + server.QueryBlocksCmd(), + server.QueryBlockResultsCmd(), authcmd.QueryTxsByEventsCmd(), authcmd.QueryTxCmd(), chainmaincli.QueryAllTxCmd(), - rpc.QueryEventForTxCmd(), ) app.ModuleBasics.AddQueryCommands(cmd) diff --git a/cmd/chain-maind/main.go b/cmd/chain-maind/main.go index 02049cf20..da9f0eb30 100644 --- a/cmd/chain-maind/main.go +++ b/cmd/chain-maind/main.go @@ -3,7 +3,6 @@ package main import ( "os" - "github.com/cosmos/cosmos-sdk/server" svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" "github.com/crypto-org-chain/chain-main/v4/app" cmd "github.com/crypto-org-chain/chain-main/v4/cmd/chain-maind/app" @@ -12,11 +11,6 @@ import ( func main() { rootCmd, _ := cmd.NewRootCmd() if err := svrcmd.Execute(rootCmd, cmd.EnvPrefix, app.DefaultNodeHome); err != nil { - switch e := err.(type) { - case server.ErrorCode: - os.Exit(e.Code) - default: - os.Exit(1) - } + os.Exit(1) } } diff --git a/go.mod b/go.mod index aa054ca97..bc00aa27b 100644 --- a/go.mod +++ b/go.mod @@ -11,6 +11,7 @@ require ( cosmossdk.io/math v1.3.0 cosmossdk.io/simapp v0.0.0-20230608160436-666c345ad23d cosmossdk.io/store v1.1.0 + cosmossdk.io/tools/confix v0.1.0 cosmossdk.io/x/evidence v0.1.0 cosmossdk.io/x/feegrant v0.1.0 cosmossdk.io/x/upgrade v0.1.1 @@ -36,7 +37,6 @@ require ( github.com/spf13/cobra v1.8.0 github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.9.0 - go.starlark.net v0.0.0-20240705175910-70002002b310 google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de google.golang.org/grpc v1.63.2 google.golang.org/protobuf v1.33.0 @@ -84,6 +84,8 @@ require ( github.com/cosmos/ics23/go v0.10.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/cosmos/rosetta-sdk-go v0.10.0 // indirect + github.com/creachadair/atomicfile v0.3.1 // indirect + github.com/creachadair/tomledit v0.0.24 // indirect github.com/crypto-org-chain/cronos/memiavl v0.0.5-0.20231225065237-42f2597fca49 // indirect github.com/danieljoos/wincred v1.1.2 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect diff --git a/go.sum b/go.sum index d5b727767..8ae6860b5 100644 --- a/go.sum +++ b/go.sum @@ -204,6 +204,8 @@ cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/simapp v0.0.0-20230608160436-666c345ad23d h1:E/8y0oG3u9hBR8l4F9MtC0LdZIamPCUwUoLlrHrX86I= cosmossdk.io/simapp v0.0.0-20230608160436-666c345ad23d/go.mod h1:xbjky3L3DJEylaho6gXplkrMvJ5sFgv+qNX+Nn47bzY= +cosmossdk.io/tools/confix v0.1.0 h1:2OOZTtQsDT5e7P3FM5xqM0bPfluAxZlAwxqaDmYBE+E= +cosmossdk.io/tools/confix v0.1.0/go.mod h1:TdXKVYs4gEayav5wM+JHT+kTU2J7fozFNqoVaN+8CdY= cosmossdk.io/x/circuit v0.1.0 h1:IAej8aRYeuOMritczqTlljbUVHq1E85CpBqaCTwYgXs= cosmossdk.io/x/circuit v0.1.0/go.mod h1:YDzblVE8+E+urPYQq5kq5foRY/IzhXovSYXb4nwd39w= cosmossdk.io/x/evidence v0.1.0 h1:J6OEyDl1rbykksdGynzPKG5R/zm6TacwW2fbLTW4nCk= @@ -434,6 +436,10 @@ github.com/cosmos/rosetta-sdk-go v0.10.0/go.mod h1:SImAZkb96YbwvoRkzSMQB6noNJXFg github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/creachadair/atomicfile v0.3.1 h1:yQORkHjSYySh/tv5th1dkKcn02NEW5JleB84sjt+W4Q= +github.com/creachadair/atomicfile v0.3.1/go.mod h1:mwfrkRxFKwpNAflYZzytbSwxvbK6fdGRRlp0KEQc0qU= +github.com/creachadair/tomledit v0.0.24 h1:5Xjr25R2esu1rKCbQEmjZYlrhFkDspoAbAKb6QKQDhQ= +github.com/creachadair/tomledit v0.0.24/go.mod h1:9qHbShRWQzSCcn617cMzg4eab1vbLCOjOshAWSzWr8U= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/crypto-org-chain/cometbft-db v0.0.0-20231011055109-57922ac52a63 h1:R1QJ9a3XdYMSKo+1RdFifxb/g3lNypC52L/rpYrWoKo= @@ -1301,8 +1307,6 @@ go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6 go.opentelemetry.io/otel/trace v1.22.0 h1:Hg6pPujv0XG9QaVbGOBVHunyuLcCC3jN7WEhPx83XD0= go.opentelemetry.io/otel/trace v1.22.0/go.mod h1:RbbHXVqKES9QhzZq/fE5UnOSILqRt40a21sPw2He1xo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.starlark.net v0.0.0-20240705175910-70002002b310 h1:tEAOMoNmN2MqVNi0MMEWpTtPI4YNCXgxmAGtuv3mST0= -go.starlark.net v0.0.0-20240705175910-70002002b310/go.mod h1:YKMCv9b1WrfWmeqdV5MAuEHWsu5iC+fe6kYl2sQjdI8= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= diff --git a/gomod2nix.toml b/gomod2nix.toml index 1b66a889f..5ab97eb7f 100644 --- a/gomod2nix.toml +++ b/gomod2nix.toml @@ -48,6 +48,9 @@ schema = 3 version = "v0.0.0-20240716063309-c47504d189d4" hash = "sha256-zne7cIFs9WLg11pIr9VLBBc+G+kZfKLn8UU1mP4w6BM=" replaced = "github.com/crypto-org-chain/cosmos-sdk/store" + [mod."cosmossdk.io/tools/confix"] + version = "v0.1.0" + hash = "sha256-PvIYbcjsATI+gP0+efJZjlGhaClx4SNfadlVY3Ok9TE=" [mod."cosmossdk.io/x/evidence"] version = "v0.1.0" hash = "sha256-ZhVrmCGOzx2yODpcgvM9c48jkqz37NwU2ln/uVuCEfc=" @@ -179,6 +182,12 @@ schema = 3 [mod."github.com/cosmos/rosetta-sdk-go"] version = "v0.10.0" hash = "sha256-WmLq9E9mYV+ms6Tdb43lCoAy6cowkDnK4bvX/ApDzLY=" + [mod."github.com/creachadair/atomicfile"] + version = "v0.3.1" + hash = "sha256-GEp1gRxKfBYI6K0XbElcVYcJMPu6eeLufaYxr7Z0MAQ=" + [mod."github.com/creachadair/tomledit"] + version = "v0.0.24" + hash = "sha256-4vUukHONOjNn0qfQr4esK6TWfPWsIp+rbdz65og84lw=" [mod."github.com/crypto-org-chain/cronos/memiavl"] version = "v0.0.0-20240716081818-7f581a697f6d" hash = "sha256-KxwdnxZIIdZeugBwduaTFZichmEATZy5bdIiZZetbyE=" @@ -550,9 +559,6 @@ schema = 3 [mod."go.opentelemetry.io/otel/trace"] version = "v1.22.0" hash = "sha256-38zzkmcoOzYYeDN+rC44HmwmdnalIcEpObCS6tIvMO8=" - [mod."go.starlark.net"] - version = "v0.0.0-20240705175910-70002002b310" - hash = "sha256-WT2I7ZJM4urBI9LeIkWJ9SlcVwMSCboIdv5GNOX2SzA=" [mod."go.uber.org/multierr"] version = "v1.10.0" hash = "sha256-GepuppwpqpOGSNKi6GtGoO01TFxUQWfKZmE0B3M/HQA="