diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b610eb219f0..4e96570e82c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,7 +42,6 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i ### Features -* (types) [#19511](https://github.com/cosmos/cosmos-sdk/pull/19511) Replace regex parsing of denom validation to direct matching methods. * (runtime) [#19571](https://github.com/cosmos/cosmos-sdk/pull/19571) Implement `core/router.Service` it in runtime. This service is present in all modules (when using depinject). * (types) [#19164](https://github.com/cosmos/cosmos-sdk/pull/19164) Add a ValueCodec for the math.Uint type that can be used in collections maps. * (types) [#19281](https://github.com/cosmos/cosmos-sdk/pull/19281) Added a new method, `IsGT`, for `types.Coin`. This method is used to check if a `types.Coin` is greater than another `types.Coin`. @@ -142,8 +141,9 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i * (server) [#18909](https://github.com/cosmos/cosmos-sdk/pull/18909) Remove configuration endpoint on grpc reflection endpoint in favour of auth module bech32prefix endpoint already exposed. * (crypto) [#19541](https://github.com/cosmos/cosmos-sdk/pull/19541) The deprecated `FromTmProtoPublicKey`, `ToTmProtoPublicKey`, `FromTmPubKeyInterface` and `ToTmPubKeyInterface` functions have been removed. Use their replacements (`Cmt` instead of `Tm`) instead. * (types) [#19652](https://github.com/cosmos/cosmos-sdk/pull/19652) - * Moved`types/module.HasRegisterInterfaces` to `cosmossdk.io/core`. - * Moved `RegisterInterfaces` and `RegisterImplementations` from `InterfaceRegistry` to `cosmossdk.io/core/registry.LegacyRegistry` interface. + * Moved`types/module.HasRegisterInterfaces` to `cosmossdk.io/core`. + * Moved `RegisterInterfaces` and `RegisterImplementations` from `InterfaceRegistry` to `cosmossdk.io/core/registry.LegacyRegistry` interface. +* (types) [#19627](https://github.com/cosmos/cosmos-sdk/pull/19627) All genesis interfaces now don't take `codec.JsonCodec`. Every module has the codec already, passing it created an unneeded dependency. Additionally, to reflect this change, the module manager does not take a codec either. ### Client Breaking Changes diff --git a/UPGRADING.md b/UPGRADING.md index 2d04c35f6806..1519b8f80efc 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -182,16 +182,16 @@ Previous module migrations have been removed. It is required to migrate to v0.50 ##### Genesis Interface -All genesis interfaces have been migrated to take context.Context instead of sdk.Context. +All genesis interfaces have been migrated to take context.Context instead of sdk.Context. Secondly, the codec is no longer passed in by the framework. The codec is now passed in by the module. ```go // InitGenesis performs genesis initialization for the authz module. -func (am AppModule) InitGenesis(ctx context.Context, cdc codec.JSONCodec, data json.RawMessage) { +func (am AppModule) InitGenesis(ctx context.Context, data json.RawMessage) error { } // ExportGenesis returns the exported genesis state as raw bytes for the authz // module. -func (am AppModule) ExportGenesis(ctx context.Context, cdc codec.JSONCodec) json.RawMessage { +func (am AppModule) ExportGenesis(ctx context.Context) (json.RawMessage, error) { } ``` diff --git a/api/go.mod b/api/go.mod index f924df554916..1467e61a79d8 100644 --- a/api/go.mod +++ b/api/go.mod @@ -7,13 +7,13 @@ require ( github.com/cosmos/cosmos-proto v1.0.0-beta.4 github.com/cosmos/gogoproto v1.4.11 google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014 - google.golang.org/grpc v1.62.0 - google.golang.org/protobuf v1.32.0 + google.golang.org/grpc v1.62.1 + google.golang.org/protobuf v1.33.0 ) require ( buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.32.0-20230509103710-5e5b9fdd0180.1 // indirect - github.com/golang/protobuf v1.5.3 // indirect + github.com/golang/protobuf v1.5.4 // indirect github.com/google/go-cmp v0.6.0 // indirect golang.org/x/exp v0.0.0-20230811145659-89c5cff77bcb // indirect golang.org/x/net v0.21.0 // indirect diff --git a/api/go.sum b/api/go.sum index aa1125c8466e..d211b34578bf 100644 --- a/api/go.sum +++ b/api/go.sum @@ -7,8 +7,8 @@ github.com/cosmos/cosmos-proto v1.0.0-beta.4/go.mod h1:oeB+FyVzG3XrQJbJng0EnV8Vl github.com/cosmos/gogoproto v1.4.11 h1:LZcMHrx4FjUgrqQSWeaGC1v/TeuVFqSLa43CC6aWR2g= github.com/cosmos/gogoproto v1.4.11/go.mod h1:/g39Mh8m17X8Q/GDEs5zYTSNaNnInBSohtaxzQnYq1Y= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -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/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= @@ -27,9 +27,9 @@ google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014 h1: google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014/go.mod h1:rbHMSEDyoYX62nRVLOCc4Qt1HbsdytAYoVwgjiOhF3I= google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c h1:NUsgEN92SQQqzfA+YtqYNqYmB3DMMYLlIwUZAQFVFbo= google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c/go.mod h1:H4O17MA/PE9BsGx3w+a+W2VOLLD1Qf7oJneAoU6WktY= -google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk= -google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= diff --git a/baseapp/abci.go b/baseapp/abci.go index f851338acbae..e54824f41e0f 100644 --- a/baseapp/abci.go +++ b/baseapp/abci.go @@ -1199,7 +1199,7 @@ func checkNegativeHeight(height int64) error { return nil } -// createQueryContext creates a new sdk.Context for a query, taking as args +// CreateQueryContext creates a new sdk.Context for a query, taking as args // the block height and whether the query needs a proof or not. func (app *BaseApp) CreateQueryContext(height int64, prove bool) (sdk.Context, error) { if err := checkNegativeHeight(height); err != nil { diff --git a/baseapp/options.go b/baseapp/options.go index 5acc6811dbe3..372c2411cf82 100644 --- a/baseapp/options.go +++ b/baseapp/options.go @@ -273,7 +273,7 @@ func (app *BaseApp) SetFauxMerkleMode() { app.fauxMerkleMode = true } -// SetNotSigverify during simulation testing, transaction signature verification needs to be ignored. +// SetNotSigverifyTx during simulation testing, transaction signature verification needs to be ignored. func (app *BaseApp) SetNotSigverifyTx() { app.sigverifyTx = false } diff --git a/baseapp/params_legacy.go b/baseapp/params_legacy.go index 13fd34add70e..b8a0591daef3 100644 --- a/baseapp/params_legacy.go +++ b/baseapp/params_legacy.go @@ -1,37 +1,36 @@ -/* -Deprecated. +// Deprecated: + +// Legacy types are defined below to aid in the migration of CometBFT consensus +// parameters from use of the now deprecated x/params modules to a new dedicated +// x/consensus module. +// +// Application developers should ensure that they implement their upgrade handler +// correctly such that app.ConsensusParamsKeeper.Set() is called with the values +// returned by GetConsensusParams(). +// +// Example: +// +// baseAppLegacySS := app.ParamsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramstypes.ConsensusParamsKeyTable()) +// +// app.UpgradeKeeper.SetUpgradeHandler( +// UpgradeName, +// func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { +// if cp := baseapp.GetConsensusParams(ctx, baseAppLegacySS); cp != nil { +// app.ConsensusParamsKeeper.Set(ctx, cp) +// } else { +// ctx.Logger().Info("warning: consensus parameters are undefined; skipping migration", "upgrade", UpgradeName) +// } +// +// return app.ModuleManager.RunMigrations(ctx, app.Configurator(), fromVM) +// }, +// ) +// +// Developers can also bypass the use of the legacy Params subspace and set the +// values to app.ConsensusParamsKeeper.Set() explicitly. +// +// Note, for new chains this is not necessary as CometBFT's consensus parameters +// will automatically be set for you in InitChain. -Legacy types are defined below to aid in the migration of CometBFT consensus -parameters from use of the now deprecated x/params modules to a new dedicated -x/consensus module. - -Application developers should ensure that they implement their upgrade handler -correctly such that app.ConsensusParamsKeeper.Set() is called with the values -returned by GetConsensusParams(). - -Example: - - baseAppLegacySS := app.ParamsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramstypes.ConsensusParamsKeyTable()) - - app.UpgradeKeeper.SetUpgradeHandler( - UpgradeName, - func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { - if cp := baseapp.GetConsensusParams(ctx, baseAppLegacySS); cp != nil { - app.ConsensusParamsKeeper.Set(ctx, cp) - } else { - ctx.Logger().Info("warning: consensus parameters are undefined; skipping migration", "upgrade", UpgradeName) - } - - return app.ModuleManager.RunMigrations(ctx, app.Configurator(), fromVM) - }, - ) - -Developers can also bypass the use of the legacy Params subspace and set the -values to app.ConsensusParamsKeeper.Set() explicitly. - -Note, for new chains this is not necessary as CometBFT's consensus parameters -will automatically be set for you in InitChain. -*/ package baseapp import ( diff --git a/client/context.go b/client/context.go index b4f8e54fe024..2d513c81b34a 100644 --- a/client/context.go +++ b/client/context.go @@ -309,7 +309,7 @@ func (ctx Context) WithAux(isAux bool) Context { return ctx } -// WithLedgerHasProto returns the context with the provided boolean value, indicating +// WithLedgerHasProtobuf returns the context with the provided boolean value, indicating // whether the target Ledger application can support Protobuf payloads. func (ctx Context) WithLedgerHasProtobuf(val bool) Context { ctx.LedgerHasProtobuf = val diff --git a/client/keys/types.go b/client/keys/types.go index 1df26ed2879d..70fdfa6520af 100644 --- a/client/keys/types.go +++ b/client/keys/types.go @@ -22,7 +22,7 @@ func NewAddNewKey(name, password, mnemonic string, account, index int) AddNewKey } } -// RecoverKeyBody recovers a key +// RecoverKey recovers a key type RecoverKey struct { Password string `json:"password"` Mnemonic string `json:"mnemonic"` diff --git a/client/rpc/block.go b/client/rpc/block.go index d1b99d722942..388741328d58 100644 --- a/client/rpc/block.go +++ b/client/rpc/block.go @@ -68,7 +68,7 @@ func QueryBlocks(clientCtx client.Context, page, limit int, query, orderBy strin return result, nil } -// get block by height +// GetBlockByHeight get block by height func GetBlockByHeight(clientCtx client.Context, height *int64) (*cmt.Block, error) { // get the node node, err := clientCtx.GetNode() diff --git a/client/v2/go.mod b/client/v2/go.mod index 0473c4c9320c..4d843e5a66dd 100644 --- a/client/v2/go.mod +++ b/client/v2/go.mod @@ -8,7 +8,7 @@ require ( cosmossdk.io/depinject v1.0.0-alpha.4 cosmossdk.io/x/bank v0.0.0-00010101000000-000000000000 cosmossdk.io/x/gov v0.0.0-20231113122742-912390d5fc4a - cosmossdk.io/x/tx v0.13.0 + cosmossdk.io/x/tx v0.13.1 github.com/chzyer/readline v1.5.1 // indirect github.com/cockroachdb/errors v1.11.1 github.com/cosmos/cosmos-proto v1.0.0-beta.4 @@ -16,8 +16,8 @@ require ( github.com/manifoldco/promptui v0.9.0 // indirect github.com/spf13/cobra v1.8.0 github.com/spf13/pflag v1.0.5 - google.golang.org/grpc v1.62.0 - google.golang.org/protobuf v1.32.0 + google.golang.org/grpc v1.62.1 + google.golang.org/protobuf v1.33.0 gotest.tools/v3 v3.5.1 sigs.k8s.io/yaml v1.4.0 ) @@ -79,7 +79,7 @@ require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/glog v1.2.0 // indirect github.com/golang/mock v1.6.0 // indirect - github.com/golang/protobuf v1.5.3 // indirect + github.com/golang/protobuf v1.5.4 // 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 @@ -124,7 +124,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.19.0 // indirect github.com/prometheus/client_model v0.6.0 // indirect - github.com/prometheus/common v0.49.0 // indirect + github.com/prometheus/common v0.50.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect @@ -151,7 +151,7 @@ require ( golang.org/x/crypto v0.21.0 // indirect golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect golang.org/x/mod v0.15.0 // indirect - golang.org/x/net v0.21.0 // indirect + golang.org/x/net v0.22.0 // indirect golang.org/x/sync v0.6.0 // indirect golang.org/x/sys v0.18.0 // indirect golang.org/x/term v0.18.0 // indirect @@ -186,5 +186,4 @@ replace ( cosmossdk.io/x/protocolpool => ./../../x/protocolpool cosmossdk.io/x/slashing => ./../../x/slashing cosmossdk.io/x/staking => ./../../x/staking - cosmossdk.io/x/tx => ./../../x/tx ) diff --git a/client/v2/go.sum b/client/v2/go.sum index 6fe8a6de5077..e473b86c060c 100644 --- a/client/v2/go.sum +++ b/client/v2/go.sum @@ -14,6 +14,8 @@ cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/store v1.0.2 h1:lSg5BTvJBHUDwswNNyeh4K/CbqiHER73VU4nDNb8uk0= cosmossdk.io/store v1.0.2/go.mod h1:EFtENTqVTuWwitGW1VwaBct+yDagk7oG/axBMPH+FXs= +cosmossdk.io/x/tx v0.13.1 h1:Mg+EMp67Pz+NukbJqYxuo8uRp7N/a9uR+oVS9pONtj8= +cosmossdk.io/x/tx v0.13.1/go.mod h1:CBCU6fsRVz23QGFIQBb1DNX2DztJCf3jWyEkHY2nJQ0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= @@ -302,8 +304,8 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -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/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.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -601,8 +603,8 @@ github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt2 github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.49.0 h1:ToNTdK4zSnPVJmh698mGFkDor9wBI/iGaJy5dbH1EgI= -github.com/prometheus/common v0.49.0/go.mod h1:Kxm+EULxRbUkjGU6WFsQqo3ORzB4tyKvlWFOE9mB2sE= +github.com/prometheus/common v0.50.0 h1:YSZE6aa9+luNa2da6/Tik0q0A5AbR+U003TItK57CPQ= +github.com/prometheus/common v0.50.0/go.mod h1:wHFBCEVWVmHMUpg7pYcOm2QUR/ocQdYSJVQJKnHc3xQ= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= @@ -805,8 +807,8 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= 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.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= +golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -957,8 +959,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk= -google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -973,8 +975,9 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= 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-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/client/v2/internal/util/util.go b/client/v2/internal/util/util.go index 1ec988142278..dddb0c42020d 100644 --- a/client/v2/internal/util/util.go +++ b/client/v2/internal/util/util.go @@ -17,7 +17,7 @@ import ( // later versions unsupported by the current version can be added var buildInfo, _ = debug.ReadBuildInfo() -// DescriptorName returns the name of the descriptor in kebab case. +// DescriptorKebabName returns the name of the descriptor in kebab case. func DescriptorKebabName(descriptor protoreflect.Descriptor) string { return strcase.ToKebab(string(descriptor.Name())) } diff --git a/codec/codec.go b/codec/codec.go index d26f91b35623..51b8d8051b31 100644 --- a/codec/codec.go +++ b/codec/codec.go @@ -59,7 +59,7 @@ type ( // MustUnmarshal calls Unmarshal and panics if error is returned. MustUnmarshal(bz []byte, ptr proto.Message) - // Unmarshal parses the data encoded with UnmarshalLengthPrefixed method and stores + // UnmarshalLengthPrefixed parses the data encoded with UnmarshalLengthPrefixed method and stores // the result in the value pointed to by v. UnmarshalLengthPrefixed(bz []byte, ptr proto.Message) error // MustUnmarshalLengthPrefixed calls UnmarshalLengthPrefixed and panics if error diff --git a/codec/types/compat.go b/codec/types/compat.go index 080ca321c72e..bb4dff0bf438 100644 --- a/codec/types/compat.go +++ b/codec/types/compat.go @@ -102,7 +102,7 @@ func (a AminoUnpacker) UnpackAny(any *Any, iface interface{}) error { return nil } -// AminoUnpacker is an AnyUnpacker provided for backwards compatibility with +// AminoPacker is provided for backwards compatibility with // amino for the binary marshaling phase type AminoPacker struct { Cdc *amino.Codec @@ -123,7 +123,7 @@ func (a AminoPacker) UnpackAny(any *Any, _ interface{}) error { return err } -// AminoUnpacker is an AnyUnpacker provided for backwards compatibility with +// AminoJSONUnpacker is an AnyUnpacker provided for backwards compatibility with // amino for the JSON marshaling phase type AminoJSONUnpacker struct { Cdc *amino.Codec @@ -160,7 +160,7 @@ func (a AminoJSONUnpacker) UnpackAny(any *Any, iface interface{}) error { return nil } -// AminoUnpacker is an AnyUnpacker provided for backwards compatibility with +// AminoJSONPacker is an AnyUnpacker provided for backwards compatibility with // amino for the JSON un-marshaling phase type AminoJSONPacker struct { Cdc *amino.Codec diff --git a/codec/unknownproto/doc.go b/codec/unknownproto/doc.go index cef3f8f253e9..ac8fd58da17e 100644 --- a/codec/unknownproto/doc.go +++ b/codec/unknownproto/doc.go @@ -1,24 +1,22 @@ -/* -unknownproto implements functionality to "type check" protobuf serialized byte sequences -against an expected proto.Message to report: - -a) Unknown fields in the stream -- this is indicative of mismatched services, perhaps a malicious actor - -b) Mismatched wire types for a field -- this is indicative of mismatched services - -Its API signature is similar to proto.Unmarshal([]byte, proto.Message) in the strict case - - if err := RejectUnknownFieldsStrict(protoBlob, protoMessage, false); err != nil { - // Handle the error. - } - -and ideally should be added before invoking proto.Unmarshal, if you'd like to enforce the features mentioned above. - -By default, for security we report every single field that's unknown, whether a non-critical field or not. To customize -this behavior, please set the boolean parameter allowUnknownNonCriticals to true to RejectUnknownFields: - - if err := RejectUnknownFields(protoBlob, protoMessage, true); err != nil { - // Handle the error. - } -*/ +// Package unknownproto implements functionality to "type check" protobuf serialized byte sequences +// against an expected proto.Message to report: +// +// a) Unknown fields in the stream -- this is indicative of mismatched services, perhaps a malicious actor +// +// b) Mismatched wire types for a field -- this is indicative of mismatched services +// +// Its API signature is similar to proto.Unmarshal([]byte, proto.Message) in the strict case +// +// if err := RejectUnknownFieldsStrict(protoBlob, protoMessage, false); err != nil { +// // Handle the error. +// } +// +// and ideally should be added before invoking proto.Unmarshal, if you'd like to enforce the features mentioned above. +// +// By default, for security we report every single field that's unknown, whether a non-critical field or not. To customize +// this behavior, please set the boolean parameter allowUnknownNonCriticals to true to RejectUnknownFields: +// +// if err := RejectUnknownFields(protoBlob, protoMessage, true); err != nil { +// // Handle the error. +// } package unknownproto diff --git a/collections/go.mod b/collections/go.mod index d48f5bec5e5e..bc89bc4cecc5 100644 --- a/collections/go.mod +++ b/collections/go.mod @@ -25,7 +25,7 @@ require ( github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/getsentry/sentry-go v0.27.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/protobuf v1.5.3 // indirect + github.com/golang/protobuf v1.5.4 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/btree v1.1.2 // indirect github.com/klauspost/compress v1.17.7 // indirect @@ -37,17 +37,17 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_golang v1.19.0 // indirect github.com/prometheus/client_model v0.6.0 // indirect - github.com/prometheus/common v0.49.0 // indirect + github.com/prometheus/common v0.50.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/spf13/cast v1.6.0 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect - golang.org/x/net v0.21.0 // indirect - golang.org/x/sys v0.17.0 // indirect + golang.org/x/net v0.22.0 // indirect + golang.org/x/sys v0.18.0 // indirect golang.org/x/text v0.14.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c // indirect - google.golang.org/grpc v1.62.0 // indirect - google.golang.org/protobuf v1.32.0 // indirect + google.golang.org/grpc v1.62.1 // indirect + google.golang.org/protobuf v1.33.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/collections/go.sum b/collections/go.sum index c1946a7079a3..cbf31d88daf8 100644 --- a/collections/go.sum +++ b/collections/go.sum @@ -56,8 +56,8 @@ github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvq github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -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/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= @@ -107,8 +107,8 @@ github.com/prometheus/client_golang v1.19.0 h1:ygXvpU1AoN1MhdzckN+PyD9QJOSD4x7km github.com/prometheus/client_golang v1.19.0/go.mod h1:ZRM9uEAypZakd+q/x7+gmsvXdURP+DABIEIjnmDdp+k= github.com/prometheus/client_model v0.6.0 h1:k1v3CzpSRUTrKMppY35TLwPvxHqBu0bYgxZzqGIgaos= github.com/prometheus/client_model v0.6.0/go.mod h1:NTQHnmxFpouOD0DpvP4XujX3CdOAGQPoaGhyTchlyt8= -github.com/prometheus/common v0.49.0 h1:ToNTdK4zSnPVJmh698mGFkDor9wBI/iGaJy5dbH1EgI= -github.com/prometheus/common v0.49.0/go.mod h1:Kxm+EULxRbUkjGU6WFsQqo3ORzB4tyKvlWFOE9mB2sE= +github.com/prometheus/common v0.50.0 h1:YSZE6aa9+luNa2da6/Tik0q0A5AbR+U003TItK57CPQ= +github.com/prometheus/common v0.50.0/go.mod h1:wHFBCEVWVmHMUpg7pYcOm2QUR/ocQdYSJVQJKnHc3xQ= github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= @@ -141,8 +141,8 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY 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.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= +golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -166,8 +166,8 @@ golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBc 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.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.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= @@ -188,8 +188,8 @@ golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c h1:NUsgEN92SQQqzfA+YtqYNqYmB3DMMYLlIwUZAQFVFbo= google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c/go.mod h1:H4O17MA/PE9BsGx3w+a+W2VOLLD1Qf7oJneAoU6WktY= -google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk= -google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -198,8 +198,8 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= -google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= 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= diff --git a/core/appmodule/genesis.go b/core/appmodule/genesis.go index 7f955a467749..dcc7fe8a992a 100644 --- a/core/appmodule/genesis.go +++ b/core/appmodule/genesis.go @@ -3,13 +3,18 @@ package appmodule import ( "context" "io" + + appmodule "cosmossdk.io/core/appmodule/v2" ) -// HasGenesis is the extension interface that modules should implement to handle +// HasGenesis defines a custom genesis handling API implementation. +type HasGenesis = appmodule.HasGenesis + +// HasGenesisAuto is the extension interface that modules should implement to handle // genesis data and state initialization. // WARNING: This interface is experimental and may change at any time. -type HasGenesis interface { - AppModule +type HasGenesisAuto interface { + appmodule.AppModule // DefaultGenesis writes the default genesis for this module to the target. DefaultGenesis(GenesisTarget) error diff --git a/core/appmodule/module.go b/core/appmodule/module.go index 291a75b29dde..f8513b838179 100644 --- a/core/appmodule/module.go +++ b/core/appmodule/module.go @@ -54,12 +54,12 @@ type HasServices interface { // HasPrepareCheckState is an extension interface that contains information about the AppModule // and PrepareCheckState. type HasPrepareCheckState interface { - AppModule + appmodule.AppModule PrepareCheckState(context.Context) error } -// HasPrecommit is an extension interface that contains information about the AppModule and Precommit. +// HasPrecommit is an extension interface that contains information about the appmodule.AppModule and Precommit. type HasPrecommit interface { - AppModule + appmodule.AppModule Precommit(context.Context) error } diff --git a/core/appmodule/v2/genesis.go b/core/appmodule/v2/genesis.go index d457ac89d8c3..d32745d13f52 100644 --- a/core/appmodule/v2/genesis.go +++ b/core/appmodule/v2/genesis.go @@ -10,7 +10,7 @@ import ( // migration of existing modules to the new app module API. It is intended to be replaced by collections type HasGenesis interface { AppModule - DefaultGenesis() Message + DefaultGenesis() json.RawMessage ValidateGenesis(data json.RawMessage) error InitGenesis(ctx context.Context, data json.RawMessage) error ExportGenesis(ctx context.Context) (json.RawMessage, error) diff --git a/core/comet/service.go b/core/comet/service.go index 8af646e011d5..bc99e820f11f 100644 --- a/core/comet/service.go +++ b/core/comet/service.go @@ -5,7 +5,7 @@ import ( "time" ) -// BlockInfoService is an interface that can be used to get information specific to Comet +// CometInfoService is an interface that can be used to get information specific to Comet type CometInfoService interface { GetCometInfo(context.Context) Info } @@ -50,7 +50,7 @@ type VoteInfo struct { BlockIDFlag BlockIDFlag } -// BlockIdFlag indicates which BlockID the signature is for +// BlockIDFlag indicates which BlockID the signature is for type BlockIDFlag int32 const ( diff --git a/core/go.mod b/core/go.mod index e5ee7dd85038..3dd081281858 100644 --- a/core/go.mod +++ b/core/go.mod @@ -6,13 +6,13 @@ require ( cosmossdk.io/log v1.3.1 github.com/cosmos/gogoproto v1.4.11 github.com/stretchr/testify v1.9.0 - google.golang.org/grpc v1.62.0 - google.golang.org/protobuf v1.32.0 + google.golang.org/grpc v1.62.1 + google.golang.org/protobuf v1.33.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/golang/protobuf v1.5.3 // indirect + github.com/golang/protobuf v1.5.4 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/mattn/go-colorable v0.1.13 // indirect diff --git a/core/go.sum b/core/go.sum index ac3b1a6b9989..d0992068e935 100644 --- a/core/go.sum +++ b/core/go.sum @@ -7,10 +7,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -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.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= 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.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= @@ -50,15 +48,12 @@ golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c h1:NUsgEN92SQQqzfA+YtqYNqYmB3DMMYLlIwUZAQFVFbo= google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c/go.mod h1:H4O17MA/PE9BsGx3w+a+W2VOLLD1Qf7oJneAoU6WktY= -google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk= -google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= -google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= 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= diff --git a/core/store/database.go b/core/store/database.go index 551727a6342b..45283ee62184 100644 --- a/core/store/database.go +++ b/core/store/database.go @@ -1,6 +1,6 @@ package store -// Database provides access to the underlying database for CRUD operations of non-consensus data. +// DatabaseService provides access to the underlying database for CRUD operations of non-consensus data. // WARNING: using this api will make your module unprovable for fraud and validity proofs type DatabaseService interface { GetDatabase() NonConsensusStore diff --git a/depinject/go.mod b/depinject/go.mod index a4633e707978..d0e49bf080a0 100644 --- a/depinject/go.mod +++ b/depinject/go.mod @@ -8,7 +8,7 @@ require ( github.com/cosmos/cosmos-proto v1.0.0-beta.4 github.com/stretchr/testify v1.9.0 golang.org/x/exp v0.0.0-20230811145659-89c5cff77bcb - google.golang.org/protobuf v1.32.0 + google.golang.org/protobuf v1.33.0 gotest.tools/v3 v3.5.1 sigs.k8s.io/yaml v1.4.0 ) @@ -19,7 +19,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/getsentry/sentry-go v0.23.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/protobuf v1.5.3 // indirect + github.com/golang/protobuf v1.5.4 // 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 @@ -30,6 +30,6 @@ require ( golang.org/x/sys v0.17.0 // indirect golang.org/x/text v0.14.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c // indirect - google.golang.org/grpc v1.62.0 // indirect + google.golang.org/grpc v1.62.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/depinject/go.sum b/depinject/go.sum index 6a8645a1f088..a8103e2c69a0 100644 --- a/depinject/go.sum +++ b/depinject/go.sum @@ -16,10 +16,8 @@ github.com/getsentry/sentry-go v0.23.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -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.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= 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= @@ -77,12 +75,10 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c h1:NUsgEN92SQQqzfA+YtqYNqYmB3DMMYLlIwUZAQFVFbo= google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c/go.mod h1:H4O17MA/PE9BsGx3w+a+W2VOLLD1Qf7oJneAoU6WktY= -google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk= -google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= -google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= 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/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/docs/build/building-apps/01-app-go-v2.md b/docs/build/building-apps/01-app-go-v2.md index 1be1bb90aa29..d77899d26e6d 100644 --- a/docs/build/building-apps/01-app-go-v2.md +++ b/docs/build/building-apps/01-app-go-v2.md @@ -2,7 +2,7 @@ sidebar_position: 1 --- -# Overview of `app_v2.go` +# Overview of `app_di.go` :::note Synopsis @@ -19,7 +19,7 @@ Learn more about the rationale of App Wiring in [ADR-057](../architecture/adr-05 ::: -This section is intended to provide an overview of the `SimApp` `app_v2.go` file with App Wiring. +This section is intended to provide an overview of the `SimApp` `app_di.go` file with App Wiring. ## `app_config.go` @@ -57,7 +57,7 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/simapp/app_config.go :::tip The example above shows how to create an `AppConfig` using Go. However, it is also possible to create an `AppConfig` using YAML, or JSON. -The configuration can then be embed with `go:embed` and read with [`appconfig.LoadYAML`](https://pkg.go.dev/cosmossdk.io/core/appconfig#LoadYAML), or [`appconfig.LoadJSON`](https://pkg.go.dev/cosmossdk.io/core/appconfig#LoadJSON), in `app_v2.go`. +The configuration can then be embed with `go:embed` and read with [`appconfig.LoadYAML`](https://pkg.go.dev/cosmossdk.io/core/appconfig#LoadYAML), or [`appconfig.LoadJSON`](https://pkg.go.dev/cosmossdk.io/core/appconfig#LoadJSON), in `app_di.go`. ```go //go:embed app_config.yaml @@ -95,9 +95,9 @@ modules: A more complete example of `app.yaml` can be found [here](https://github.com/cosmos/cosmos-sdk/blob/91b1d83f1339e235a1dfa929ecc00084101a19e3/simapp/app.yaml). -## `app_v2.go` +## `app_di.go` -`app_v2.go` is the place where `SimApp` is constructed. `depinject.Inject` facilitates that by automatically wiring the app modules and keepers, provided an application configuration `AppConfig` is provided. `SimApp` is constructed, when calling the injected `*runtime.AppBuilder`, with `appBuilder.Build(...)`. +`app_di.go` is the place where `SimApp` is constructed. `depinject.Inject` facilitates that by automatically wiring the app modules and keepers, provided an application configuration `AppConfig` is provided. `SimApp` is constructed, when calling the injected `*runtime.AppBuilder`, with `appBuilder.Build(...)`. In short `depinject` and the [`runtime` package](https://pkg.go.dev/github.com/cosmos/cosmos-sdk/runtime) abstract the wiring of the app, and the `AppBuilder` is the place where the app is constructed. [`runtime`](https://pkg.go.dev/github.com/cosmos/cosmos-sdk/runtime) takes care of registering the codecs, KV store, subspaces and instantiating `baseapp`. ```go reference @@ -143,10 +143,10 @@ When using AutoCLI and combining app wiring and non app wiring modules. The Auto Otherwise it will miss the non depinject modules and not register their CLI. ::: -### Complete `app_v2.go` +### Complete `app_di.go` :::tip -Note that in the complete `SimApp` `app_v2.go` file, testing utilities are also defined, but they could as well be defined in a separate file. +Note that in the complete `SimApp` `app_di.go` file, testing utilities are also defined, but they could as well be defined in a separate file. ::: ```go reference diff --git a/docs/build/building-modules/01-module-manager.md b/docs/build/building-modules/01-module-manager.md index 61a3fe66fea6..bce8cea7f6dc 100644 --- a/docs/build/building-modules/01-module-manager.md +++ b/docs/build/building-modules/01-module-manager.md @@ -30,6 +30,8 @@ There are 2 main application module interfaces: The above interfaces are mostly embedding smaller interfaces (extension interfaces), that defines specific functionalities: + + * (legacy) `module.HasName`: Allows the module to provide its own name for legacy purposes. * (legacy) [`module.HasGenesisBasics`](#modulehasgenesisbasics): The legacy interface for stateless genesis methods. * (legacy) [`module.HasGenesis`](#modulehasgenesis) for inter-dependent genesis-related module functionalities. @@ -270,9 +272,9 @@ The module manager is used throughout the application whenever an action on a co * `SetOrderMigrations(moduleNames ...string)`: Sets the order of migrations to be run. If not set then migrations will be run with an order defined in `DefaultMigrationsOrder`. * `RegisterInvariants(ir sdk.InvariantRegistry)`: Registers the [invariants](./07-invariants.md) of module implementing the `HasInvariants` interface. * `RegisterServices(cfg Configurator)`: Registers the services of modules implementing the `HasServices` interface. -* `InitGenesis(ctx context.Context, cdc codec.JSONCodec, genesisData map[string]json.RawMessage)`: Calls the [`InitGenesis`](./08-genesis.md#initgenesis) function of each module when the application is first started, in the order defined in `OrderInitGenesis`. Returns an `abci.ResponseInitChain` to the underlying consensus engine, which can contain validator updates. -* `ExportGenesis(ctx context.Context, cdc codec.JSONCodec)`: Calls the [`ExportGenesis`](./08-genesis.md#exportgenesis) function of each module, in the order defined in `OrderExportGenesis`. The export constructs a genesis file from a previously existing state, and is mainly used when a hard-fork upgrade of the chain is required. -* `ExportGenesisForModules(ctx context.Context, cdc codec.JSONCodec, modulesToExport []string)`: Behaves the same as `ExportGenesis`, except takes a list of modules to export. +* `InitGenesis(ctx context.Context, genesisData map[string]json.RawMessage)`: Calls the [`InitGenesis`](./08-genesis.md#initgenesis) function of each module when the application is first started, in the order defined in `OrderInitGenesis`. Returns an `abci.ResponseInitChain` to the underlying consensus engine, which can contain validator updates. +* `ExportGenesis(ctx context.Context)`: Calls the [`ExportGenesis`](./08-genesis.md#exportgenesis) function of each module, in the order defined in `OrderExportGenesis`. The export constructs a genesis file from a previously existing state, and is mainly used when a hard-fork upgrade of the chain is required. +* `ExportGenesisForModules(ctx context.Context, modulesToExport []string)`: Behaves the same as `ExportGenesis`, except takes a list of modules to export. * `BeginBlock(ctx context.Context) error`: At the beginning of each block, this function is called from [`BaseApp`](../../learn/advanced/00-baseapp.md#beginblock) and, in turn, calls the [`BeginBlock`](./06-beginblock-endblock.md) function of each modules implementing the `appmodule.HasBeginBlocker` interface, in the order defined in `OrderBeginBlockers`. It creates a child [context](../../learn/advanced/02-context.md) with an event manager to aggregate [events](../../learn/advanced/08-events.md) emitted from each modules. * `EndBlock(ctx context.Context) error`: At the end of each block, this function is called from [`BaseApp`](../../learn/advanced/00-baseapp.md#endblock) and, in turn, calls the [`EndBlock`](./06-beginblock-endblock.md) function of each modules implementing the `appmodule.HasEndBlocker` interface, in the order defined in `OrderEndBlockers`. It creates a child [context](../../learn/advanced/02-context.md) with an event manager to aggregate [events](../../learn/advanced/08-events.md) emitted from all modules. The function returns an `abci` which contains the aforementioned events, as well as validator set updates (if any). * `EndBlock(context.Context) ([]abci.ValidatorUpdate, error)`: At the end of each block, this function is called from [`BaseApp`](../../learn/advanced/00-baseapp.md#endblock) and, in turn, calls the [`EndBlock`](./06-beginblock-endblock.md) function of each modules implementing the `module.HasABCIEndBlock` interface, in the order defined in `OrderEndBlockers`. It creates a child [context](../../learn/advanced/02-context.md) with an event manager to aggregate [events](../../learn/advanced/08-events.md) emitted from all modules. The function returns an `abci` which contains the aforementioned events, as well as validator set updates (if any). diff --git a/docs/build/building-modules/15-depinject.md b/docs/build/building-modules/15-depinject.md index 06636fefbce1..905a21ce7c5e 100644 --- a/docs/build/building-modules/15-depinject.md +++ b/docs/build/building-modules/15-depinject.md @@ -123,12 +123,8 @@ All methods, structs and their fields must be public for `depinject`. https://github.com/cosmos/cosmos-sdk/blob/f4bdec3433373cc4950f4680743e969495763fbb/x/group/module/module.go#L64-L65 ``` - - - - The module is now ready to be used with `depinject` by a chain developer. ## Integrate in an application -The App Wiring is done in `app_config.go` / `app.yaml` and `app_v2.go` and is explained in detail in the [overview of `app_v2.go`](https://docs.cosmos.network/main/build/building-apps/app-go-v2). +The App Wiring is done in `app_config.go` / `app.yaml` and `app_di.go` and is explained in detail in the [overview of `app_di.go`](https://docs.cosmos.network/main/build/building-apps/app-go-v2). diff --git a/errors/doc.go b/errors/doc.go index ed6b9a69bfca..f98e7932aeb4 100644 --- a/errors/doc.go +++ b/errors/doc.go @@ -1,33 +1,31 @@ -/* -Package errors implements custom error interfaces for cosmos-sdk. - -Error declarations should be generic and cover broad range of cases. Each -returned error instance can wrap a generic error declaration to provide more -details. - -This package provides a broad range of errors declared that fits all common -cases. If an error is very specific for an extension it can be registered outside -of the errors package. If it will be needed my many extensions, please consider -registering it in the errors package. To create a new error instance use Register -function. You must provide a unique, non zero error code and a short description, for example: - - var ErrZeroDivision = errors.Register(9241, "zero division") - -When returning an error, you can attach to it an additional context -information by using Wrap function, for example: - - func safeDiv(val, div int) (int, err) { - if div == 0 { - return 0, errors.Wrapf(ErrZeroDivision, "cannot divide %d", val) - } - return val / div, nil - } - -The first time an error instance is wrapped a stacktrace is attached as well. -Stacktrace information can be printed using %+v and %v formats. - - %s is just the error message - %+v is the full stack trace - %v appends a compressed [filename:line] where the error was created -*/ +// Package errors implements custom error interfaces for cosmos-sdk. +// +// Error declarations should be generic and cover broad range of cases. Each +// returned error instance can wrap a generic error declaration to provide more +// details. +// +// This package provides a broad range of errors declared that fits all common +// cases. If an error is very specific for an extension it can be registered outside +// of the errors package. If it will be needed my many extensions, please consider +// registering it in the errors package. To create a new error instance use Register +// function. You must provide a unique, non zero error code and a short description, for example: +// +// var ErrZeroDivision = errors.Register(9241, "zero division") +// +// When returning an error, you can attach to it an additional context +// information by using Wrap function, for example: +// +// func safeDiv(val, div int) (int, err) { +// if div == 0 { +// return 0, errors.Wrapf(ErrZeroDivision, "cannot divide %d", val) +// } +// return val / div, nil +// } +// +// The first time an error instance is wrapped a stacktrace is attached as well. +// Stacktrace information can be printed using %+v and %v formats. +// +// %s is just the error message +// %+v is the full stack trace +// %v appends a compressed [filename:line] where the error was created package errors diff --git a/errors/go.mod b/errors/go.mod index 8fe23f757f23..3b5938a80445 100644 --- a/errors/go.mod +++ b/errors/go.mod @@ -5,19 +5,19 @@ go 1.20 require ( github.com/pkg/errors v0.9.1 github.com/stretchr/testify v1.9.0 - google.golang.org/grpc v1.62.0 + google.golang.org/grpc v1.62.1 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/golang/protobuf v1.5.3 // indirect + github.com/golang/protobuf v1.5.4 // indirect github.com/kr/pretty v0.3.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.8.1 // indirect golang.org/x/net v0.21.0 // indirect golang.org/x/sys v0.17.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c // indirect - google.golang.org/protobuf v1.32.0 // indirect + google.golang.org/protobuf v1.33.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/errors/go.sum b/errors/go.sum index 02d81a8330cd..24e6b1e83195 100644 --- a/errors/go.sum +++ b/errors/go.sum @@ -1,10 +1,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -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.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= @@ -29,15 +27,12 @@ golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c h1:NUsgEN92SQQqzfA+YtqYNqYmB3DMMYLlIwUZAQFVFbo= google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c/go.mod h1:H4O17MA/PE9BsGx3w+a+W2VOLLD1Qf7oJneAoU6WktY= -google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk= -google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= -google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= diff --git a/go.mod b/go.mod index f6a60c02dd80..55e1683242a2 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 cosmossdk.io/x/bank v0.0.0-00010101000000-000000000000 cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 - cosmossdk.io/x/tx v0.13.0 + cosmossdk.io/x/tx v0.13.1 github.com/99designs/keyring v1.2.2 github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 github.com/cockroachdb/errors v1.11.1 @@ -28,7 +28,7 @@ require ( github.com/cosmos/ledger-cosmos-go v0.13.3 github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 github.com/golang/mock v1.6.0 - github.com/golang/protobuf v1.5.3 + github.com/golang/protobuf v1.5.4 github.com/google/go-cmp v0.6.0 github.com/google/gofuzz v1.2.0 github.com/gorilla/handlers v1.5.2 @@ -45,7 +45,7 @@ require ( github.com/mdp/qrterminal/v3 v3.2.0 github.com/muesli/termenv v0.15.2 github.com/prometheus/client_golang v1.19.0 - github.com/prometheus/common v0.49.0 + github.com/prometheus/common v0.50.0 github.com/rs/zerolog v1.32.0 github.com/spf13/cast v1.6.0 github.com/spf13/cobra v1.8.0 @@ -58,8 +58,8 @@ require ( golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 golang.org/x/sync v0.6.0 google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014 - google.golang.org/grpc v1.62.0 - google.golang.org/protobuf v1.32.0 + google.golang.org/grpc v1.62.1 + google.golang.org/protobuf v1.33.0 gotest.tools/v3 v3.5.1 pgregory.net/rapid v1.1.0 sigs.k8s.io/yaml v1.4.0 @@ -160,7 +160,7 @@ require ( go.etcd.io/bbolt v1.3.7 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/mod v0.15.0 // indirect - golang.org/x/net v0.21.0 // indirect + golang.org/x/net v0.22.0 // indirect golang.org/x/sys v0.18.0 // indirect golang.org/x/term v0.18.0 // indirect golang.org/x/text v0.14.0 // indirect @@ -187,9 +187,10 @@ replace ( cosmossdk.io/x/auth => ./x/auth cosmossdk.io/x/bank => ./x/bank cosmossdk.io/x/staking => ./x/staking - cosmossdk.io/x/tx => ./x/tx ) +replace github.com/cosmos/iavl => github.com/cosmos/iavl v1.0.1 // TODO remove + // Below are the long-lived replace of the Cosmos SDK replace ( // use cosmos fork of keyring diff --git a/go.sum b/go.sum index dcdbce372a92..fb685aaddda5 100644 --- a/go.sum +++ b/go.sum @@ -14,6 +14,8 @@ cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/store v1.0.2 h1:lSg5BTvJBHUDwswNNyeh4K/CbqiHER73VU4nDNb8uk0= cosmossdk.io/store v1.0.2/go.mod h1:EFtENTqVTuWwitGW1VwaBct+yDagk7oG/axBMPH+FXs= +cosmossdk.io/x/tx v0.13.1 h1:Mg+EMp67Pz+NukbJqYxuo8uRp7N/a9uR+oVS9pONtj8= +cosmossdk.io/x/tx v0.13.1/go.mod h1:CBCU6fsRVz23QGFIQBb1DNX2DztJCf3jWyEkHY2nJQ0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= @@ -144,8 +146,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.4.11 h1:LZcMHrx4FjUgrqQSWeaGC1v/TeuVFqSLa43CC6aWR2g= github.com/cosmos/gogoproto v1.4.11/go.mod h1:/g39Mh8m17X8Q/GDEs5zYTSNaNnInBSohtaxzQnYq1Y= -github.com/cosmos/iavl v1.0.0 h1:bw6t0Mv/mVCJvlMTOPHWLs5uUE3BRBfVWCRelOzl+so= -github.com/cosmos/iavl v1.0.0/go.mod h1:CmTGqMnRnucjxbjduneZXT+0vPgNElYvdefjX2q9tYc= +github.com/cosmos/iavl v1.0.1 h1:D+mYbcRO2wptYzOM1Hxl9cpmmHU1ZEt9T2Wv5nZTeUw= +github.com/cosmos/iavl v1.0.1/go.mod h1:8xIUkgVvwvVrBu81scdPty+/Dx9GqwHnAvXz4cwF7RY= 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/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo= @@ -297,8 +299,8 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -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/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.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -599,8 +601,8 @@ github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt2 github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.49.0 h1:ToNTdK4zSnPVJmh698mGFkDor9wBI/iGaJy5dbH1EgI= -github.com/prometheus/common v0.49.0/go.mod h1:Kxm+EULxRbUkjGU6WFsQqo3ORzB4tyKvlWFOE9mB2sE= +github.com/prometheus/common v0.50.0 h1:YSZE6aa9+luNa2da6/Tik0q0A5AbR+U003TItK57CPQ= +github.com/prometheus/common v0.50.0/go.mod h1:wHFBCEVWVmHMUpg7pYcOm2QUR/ocQdYSJVQJKnHc3xQ= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= @@ -820,8 +822,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= +golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -983,8 +985,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk= -google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -1000,8 +1002,9 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= 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-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/orm/go.mod b/orm/go.mod index 818230ebcb1d..69c05a4f41b8 100644 --- a/orm/go.mod +++ b/orm/go.mod @@ -15,8 +15,8 @@ require ( github.com/regen-network/gocuke v1.1.0 github.com/stretchr/testify v1.9.0 golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 - google.golang.org/grpc v1.62.0 - google.golang.org/protobuf v1.32.0 + google.golang.org/grpc v1.62.1 + google.golang.org/protobuf v1.33.0 gotest.tools/v3 v3.5.1 pgregory.net/rapid v1.1.0 ) @@ -42,7 +42,7 @@ require ( 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 - github.com/golang/protobuf v1.5.3 // indirect + github.com/golang/protobuf v1.5.4 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/btree v1.1.2 // indirect github.com/klauspost/compress v1.17.7 // indirect @@ -54,13 +54,13 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_golang v1.19.0 // indirect github.com/prometheus/client_model v0.6.0 // indirect - github.com/prometheus/common v0.49.0 // indirect + github.com/prometheus/common v0.50.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/spf13/cast v1.6.0 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect - golang.org/x/net v0.21.0 // indirect - golang.org/x/sys v0.17.0 // indirect + golang.org/x/net v0.22.0 // indirect + golang.org/x/sys v0.18.0 // indirect golang.org/x/text v0.14.0 // indirect google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014 // indirect diff --git a/orm/go.sum b/orm/go.sum index 15ec8faf3350..de6d487869be 100644 --- a/orm/go.sum +++ b/orm/go.sum @@ -75,8 +75,8 @@ github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvq github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -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/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= @@ -131,8 +131,8 @@ github.com/prometheus/client_golang v1.19.0 h1:ygXvpU1AoN1MhdzckN+PyD9QJOSD4x7km github.com/prometheus/client_golang v1.19.0/go.mod h1:ZRM9uEAypZakd+q/x7+gmsvXdURP+DABIEIjnmDdp+k= github.com/prometheus/client_model v0.6.0 h1:k1v3CzpSRUTrKMppY35TLwPvxHqBu0bYgxZzqGIgaos= github.com/prometheus/client_model v0.6.0/go.mod h1:NTQHnmxFpouOD0DpvP4XujX3CdOAGQPoaGhyTchlyt8= -github.com/prometheus/common v0.49.0 h1:ToNTdK4zSnPVJmh698mGFkDor9wBI/iGaJy5dbH1EgI= -github.com/prometheus/common v0.49.0/go.mod h1:Kxm+EULxRbUkjGU6WFsQqo3ORzB4tyKvlWFOE9mB2sE= +github.com/prometheus/common v0.50.0 h1:YSZE6aa9+luNa2da6/Tik0q0A5AbR+U003TItK57CPQ= +github.com/prometheus/common v0.50.0/go.mod h1:wHFBCEVWVmHMUpg7pYcOm2QUR/ocQdYSJVQJKnHc3xQ= github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= github.com/regen-network/gocuke v1.1.0 h1:gxlkRTfpR9gJ0mwqQZIpoXHZGx+KPshKQpKE0jtUH5s= @@ -173,8 +173,8 @@ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96b 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.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= +golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -201,8 +201,8 @@ golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBc 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.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.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= @@ -228,8 +228,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014 h1: google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014/go.mod h1:rbHMSEDyoYX62nRVLOCc4Qt1HbsdytAYoVwgjiOhF3I= google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c h1:NUsgEN92SQQqzfA+YtqYNqYmB3DMMYLlIwUZAQFVFbo= google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c/go.mod h1:H4O17MA/PE9BsGx3w+a+W2VOLLD1Qf7oJneAoU6WktY= -google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk= -google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -238,8 +238,8 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= -google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= 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= diff --git a/orm/model/ormdb/module.go b/orm/model/ormdb/module.go index 95ba640c7585..605e641729ad 100644 --- a/orm/model/ormdb/module.go +++ b/orm/model/ormdb/module.go @@ -39,7 +39,7 @@ type ModuleDB interface { // func NewAppModule(keeper keeper.Keeper) AppModule { // return AppModule{HasGenesis: keeper.GenesisHandler()} // } - GenesisHandler() appmodule.HasGenesis + GenesisHandler() appmodule.HasGenesis // TODO should be appmodule.HasGenesisAuto with core v1 private() } @@ -212,7 +212,7 @@ func (m moduleDB) GetTable(message proto.Message) ormtable.Table { return m.tablesByName[message.ProtoReflect().Descriptor().FullName()] } -func (m moduleDB) GenesisHandler() appmodule.HasGenesis { +func (m moduleDB) GenesisHandler() appmodule.HasGenesis { // TODO should be appmodule.HasGenesisAuto with core v1 return appModuleGenesisWrapper{m} } diff --git a/runtime/app.go b/runtime/app.go index 897644633327..6fdfe08ca1f0 100644 --- a/runtime/app.go +++ b/runtime/app.go @@ -242,7 +242,7 @@ func (a *App) LoadHeight(height int64) error { // DefaultGenesis returns a default genesis from the registered AppModule's. func (a *App) DefaultGenesis() map[string]json.RawMessage { - return a.ModuleManager.DefaultGenesis(a.cdc) + return a.ModuleManager.DefaultGenesis() } // GetStoreKeys returns all the stored store keys. diff --git a/runtime/events.go b/runtime/events.go index 150de335d5df..956e445b42a1 100644 --- a/runtime/events.go +++ b/runtime/events.go @@ -50,7 +50,7 @@ func (e Events) EmitKV(eventType string, attrs ...event.Attribute) error { return nil } -// Emit emits an typed event that is defined in the protobuf file. +// EmitNonConsensus emits an typed event that is defined in the protobuf file. // In the future these events will be added to consensus. func (e Events) EmitNonConsensus(event protoiface.MessageV1) error { return e.EventManagerI.EmitTypedEvent(event) diff --git a/runtime/types.go b/runtime/types.go index 4ae2774d5bee..04027d0dbc69 100644 --- a/runtime/types.go +++ b/runtime/types.go @@ -10,25 +10,25 @@ import ( const ModuleName = "runtime" -// App implements the common methods for a Cosmos SDK-based application +// AppI implements the common methods for a Cosmos SDK-based application // specific blockchain. type AppI interface { - // The assigned name of the app. + // Name the assigned name of the app. Name() string - // Application updates every begin block. + // BeginBlocker updates every begin block. BeginBlocker(ctx sdk.Context) (sdk.BeginBlock, error) - // Application updates every end block. + // EndBlocker updates every end block. EndBlocker(ctx sdk.Context) (sdk.EndBlock, error) - // Application update at chain (i.e app) initialization. + // InitChainer update at chain (i.e app) initialization. InitChainer(ctx sdk.Context, req *abci.RequestInitChain) (*abci.ResponseInitChain, error) - // Loads the app at a given height. + // LoadHeight load the app at a given height. LoadHeight(height int64) error - // Exports the state of the application for a genesis file. + // ExportAppStateAndValidators exports the state of the application for a genesis file. ExportAppStateAndValidators(forZeroHeight bool, jailAllowedAddrs, modulesToExport []string) (types.ExportedApp, error) } @@ -36,6 +36,6 @@ type AppI interface { // specific blockchain that chooses to utilize the sdk simulation framework. type AppSimI interface { AppI - // Helper for the simulation framework. + // SimulationManager helper for the simulation framework. SimulationManager() *module.SimulationManager } diff --git a/scripts/dep-assert.sh b/scripts/dep-assert.sh index 0fa8a8650153..2f4dfd0dbf64 100755 --- a/scripts/dep-assert.sh +++ b/scripts/dep-assert.sh @@ -2,14 +2,14 @@ set -o errexit -SIMAPP_REGEX="cosmossdk.io/simapp" CWD=$(pwd) - +# no simapp imports in modules +SIMAPP_REGEX="cosmossdk.io/simapp" find . -type f -name 'go.mod' -print0 | while IFS= read -r -d '' file do d=$(dirname "$file") - if [[ "$d" =~ \./simapp$|\./tests* ]]; then + if [[ "$d" =~ \./simapp$|\./simapp/v2$|\./tests* ]]; then continue fi @@ -18,3 +18,20 @@ do exit 1 fi done + +# no runtime/v2 or server/v2 imports in x/ modules +RUNTIMEV2_REGEX="cosmossdk.io/runtime/v2" +SEVERV2_REGEX="cosmossdk.io/server/v2" +find ./x/ -type f -name 'go.mod' -print0 | while IFS= read -r -d '' file +do + d=$(dirname "$file") + if cd "$CWD/$d" && go list -test -f '{{ .Imports }}' ./... | grep -q -E "${RUNTIMEV2_REGEX}"; then + echo "${d} has a dependency on runtime/v2!" + exit 1 + fi + + if cd "$CWD/$d" && go list -test -f '{{ .Imports }}' ./... | grep -q -E "${SEVERV2_REGEX}"; then + echo "${d} has a dependency on server/v2!" + exit 1 + fi +done \ No newline at end of file diff --git a/server/doc.go b/server/doc.go index 241c2182595b..22ba8c16753b 100644 --- a/server/doc.go +++ b/server/doc.go @@ -1,30 +1,28 @@ -/* -The commands from the SDK are defined with `cobra` and configured with the -`viper` package. - -This takes place in the `InterceptConfigsPreRunHandler` function. -Since the `viper` package is used for configuration the precedence is dictated -by that package. That is - -1. Command line switches -2. Environment variables -3. Files from configuration values -4. Default values - -The global configuration instance exposed by the `viper` package is not -used by Cosmos SDK in this function. A new instance of `viper.Viper` is created -and the following is performed. The environmental variable prefix is set -to the current program name. Environmental variables consider the underscore -to be equivalent to the `.` or `-` character. This means that an configuration -value called `rpc.laddr` would be read from an environmental variable called -`MYTOOL_RPC_LADDR` if the current program name is `mytool`. - -Running the `InterceptConfigsPreRunHandler` also reads `app.toml` -and `config.toml` from the home directory under the `config` directory. -If `config.toml` or `app.toml` do not exist then those files are created -and populated with default values. `InterceptConfigsPreRunHandler` takes -two parameters to set/update a custom template to create custom `app.toml`. -If these parameters are empty, the server then creates a default template -provided by the SDK. -*/ +// Package server The commands from the SDK are defined with `cobra` and configured with the +// `viper` package. +// +// This takes place in the `InterceptConfigsPreRunHandler` function. +// Since the `viper` package is used for configuration the precedence is dictated +// by that package. That is +// +// 1. Command line switches +// 2. Environment variables +// 3. Files from configuration values +// 4. Default values +// +// The global configuration instance exposed by the `viper` package is not +// used by Cosmos SDK in this function. A new instance of `viper.Viper` is created +// and the following is performed. The environmental variable prefix is set +// to the current program name. Environmental variables consider the underscore +// to be equivalent to the `.` or `-` character. This means that an configuration +// value called `rpc.laddr` would be read from an environmental variable called +// `MYTOOL_RPC_LADDR` if the current program name is `mytool`. +// +// Running the `InterceptConfigsPreRunHandler` also reads `app.toml` +// and `config.toml` from the home directory under the `config` directory. +// If `config.toml` or `app.toml` do not exist then those files are created +// and populated with default values. `InterceptConfigsPreRunHandler` takes +// two parameters to set/update a custom template to create custom `app.toml`. +// If these parameters are empty, the server then creates a default template +// provided by the SDK. package server diff --git a/server/grpc/gogoreflection/serverreflection.go b/server/grpc/gogoreflection/serverreflection.go index 9d04abb92fb5..c5db746ef87e 100644 --- a/server/grpc/gogoreflection/serverreflection.go +++ b/server/grpc/gogoreflection/serverreflection.go @@ -1,40 +1,35 @@ -/* - * - * Copyright 2016 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -/* -Package reflection implements server reflection service. - -The service implemented is defined in: -https://github.com/grpc/grpc/blob/master/src/proto/grpc/reflection/v1alpha/reflection.proto. - -To register server reflection on a gRPC server: - - import "google.golang.org/grpc/reflection" - - s := grpc.NewServer() - pb.RegisterYourOwnServer(s, &server{}) - - // Register reflection service on gRPC server. - reflection.Register(s) - - s.Serve(lis) -*/ -package gogoreflection // import "google.golang.org/grpc/reflection" +// Copyright 2016 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package gogoreflection implements server reflection service. +// +// The service implemented is defined in: +// https://github.com/grpc/grpc/blob/master/src/proto/grpc/reflection/v1alpha/reflection.proto. +// +// To register server reflection on a gRPC server: +// +// import "google.golang.org/grpc/reflection" +// +// s := grpc.NewServer() +// pb.RegisterYourOwnServer(s, &server{}) +// +// // Register reflection service on gRPC server. +// reflection.Register(s) +// +// s.Serve(lis) + +package gogoreflection import ( "bytes" diff --git a/server/mock/app.go b/server/mock/app.go index f090f8c6df88..5348215355a9 100644 --- a/server/mock/app.go +++ b/server/mock/app.go @@ -89,13 +89,13 @@ func KVStoreHandler(storeKey storetypes.StoreKey) bam.MsgServiceHandler { } } -// basic KV structure +// KV is a basic kv structure type KV struct { Key string `json:"key"` Value string `json:"value"` } -// What Genesis JSON is formatted as +// GenesisJSON what genesis JSON is formatted as type GenesisJSON struct { Values []KV `json:"values"` } @@ -144,7 +144,7 @@ func AppGenStateEmpty(_ *codec.LegacyAmino, _ genutiltypes.AppGenesis, _ []json. return } -// Manually write the handlers for this custom message +// MsgServer manually write the handlers for this custom message type MsgServer interface { Test(ctx context.Context, msg *KVStoreTx) (*sdk.Result, error) } diff --git a/server/mock/tx.go b/server/mock/tx.go index 151a4d574613..ab2fc6bfdb18 100644 --- a/server/mock/tx.go +++ b/server/mock/tx.go @@ -16,7 +16,7 @@ import ( txsigning "github.com/cosmos/cosmos-sdk/types/tx/signing" ) -// An sdk.Tx which is its own sdk.Msg. +// KVStoreTx is an sdk.Tx which is its own sdk.Msg. type KVStoreTx struct { key []byte value []byte @@ -72,6 +72,7 @@ func (msg *KVStoreTx) Equals(key cryptotypes.PubKey) bool { } // dummy implementation of proto.Message + func (msg *KVStoreTx) Reset() {} func (msg *KVStoreTx) String() string { return "TODO" } func (msg *KVStoreTx) ProtoMessage() {} @@ -110,7 +111,7 @@ func (msg *KVStoreTx) GetSignBytes() []byte { return msg.bytes } -// Should the app be calling this? Or only handlers? +// ValidateBasic should the app be calling this? or only handlers? func (msg *KVStoreTx) ValidateBasic() error { return nil } diff --git a/server/start.go b/server/start.go index ae64602a19c0..85d0fca57a8c 100644 --- a/server/start.go +++ b/server/start.go @@ -76,10 +76,12 @@ const ( FlagShutdownGrace = "shutdown-grace" // state sync-related flags + FlagStateSyncSnapshotInterval = "state-sync.snapshot-interval" FlagStateSyncSnapshotKeepRecent = "state-sync.snapshot-keep-recent" // api-related flags + FlagAPIEnable = "api.enable" FlagAPISwagger = "api.swagger" FlagAPIAddress = "api.address" @@ -90,15 +92,18 @@ const ( FlagAPIEnableUnsafeCORS = "api.enabled-unsafe-cors" // gRPC-related flags + flagGRPCOnly = "grpc-only" flagGRPCEnable = "grpc.enable" flagGRPCAddress = "grpc.address" flagGRPCWebEnable = "grpc-web.enable" // mempool flags + FlagMempoolMaxTxs = "mempool.max-txs" // testnet keys + KeyIsTestnet = "is-testnet" KeyNewChainID = "new-chain-ID" KeyNewOpAddr = "new-operator-addr" diff --git a/server/types/abci.go b/server/types/abci.go index 9c298691dc6b..6eb922b9798e 100644 --- a/server/types/abci.go +++ b/server/types/abci.go @@ -10,28 +10,40 @@ import ( // to be driven by a blockchain-based replication engine via the ABCI. type ABCI interface { // Info/Query Connection - Info(*abci.RequestInfo) (*abci.ResponseInfo, error) // Return application info - Query(context.Context, *abci.RequestQuery) (*abci.ResponseQuery, error) // Query for state + + // Info returns application info + Info(*abci.RequestInfo) (*abci.ResponseInfo, error) + // Query returns application state + Query(context.Context, *abci.RequestQuery) (*abci.ResponseQuery, error) // Mempool Connection - CheckTx(*abci.RequestCheckTx) (*abci.ResponseCheckTx, error) // Validate a tx for the mempool + + // CheckTx validate a tx for the mempool + CheckTx(*abci.RequestCheckTx) (*abci.ResponseCheckTx, error) // Consensus Connection - InitChain(*abci.RequestInitChain) (*abci.ResponseInitChain, error) // Initialize blockchain w validators/other info from CometBFT + + // InitChain Initialize blockchain w validators/other info from CometBFT + InitChain(*abci.RequestInitChain) (*abci.ResponseInitChain, error) PrepareProposal(*abci.RequestPrepareProposal) (*abci.ResponsePrepareProposal, error) ProcessProposal(*abci.RequestProcessProposal) (*abci.ResponseProcessProposal, error) - // Deliver the decided block with its txs to the Application + // FinalizeBlock deliver the decided block with its txs to the Application FinalizeBlock(*abci.RequestFinalizeBlock) (*abci.ResponseFinalizeBlock, error) - // Create application specific vote extension + // ExtendVote create application specific vote extension ExtendVote(context.Context, *abci.RequestExtendVote) (*abci.ResponseExtendVote, error) - // Verify application's vote extension data + // VerifyVoteExtension verify application's vote extension data VerifyVoteExtension(*abci.RequestVerifyVoteExtension) (*abci.ResponseVerifyVoteExtension, error) // Commit the state and return the application Merkle root hash Commit() (*abci.ResponseCommit, error) // State Sync Connection - ListSnapshots(*abci.RequestListSnapshots) (*abci.ResponseListSnapshots, error) // List available snapshots - OfferSnapshot(*abci.RequestOfferSnapshot) (*abci.ResponseOfferSnapshot, error) // Offer a snapshot to the application - LoadSnapshotChunk(*abci.RequestLoadSnapshotChunk) (*abci.ResponseLoadSnapshotChunk, error) // Load a snapshot chunk - ApplySnapshotChunk(*abci.RequestApplySnapshotChunk) (*abci.ResponseApplySnapshotChunk, error) // Apply a snapshot chunk + + // ListSnapshots list available snapshots + ListSnapshots(*abci.RequestListSnapshots) (*abci.ResponseListSnapshots, error) + // OfferSnapshot offer a snapshot to the application + OfferSnapshot(*abci.RequestOfferSnapshot) (*abci.ResponseOfferSnapshot, error) + // LoadSnapshotChunk load a snapshot chunk + LoadSnapshotChunk(*abci.RequestLoadSnapshotChunk) (*abci.ResponseLoadSnapshotChunk, error) + // ApplySnapshotChunk apply a snapshot chunk + ApplySnapshotChunk(*abci.RequestApplySnapshotChunk) (*abci.ResponseApplySnapshotChunk, error) } diff --git a/server/types/app.go b/server/types/app.go index c0b4a30309fc..8d73f69e13f1 100644 --- a/server/types/app.go +++ b/server/types/app.go @@ -56,7 +56,7 @@ type ( // CommitMultiStore return the multistore instance CommitMultiStore() storetypes.CommitMultiStore - // Return the snapshot manager + // SnapshotManager return the snapshot manager SnapshotManager() *snapshots.Manager // Close is called in start cmd to gracefully cleanup resources. diff --git a/server/util.go b/server/util.go index 54d075c40617..de48b0bad343 100644 --- a/server/util.go +++ b/server/util.go @@ -44,7 +44,7 @@ import ( // a command's Context. const ServerContextKey = sdk.ContextKey("server.context") -// server context +// Context server context type Context struct { Viper *viper.Viper Config *cmtcfg.Config @@ -323,7 +323,7 @@ func interceptConfigs(rootViper *viper.Viper, customAppTemplate string, customCo return conf, nil } -// add server commands +// AddCommands add server commands func AddCommands[T types.Application](rootCmd *cobra.Command, appCreator types.AppCreator[T], addStartFlags types.ModuleInitFlags) { cometCmd := &cobra.Command{ Use: "comet", @@ -361,7 +361,7 @@ func AddTestnetCreatorCommand[T types.Application](rootCmd *cobra.Command, appCr rootCmd.AddCommand(testnetCreateCmd) } -// https://stackoverflow.com/questions/23558425/how-do-i-get-the-local-ip-address-in-go +// ExternalIP https://stackoverflow.com/questions/23558425/how-do-i-get-the-local-ip-address-in-go // TODO there must be a better way to get external IP func ExternalIP() (string, error) { ifaces, err := net.Interfaces() diff --git a/simapp/app.go b/simapp/app.go index 2b4affd09842..3304c335b4ec 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -408,8 +408,8 @@ func NewSimApp( // NOTE: Any module instantiated in the module manager that is later modified // must be passed by reference here. app.ModuleManager = module.NewManager( - genutil.NewAppModule(app.AuthKeeper, app.StakingKeeper, app, txConfig, genutiltypes.DefaultMessageValidator), - accounts.NewAppModule(app.AccountsKeeper), + genutil.NewAppModule(appCodec, app.AuthKeeper, app.StakingKeeper, app, txConfig, genutiltypes.DefaultMessageValidator), + accounts.NewAppModule(appCodec, app.AccountsKeeper), auth.NewAppModule(appCodec, app.AuthKeeper, authsims.RandomGenesisAccounts), vesting.NewAppModule(app.AuthKeeper, app.BankKeeper), bank.NewAppModule(appCodec, app.BankKeeper, app.AuthKeeper), @@ -420,7 +420,7 @@ func NewSimApp( distr.NewAppModule(appCodec, app.DistrKeeper, app.AuthKeeper, app.BankKeeper, app.StakingKeeper, app.PoolKeeper), staking.NewAppModule(appCodec, app.StakingKeeper, app.AuthKeeper, app.BankKeeper), upgrade.NewAppModule(app.UpgradeKeeper), - evidence.NewAppModule(app.EvidenceKeeper), + evidence.NewAppModule(appCodec, app.EvidenceKeeper), authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AuthKeeper, app.BankKeeper, app.interfaceRegistry), groupmodule.NewAppModule(appCodec, app.GroupKeeper, app.AuthKeeper, app.BankKeeper, app.interfaceRegistry), nftmodule.NewAppModule(appCodec, app.NFTKeeper, app.AuthKeeper, app.BankKeeper, app.interfaceRegistry), @@ -698,7 +698,7 @@ func (app *SimApp) AutoCliOpts() autocli.AppOptions { // DefaultGenesis returns a default genesis from the registered AppModule's. func (a *SimApp) DefaultGenesis() map[string]json.RawMessage { - return a.ModuleManager.DefaultGenesis(a.appCodec) + return a.ModuleManager.DefaultGenesis() } // GetKey returns the KVStoreKey for the provided store key. diff --git a/simapp/app_v2.go b/simapp/app_di.go similarity index 100% rename from simapp/app_v2.go rename to simapp/app_di.go diff --git a/simapp/app_test.go b/simapp/app_test.go index da8d555de983..8c1c5a8d8ef3 100644 --- a/simapp/app_test.go +++ b/simapp/app_test.go @@ -237,8 +237,8 @@ func TestInitGenesisOnMigration(t *testing.T) { t.Cleanup(mockCtrl.Finish) mockModule := mock.NewMockAppModuleWithAllExtensions(mockCtrl) mockDefaultGenesis := json.RawMessage(`{"key": "value"}`) - mockModule.EXPECT().DefaultGenesis(gomock.Eq(app.appCodec)).Times(1).Return(mockDefaultGenesis) - mockModule.EXPECT().InitGenesis(gomock.Eq(ctx), gomock.Eq(app.appCodec), gomock.Eq(mockDefaultGenesis)).Times(1) + mockModule.EXPECT().DefaultGenesis().Times(1).Return(mockDefaultGenesis) + mockModule.EXPECT().InitGenesis(gomock.Eq(ctx), gomock.Eq(mockDefaultGenesis)).Times(1) mockModule.EXPECT().ConsensusVersion().Times(1).Return(uint64(0)) app.ModuleManager.Modules["mock"] = mockModule diff --git a/simapp/export.go b/simapp/export.go index 33071033df16..4fda92cc9358 100644 --- a/simapp/export.go +++ b/simapp/export.go @@ -31,7 +31,7 @@ func (app *SimApp) ExportAppStateAndValidators(forZeroHeight bool, jailAllowedAd app.prepForZeroHeightGenesis(ctx, jailAllowedAddrs) } - genState, err := app.ModuleManager.ExportGenesisForModules(ctx, app.appCodec, modulesToExport) + genState, err := app.ModuleManager.ExportGenesisForModules(ctx, modulesToExport) if err != nil { return servertypes.ExportedApp{}, err } diff --git a/simapp/go.mod b/simapp/go.mod index 386e1bc23717..78624ae8973f 100644 --- a/simapp/go.mod +++ b/simapp/go.mod @@ -17,7 +17,7 @@ require ( cosmossdk.io/x/feegrant v0.0.0-20230613133644-0a778132a60f cosmossdk.io/x/nft v0.0.0-20230613133644-0a778132a60f cosmossdk.io/x/protocolpool v0.0.0-20230925135524-a1bc045b3190 - cosmossdk.io/x/tx v0.13.0 + cosmossdk.io/x/tx v0.13.1 cosmossdk.io/x/upgrade v0.0.0-20230613133644-0a778132a60f github.com/cometbft/cometbft v0.38.5 github.com/cosmos/cosmos-db v1.0.2 @@ -30,7 +30,7 @@ require ( github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.18.2 github.com/stretchr/testify v1.9.0 - google.golang.org/protobuf v1.32.0 + google.golang.org/protobuf v1.33.0 ) require cosmossdk.io/x/accounts v0.0.0-20240104091155-b729e981f130 @@ -113,7 +113,7 @@ require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/glog v1.2.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/golang/protobuf v1.5.3 // indirect + github.com/golang/protobuf v1.5.4 // 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 @@ -173,7 +173,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.19.0 // indirect github.com/prometheus/client_model v0.6.0 // indirect - github.com/prometheus/common v0.49.0 // indirect + github.com/prometheus/common v0.50.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rivo/uniseg v0.2.0 // indirect @@ -205,8 +205,8 @@ require ( golang.org/x/crypto v0.21.0 // indirect golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect golang.org/x/mod v0.15.0 // indirect - golang.org/x/net v0.21.0 // indirect - golang.org/x/oauth2 v0.17.0 // indirect + golang.org/x/net v0.22.0 // indirect + golang.org/x/oauth2 v0.18.0 // indirect golang.org/x/sync v0.6.0 // indirect golang.org/x/sys v0.18.0 // indirect golang.org/x/term v0.18.0 // indirect @@ -218,7 +218,7 @@ require ( google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c // indirect - google.golang.org/grpc v1.62.0 // indirect + google.golang.org/grpc v1.62.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gotest.tools/v3 v3.5.1 // indirect @@ -257,7 +257,6 @@ replace ( cosmossdk.io/x/protocolpool => ../x/protocolpool cosmossdk.io/x/slashing => ../x/slashing cosmossdk.io/x/staking => ../x/staking - cosmossdk.io/x/tx => ../x/tx cosmossdk.io/x/upgrade => ../x/upgrade ) diff --git a/simapp/go.sum b/simapp/go.sum index c26abbac81e8..8bfe6c03adeb 100644 --- a/simapp/go.sum +++ b/simapp/go.sum @@ -198,6 +198,8 @@ cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/store v1.0.2 h1:lSg5BTvJBHUDwswNNyeh4K/CbqiHER73VU4nDNb8uk0= cosmossdk.io/store v1.0.2/go.mod h1:EFtENTqVTuWwitGW1VwaBct+yDagk7oG/axBMPH+FXs= +cosmossdk.io/x/tx v0.13.1 h1:Mg+EMp67Pz+NukbJqYxuo8uRp7N/a9uR+oVS9pONtj8= +cosmossdk.io/x/tx v0.13.1/go.mod h1:CBCU6fsRVz23QGFIQBb1DNX2DztJCf3jWyEkHY2nJQ0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= @@ -535,8 +537,8 @@ github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -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/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.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -908,8 +910,8 @@ github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt2 github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.49.0 h1:ToNTdK4zSnPVJmh698mGFkDor9wBI/iGaJy5dbH1EgI= -github.com/prometheus/common v0.49.0/go.mod h1:Kxm+EULxRbUkjGU6WFsQqo3ORzB4tyKvlWFOE9mB2sE= +github.com/prometheus/common v0.50.0 h1:YSZE6aa9+luNa2da6/Tik0q0A5AbR+U003TItK57CPQ= +github.com/prometheus/common v0.50.0/go.mod h1:wHFBCEVWVmHMUpg7pYcOm2QUR/ocQdYSJVQJKnHc3xQ= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= @@ -1205,8 +1207,8 @@ golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= +golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1232,8 +1234,8 @@ golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A= -golang.org/x/oauth2 v0.17.0 h1:6m3ZPmLEFdVxKKWnKq4VqZ60gutO35zm+zrAHVmHyDQ= -golang.org/x/oauth2 v0.17.0/go.mod h1:OzPDGQiuQMguemayvdylqddI7qcD9lnSDb+1FiwQ5HA= +golang.org/x/oauth2 v0.18.0 h1:09qnuIAgzdx1XplqJvW6CQqMCtGZykZWcXzPMPUusvI= +golang.org/x/oauth2 v0.18.0/go.mod h1:Wf7knwG0MPoWIMMBgFlEaSUDaKskp0dCfrlJRJXbBi8= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 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= @@ -1671,8 +1673,8 @@ google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk= -google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -1690,8 +1692,9 @@ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= 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-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/simapp/gomod2nix.toml b/simapp/gomod2nix.toml index d04275637515..94f129bf6c4f 100644 --- a/simapp/gomod2nix.toml +++ b/simapp/gomod2nix.toml @@ -37,6 +37,9 @@ schema = 3 [mod."cosmossdk.io/store"] version = "v1.0.2" hash = "sha256-mEaBNfU892M3V6qTMEDXb1GLaywlyouTRC5XfVqNSMs=" + [mod."cosmossdk.io/x/tx"] + version = "v0.13.1" + hash = "sha256-dHv2Zx8xbqfv1Gq0syh33G7TFJOVx4857QMH4b8Jj9k=" [mod."filippo.io/edwards25519"] version = "v1.1.0" hash = "sha256-9ACANrgWZSd5HYPfDZHY8DVbPSC9LOMgy8deq3rDOoc=" @@ -222,8 +225,8 @@ schema = 3 version = "v1.6.0" hash = "sha256-fWdnMQisRbiRzGT3ISrUHovquzLRHWvcv1JEsJFZRno=" [mod."github.com/golang/protobuf"] - version = "v1.5.3" - hash = "sha256-svogITcP4orUIsJFjMtp+Uv1+fKJv2Q5Zwf2dMqnpOQ=" + version = "v1.5.4" + hash = "sha256-N3+Lv9lEZjrdOWdQhFj6Y3Iap4rVLEQeI8/eFFyAMZ0=" [mod."github.com/golang/snappy"] version = "v0.0.4" hash = "sha256-Umx+5xHAQCN/Gi4HbtMhnDCSPFAXSsjVbXd8n5LhjAA=" @@ -402,8 +405,8 @@ schema = 3 version = "v0.6.0" hash = "sha256-TAD0mm7msYHo99yoNijeYzlDD0i1Vg3uTetpkDUWQo8=" [mod."github.com/prometheus/common"] - version = "v0.49.0" - hash = "sha256-jDD8MAv4kervfJWlIX22ErjUrE5w8S7F8PQEO8/QN/w=" + version = "v0.50.0" + hash = "sha256-zDhmdO4gGiyKyLuNrMnsoY3pkb9fGZIAHcjP8j26HQI=" [mod."github.com/prometheus/procfs"] version = "v0.12.0" hash = "sha256-Y4ZZmxIpVCO67zN3pGwSk2TcI88zvmGJkgwq9DRTwFw=" @@ -514,11 +517,11 @@ schema = 3 version = "v0.15.0" hash = "sha256-ANSnGmd525BfnkMZpCmu6deMPFGADtnZx3lmZpdm2aM=" [mod."golang.org/x/net"] - version = "v0.21.0" - hash = "sha256-LfiqMpPtqvW/eLkfx6Ebr5ksqKbQli6uq06c/+XrBsw=" + version = "v0.22.0" + hash = "sha256-pcefO4noO9I6mATKBWF6shgIjZvFg0kDsV1Jo/NsFns=" [mod."golang.org/x/oauth2"] - version = "v0.17.0" - hash = "sha256-M2ZZQZt449RJL18YpzGiAiqfGsDVMsr1IVWbYp/G/go=" + version = "v0.18.0" + hash = "sha256-TX4CvtvHU+SGSmqlxaQqlgJjlJiOtLGYAZa0zeBfZak=" [mod."golang.org/x/sync"] version = "v0.6.0" hash = "sha256-LLims/wjDZtIqlYCVHREewcUOX4hwRwplEuZKPOJ/HI=" @@ -553,11 +556,11 @@ schema = 3 version = "v0.0.0-20240221002015-b0ce06bbee7c" hash = "sha256-XF1eaB8Uwjuii1SVpiZABBhrpszJy5ujOtN+7qAAouM=" [mod."google.golang.org/grpc"] - version = "v1.62.0" - hash = "sha256-OnEEt6J1d9uQazORCpD6jbAKph8/dKlDHcUEEkLQyjQ=" + version = "v1.62.1" + hash = "sha256-1su6X0YT7MUflrTJijbq1CiisADZHudEx5sJq01TEaE=" [mod."google.golang.org/protobuf"] - version = "v1.32.0" - hash = "sha256-GJuTkMGHCzHbyK4yD5kY4oMn8wQWqgkeBK//yVDqHJk=" + version = "v1.33.0" + hash = "sha256-cWwQjtUwSIEkAlAadrlxK1PYZXTRrV4NKzt7xDpJgIU=" [mod."gopkg.in/ini.v1"] version = "v1.67.0" hash = "sha256-V10ahGNGT+NLRdKUyRg1dos5RxLBXBk1xutcnquc/+4=" diff --git a/simapp/simd/cmd/root_v2.go b/simapp/simd/cmd/root_di.go similarity index 100% rename from simapp/simd/cmd/root_v2.go rename to simapp/simd/cmd/root_di.go diff --git a/simapp/simd/cmd/testnet.go b/simapp/simd/cmd/testnet.go index 101cf5388a3e..b0c95a43a7e5 100644 --- a/simapp/simd/cmd/testnet.go +++ b/simapp/simd/cmd/testnet.go @@ -375,7 +375,7 @@ func initGenFiles( genAccounts []authtypes.GenesisAccount, genBalances []banktypes.Balance, genFiles []string, numValidators int, ) error { - appGenState := mm.DefaultGenesis(clientCtx.Codec) + appGenState := mm.DefaultGenesis() // set the accounts in the genesis state var authGenState authtypes.GenesisState diff --git a/store/db/goleveldb.go b/store/db/goleveldb.go index 22c108a2af1d..667f45eef10f 100644 --- a/store/db/goleveldb.go +++ b/store/db/goleveldb.go @@ -7,7 +7,7 @@ import ( "github.com/spf13/cast" "github.com/syndtr/goleveldb/leveldb" - "github.com/syndtr/goleveldb/leveldb/errors" + dberrors "github.com/syndtr/goleveldb/leveldb/errors" "github.com/syndtr/goleveldb/leveldb/filter" "github.com/syndtr/goleveldb/leveldb/iterator" "github.com/syndtr/goleveldb/leveldb/opt" @@ -15,6 +15,7 @@ import ( corestore "cosmossdk.io/core/store" "cosmossdk.io/store/v2" + "cosmossdk.io/store/v2/errors" ) // GoLevelDB implements RawDB using github.com/syndtr/goleveldb/leveldb. @@ -54,11 +55,11 @@ func NewGoLevelDBWithOpts(name, dir string, o *opt.Options) (*GoLevelDB, error) // Get implements RawDB. func (db *GoLevelDB) Get(key []byte) ([]byte, error) { if len(key) == 0 { - return nil, store.ErrKeyEmpty + return nil, errors.ErrKeyEmpty } res, err := db.db.Get(key, nil) if err != nil { - if err == errors.ErrNotFound { + if err == dberrors.ErrNotFound { return nil, nil } return nil, err @@ -78,10 +79,10 @@ func (db *GoLevelDB) Has(key []byte) (bool, error) { // Set implements RawDB. func (db *GoLevelDB) Set(key, value []byte) error { if len(key) == 0 { - return store.ErrKeyEmpty + return errors.ErrKeyEmpty } if value == nil { - return store.ErrValueNil + return errors.ErrValueNil } if err := db.db.Put(key, value, nil); err != nil { return err @@ -92,10 +93,10 @@ func (db *GoLevelDB) Set(key, value []byte) error { // SetSync implements RawDB. func (db *GoLevelDB) SetSync(key, value []byte) error { if len(key) == 0 { - return store.ErrKeyEmpty + return errors.ErrKeyEmpty } if value == nil { - return store.ErrValueNil + return errors.ErrValueNil } if err := db.db.Put(key, value, &opt.WriteOptions{Sync: true}); err != nil { return err @@ -106,7 +107,7 @@ func (db *GoLevelDB) SetSync(key, value []byte) error { // Delete implements RawDB. func (db *GoLevelDB) Delete(key []byte) error { if len(key) == 0 { - return store.ErrKeyEmpty + return errors.ErrKeyEmpty } if err := db.db.Delete(key, nil); err != nil { return err @@ -117,7 +118,7 @@ func (db *GoLevelDB) Delete(key []byte) error { // DeleteSync implements RawDB. func (db *GoLevelDB) DeleteSync(key []byte) error { if len(key) == 0 { - return store.ErrKeyEmpty + return errors.ErrKeyEmpty } err := db.db.Delete(key, &opt.WriteOptions{Sync: true}) if err != nil { @@ -195,7 +196,7 @@ func (db *GoLevelDB) NewBatchWithSize(size int) store.RawBatch { // Iterator implements RawDB. func (db *GoLevelDB) Iterator(start, end []byte) (corestore.Iterator, error) { if (start != nil && len(start) == 0) || (end != nil && len(end) == 0) { - return nil, store.ErrKeyEmpty + return nil, errors.ErrKeyEmpty } itr := db.db.NewIterator(&util.Range{Start: start, Limit: end}, nil) return newGoLevelDBIterator(itr, start, end, false), nil @@ -204,7 +205,7 @@ func (db *GoLevelDB) Iterator(start, end []byte) (corestore.Iterator, error) { // ReverseIterator implements RawDB. func (db *GoLevelDB) ReverseIterator(start, end []byte) (corestore.Iterator, error) { if (start != nil && len(start) == 0) || (end != nil && len(end) == 0) { - return nil, store.ErrKeyEmpty + return nil, errors.ErrKeyEmpty } itr := db.db.NewIterator(&util.Range{Start: start, Limit: end}, nil) return newGoLevelDBIterator(itr, start, end, true), nil @@ -363,13 +364,13 @@ func newGoLevelDBBatchWithSize(db *GoLevelDB, size int) *goLevelDBBatch { // Set implements RawBatch. func (b *goLevelDBBatch) Set(key, value []byte) error { if len(key) == 0 { - return store.ErrKeyEmpty + return errors.ErrKeyEmpty } if value == nil { - return store.ErrValueNil + return errors.ErrValueNil } if b.batch == nil { - return store.ErrBatchClosed + return errors.ErrBatchClosed } b.batch.Put(key, value) return nil @@ -378,10 +379,10 @@ func (b *goLevelDBBatch) Set(key, value []byte) error { // Delete implements RawBatch. func (b *goLevelDBBatch) Delete(key []byte) error { if len(key) == 0 { - return store.ErrKeyEmpty + return errors.ErrKeyEmpty } if b.batch == nil { - return store.ErrBatchClosed + return errors.ErrBatchClosed } b.batch.Delete(key) return nil @@ -399,7 +400,7 @@ func (b *goLevelDBBatch) WriteSync() error { func (b *goLevelDBBatch) write(sync bool) error { if b.batch == nil { - return store.ErrBatchClosed + return errors.ErrBatchClosed } err := b.db.db.Write(b.batch, &opt.WriteOptions{Sync: sync}) if err != nil { @@ -421,7 +422,7 @@ func (b *goLevelDBBatch) Close() error { // GetByteSize implements RawBatch func (b *goLevelDBBatch) GetByteSize() (int, error) { if b.batch == nil { - return 0, store.ErrBatchClosed + return 0, errors.ErrBatchClosed } return len(b.batch.Dump()), nil } diff --git a/store/db/memdb.go b/store/db/memdb.go index a7f9e4899651..153cc2727ac2 100644 --- a/store/db/memdb.go +++ b/store/db/memdb.go @@ -10,6 +10,7 @@ import ( corestore "cosmossdk.io/core/store" "cosmossdk.io/store/v2" + "cosmossdk.io/store/v2/errors" ) const ( @@ -64,7 +65,7 @@ func NewMemDB() *MemDB { // Get implements DB. func (db *MemDB) Get(key []byte) ([]byte, error) { if len(key) == 0 { - return nil, store.ErrKeyEmpty + return nil, errors.ErrKeyEmpty } db.mtx.RLock() defer db.mtx.RUnlock() @@ -79,7 +80,7 @@ func (db *MemDB) Get(key []byte) ([]byte, error) { // Has implements DB. func (db *MemDB) Has(key []byte) (bool, error) { if len(key) == 0 { - return false, store.ErrKeyEmpty + return false, errors.ErrKeyEmpty } db.mtx.RLock() defer db.mtx.RUnlock() @@ -90,10 +91,10 @@ func (db *MemDB) Has(key []byte) (bool, error) { // Set implements DB. func (db *MemDB) Set(key, value []byte) error { if len(key) == 0 { - return store.ErrKeyEmpty + return errors.ErrKeyEmpty } if value == nil { - return store.ErrValueNil + return errors.ErrValueNil } db.mtx.Lock() defer db.mtx.Unlock() @@ -115,7 +116,7 @@ func (db *MemDB) SetSync(key, value []byte) error { // Delete implements DB. func (db *MemDB) Delete(key []byte) error { if len(key) == 0 { - return store.ErrKeyEmpty + return errors.ErrKeyEmpty } db.mtx.Lock() defer db.mtx.Unlock() @@ -181,7 +182,7 @@ func (db *MemDB) NewBatchWithSize(size int) store.RawBatch { // Takes out a read-lock on the database until the iterator is closed. func (db *MemDB) Iterator(start, end []byte) (corestore.Iterator, error) { if (start != nil && len(start) == 0) || (end != nil && len(end) == 0) { - return nil, store.ErrKeyEmpty + return nil, errors.ErrKeyEmpty } return newMemDBIterator(db, start, end, false), nil } @@ -190,7 +191,7 @@ func (db *MemDB) Iterator(start, end []byte) (corestore.Iterator, error) { // Takes out a read-lock on the database until the iterator is closed. func (db *MemDB) ReverseIterator(start, end []byte) (corestore.Iterator, error) { if (start != nil && len(start) == 0) || (end != nil && len(end) == 0) { - return nil, store.ErrKeyEmpty + return nil, errors.ErrKeyEmpty } return newMemDBIterator(db, start, end, true), nil } @@ -198,7 +199,7 @@ func (db *MemDB) ReverseIterator(start, end []byte) (corestore.Iterator, error) // IteratorNoMtx makes an iterator with no mutex. func (db *MemDB) IteratorNoMtx(start, end []byte) (corestore.Iterator, error) { if (start != nil && len(start) == 0) || (end != nil && len(end) == 0) { - return nil, store.ErrKeyEmpty + return nil, errors.ErrKeyEmpty } return newMemDBIteratorMtxChoice(db, start, end, false, false), nil } @@ -206,7 +207,7 @@ func (db *MemDB) IteratorNoMtx(start, end []byte) (corestore.Iterator, error) { // ReverseIteratorNoMtx makes an iterator with no mutex. func (db *MemDB) ReverseIteratorNoMtx(start, end []byte) (corestore.Iterator, error) { if (start != nil && len(start) == 0) || (end != nil && len(end) == 0) { - return nil, store.ErrKeyEmpty + return nil, errors.ErrKeyEmpty } return newMemDBIteratorMtxChoice(db, start, end, true, false), nil } @@ -395,13 +396,13 @@ func newMemDBBatch(db *MemDB) *memDBBatch { // Set implements Batch. func (b *memDBBatch) Set(key, value []byte) error { if len(key) == 0 { - return store.ErrKeyEmpty + return errors.ErrKeyEmpty } if value == nil { - return store.ErrValueNil + return errors.ErrValueNil } if b.ops == nil { - return store.ErrBatchClosed + return errors.ErrBatchClosed } b.size += len(key) + len(value) b.ops = append(b.ops, operation{opTypeSet, key, value}) @@ -411,10 +412,10 @@ func (b *memDBBatch) Set(key, value []byte) error { // Delete implements Batch. func (b *memDBBatch) Delete(key []byte) error { if len(key) == 0 { - return store.ErrKeyEmpty + return errors.ErrKeyEmpty } if b.ops == nil { - return store.ErrBatchClosed + return errors.ErrBatchClosed } b.size += len(key) b.ops = append(b.ops, operation{opTypeDelete, key, nil}) @@ -424,7 +425,7 @@ func (b *memDBBatch) Delete(key []byte) error { // Write implements Batch. func (b *memDBBatch) Write() error { if b.ops == nil { - return store.ErrBatchClosed + return errors.ErrBatchClosed } b.db.mtx.Lock() defer b.db.mtx.Unlock() @@ -459,7 +460,7 @@ func (b *memDBBatch) Close() error { // GetByteSize implements Batch func (b *memDBBatch) GetByteSize() (int, error) { if b.ops == nil { - return 0, store.ErrBatchClosed + return 0, errors.ErrBatchClosed } return b.size, nil } diff --git a/store/db/prefixdb.go b/store/db/prefixdb.go index c851ad311bfd..7ead2aa69920 100644 --- a/store/db/prefixdb.go +++ b/store/db/prefixdb.go @@ -7,6 +7,7 @@ import ( corestore "cosmossdk.io/core/store" "cosmossdk.io/store/v2" + "cosmossdk.io/store/v2/errors" ) // PrefixDB wraps a namespace of another database as a logical database. @@ -29,7 +30,7 @@ func NewPrefixDB(db store.RawDB, prefix []byte) *PrefixDB { // Get implements RawDB. func (pdb *PrefixDB) Get(key []byte) ([]byte, error) { if len(key) == 0 { - return nil, store.ErrKeyEmpty + return nil, errors.ErrKeyEmpty } pkey := pdb.prefixed(key) @@ -43,7 +44,7 @@ func (pdb *PrefixDB) Get(key []byte) ([]byte, error) { // Has implements RawDB. func (pdb *PrefixDB) Has(key []byte) (bool, error) { if len(key) == 0 { - return false, store.ErrKeyEmpty + return false, errors.ErrKeyEmpty } ok, err := pdb.db.Has(pdb.prefixed(key)) @@ -57,7 +58,7 @@ func (pdb *PrefixDB) Has(key []byte) (bool, error) { // Iterator implements RawDB. func (pdb *PrefixDB) Iterator(start, end []byte) (corestore.Iterator, error) { if (start != nil && len(start) == 0) || (end != nil && len(end) == 0) { - return nil, store.ErrKeyEmpty + return nil, errors.ErrKeyEmpty } var pstart, pend []byte @@ -78,7 +79,7 @@ func (pdb *PrefixDB) Iterator(start, end []byte) (corestore.Iterator, error) { // ReverseIterator implements RawDB. func (pdb *PrefixDB) ReverseIterator(start, end []byte) (corestore.Iterator, error) { if (start != nil && len(start) == 0) || (end != nil && len(end) == 0) { - return nil, store.ErrKeyEmpty + return nil, errors.ErrKeyEmpty } var pstart, pend []byte @@ -277,10 +278,10 @@ func newPrefixBatch(prefix []byte, source store.RawBatch) prefixDBBatch { // Set implements RawBatch. func (pb prefixDBBatch) Set(key, value []byte) error { if len(key) == 0 { - return store.ErrKeyEmpty + return errors.ErrKeyEmpty } if value == nil { - return store.ErrValueNil + return errors.ErrValueNil } pkey := append(cp(pb.prefix), key...) return pb.source.Set(pkey, value) @@ -289,7 +290,7 @@ func (pb prefixDBBatch) Set(key, value []byte) error { // Delete implements RawBatch. func (pb prefixDBBatch) Delete(key []byte) error { if len(key) == 0 { - return store.ErrKeyEmpty + return errors.ErrKeyEmpty } pkey := append(cp(pb.prefix), key...) return pb.source.Delete(pkey) @@ -313,7 +314,7 @@ func (pb prefixDBBatch) Close() error { // GetByteSize implements RawBatch func (pb prefixDBBatch) GetByteSize() (int, error) { if pb.source == nil { - return 0, store.ErrBatchClosed + return 0, errors.ErrBatchClosed } return pb.source.GetByteSize() } diff --git a/store/errors.go b/store/errors.go deleted file mode 100644 index fe6fd386993c..000000000000 --- a/store/errors.go +++ /dev/null @@ -1,52 +0,0 @@ -package store - -import ( - "fmt" - - "cosmossdk.io/errors" -) - -// StoreCodespace defines the store package's unique error code space. -const StoreCodespace = "store" - -var ( - // ErrTxDecode is returned if we cannot parse a transaction - ErrTxDecode = errors.Register(StoreCodespace, 3, "tx parse error") - - // ErrUnknownRequest to doc - ErrUnknownRequest = errors.Register(StoreCodespace, 4, "unknown request") - - // ErrLogic defines an internal logic error, e.g. an invariant or assertion - // that is violated. It is a programmer error, not a user-facing error. - ErrLogic = errors.Register(StoreCodespace, 5, "internal logic error") - - // ErrConflict defines a conflict error, e.g. when two goroutines try to access - // the same resource and one of them fails. - ErrConflict = errors.Register(StoreCodespace, 6, "conflict") - - // ErrInvalidRequest defines an ABCI typed error where the request contains - // invalid data. - ErrInvalidRequest = errors.Register(StoreCodespace, 7, "invalid request") - - ErrClosed = errors.Register(StoreCodespace, 8, "closed") - ErrRecordNotFound = errors.Register(StoreCodespace, 9, "record not found") - ErrUnknownStoreKey = errors.Register(StoreCodespace, 10, "unknown store key") - ErrKeyEmpty = errors.Register(StoreCodespace, 11, "key empty") - ErrStartAfterEnd = errors.Register(StoreCodespace, 12, "start key after end key") - - // ErrBatchClosed is returned when a closed or written batch is used. - ErrBatchClosed = errors.Register(StoreCodespace, 13, "batch has been written or closed") - - // ErrValueNil is returned when attempting to set a nil value. - ErrValueNil = errors.Register(StoreCodespace, 14, "value nil") -) - -// ErrVersionPruned defines an error returned when a version queried is pruned -// or does not exist. -type ErrVersionPruned struct { - EarliestVersion uint64 -} - -func (e ErrVersionPruned) Error() string { - return fmt.Sprintf("requested version is pruned; earliest available version is: %d", e.EarliestVersion) -} diff --git a/store/errors/errors.go b/store/errors/errors.go new file mode 100644 index 000000000000..659e6b244ddd --- /dev/null +++ b/store/errors/errors.go @@ -0,0 +1,51 @@ +package errors + +import ( + "errors" + "fmt" +) + +var ( + // ErrInvalidProof is returned when a proof is invalid + ErrInvalidProof = errors.New("invalid proof") + + // ErrTxDecode is returned if we cannot parse a transaction + ErrTxDecode = errors.New("tx parse error") + + // ErrUnknownRequest to doc + ErrUnknownRequest = errors.New("unknown request") + + // ErrLogic defines an internal logic error, e.g. an invariant or assertion + // that is violated. It is a programmer error, not a user-facing error. + ErrLogic = errors.New("internal logic error") + + // ErrConflict defines a conflict error, e.g. when two goroutines try to access + // the same resource and one of them fails. + ErrConflict = errors.New("conflict") + + // ErrInvalidRequest defines an ABCI typed error where the request contains + // invalid data. + ErrInvalidRequest = errors.New("invalid request") + + ErrClosed = errors.New("closed") + ErrRecordNotFound = errors.New("record not found") + ErrUnknownStoreKey = errors.New("unknown store key") + ErrKeyEmpty = errors.New("key empty") + ErrStartAfterEnd = errors.New("start key after end key") + + // ErrBatchClosed is returned when a closed or written batch is used. + ErrBatchClosed = errors.New("batch has been written or closed") + + // ErrValueNil is returned when attempting to set a nil value. + ErrValueNil = errors.New("value nil") +) + +// ErrVersionPruned defines an error returned when a version queried is pruned +// or does not exist. +type ErrVersionPruned struct { + EarliestVersion uint64 +} + +func (e ErrVersionPruned) Error() string { + return fmt.Sprintf("requested version is pruned; earliest available version is: %d", e.EarliestVersion) +} diff --git a/store/go.mod b/store/go.mod index b8ce0031a6fa..fbc8236e91e7 100644 --- a/store/go.mod +++ b/store/go.mod @@ -37,7 +37,7 @@ require ( github.com/emicklei/dot v1.6.1 // indirect github.com/getsentry/sentry-go v0.27.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/protobuf v1.5.3 // indirect + github.com/golang/protobuf v1.5.4 // 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 @@ -53,18 +53,18 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.19.0 // indirect github.com/prometheus/client_model v0.6.0 // indirect - github.com/prometheus/common v0.49.0 // indirect + github.com/prometheus/common v0.50.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/rs/zerolog v1.32.0 // indirect github.com/sasha-s/go-deadlock v0.3.1 // indirect golang.org/x/crypto v0.21.0 // indirect - golang.org/x/net v0.21.0 // indirect + golang.org/x/net v0.22.0 // indirect golang.org/x/sys v0.18.0 // indirect golang.org/x/text v0.14.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c // indirect - google.golang.org/grpc v1.62.0 // indirect - google.golang.org/protobuf v1.32.0 // indirect + google.golang.org/grpc v1.62.1 // indirect + google.golang.org/protobuf v1.33.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/store/go.sum b/store/go.sum index 2766d7c0983f..4e25aa335aaa 100644 --- a/store/go.sum +++ b/store/go.sum @@ -46,8 +46,6 @@ github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAK github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= github.com/cosmos/gogoproto v1.4.11 h1:LZcMHrx4FjUgrqQSWeaGC1v/TeuVFqSLa43CC6aWR2g= github.com/cosmos/gogoproto v1.4.11/go.mod h1:/g39Mh8m17X8Q/GDEs5zYTSNaNnInBSohtaxzQnYq1Y= -github.com/cosmos/iavl v1.0.0-beta.1.0.20240125174944-11ba4961dae9 h1:guolkG50C5Pfk/+iHXbRg20DhkDkDMHmJVXtzS67FME= -github.com/cosmos/iavl v1.0.0-beta.1.0.20240125174944-11ba4961dae9/go.mod h1:JDw0feJTylH9iDDzi8sWeJO0xrf3qajxebBMnWA6iz4= github.com/cosmos/iavl v1.1.0 h1:YRdPLKCPoJQDXoZu0BToQ6PADswLkhNzyt7DZLgK0xY= github.com/cosmos/iavl v1.1.0/go.mod h1:jLeUvm6bGT1YutCaL2fIar/8vGUE8cPZvh/gXEWDaDM= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= @@ -97,8 +95,8 @@ github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvq github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -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/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= @@ -198,8 +196,8 @@ github.com/prometheus/client_model v0.6.0 h1:k1v3CzpSRUTrKMppY35TLwPvxHqBu0bYgxZ github.com/prometheus/client_model v0.6.0/go.mod h1:NTQHnmxFpouOD0DpvP4XujX3CdOAGQPoaGhyTchlyt8= 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.49.0 h1:ToNTdK4zSnPVJmh698mGFkDor9wBI/iGaJy5dbH1EgI= -github.com/prometheus/common v0.49.0/go.mod h1:Kxm+EULxRbUkjGU6WFsQqo3ORzB4tyKvlWFOE9mB2sE= +github.com/prometheus/common v0.50.0 h1:YSZE6aa9+luNa2da6/Tik0q0A5AbR+U003TItK57CPQ= +github.com/prometheus/common v0.50.0/go.mod h1:wHFBCEVWVmHMUpg7pYcOm2QUR/ocQdYSJVQJKnHc3xQ= 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= @@ -252,8 +250,8 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY 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.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= +golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 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= @@ -307,8 +305,8 @@ golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c h1:NUsgEN92SQQqzfA+YtqYNqYmB3DMMYLlIwUZAQFVFbo= google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c/go.mod h1:H4O17MA/PE9BsGx3w+a+W2VOLLD1Qf7oJneAoU6WktY= -google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk= -google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -317,8 +315,8 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= -google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= 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= diff --git a/store/proof/proof.go b/store/proof/proof.go index c93ceb5b2f7e..120cf3d2a13b 100644 --- a/store/proof/proof.go +++ b/store/proof/proof.go @@ -6,11 +6,9 @@ import ( ics23 "github.com/cosmos/ics23/go" "cosmossdk.io/errors" + storeerrors "cosmossdk.io/store/v2/errors" ) -// ErrInvalidProof is returned when a proof is invalid -var ErrInvalidProof = errors.Register("store", 2, "invalid proof") - // Proof operation types const ( ProofOpIAVLCommitment = "ics23:iavl" @@ -100,7 +98,7 @@ func (op CommitmentOp) Run(args [][]byte) ([][]byte, error) { // calculate root from proof root, err := op.Proof.Calculate() if err != nil { - return nil, errors.Wrapf(ErrInvalidProof, "could not calculate root for proof: %v", err) + return nil, errors.Wrapf(storeerrors.ErrInvalidProof, "could not calculate root for proof: %v", err) } // Only support an existence proof or nonexistence proof (batch proofs currently unsupported) @@ -109,17 +107,17 @@ func (op CommitmentOp) Run(args [][]byte) ([][]byte, error) { // Args are nil, so we verify the absence of the key. absent := ics23.VerifyNonMembership(op.Spec, root, op.Proof, op.Key) if !absent { - return nil, errors.Wrapf(ErrInvalidProof, "proof did not verify absence of key: %s", string(op.Key)) + return nil, errors.Wrapf(storeerrors.ErrInvalidProof, "proof did not verify absence of key: %s", string(op.Key)) } case 1: // Args is length 1, verify existence of key with value args[0] if !ics23.VerifyMembership(op.Spec, root, op.Proof, op.Key, args[0]) { - return nil, errors.Wrapf(ErrInvalidProof, "proof did not verify existence of key %s with given value %x", op.Key, args[0]) + return nil, errors.Wrapf(storeerrors.ErrInvalidProof, "proof did not verify existence of key %s with given value %x", op.Key, args[0]) } default: - return nil, errors.Wrapf(ErrInvalidProof, "args must be length 0 or 1, got: %d", len(args)) + return nil, errors.Wrapf(storeerrors.ErrInvalidProof, "args must be length 0 or 1, got: %d", len(args)) } return [][]byte{root}, nil diff --git a/store/snapshots/chunk.go b/store/snapshots/chunk.go index 874bf966871b..aab00a3e5d28 100644 --- a/store/snapshots/chunk.go +++ b/store/snapshots/chunk.go @@ -5,7 +5,7 @@ import ( "math" "cosmossdk.io/errors" - "cosmossdk.io/store/v2" + storeerrors "cosmossdk.io/store/v2/errors" snapshotstypes "cosmossdk.io/store/v2/snapshots/types" ) @@ -72,7 +72,7 @@ func (w *ChunkWriter) CloseWithError(err error) { // Write implements io.Writer. func (w *ChunkWriter) Write(data []byte) (int, error) { if w.closed { - return 0, errors.Wrap(store.ErrLogic, "cannot write to closed ChunkWriter") + return 0, errors.Wrap(storeerrors.ErrLogic, "cannot write to closed ChunkWriter") } nTotal := 0 for len(data) > 0 { @@ -174,7 +174,7 @@ func ValidRestoreHeight(format uint32, height uint64) error { } if height == 0 { - return errors.Wrap(store.ErrLogic, "cannot restore snapshot at height 0") + return errors.Wrap(storeerrors.ErrLogic, "cannot restore snapshot at height 0") } if height > uint64(math.MaxInt64) { return errors.Wrapf(snapshotstypes.ErrInvalidMetadata, diff --git a/store/snapshots/helpers_test.go b/store/snapshots/helpers_test.go index 33dcc14fa6f4..a0d1add9a85d 100644 --- a/store/snapshots/helpers_test.go +++ b/store/snapshots/helpers_test.go @@ -291,7 +291,6 @@ func (s *extSnapshotter) RestoreExtension(height uint64, format uint32, payloadR // GetTempDir returns a writable temporary director for the test to use. func GetTempDir(tb testing.TB) string { - //return "/tmp/snapshots" tb.Helper() // os.MkDir() is used instead of testing.T.TempDir() // see https://github.com/cosmos/cosmos-sdk/pull/8475 and diff --git a/store/snapshots/manager.go b/store/snapshots/manager.go index b713da7134f4..c4a4bead3633 100644 --- a/store/snapshots/manager.go +++ b/store/snapshots/manager.go @@ -14,6 +14,7 @@ import ( errorsmod "cosmossdk.io/errors" "cosmossdk.io/log" "cosmossdk.io/store/v2" + storeerrors "cosmossdk.io/store/v2/errors" "cosmossdk.io/store/v2/snapshots/types" ) @@ -117,10 +118,10 @@ func (m *Manager) begin(op operation) error { // beginLocked begins an operation while already holding the mutex. func (m *Manager) beginLocked(op operation) error { if op == opNone { - return errorsmod.Wrap(store.ErrLogic, "can't begin a none operation") + return errorsmod.Wrap(storeerrors.ErrLogic, "can't begin a none operation") } if m.operation != opNone { - return errorsmod.Wrapf(store.ErrConflict, "a %v operation is in progress", m.operation) + return errorsmod.Wrapf(storeerrors.ErrConflict, "a %v operation is in progress", m.operation) } m.operation = op return nil @@ -166,7 +167,7 @@ func (m *Manager) GetSnapshotBlockRetentionHeights() int64 { // Create creates a snapshot and returns its metadata. func (m *Manager) Create(height uint64) (*types.Snapshot, error) { if m == nil { - return nil, errorsmod.Wrap(store.ErrLogic, "Snapshot Manager is nil") + return nil, errorsmod.Wrap(storeerrors.ErrLogic, "Snapshot Manager is nil") } err := m.begin(opSnapshot) @@ -180,7 +181,7 @@ func (m *Manager) Create(height uint64) (*types.Snapshot, error) { return nil, errorsmod.Wrap(err, "failed to examine latest snapshot") } if latest != nil && latest.Height >= height { - return nil, errorsmod.Wrapf(store.ErrConflict, + return nil, errorsmod.Wrapf(storeerrors.ErrConflict, "a more recent snapshot already exists at height %v", latest.Height) } @@ -237,7 +238,7 @@ func (m *Manager) createSnapshot(height uint64, ch chan<- io.ReadCloser) { // It is used to migrate the state from the original store to the store/v2. func (m *Manager) CreateMigration(height uint64, protoWriter WriteCloser) error { if m == nil { - return errorsmod.Wrap(store.ErrLogic, "Snapshot Manager is nil") + return errorsmod.Wrap(storeerrors.ErrLogic, "Snapshot Manager is nil") } err := m.begin(opSnapshot) @@ -306,7 +307,7 @@ func (m *Manager) Restore(snapshot types.Snapshot) error { return errorsmod.Wrapf(types.ErrUnknownFormat, "snapshot format %v", snapshot.Format) } if snapshot.Height == 0 { - return errorsmod.Wrap(store.ErrLogic, "cannot restore snapshot at height 0") + return errorsmod.Wrap(storeerrors.ErrLogic, "cannot restore snapshot at height 0") } if snapshot.Height > uint64(math.MaxInt64) { return errorsmod.Wrapf(types.ErrInvalidMetadata, @@ -415,11 +416,11 @@ func (m *Manager) doRestoreSnapshot(snapshot types.Snapshot, chChunks <-chan io. } metadata := nextItem.GetExtension() if metadata == nil { - return errorsmod.Wrapf(store.ErrLogic, "unknown snapshot item %T", nextItem.Item) + return errorsmod.Wrapf(storeerrors.ErrLogic, "unknown snapshot item %T", nextItem.Item) } extension, ok := m.extensions[metadata.Name] if !ok { - return errorsmod.Wrapf(store.ErrLogic, "unknown extension snapshotter %s", metadata.Name) + return errorsmod.Wrapf(storeerrors.ErrLogic, "unknown extension snapshotter %s", metadata.Name) } if !IsFormatSupported(extension, metadata.Format) { return errorsmod.Wrapf(types.ErrUnknownFormat, "format %v for extension %s", metadata.Format, metadata.Name) @@ -448,11 +449,11 @@ func (m *Manager) RestoreChunk(chunk []byte) (bool, error) { m.mtx.Lock() defer m.mtx.Unlock() if m.operation != opRestore { - return false, errorsmod.Wrap(store.ErrLogic, "no restore operation in progress") + return false, errorsmod.Wrap(storeerrors.ErrLogic, "no restore operation in progress") } if int(m.restoreChunkIndex) >= len(m.restoreSnapshot.Metadata.ChunkHashes) { - return false, errorsmod.Wrap(store.ErrLogic, "received unexpected chunk") + return false, errorsmod.Wrap(storeerrors.ErrLogic, "received unexpected chunk") } // Check if any errors have occurred yet. @@ -462,7 +463,7 @@ func (m *Manager) RestoreChunk(chunk []byte) (bool, error) { if done.err != nil { return false, done.err } - return false, errorsmod.Wrap(store.ErrLogic, "restore ended unexpectedly") + return false, errorsmod.Wrap(storeerrors.ErrLogic, "restore ended unexpectedly") default: } @@ -498,7 +499,7 @@ func (m *Manager) RestoreChunk(chunk []byte) (bool, error) { return false, done.err } if !done.complete { - return false, errorsmod.Wrap(store.ErrLogic, "restore ended prematurely") + return false, errorsmod.Wrap(storeerrors.ErrLogic, "restore ended prematurely") } return true, nil diff --git a/store/snapshots/store.go b/store/snapshots/store.go index c7fef66bb424..5c82a095e6dd 100644 --- a/store/snapshots/store.go +++ b/store/snapshots/store.go @@ -18,6 +18,7 @@ import ( "cosmossdk.io/errors" "cosmossdk.io/store/v2" + storeerrors "cosmossdk.io/store/v2/errors" "cosmossdk.io/store/v2/snapshots/types" ) @@ -37,7 +38,7 @@ type Store struct { // NewStore creates a new snapshot store. func NewStore(dir string) (*Store, error) { if dir == "" { - return nil, errors.Wrap(store.ErrLogic, "snapshot directory not given") + return nil, errors.Wrap(storeerrors.ErrLogic, "snapshot directory not given") } err := os.MkdirAll(dir, 0o755) if err != nil { @@ -60,7 +61,7 @@ func (s *Store) Delete(height uint64, format uint32) error { saving := s.saving[height] s.mtx.Unlock() if saving { - return errors.Wrapf(store.ErrConflict, + return errors.Wrapf(storeerrors.ErrConflict, "snapshot for height %v format %v is currently being saved", height, format) } if err := os.RemoveAll(s.pathSnapshot(height, format)); err != nil { @@ -222,7 +223,7 @@ func (s *Store) Prune(retain uint32) (uint64, error) { skip[height] = true continue } - err = s.Delete(height, uint32(format)) + err = s.Delete(height, format) if err != nil { return 0, errors.Wrap(err, "failed to prune snapshots") } @@ -248,7 +249,7 @@ func (s *Store) Save( ) (*types.Snapshot, error) { defer DrainChunks(chunks) if height == 0 { - return nil, errors.Wrap(store.ErrLogic, "snapshot height cannot be 0") + return nil, errors.Wrap(storeerrors.ErrLogic, "snapshot height cannot be 0") } s.mtx.Lock() @@ -256,7 +257,7 @@ func (s *Store) Save( s.saving[height] = true s.mtx.Unlock() if saving { - return nil, errors.Wrapf(store.ErrConflict, + return nil, errors.Wrapf(storeerrors.ErrConflict, "a snapshot for height %v is already being saved", height) } defer func() { @@ -381,7 +382,7 @@ func (s *Store) parseMetadataFilename(filename string) (height uint64, format ui return 0, 0, errors.Wrapf(err, "invalid snapshot metadata filename %s", filename) } format = uint32(f) - if filename != filepath.Base(s.pathMetadata(height, uint32(format))) { + if filename != filepath.Base(s.pathMetadata(height, format)) { return 0, 0, fmt.Errorf("invalid snapshot metadata filename %s", filename) } return height, format, nil @@ -399,10 +400,10 @@ func (s *Store) validateMetadataPath(path string) error { // legacyV1DecodeKey decodes a legacy snapshot key used in a raw kv store. func legacyV1DecodeKey(k []byte) (uint64, uint32, error) { if len(k) != 13 { - return 0, 0, errors.Wrapf(store.ErrLogic, "invalid snapshot key with length %v", len(k)) + return 0, 0, errors.Wrapf(storeerrors.ErrLogic, "invalid snapshot key with length %v", len(k)) } if k[0] != keyPrefixSnapshot { - return 0, 0, errors.Wrapf(store.ErrLogic, "invalid snapshot key prefix %x", k[0]) + return 0, 0, errors.Wrapf(storeerrors.ErrLogic, "invalid snapshot key prefix %x", k[0]) } height := binary.BigEndian.Uint64(k[1:9]) diff --git a/store/storage/pebbledb/db.go b/store/storage/pebbledb/db.go index 4eff6ff7ff2f..8d502d46cf27 100644 --- a/store/storage/pebbledb/db.go +++ b/store/storage/pebbledb/db.go @@ -12,6 +12,7 @@ import ( corestore "cosmossdk.io/core/store" "cosmossdk.io/store/v2" + storeerrors "cosmossdk.io/store/v2/errors" "cosmossdk.io/store/v2/storage" ) @@ -148,12 +149,12 @@ func (db *Database) Has(storeKey string, version uint64, key []byte) (bool, erro func (db *Database) Get(storeKey string, targetVersion uint64, key []byte) ([]byte, error) { if targetVersion < db.earliestVersion { - return nil, store.ErrVersionPruned{EarliestVersion: db.earliestVersion} + return nil, storeerrors.ErrVersionPruned{EarliestVersion: db.earliestVersion} } prefixedVal, err := getMVCCSlice(db.storage, storeKey, key, targetVersion) if err != nil { - if errors.Is(err, store.ErrRecordNotFound) { + if errors.Is(err, storeerrors.ErrRecordNotFound) { return nil, nil } @@ -268,11 +269,11 @@ func (db *Database) Prune(version uint64) error { func (db *Database) Iterator(storeKey string, version uint64, start, end []byte) (corestore.Iterator, error) { if (start != nil && len(start) == 0) || (end != nil && len(end) == 0) { - return nil, store.ErrKeyEmpty + return nil, storeerrors.ErrKeyEmpty } if start != nil && end != nil && bytes.Compare(start, end) > 0 { - return nil, store.ErrStartAfterEnd + return nil, storeerrors.ErrStartAfterEnd } lowerBound := MVCCEncode(prependStoreKey(storeKey, start), 0) @@ -292,11 +293,11 @@ func (db *Database) Iterator(storeKey string, version uint64, start, end []byte) func (db *Database) ReverseIterator(storeKey string, version uint64, start, end []byte) (corestore.Iterator, error) { if (start != nil && len(start) == 0) || (end != nil && len(end) == 0) { - return nil, store.ErrKeyEmpty + return nil, storeerrors.ErrKeyEmpty } if start != nil && end != nil && bytes.Compare(start, end) > 0 { - return nil, store.ErrStartAfterEnd + return nil, storeerrors.ErrStartAfterEnd } lowerBound := MVCCEncode(prependStoreKey(storeKey, start), 0) @@ -378,7 +379,7 @@ func getMVCCSlice(db *pebble.DB, storeKey string, key []byte, version uint64) ([ defer itr.Close() if !itr.Last() { - return nil, store.ErrRecordNotFound + return nil, storeerrors.ErrRecordNotFound } _, vBz, ok := SplitMVCCKey(itr.Key()) diff --git a/store/storage/rocksdb/db.go b/store/storage/rocksdb/db.go index 440d26ccccce..32ece55de926 100644 --- a/store/storage/rocksdb/db.go +++ b/store/storage/rocksdb/db.go @@ -8,11 +8,13 @@ import ( "encoding/binary" "fmt" - "github.com/linxGnu/grocksdb" "slices" + "github.com/linxGnu/grocksdb" + corestore "cosmossdk.io/core/store" "cosmossdk.io/store/v2" + "cosmossdk.io/store/v2/errors" "cosmossdk.io/store/v2/storage" "cosmossdk.io/store/v2/storage/util" ) @@ -98,7 +100,7 @@ func (db *Database) NewBatch(version uint64) (store.Batch, error) { func (db *Database) getSlice(storeKey string, version uint64, key []byte) (*grocksdb.Slice, error) { if version < db.tsLow { - return nil, store.ErrVersionPruned{EarliestVersion: db.tsLow} + return nil, errors.ErrVersionPruned{EarliestVersion: db.tsLow} } return db.storage.GetCF( @@ -165,11 +167,11 @@ func (db *Database) Prune(version uint64) error { func (db *Database) Iterator(storeKey string, version uint64, start, end []byte) (corestore.Iterator, error) { if (start != nil && len(start) == 0) || (end != nil && len(end) == 0) { - return nil, store.ErrKeyEmpty + return nil, errors.ErrKeyEmpty } if start != nil && end != nil && bytes.Compare(start, end) > 0 { - return nil, store.ErrStartAfterEnd + return nil, errors.ErrStartAfterEnd } prefix := storePrefix(storeKey) @@ -181,11 +183,11 @@ func (db *Database) Iterator(storeKey string, version uint64, start, end []byte) func (db *Database) ReverseIterator(storeKey string, version uint64, start, end []byte) (corestore.Iterator, error) { if (start != nil && len(start) == 0) || (end != nil && len(end) == 0) { - return nil, store.ErrKeyEmpty + return nil, errors.ErrKeyEmpty } if start != nil && end != nil && bytes.Compare(start, end) > 0 { - return nil, store.ErrStartAfterEnd + return nil, errors.ErrStartAfterEnd } prefix := storePrefix(storeKey) diff --git a/store/storage/sqlite/db.go b/store/storage/sqlite/db.go index 5d6b6138f249..c114dc6ef06c 100644 --- a/store/storage/sqlite/db.go +++ b/store/storage/sqlite/db.go @@ -12,6 +12,7 @@ import ( corestore "cosmossdk.io/core/store" "cosmossdk.io/store/v2" + storeerrors "cosmossdk.io/store/v2/errors" "cosmossdk.io/store/v2/storage" ) @@ -138,7 +139,7 @@ func (db *Database) Has(storeKey string, version uint64, key []byte) (bool, erro func (db *Database) Get(storeKey string, targetVersion uint64, key []byte) ([]byte, error) { if targetVersion < db.earliestVersion { - return nil, store.ErrVersionPruned{EarliestVersion: db.earliestVersion} + return nil, storeerrors.ErrVersionPruned{EarliestVersion: db.earliestVersion} } stmt, err := db.storage.Prepare(` @@ -217,11 +218,11 @@ func (db *Database) Prune(version uint64) error { func (db *Database) Iterator(storeKey string, version uint64, start, end []byte) (corestore.Iterator, error) { if (start != nil && len(start) == 0) || (end != nil && len(end) == 0) { - return nil, store.ErrKeyEmpty + return nil, storeerrors.ErrKeyEmpty } if start != nil && end != nil && bytes.Compare(start, end) > 0 { - return nil, store.ErrStartAfterEnd + return nil, storeerrors.ErrStartAfterEnd } return newIterator(db, storeKey, version, start, end, false) @@ -229,11 +230,11 @@ func (db *Database) Iterator(storeKey string, version uint64, start, end []byte) func (db *Database) ReverseIterator(storeKey string, version uint64, start, end []byte) (corestore.Iterator, error) { if (start != nil && len(start) == 0) || (end != nil && len(end) == 0) { - return nil, store.ErrKeyEmpty + return nil, storeerrors.ErrKeyEmpty } if start != nil && end != nil && bytes.Compare(start, end) > 0 { - return nil, store.ErrStartAfterEnd + return nil, storeerrors.ErrStartAfterEnd } return newIterator(db, storeKey, version, start, end, true) diff --git a/tests/go.mod b/tests/go.mod index 431bc08d0a74..d90beda7a4c1 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -18,7 +18,7 @@ require ( cosmossdk.io/x/feegrant v0.0.0-20230613133644-0a778132a60f cosmossdk.io/x/nft v0.0.0-20230613133644-0a778132a60f cosmossdk.io/x/protocolpool v0.0.0-20230925135524-a1bc045b3190 - cosmossdk.io/x/tx v0.13.0 + cosmossdk.io/x/tx v0.13.1 cosmossdk.io/x/upgrade v0.0.0-20230613133644-0a778132a60f github.com/cometbft/cometbft v0.38.5 github.com/cosmos/cosmos-db v1.0.2 @@ -29,8 +29,8 @@ require ( github.com/golang/mock v1.6.0 github.com/spf13/cobra v1.8.0 github.com/stretchr/testify v1.9.0 - google.golang.org/grpc v1.62.0 - google.golang.org/protobuf v1.32.0 + google.golang.org/grpc v1.62.1 + google.golang.org/protobuf v1.33.0 gotest.tools/v3 v3.5.1 pgregory.net/rapid v1.1.0 ) @@ -114,7 +114,7 @@ require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/glog v1.2.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/golang/protobuf v1.5.3 // indirect + github.com/golang/protobuf v1.5.4 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/btree v1.1.2 // indirect github.com/google/orderedcode v0.0.1 // indirect @@ -169,7 +169,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.19.0 // indirect github.com/prometheus/client_model v0.6.0 // indirect - github.com/prometheus/common v0.49.0 // indirect + github.com/prometheus/common v0.50.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect @@ -203,8 +203,8 @@ require ( golang.org/x/crypto v0.21.0 // indirect golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect golang.org/x/mod v0.15.0 // indirect - golang.org/x/net v0.21.0 // indirect - golang.org/x/oauth2 v0.17.0 // indirect + golang.org/x/net v0.22.0 // indirect + golang.org/x/oauth2 v0.18.0 // indirect golang.org/x/sync v0.6.0 // indirect golang.org/x/sys v0.18.0 // indirect golang.org/x/term v0.18.0 // indirect @@ -250,7 +250,6 @@ replace ( cosmossdk.io/x/protocolpool => ../x/protocolpool cosmossdk.io/x/slashing => ../x/slashing cosmossdk.io/x/staking => ../x/staking - cosmossdk.io/x/tx => ../x/tx cosmossdk.io/x/upgrade => ../x/upgrade ) diff --git a/tests/go.sum b/tests/go.sum index 7f2d8d180071..6c8c39fe2d6f 100644 --- a/tests/go.sum +++ b/tests/go.sum @@ -198,6 +198,8 @@ cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/store v1.0.2 h1:lSg5BTvJBHUDwswNNyeh4K/CbqiHER73VU4nDNb8uk0= cosmossdk.io/store v1.0.2/go.mod h1:EFtENTqVTuWwitGW1VwaBct+yDagk7oG/axBMPH+FXs= +cosmossdk.io/x/tx v0.13.1 h1:Mg+EMp67Pz+NukbJqYxuo8uRp7N/a9uR+oVS9pONtj8= +cosmossdk.io/x/tx v0.13.1/go.mod h1:CBCU6fsRVz23QGFIQBb1DNX2DztJCf3jWyEkHY2nJQ0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= @@ -525,8 +527,8 @@ github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -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/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.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -892,8 +894,8 @@ github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt2 github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.49.0 h1:ToNTdK4zSnPVJmh698mGFkDor9wBI/iGaJy5dbH1EgI= -github.com/prometheus/common v0.49.0/go.mod h1:Kxm+EULxRbUkjGU6WFsQqo3ORzB4tyKvlWFOE9mB2sE= +github.com/prometheus/common v0.50.0 h1:YSZE6aa9+luNa2da6/Tik0q0A5AbR+U003TItK57CPQ= +github.com/prometheus/common v0.50.0/go.mod h1:wHFBCEVWVmHMUpg7pYcOm2QUR/ocQdYSJVQJKnHc3xQ= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= @@ -1177,8 +1179,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= -golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= +golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1204,8 +1206,8 @@ golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A= -golang.org/x/oauth2 v0.17.0 h1:6m3ZPmLEFdVxKKWnKq4VqZ60gutO35zm+zrAHVmHyDQ= -golang.org/x/oauth2 v0.17.0/go.mod h1:OzPDGQiuQMguemayvdylqddI7qcD9lnSDb+1FiwQ5HA= +golang.org/x/oauth2 v0.18.0 h1:09qnuIAgzdx1XplqJvW6CQqMCtGZykZWcXzPMPUusvI= +golang.org/x/oauth2 v0.18.0/go.mod h1:Wf7knwG0MPoWIMMBgFlEaSUDaKskp0dCfrlJRJXbBi8= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 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= @@ -1632,8 +1634,8 @@ google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk= -google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -1650,8 +1652,9 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= 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-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/tests/integration/evidence/genesis_test.go b/tests/integration/evidence/genesis_test.go index 902bc3f23d15..c2cb89c406fc 100644 --- a/tests/integration/evidence/genesis_test.go +++ b/tests/integration/evidence/genesis_test.go @@ -105,13 +105,12 @@ func (suite *GenesisTestSuite) TestInitGenesis() { tc.malleate() if tc.expPass { - suite.NotPanics(func() { - evidence.InitGenesis(suite.ctx, suite.keeper, genesisState) - }) + err := evidence.InitGenesis(suite.ctx, suite.keeper, genesisState) + suite.NoError(err) } else { - suite.Panics(func() { - evidence.InitGenesis(suite.ctx, suite.keeper, genesisState) - }) + err := evidence.InitGenesis(suite.ctx, suite.keeper, genesisState) + suite.Error(err) + } tc.posttests() @@ -151,13 +150,13 @@ func (suite *GenesisTestSuite) TestExportGenesis() { tc.malleate() if tc.expPass { - suite.NotPanics(func() { - evidence.ExportGenesis(suite.ctx, suite.keeper) - }) + + _, err := evidence.ExportGenesis(suite.ctx, suite.keeper) + suite.Require().NoError(err) + } else { - suite.Panics(func() { - evidence.ExportGenesis(suite.ctx, suite.keeper) - }) + _, err := evidence.ExportGenesis(suite.ctx, suite.keeper) + suite.Require().Error(err) } tc.posttests() diff --git a/tests/integration/evidence/keeper/infraction_test.go b/tests/integration/evidence/keeper/infraction_test.go index 5c9977d6c7c6..4dcc9b3e8298 100644 --- a/tests/integration/evidence/keeper/infraction_test.go +++ b/tests/integration/evidence/keeper/infraction_test.go @@ -141,7 +141,7 @@ func initFixture(tb testing.TB) *fixture { bankModule := bank.NewAppModule(cdc, bankKeeper, accountKeeper) stakingModule := staking.NewAppModule(cdc, stakingKeeper, accountKeeper, bankKeeper) slashingModule := slashing.NewAppModule(cdc, slashingKeeper, accountKeeper, bankKeeper, stakingKeeper, cdc.InterfaceRegistry()) - evidenceModule := evidence.NewAppModule(*evidenceKeeper) + evidenceModule := evidence.NewAppModule(cdc, *evidenceKeeper) integrationApp := integration.NewIntegrationApp(newCtx, logger, keys, cdc, encodingCfg.InterfaceRegistry.SigningContext().AddressCodec(), diff --git a/tests/integration/gov/genesis_test.go b/tests/integration/gov/genesis_test.go index 265ecb66d94c..86599ff3073c 100644 --- a/tests/integration/gov/genesis_test.go +++ b/tests/integration/gov/genesis_test.go @@ -204,23 +204,26 @@ func TestImportExportQueues_ErrorUnconsistentState(t *testing.T) { suite := createTestSuite(t) app := suite.app ctx := app.BaseApp.NewContext(false) - require.Panics(t, func() { - gov.InitGenesis(ctx, suite.AccountKeeper, suite.BankKeeper, suite.GovKeeper, &v1.GenesisState{ - Deposits: v1.Deposits{ - { - ProposalId: 1234, - Depositor: "me", - Amount: sdk.Coins{ - sdk.NewCoin( - "stake", - sdkmath.NewInt(1234), - ), - }, + + params := v1.DefaultParams() + err := gov.InitGenesis(ctx, suite.AccountKeeper, suite.BankKeeper, suite.GovKeeper, &v1.GenesisState{ + Deposits: v1.Deposits{ + { + ProposalId: 1234, + Depositor: "me", + Amount: sdk.Coins{ + sdk.NewCoin( + "stake", + sdkmath.NewInt(1234), + ), }, }, - }) + }, + Params: ¶ms, }) - gov.InitGenesis(ctx, suite.AccountKeeper, suite.BankKeeper, suite.GovKeeper, v1.DefaultGenesisState()) + require.Error(t, err) + err = gov.InitGenesis(ctx, suite.AccountKeeper, suite.BankKeeper, suite.GovKeeper, v1.DefaultGenesisState()) + require.NoError(t, err) genState, err := gov.ExportGenesis(ctx, suite.GovKeeper) require.NoError(t, err) require.Equal(t, genState, v1.DefaultGenesisState()) diff --git a/tests/starship/tests/go.mod b/tests/starship/tests/go.mod index 0587601091cf..1c1722ff811b 100644 --- a/tests/starship/tests/go.mod +++ b/tests/starship/tests/go.mod @@ -34,7 +34,6 @@ replace ( cosmossdk.io/x/protocolpool => ../../../x/protocolpool cosmossdk.io/x/slashing => ../../../x/slashing cosmossdk.io/x/staking => ../../../x/staking - cosmossdk.io/x/tx => ../../../x/tx cosmossdk.io/x/upgrade => ../../../x/upgrade ) @@ -47,7 +46,7 @@ require ( github.com/cosmos/cosmos-db v1.0.2 github.com/cosmos/cosmos-sdk v0.51.0 github.com/stretchr/testify v1.9.0 - google.golang.org/grpc v1.62.0 + google.golang.org/grpc v1.62.1 gopkg.in/yaml.v3 v3.0.1 ) @@ -79,7 +78,7 @@ require ( cosmossdk.io/x/protocolpool v0.0.0-20230925135524-a1bc045b3190 // indirect cosmossdk.io/x/slashing v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 // indirect - cosmossdk.io/x/tx v0.13.0 // indirect + cosmossdk.io/x/tx v0.13.1 // indirect cosmossdk.io/x/upgrade v0.0.0-20230613133644-0a778132a60f // indirect filippo.io/edwards25519 v1.1.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect @@ -138,7 +137,7 @@ require ( github.com/golang/glog v1.2.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/mock v1.6.0 // indirect - github.com/golang/protobuf v1.5.3 // indirect + github.com/golang/protobuf v1.5.4 // 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 @@ -197,7 +196,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.19.0 // indirect github.com/prometheus/client_model v0.6.0 // indirect - github.com/prometheus/common v0.49.0 // indirect + github.com/prometheus/common v0.50.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect @@ -233,8 +232,8 @@ require ( golang.org/x/crypto v0.21.0 // indirect golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect golang.org/x/mod v0.15.0 // indirect - golang.org/x/net v0.21.0 // indirect - golang.org/x/oauth2 v0.17.0 // indirect + golang.org/x/net v0.22.0 // indirect + golang.org/x/oauth2 v0.18.0 // indirect golang.org/x/sync v0.6.0 // indirect golang.org/x/sys v0.18.0 // indirect golang.org/x/term v0.18.0 // indirect @@ -246,7 +245,7 @@ require ( google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c // indirect - google.golang.org/protobuf v1.32.0 // indirect + google.golang.org/protobuf v1.33.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gotest.tools/v3 v3.5.1 // indirect nhooyr.io/websocket v1.8.6 // indirect diff --git a/tests/starship/tests/go.sum b/tests/starship/tests/go.sum index f354c4c32409..b76abfe72a07 100644 --- a/tests/starship/tests/go.sum +++ b/tests/starship/tests/go.sum @@ -198,6 +198,8 @@ cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/store v1.0.2 h1:lSg5BTvJBHUDwswNNyeh4K/CbqiHER73VU4nDNb8uk0= cosmossdk.io/store v1.0.2/go.mod h1:EFtENTqVTuWwitGW1VwaBct+yDagk7oG/axBMPH+FXs= +cosmossdk.io/x/tx v0.13.1 h1:Mg+EMp67Pz+NukbJqYxuo8uRp7N/a9uR+oVS9pONtj8= +cosmossdk.io/x/tx v0.13.1/go.mod h1:CBCU6fsRVz23QGFIQBb1DNX2DztJCf3jWyEkHY2nJQ0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= @@ -525,8 +527,8 @@ github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -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/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.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -892,8 +894,8 @@ github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt2 github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.49.0 h1:ToNTdK4zSnPVJmh698mGFkDor9wBI/iGaJy5dbH1EgI= -github.com/prometheus/common v0.49.0/go.mod h1:Kxm+EULxRbUkjGU6WFsQqo3ORzB4tyKvlWFOE9mB2sE= +github.com/prometheus/common v0.50.0 h1:YSZE6aa9+luNa2da6/Tik0q0A5AbR+U003TItK57CPQ= +github.com/prometheus/common v0.50.0/go.mod h1:wHFBCEVWVmHMUpg7pYcOm2QUR/ocQdYSJVQJKnHc3xQ= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= @@ -1177,8 +1179,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= -golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= +golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1204,8 +1206,8 @@ golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A= -golang.org/x/oauth2 v0.17.0 h1:6m3ZPmLEFdVxKKWnKq4VqZ60gutO35zm+zrAHVmHyDQ= -golang.org/x/oauth2 v0.17.0/go.mod h1:OzPDGQiuQMguemayvdylqddI7qcD9lnSDb+1FiwQ5HA= +golang.org/x/oauth2 v0.18.0 h1:09qnuIAgzdx1XplqJvW6CQqMCtGZykZWcXzPMPUusvI= +golang.org/x/oauth2 v0.18.0/go.mod h1:Wf7knwG0MPoWIMMBgFlEaSUDaKskp0dCfrlJRJXbBi8= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 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= @@ -1633,8 +1635,8 @@ google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk= -google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -1651,8 +1653,9 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= 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-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/testutil/integration/router.go b/testutil/integration/router.go index 45fa80dbbf44..9bf25657cff7 100644 --- a/testutil/integration/router.go +++ b/testutil/integration/router.go @@ -64,7 +64,9 @@ func NewIntegrationApp( bApp.SetInitChainer(func(ctx sdk.Context, _ *cmtabcitypes.RequestInitChain) (*cmtabcitypes.ResponseInitChain, error) { for _, mod := range modules { if m, ok := mod.(module.HasGenesis); ok { - m.InitGenesis(ctx, appCodec, m.DefaultGenesis(appCodec)) + if err := m.InitGenesis(ctx, m.DefaultGenesis()); err != nil { + return nil, err + } } } diff --git a/testutil/mock/types_mock_appmodule.go b/testutil/mock/types_mock_appmodule.go index 29669fdc6183..6118f774fd9f 100644 --- a/testutil/mock/types_mock_appmodule.go +++ b/testutil/mock/types_mock_appmodule.go @@ -10,11 +10,9 @@ import ( reflect "reflect" appmodule "cosmossdk.io/core/appmodule" - "cosmossdk.io/core/registry" + registry "cosmossdk.io/core/registry" types "github.com/cometbft/cometbft/abci/types" - client "github.com/cosmos/cosmos-sdk/client" - codec "github.com/cosmos/cosmos-sdk/codec" - types1 "github.com/cosmos/cosmos-sdk/types" + types0 "github.com/cosmos/cosmos-sdk/types" module "github.com/cosmos/cosmos-sdk/types/module" gomock "github.com/golang/mock/gomock" ) @@ -57,17 +55,17 @@ func (mr *MockAppModuleWithAllExtensionsMockRecorder) ConsensusVersion() *gomock } // DefaultGenesis mocks base method. -func (m *MockAppModuleWithAllExtensions) DefaultGenesis(arg0 codec.JSONCodec) json.RawMessage { +func (m *MockAppModuleWithAllExtensions) DefaultGenesis() json.RawMessage { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DefaultGenesis", arg0) + ret := m.ctrl.Call(m, "DefaultGenesis") ret0, _ := ret[0].(json.RawMessage) return ret0 } // DefaultGenesis indicates an expected call of DefaultGenesis. -func (mr *MockAppModuleWithAllExtensionsMockRecorder) DefaultGenesis(arg0 interface{}) *gomock.Call { +func (mr *MockAppModuleWithAllExtensionsMockRecorder) DefaultGenesis() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DefaultGenesis", reflect.TypeOf((*MockAppModuleWithAllExtensions)(nil).DefaultGenesis), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DefaultGenesis", reflect.TypeOf((*MockAppModuleWithAllExtensions)(nil).DefaultGenesis)) } // EndBlock mocks base method. @@ -86,29 +84,32 @@ func (mr *MockAppModuleWithAllExtensionsMockRecorder) EndBlock(arg0 interface{}) } // ExportGenesis mocks base method. -func (m *MockAppModuleWithAllExtensions) ExportGenesis(arg0 context.Context, arg1 codec.JSONCodec) json.RawMessage { +func (m *MockAppModuleWithAllExtensions) ExportGenesis(ctx context.Context) (json.RawMessage, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ExportGenesis", arg0, arg1) + ret := m.ctrl.Call(m, "ExportGenesis", ctx) ret0, _ := ret[0].(json.RawMessage) - return ret0 + ret1, _ := ret[1].(error) + return ret0, ret1 } // ExportGenesis indicates an expected call of ExportGenesis. -func (mr *MockAppModuleWithAllExtensionsMockRecorder) ExportGenesis(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAppModuleWithAllExtensionsMockRecorder) ExportGenesis(ctx interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExportGenesis", reflect.TypeOf((*MockAppModuleWithAllExtensions)(nil).ExportGenesis), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExportGenesis", reflect.TypeOf((*MockAppModuleWithAllExtensions)(nil).ExportGenesis), ctx) } // InitGenesis mocks base method. -func (m *MockAppModuleWithAllExtensions) InitGenesis(arg0 context.Context, arg1 codec.JSONCodec, arg2 json.RawMessage) { +func (m *MockAppModuleWithAllExtensions) InitGenesis(ctx context.Context, data json.RawMessage) error { m.ctrl.T.Helper() - m.ctrl.Call(m, "InitGenesis", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "InitGenesis", ctx, data) + ret0, _ := ret[0].(error) + return ret0 } // InitGenesis indicates an expected call of InitGenesis. -func (mr *MockAppModuleWithAllExtensionsMockRecorder) InitGenesis(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockAppModuleWithAllExtensionsMockRecorder) InitGenesis(ctx, data interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InitGenesis", reflect.TypeOf((*MockAppModuleWithAllExtensions)(nil).InitGenesis), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InitGenesis", reflect.TypeOf((*MockAppModuleWithAllExtensions)(nil).InitGenesis), ctx, data) } // IsAppModule mocks base method. @@ -162,7 +163,7 @@ func (mr *MockAppModuleWithAllExtensionsMockRecorder) RegisterInterfaces(arg0 in } // RegisterInvariants mocks base method. -func (m *MockAppModuleWithAllExtensions) RegisterInvariants(arg0 types1.InvariantRegistry) { +func (m *MockAppModuleWithAllExtensions) RegisterInvariants(arg0 types0.InvariantRegistry) { m.ctrl.T.Helper() m.ctrl.Call(m, "RegisterInvariants", arg0) } @@ -186,17 +187,17 @@ func (mr *MockAppModuleWithAllExtensionsMockRecorder) RegisterServices(arg0 inte } // ValidateGenesis mocks base method. -func (m *MockAppModuleWithAllExtensions) ValidateGenesis(arg0 codec.JSONCodec, arg1 client.TxEncodingConfig, arg2 json.RawMessage) error { +func (m *MockAppModuleWithAllExtensions) ValidateGenesis(data json.RawMessage) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ValidateGenesis", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "ValidateGenesis", data) ret0, _ := ret[0].(error) return ret0 } // ValidateGenesis indicates an expected call of ValidateGenesis. -func (mr *MockAppModuleWithAllExtensionsMockRecorder) ValidateGenesis(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockAppModuleWithAllExtensionsMockRecorder) ValidateGenesis(data interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidateGenesis", reflect.TypeOf((*MockAppModuleWithAllExtensions)(nil).ValidateGenesis), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidateGenesis", reflect.TypeOf((*MockAppModuleWithAllExtensions)(nil).ValidateGenesis), data) } // MockAppModuleWithAllExtensionsABCI is a mock of AppModuleWithAllExtensionsABCI interface. @@ -237,17 +238,17 @@ func (mr *MockAppModuleWithAllExtensionsABCIMockRecorder) ConsensusVersion() *go } // DefaultGenesis mocks base method. -func (m *MockAppModuleWithAllExtensionsABCI) DefaultGenesis(arg0 codec.JSONCodec) json.RawMessage { +func (m *MockAppModuleWithAllExtensionsABCI) DefaultGenesis() json.RawMessage { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DefaultGenesis", arg0) + ret := m.ctrl.Call(m, "DefaultGenesis") ret0, _ := ret[0].(json.RawMessage) return ret0 } // DefaultGenesis indicates an expected call of DefaultGenesis. -func (mr *MockAppModuleWithAllExtensionsABCIMockRecorder) DefaultGenesis(arg0 interface{}) *gomock.Call { +func (mr *MockAppModuleWithAllExtensionsABCIMockRecorder) DefaultGenesis() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DefaultGenesis", reflect.TypeOf((*MockAppModuleWithAllExtensionsABCI)(nil).DefaultGenesis), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DefaultGenesis", reflect.TypeOf((*MockAppModuleWithAllExtensionsABCI)(nil).DefaultGenesis)) } // EndBlock mocks base method. @@ -266,31 +267,31 @@ func (mr *MockAppModuleWithAllExtensionsABCIMockRecorder) EndBlock(arg0 interfac } // ExportGenesis mocks base method. -func (m *MockAppModuleWithAllExtensionsABCI) ExportGenesis(arg0 context.Context, arg1 codec.JSONCodec) json.RawMessage { +func (m *MockAppModuleWithAllExtensionsABCI) ExportGenesis(arg0 context.Context) json.RawMessage { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ExportGenesis", arg0, arg1) + ret := m.ctrl.Call(m, "ExportGenesis", arg0) ret0, _ := ret[0].(json.RawMessage) return ret0 } // ExportGenesis indicates an expected call of ExportGenesis. -func (mr *MockAppModuleWithAllExtensionsABCIMockRecorder) ExportGenesis(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAppModuleWithAllExtensionsABCIMockRecorder) ExportGenesis(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExportGenesis", reflect.TypeOf((*MockAppModuleWithAllExtensionsABCI)(nil).ExportGenesis), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExportGenesis", reflect.TypeOf((*MockAppModuleWithAllExtensionsABCI)(nil).ExportGenesis), arg0) } // InitGenesis mocks base method. -func (m *MockAppModuleWithAllExtensionsABCI) InitGenesis(arg0 context.Context, arg1 codec.JSONCodec, arg2 json.RawMessage) []types.ValidatorUpdate { +func (m *MockAppModuleWithAllExtensionsABCI) InitGenesis(arg0 context.Context, arg1 json.RawMessage) []types.ValidatorUpdate { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "InitGenesis", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "InitGenesis", arg0, arg1) ret0, _ := ret[0].([]types.ValidatorUpdate) return ret0 } // InitGenesis indicates an expected call of InitGenesis. -func (mr *MockAppModuleWithAllExtensionsABCIMockRecorder) InitGenesis(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockAppModuleWithAllExtensionsABCIMockRecorder) InitGenesis(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InitGenesis", reflect.TypeOf((*MockAppModuleWithAllExtensionsABCI)(nil).InitGenesis), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InitGenesis", reflect.TypeOf((*MockAppModuleWithAllExtensionsABCI)(nil).InitGenesis), arg0, arg1) } // IsAppModule mocks base method. @@ -344,7 +345,7 @@ func (mr *MockAppModuleWithAllExtensionsABCIMockRecorder) RegisterInterfaces(arg } // RegisterInvariants mocks base method. -func (m *MockAppModuleWithAllExtensionsABCI) RegisterInvariants(arg0 types1.InvariantRegistry) { +func (m *MockAppModuleWithAllExtensionsABCI) RegisterInvariants(arg0 types0.InvariantRegistry) { m.ctrl.T.Helper() m.ctrl.Call(m, "RegisterInvariants", arg0) } @@ -368,17 +369,17 @@ func (mr *MockAppModuleWithAllExtensionsABCIMockRecorder) RegisterServices(arg0 } // ValidateGenesis mocks base method. -func (m *MockAppModuleWithAllExtensionsABCI) ValidateGenesis(arg0 codec.JSONCodec, arg1 client.TxEncodingConfig, arg2 json.RawMessage) error { +func (m *MockAppModuleWithAllExtensionsABCI) ValidateGenesis(arg0 json.RawMessage) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ValidateGenesis", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "ValidateGenesis", arg0) ret0, _ := ret[0].(error) return ret0 } // ValidateGenesis indicates an expected call of ValidateGenesis. -func (mr *MockAppModuleWithAllExtensionsABCIMockRecorder) ValidateGenesis(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockAppModuleWithAllExtensionsABCIMockRecorder) ValidateGenesis(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidateGenesis", reflect.TypeOf((*MockAppModuleWithAllExtensionsABCI)(nil).ValidateGenesis), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidateGenesis", reflect.TypeOf((*MockAppModuleWithAllExtensionsABCI)(nil).ValidateGenesis), arg0) } // MockCoreAppModule is a mock of CoreAppModule interface. diff --git a/testutil/mock/types_module_module.go b/testutil/mock/types_module_module.go index 044cca224fa5..b3e6283f509b 100644 --- a/testutil/mock/types_module_module.go +++ b/testutil/mock/types_module_module.go @@ -9,11 +9,11 @@ import ( json "encoding/json" reflect "reflect" - "cosmossdk.io/core/registry" + registry "cosmossdk.io/core/registry" types "github.com/cometbft/cometbft/abci/types" client "github.com/cosmos/cosmos-sdk/client" codec "github.com/cosmos/cosmos-sdk/codec" - types1 "github.com/cosmos/cosmos-sdk/types" + types0 "github.com/cosmos/cosmos-sdk/types" module "github.com/cosmos/cosmos-sdk/types/module" gomock "github.com/golang/mock/gomock" runtime "github.com/grpc-ecosystem/grpc-gateway/runtime" @@ -226,17 +226,17 @@ func (m *MockHasGenesisBasics) EXPECT() *MockHasGenesisBasicsMockRecorder { } // DefaultGenesis mocks base method. -func (m *MockHasGenesisBasics) DefaultGenesis(arg0 codec.JSONCodec) json.RawMessage { +func (m *MockHasGenesisBasics) DefaultGenesis() json.RawMessage { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DefaultGenesis", arg0) + ret := m.ctrl.Call(m, "DefaultGenesis") ret0, _ := ret[0].(json.RawMessage) return ret0 } // DefaultGenesis indicates an expected call of DefaultGenesis. -func (mr *MockHasGenesisBasicsMockRecorder) DefaultGenesis(arg0 interface{}) *gomock.Call { +func (mr *MockHasGenesisBasicsMockRecorder) DefaultGenesis() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DefaultGenesis", reflect.TypeOf((*MockHasGenesisBasics)(nil).DefaultGenesis), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DefaultGenesis", reflect.TypeOf((*MockHasGenesisBasics)(nil).DefaultGenesis)) } // Name mocks base method. @@ -254,17 +254,17 @@ func (mr *MockHasGenesisBasicsMockRecorder) Name() *gomock.Call { } // ValidateGenesis mocks base method. -func (m *MockHasGenesisBasics) ValidateGenesis(arg0 codec.JSONCodec, arg1 client.TxEncodingConfig, arg2 json.RawMessage) error { +func (m *MockHasGenesisBasics) ValidateGenesis(arg0 json.RawMessage) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ValidateGenesis", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "ValidateGenesis", arg0) ret0, _ := ret[0].(error) return ret0 } // ValidateGenesis indicates an expected call of ValidateGenesis. -func (mr *MockHasGenesisBasicsMockRecorder) ValidateGenesis(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockHasGenesisBasicsMockRecorder) ValidateGenesis(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidateGenesis", reflect.TypeOf((*MockHasGenesisBasics)(nil).ValidateGenesis), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidateGenesis", reflect.TypeOf((*MockHasGenesisBasics)(nil).ValidateGenesis), arg0) } // MockHasAminoCodec is a mock of HasAminoCodec interface. @@ -302,41 +302,6 @@ func (mr *MockHasAminoCodecMockRecorder) RegisterLegacyAminoCodec(arg0 interface return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterLegacyAminoCodec", reflect.TypeOf((*MockHasAminoCodec)(nil).RegisterLegacyAminoCodec), arg0) } -// MockHasRegisterInterfaces is a mock of HasRegisterInterfaces interface. -type MockHasRegisterInterfaces struct { - ctrl *gomock.Controller - recorder *MockHasRegisterInterfacesMockRecorder -} - -// MockHasRegisterInterfacesMockRecorder is the mock recorder for MockHasRegisterInterfaces. -type MockHasRegisterInterfacesMockRecorder struct { - mock *MockHasRegisterInterfaces -} - -// NewMockHasRegisterInterfaces creates a new mock instance. -func NewMockHasRegisterInterfaces(ctrl *gomock.Controller) *MockHasRegisterInterfaces { - mock := &MockHasRegisterInterfaces{ctrl: ctrl} - mock.recorder = &MockHasRegisterInterfacesMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockHasRegisterInterfaces) EXPECT() *MockHasRegisterInterfacesMockRecorder { - return m.recorder -} - -// RegisterInterfaces mocks base method. -func (m *MockHasRegisterInterfaces) RegisterInterfaces(arg0 registry.LegacyRegistry) { - m.ctrl.T.Helper() - m.ctrl.Call(m, "RegisterInterfaces", arg0) -} - -// RegisterInterfaces indicates an expected call of RegisterInterfaces. -func (mr *MockHasRegisterInterfacesMockRecorder) RegisterInterfaces(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterInterfaces", reflect.TypeOf((*MockHasRegisterInterfaces)(nil).RegisterInterfaces), arg0) -} - // MockHasGRPCGateway is a mock of HasGRPCGateway interface. type MockHasGRPCGateway struct { ctrl *gomock.Controller @@ -372,97 +337,6 @@ func (mr *MockHasGRPCGatewayMockRecorder) RegisterGRPCGatewayRoutes(arg0, arg1 i return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterGRPCGatewayRoutes", reflect.TypeOf((*MockHasGRPCGateway)(nil).RegisterGRPCGatewayRoutes), arg0, arg1) } -// MockHasGenesis is a mock of HasGenesis interface. -type MockHasGenesis struct { - ctrl *gomock.Controller - recorder *MockHasGenesisMockRecorder -} - -// MockHasGenesisMockRecorder is the mock recorder for MockHasGenesis. -type MockHasGenesisMockRecorder struct { - mock *MockHasGenesis -} - -// NewMockHasGenesis creates a new mock instance. -func NewMockHasGenesis(ctrl *gomock.Controller) *MockHasGenesis { - mock := &MockHasGenesis{ctrl: ctrl} - mock.recorder = &MockHasGenesisMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockHasGenesis) EXPECT() *MockHasGenesisMockRecorder { - return m.recorder -} - -// DefaultGenesis mocks base method. -func (m *MockHasGenesis) DefaultGenesis(arg0 codec.JSONCodec) json.RawMessage { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DefaultGenesis", arg0) - ret0, _ := ret[0].(json.RawMessage) - return ret0 -} - -// DefaultGenesis indicates an expected call of DefaultGenesis. -func (mr *MockHasGenesisMockRecorder) DefaultGenesis(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DefaultGenesis", reflect.TypeOf((*MockHasGenesis)(nil).DefaultGenesis), arg0) -} - -// ExportGenesis mocks base method. -func (m *MockHasGenesis) ExportGenesis(arg0 context.Context, arg1 codec.JSONCodec) json.RawMessage { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ExportGenesis", arg0, arg1) - ret0, _ := ret[0].(json.RawMessage) - return ret0 -} - -// ExportGenesis indicates an expected call of ExportGenesis. -func (mr *MockHasGenesisMockRecorder) ExportGenesis(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExportGenesis", reflect.TypeOf((*MockHasGenesis)(nil).ExportGenesis), arg0, arg1) -} - -// InitGenesis mocks base method. -func (m *MockHasGenesis) InitGenesis(arg0 context.Context, arg1 codec.JSONCodec, arg2 json.RawMessage) { - m.ctrl.T.Helper() - m.ctrl.Call(m, "InitGenesis", arg0, arg1, arg2) -} - -// InitGenesis indicates an expected call of InitGenesis. -func (mr *MockHasGenesisMockRecorder) InitGenesis(arg0, arg1, arg2 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InitGenesis", reflect.TypeOf((*MockHasGenesis)(nil).InitGenesis), arg0, arg1, arg2) -} - -// Name mocks base method. -func (m *MockHasGenesis) Name() string { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Name") - ret0, _ := ret[0].(string) - return ret0 -} - -// Name indicates an expected call of Name. -func (mr *MockHasGenesisMockRecorder) Name() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Name", reflect.TypeOf((*MockHasGenesis)(nil).Name)) -} - -// ValidateGenesis mocks base method. -func (m *MockHasGenesis) ValidateGenesis(arg0 codec.JSONCodec, arg1 client.TxEncodingConfig, arg2 json.RawMessage) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ValidateGenesis", arg0, arg1, arg2) - ret0, _ := ret[0].(error) - return ret0 -} - -// ValidateGenesis indicates an expected call of ValidateGenesis. -func (mr *MockHasGenesisMockRecorder) ValidateGenesis(arg0, arg1, arg2 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidateGenesis", reflect.TypeOf((*MockHasGenesis)(nil).ValidateGenesis), arg0, arg1, arg2) -} - // MockHasABCIGenesis is a mock of HasABCIGenesis interface. type MockHasABCIGenesis struct { ctrl *gomock.Controller @@ -487,45 +361,45 @@ func (m *MockHasABCIGenesis) EXPECT() *MockHasABCIGenesisMockRecorder { } // DefaultGenesis mocks base method. -func (m *MockHasABCIGenesis) DefaultGenesis(arg0 codec.JSONCodec) json.RawMessage { +func (m *MockHasABCIGenesis) DefaultGenesis() json.RawMessage { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DefaultGenesis", arg0) + ret := m.ctrl.Call(m, "DefaultGenesis") ret0, _ := ret[0].(json.RawMessage) return ret0 } // DefaultGenesis indicates an expected call of DefaultGenesis. -func (mr *MockHasABCIGenesisMockRecorder) DefaultGenesis(arg0 interface{}) *gomock.Call { +func (mr *MockHasABCIGenesisMockRecorder) DefaultGenesis() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DefaultGenesis", reflect.TypeOf((*MockHasABCIGenesis)(nil).DefaultGenesis), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DefaultGenesis", reflect.TypeOf((*MockHasABCIGenesis)(nil).DefaultGenesis)) } // ExportGenesis mocks base method. -func (m *MockHasABCIGenesis) ExportGenesis(arg0 context.Context, arg1 codec.JSONCodec) json.RawMessage { +func (m *MockHasABCIGenesis) ExportGenesis(arg0 context.Context) json.RawMessage { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ExportGenesis", arg0, arg1) + ret := m.ctrl.Call(m, "ExportGenesis", arg0) ret0, _ := ret[0].(json.RawMessage) return ret0 } // ExportGenesis indicates an expected call of ExportGenesis. -func (mr *MockHasABCIGenesisMockRecorder) ExportGenesis(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockHasABCIGenesisMockRecorder) ExportGenesis(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExportGenesis", reflect.TypeOf((*MockHasABCIGenesis)(nil).ExportGenesis), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExportGenesis", reflect.TypeOf((*MockHasABCIGenesis)(nil).ExportGenesis), arg0) } // InitGenesis mocks base method. -func (m *MockHasABCIGenesis) InitGenesis(arg0 context.Context, arg1 codec.JSONCodec, arg2 json.RawMessage) []types.ValidatorUpdate { +func (m *MockHasABCIGenesis) InitGenesis(arg0 context.Context, arg1 json.RawMessage) []types.ValidatorUpdate { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "InitGenesis", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "InitGenesis", arg0, arg1) ret0, _ := ret[0].([]types.ValidatorUpdate) return ret0 } // InitGenesis indicates an expected call of InitGenesis. -func (mr *MockHasABCIGenesisMockRecorder) InitGenesis(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockHasABCIGenesisMockRecorder) InitGenesis(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InitGenesis", reflect.TypeOf((*MockHasABCIGenesis)(nil).InitGenesis), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InitGenesis", reflect.TypeOf((*MockHasABCIGenesis)(nil).InitGenesis), arg0, arg1) } // Name mocks base method. @@ -543,17 +417,17 @@ func (mr *MockHasABCIGenesisMockRecorder) Name() *gomock.Call { } // ValidateGenesis mocks base method. -func (m *MockHasABCIGenesis) ValidateGenesis(arg0 codec.JSONCodec, arg1 client.TxEncodingConfig, arg2 json.RawMessage) error { +func (m *MockHasABCIGenesis) ValidateGenesis(arg0 json.RawMessage) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ValidateGenesis", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "ValidateGenesis", arg0) ret0, _ := ret[0].(error) return ret0 } // ValidateGenesis indicates an expected call of ValidateGenesis. -func (mr *MockHasABCIGenesisMockRecorder) ValidateGenesis(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockHasABCIGenesisMockRecorder) ValidateGenesis(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidateGenesis", reflect.TypeOf((*MockHasABCIGenesis)(nil).ValidateGenesis), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidateGenesis", reflect.TypeOf((*MockHasABCIGenesis)(nil).ValidateGenesis), arg0) } // MockHasInvariants is a mock of HasInvariants interface. @@ -580,7 +454,7 @@ func (m *MockHasInvariants) EXPECT() *MockHasInvariantsMockRecorder { } // RegisterInvariants mocks base method. -func (m *MockHasInvariants) RegisterInvariants(arg0 types1.InvariantRegistry) { +func (m *MockHasInvariants) RegisterInvariants(arg0 types0.InvariantRegistry) { m.ctrl.T.Helper() m.ctrl.Call(m, "RegisterInvariants", arg0) } diff --git a/tools/confix/go.mod b/tools/confix/go.mod index 61ddf3d35558..bed27f8df432 100644 --- a/tools/confix/go.mod +++ b/tools/confix/go.mod @@ -72,7 +72,7 @@ require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/glog v1.2.0 // indirect github.com/golang/mock v1.6.0 // indirect - github.com/golang/protobuf v1.5.3 // indirect + github.com/golang/protobuf v1.5.4 // 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 @@ -147,8 +147,8 @@ require ( google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c // indirect - google.golang.org/grpc v1.62.0 // indirect - google.golang.org/protobuf v1.32.0 // indirect + google.golang.org/grpc v1.62.1 // indirect + google.golang.org/protobuf v1.33.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect nhooyr.io/websocket v1.8.6 // indirect diff --git a/tools/confix/go.sum b/tools/confix/go.sum index 2dce2f1323ea..4d0df6b00584 100644 --- a/tools/confix/go.sum +++ b/tools/confix/go.sum @@ -313,8 +313,8 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -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/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.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -964,8 +964,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk= -google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -980,8 +980,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= -google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= 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-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/tools/cosmovisor/go.mod b/tools/cosmovisor/go.mod index b1b001d65339..faa3e3f9983b 100644 --- a/tools/cosmovisor/go.mod +++ b/tools/cosmovisor/go.mod @@ -78,7 +78,7 @@ require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/glog v1.2.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/golang/protobuf v1.5.3 // indirect + github.com/golang/protobuf v1.5.4 // 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 @@ -174,8 +174,8 @@ require ( google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c // indirect - google.golang.org/grpc v1.62.0 // indirect - google.golang.org/protobuf v1.32.0 // indirect + google.golang.org/grpc v1.62.1 // indirect + google.golang.org/protobuf v1.33.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gotest.tools/v3 v3.5.1 // indirect diff --git a/tools/cosmovisor/go.sum b/tools/cosmovisor/go.sum index 50204b78722e..b310dd511383 100644 --- a/tools/cosmovisor/go.sum +++ b/tools/cosmovisor/go.sum @@ -511,8 +511,8 @@ github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -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/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.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -1603,8 +1603,8 @@ google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk= -google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -1621,8 +1621,8 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= -google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= 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-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/tools/hubl/go.mod b/tools/hubl/go.mod index 2becafd77a11..40d58febc528 100644 --- a/tools/hubl/go.mod +++ b/tools/hubl/go.mod @@ -12,8 +12,8 @@ require ( github.com/manifoldco/promptui v0.9.0 github.com/pelletier/go-toml/v2 v2.1.1 github.com/spf13/cobra v1.8.0 - google.golang.org/grpc v1.62.0 - google.golang.org/protobuf v1.32.0 + google.golang.org/grpc v1.62.1 + google.golang.org/protobuf v1.33.0 ) require ( @@ -71,7 +71,7 @@ require ( github.com/gogo/googleapis v1.4.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/glog v1.2.0 // indirect - github.com/golang/protobuf v1.5.3 // indirect + github.com/golang/protobuf v1.5.4 // 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 diff --git a/tools/hubl/go.sum b/tools/hubl/go.sum index 2ab5bdd38afa..b6a948fda5c2 100644 --- a/tools/hubl/go.sum +++ b/tools/hubl/go.sum @@ -313,8 +313,8 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -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/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.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -960,8 +960,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk= -google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -976,8 +976,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= -google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= 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-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/types/coin.go b/types/coin.go index 3f32bc349757..12a05d006cdc 100644 --- a/types/coin.go +++ b/types/coin.go @@ -7,6 +7,7 @@ import ( "regexp" "sort" "strings" + "unicode" "cosmossdk.io/math" ) @@ -865,10 +866,9 @@ func SetCoinDenomRegex(reFn func() string) { func ValidateDenom(denom string) error { if reDnm == nil || reDecCoin == nil { // Convert the string to a byte slice as required by the Ragel-generated function. - denomBytes := []byte(denom) // Call the Ragel-generated function. - if !MatchDenom(denomBytes) { + if !MatchDenom(denom) { return fmt.Errorf("invalid denom: %s", denom) } } else if !reDnm.MatchString(denom) { // If reDnm has been initialized, use it for matching. @@ -878,6 +878,35 @@ func ValidateDenom(denom string) error { return nil } +// isValidRune checks if a given rune is a valid character for a rune. +// It returns true if the rune is a letter, digit, '/', ':', '.', '_', or '-'. +func isValidRune(r rune) bool { + return unicode.IsLetter(r) || unicode.IsDigit(r) || r == '/' || r == ':' || r == '.' || r == '_' || r == '-' +} + +// MatchDenom checks if the given string is a valid denomination. +// A valid denomination must have a length between 3 and 128 characters, +// start with a letter, and only contain valid runes. +func MatchDenom(s string) bool { + length := len(s) + if length < 3 || length > 128 { + return false + } + + firstRune := rune(s[0]) + if !unicode.IsLetter(firstRune) { + return false + } + + for _, r := range s[1:] { + if !isValidRune(r) { + return false + } + } + + return true +} + func mustValidateDenom(denom string) { if err := ValidateDenom(denom); err != nil { panic(err) diff --git a/types/coin_regex.go b/types/coin_regex.go deleted file mode 100644 index ea6134a9b82e..000000000000 --- a/types/coin_regex.go +++ /dev/null @@ -1,173 +0,0 @@ -//line coin_regex.rl:1 -// `coin_regex.go` is generated by regel using `ragel -Z coin_regex.rl`. -// do not directly edit `coin_regex.go`. -// source: types/coin_regex.rl -// nolint:gocritic,unused,ineffassign - -// Regex parsing of denoms were as the following -// reDnmString = `[a-zA-Z][a-zA-Z0-9/:._-]{2,127}` -// reDecAmt = `[[:digit:]]+(?:\.[[:digit:]]+)?|\.[[:digit:]]+` -// reSpc = `[[:space:]]*` - -// reDnm = regexp.MustCompile(fmt.Sprintf(`^%s$`, coinDenomRegex())) -// reDecCoin = regexp.MustCompile(fmt.Sprintf(`^(%s)%s(%s)$`, reDecAmt, reSpc, coinDenomRegex())) - -package types - -func MatchDenom(data []byte) bool { - var _scanner_actions []byte = []byte{ - 0, 1, 0, - } - - var _scanner_key_offsets []byte = []byte{ - 0, 0, 4, 11, - } - - var _scanner_trans_keys []byte = []byte{ - 65, 90, 97, 122, 95, 45, 58, 65, - 90, 97, 122, - } - - var _scanner_single_lengths []byte = []byte{ - 0, 0, 1, 0, - } - - var _scanner_range_lengths []byte = []byte{ - 0, 2, 3, 0, - } - - var _scanner_index_offsets []byte = []byte{ - 0, 0, 3, 8, - } - - var _scanner_indicies []byte = []byte{ - 0, 0, 1, 2, 2, 2, 2, 1, - 1, - } - - var _scanner_trans_targs []byte = []byte{ - 2, 0, 3, - } - - var _scanner_trans_actions []byte = []byte{ - 0, 0, 1, - } - - const scanner_start int = 1 - const scanner_first_final int = 3 - const scanner_error int = 0 - - const scanner_en_main int = 1 - - if len(data) < 3 || len(data) > 128 { - return false - } - cs, p, pe, eof := 0, 0, len(data), len(data) - _ = eof - - { - cs = scanner_start - } - - { - var _klen int - var _trans int - var _acts int - var _nacts uint - var _keys int - if p == pe { - goto _test_eof - } - if cs == 0 { - goto _out - } - _resume: - _keys = int(_scanner_key_offsets[cs]) - _trans = int(_scanner_index_offsets[cs]) - - _klen = int(_scanner_single_lengths[cs]) - if _klen > 0 { - _lower := int(_keys) - var _mid int - _upper := int(_keys + _klen - 1) - for { - if _upper < _lower { - break - } - - _mid = _lower + ((_upper - _lower) >> 1) - switch { - case data[p] < _scanner_trans_keys[_mid]: - _upper = _mid - 1 - case data[p] > _scanner_trans_keys[_mid]: - _lower = _mid + 1 - default: - _trans += int(_mid - int(_keys)) - goto _match - } - } - _keys += _klen - _trans += _klen - } - - _klen = int(_scanner_range_lengths[cs]) - if _klen > 0 { - _lower := int(_keys) - var _mid int - _upper := int(_keys + (_klen << 1) - 2) - for { - if _upper < _lower { - break - } - - _mid = _lower + (((_upper - _lower) >> 1) & ^1) - switch { - case data[p] < _scanner_trans_keys[_mid]: - _upper = _mid - 2 - case data[p] > _scanner_trans_keys[_mid+1]: - _lower = _mid + 2 - default: - _trans += int((_mid - int(_keys)) >> 1) - goto _match - } - } - _trans += _klen - } - - _match: - _trans = int(_scanner_indicies[_trans]) - cs = int(_scanner_trans_targs[_trans]) - - if _scanner_trans_actions[_trans] == 0 { - goto _again - } - - _acts = int(_scanner_trans_actions[_trans]) - _nacts = uint(_scanner_actions[_acts]) - _acts++ - for ; _nacts > 0; _nacts-- { - _acts++ - switch _scanner_actions[_acts-1] { - case 0: - return true - } - } - - _again: - if cs == 0 { - goto _out - } - p++ - if p != pe { - goto _resume - } - _test_eof: - { - } - _out: - { - } - } - - return false -} diff --git a/types/coin_regex.rl b/types/coin_regex.rl deleted file mode 100644 index 4a4355162b89..000000000000 --- a/types/coin_regex.rl +++ /dev/null @@ -1,40 +0,0 @@ -// `coin_regex.go` is generated by regel using `ragel -Z coin_regex.rl`. -// do not directly edit `coin_regex.go`. -// source: types/coin_regex.rl -// nolint:gocritic,unused,ineffassign - - -// Regex parsing of denoms were as the following -// reDnmString = `[a-zA-Z][a-zA-Z0-9/:._-]{2,127}` -// reDecAmt = `[[:digit:]]+(?:\.[[:digit:]]+)?|\.[[:digit:]]+` -// reSpc = `[[:space:]]*` - -// reDnm = regexp.MustCompile(fmt.Sprintf(`^%s$`, coinDenomRegex())) -// reDecCoin = regexp.MustCompile(fmt.Sprintf(`^(%s)%s(%s)$`, reDecAmt, reSpc, coinDenomRegex())) - -package types - -func MatchDenom(data []byte) bool { -%% machine scanner; -%% write data; - - if len(data) < 3 || len(data) > 128 { - return false - } - cs, p, pe, eof := 0, 0, len(data), len(data) - _ = eof - %%{ - # Define character classes - special = '/' | ':' | '.' | '_' | '-'; - - denom_pattern = [a-zA-Z] (alnum | special); - - - # Combined pattern for matching either a denomination or a decimal amount - main := denom_pattern @{ return true }; - - write init; - write exec; - }%% - return false -} \ No newline at end of file diff --git a/types/coin_test.go b/types/coin_test.go index e805a407e160..42fd51768e0a 100644 --- a/types/coin_test.go +++ b/types/coin_test.go @@ -1021,6 +1021,33 @@ func (s *coinTestSuite) TestParseCoins() { } } +func (s *coinTestSuite) TestValidateDenom() { + cases := []struct { + input string + valid bool + }{ + {"", false}, + {"stake", true}, + {"stake,", false}, + {"me coin", false}, + {"me coin much", false}, + {"not a coin", false}, + {"foo:bar", true}, // special characters '/' | ':' | '.' | '_' | '-' are allowed + {"atom10", true}, // number in denom is allowed + {"transfer/channelToA/uatom", true}, + {"ibc/7F1D3FCF4AE79E1554D670D1AD949A9BA4E4A3C76C63093E17E446A46061A7A2", true}, + } + + for _, tc := range cases { + err := sdk.ValidateDenom(tc.input) + if !tc.valid { + s.Require().Error(err) + } else { + s.Require().NoError(err) + } + } +} + func (s *coinTestSuite) TestSortCoins() { good := sdk.Coins{ sdk.NewInt64Coin("gas", 1), diff --git a/types/module/core_module.go b/types/module/core_module.go index ae3101043603..7b59b430c019 100644 --- a/types/module/core_module.go +++ b/types/module/core_module.go @@ -43,8 +43,8 @@ type coreAppModuleAdaptor struct { } // DefaultGenesis implements HasGenesis -func (c coreAppModuleAdaptor) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - if mod, ok := c.module.(appmodule.HasGenesis); ok { +func (c coreAppModuleAdaptor) DefaultGenesis() json.RawMessage { + if mod, ok := c.module.(appmodule.HasGenesisAuto); ok { target := genesis.RawJSONTarget{} err := mod.DefaultGenesis(target.Target()) if err != nil { @@ -60,15 +60,19 @@ func (c coreAppModuleAdaptor) DefaultGenesis(cdc codec.JSONCodec) json.RawMessag } if mod, ok := c.module.(HasGenesisBasics); ok { - return mod.DefaultGenesis(cdc) + return mod.DefaultGenesis() + } + + if mod, ok := c.module.(HasGenesis); ok { + return mod.DefaultGenesis() } return nil } // ValidateGenesis implements HasGenesis -func (c coreAppModuleAdaptor) ValidateGenesis(cdc codec.JSONCodec, txConfig client.TxEncodingConfig, bz json.RawMessage) error { - if mod, ok := c.module.(appmodule.HasGenesis); ok { +func (c coreAppModuleAdaptor) ValidateGenesis(bz json.RawMessage) error { + if mod, ok := c.module.(appmodule.HasGenesisAuto); ok { source, err := genesis.SourceFromRawJSON(bz) if err != nil { return err @@ -80,15 +84,19 @@ func (c coreAppModuleAdaptor) ValidateGenesis(cdc codec.JSONCodec, txConfig clie } if mod, ok := c.module.(HasGenesisBasics); ok { - return mod.ValidateGenesis(cdc, txConfig, bz) + return mod.ValidateGenesis(bz) + } + + if mod, ok := c.module.(HasGenesis); ok { + return mod.ValidateGenesis(bz) } return nil } // ExportGenesis implements HasGenesis -func (c coreAppModuleAdaptor) ExportGenesis(ctx context.Context, cdc codec.JSONCodec) json.RawMessage { - if module, ok := c.module.(appmodule.HasGenesis); ok { +func (c coreAppModuleAdaptor) ExportGenesis(ctx context.Context) json.RawMessage { + if module, ok := c.module.(appmodule.HasGenesisAuto); ok { ctx := sdk.UnwrapSDKContext(ctx).WithGasMeter(storetypes.NewInfiniteGasMeter()) // avoid race conditions target := genesis.RawJSONTarget{} err := module.ExportGenesis(ctx, target.Target()) @@ -104,16 +112,24 @@ func (c coreAppModuleAdaptor) ExportGenesis(ctx context.Context, cdc codec.JSONC return rawJSON } + if mod, ok := c.module.(HasABCIGenesis); ok { + return mod.ExportGenesis(ctx) + } + if mod, ok := c.module.(HasGenesis); ok { - return mod.ExportGenesis(ctx, cdc) + eg, err := mod.ExportGenesis(ctx) + if err != nil { + panic(err) + } + return eg } return nil } // InitGenesis implements HasGenesis -func (c coreAppModuleAdaptor) InitGenesis(ctx context.Context, cdc codec.JSONCodec, bz json.RawMessage) []abci.ValidatorUpdate { - if module, ok := c.module.(appmodule.HasGenesis); ok { +func (c coreAppModuleAdaptor) InitGenesis(ctx context.Context, bz json.RawMessage) []abci.ValidatorUpdate { + if module, ok := c.module.(appmodule.HasGenesisAuto); ok { // core API genesis source, err := genesis.SourceFromRawJSON(bz) if err != nil { @@ -126,12 +142,16 @@ func (c coreAppModuleAdaptor) InitGenesis(ctx context.Context, cdc codec.JSONCod } } - if mod, ok := c.module.(HasGenesis); ok { - mod.InitGenesis(ctx, cdc, bz) - return nil - } if mod, ok := c.module.(HasABCIGenesis); ok { - return mod.InitGenesis(ctx, cdc, bz) + return mod.InitGenesis(ctx, bz) + } + + if mod, ok := c.module.(HasGenesis); ok { + err := mod.InitGenesis(ctx, bz) + if err != nil { + panic(err) + } + } return nil } diff --git a/types/module/mock_appmodule_test.go b/types/module/mock_appmodule_test.go index 07c9c6389f51..848280147fb1 100644 --- a/types/module/mock_appmodule_test.go +++ b/types/module/mock_appmodule_test.go @@ -2,6 +2,7 @@ package module_test import ( "cosmossdk.io/core/appmodule" + appmodulev2 "cosmossdk.io/core/appmodule/v2" "github.com/cosmos/cosmos-sdk/types/module" ) @@ -11,7 +12,7 @@ import ( type AppModuleWithAllExtensions interface { module.AppModule module.HasServices - module.HasGenesis + appmodulev2.HasGenesis module.HasInvariants module.HasConsensusVersion module.HasABCIEndBlock @@ -32,10 +33,10 @@ type AppModuleWithAllExtensionsABCI interface { // CoreAppModule is solely here for the purpose of generating // mocks to be used in module tests. type CoreAppModule interface { - appmodule.AppModule - appmodule.HasGenesis - appmodule.HasBeginBlocker - appmodule.HasEndBlocker + appmodulev2.AppModule + appmodule.HasGenesisAuto + appmodulev2.HasBeginBlocker + appmodulev2.HasEndBlocker appmodule.HasPrecommit appmodule.HasPrepareCheckState } diff --git a/types/module/module.go b/types/module/module.go index 48dea14685eb..6dd626f7cd20 100644 --- a/types/module/module.go +++ b/types/module/module.go @@ -32,6 +32,7 @@ import ( "golang.org/x/exp/maps" "cosmossdk.io/core/appmodule" + appmodulev2 "cosmossdk.io/core/appmodule/v2" "cosmossdk.io/core/genesis" "cosmossdk.io/core/registry" errorsmod "cosmossdk.io/errors" @@ -45,8 +46,9 @@ import ( // Deprecated: use the embed extension interfaces instead, when needed. type AppModuleBasic interface { + appmodulev2.HasRegisterInterfaces + HasName - HasRegisterInterfaces HasGRPCGateway HasAminoCodec } @@ -55,10 +57,10 @@ type AppModuleBasic interface { // its functionality has been moved to extension interfaces. // Deprecated: use appmodule.AppModule with a combination of extension interfaces interfaces instead. type AppModule interface { - appmodule.AppModule - HasName - HasRegisterInterfaces + + appmodulev2.AppModule + appmodulev2.HasRegisterInterfaces } // HasName allows the module to provide its own name for legacy purposes. @@ -72,8 +74,8 @@ type HasName interface { type HasGenesisBasics interface { HasName - DefaultGenesis(codec.JSONCodec) json.RawMessage - ValidateGenesis(codec.JSONCodec, client.TxEncodingConfig, json.RawMessage) error + DefaultGenesis() json.RawMessage + ValidateGenesis(json.RawMessage) error } // HasAminoCodec is the interface for modules that have amino codec registration. @@ -83,7 +85,7 @@ type HasAminoCodec interface { } // HasRegisterInterfaces is the interface for modules to register their msg types. -type HasRegisterInterfaces appmodule.HasRegisterInterfaces +type HasRegisterInterfaces appmodulev2.HasRegisterInterfaces // HasGRPCGateway is the interface for modules to register their gRPC gateway routes. type HasGRPCGateway interface { @@ -91,17 +93,13 @@ type HasGRPCGateway interface { } // HasGenesis is the extension interface for stateful genesis methods. -type HasGenesis interface { - HasGenesisBasics - InitGenesis(context.Context, codec.JSONCodec, json.RawMessage) - ExportGenesis(context.Context, codec.JSONCodec) json.RawMessage -} +type HasGenesis = appmodulev2.HasGenesis // HasABCIGenesis is the extension interface for stateful genesis methods which returns validator updates. type HasABCIGenesis interface { HasGenesisBasics - InitGenesis(context.Context, codec.JSONCodec, json.RawMessage) []abci.ValidatorUpdate - ExportGenesis(context.Context, codec.JSONCodec) json.RawMessage + InitGenesis(context.Context, json.RawMessage) []abci.ValidatorUpdate + ExportGenesis(context.Context) json.RawMessage } // HasInvariants is the interface for registering invariants. @@ -207,7 +205,7 @@ func NewManagerFromMap(moduleMap map[string]appmodule.AppModule) *Manager { func (m *Manager) SetOrderInitGenesis(moduleNames ...string) { m.assertNoForgottenModules("SetOrderInitGenesis", moduleNames, func(moduleName string) bool { module := m.Modules[moduleName] - if _, hasGenesis := module.(appmodule.HasGenesis); hasGenesis { + if _, hasGenesis := module.(appmodule.HasGenesisAuto); hasGenesis { return !hasGenesis } @@ -225,7 +223,7 @@ func (m *Manager) SetOrderInitGenesis(moduleNames ...string) { func (m *Manager) SetOrderExportGenesis(moduleNames ...string) { m.assertNoForgottenModules("SetOrderExportGenesis", moduleNames, func(moduleName string) bool { module := m.Modules[moduleName] - if _, hasGenesis := module.(appmodule.HasGenesis); hasGenesis { + if _, hasGenesis := module.(appmodule.HasGenesisAuto); hasGenesis { return !hasGenesis } @@ -324,11 +322,11 @@ func (m *Manager) RegisterInterfaces(registry registry.LegacyRegistry) { } // DefaultGenesis provides default genesis information for all modules -func (m *Manager) DefaultGenesis(cdc codec.JSONCodec) map[string]json.RawMessage { +func (m *Manager) DefaultGenesis() map[string]json.RawMessage { genesisData := make(map[string]json.RawMessage) for _, b := range m.Modules { if mod, ok := b.(HasGenesisBasics); ok { - genesisData[mod.Name()] = mod.DefaultGenesis(cdc) + genesisData[mod.Name()] = mod.DefaultGenesis() } else if mod, ok := b.(HasName); ok { genesisData[mod.Name()] = []byte("{}") } @@ -338,11 +336,11 @@ func (m *Manager) DefaultGenesis(cdc codec.JSONCodec) map[string]json.RawMessage } // ValidateGenesis performs genesis state validation for all modules -func (m *Manager) ValidateGenesis(cdc codec.JSONCodec, txEncCfg client.TxEncodingConfig, genesisData map[string]json.RawMessage) error { +func (m *Manager) ValidateGenesis(genesisData map[string]json.RawMessage) error { for _, b := range m.Modules { // first check if the module is an adapted Core API Module if mod, ok := b.(HasGenesisBasics); ok { - if err := mod.ValidateGenesis(cdc, txEncCfg, genesisData[mod.Name()]); err != nil { + if err := mod.ValidateGenesis(genesisData[mod.Name()]); err != nil { return err } } @@ -427,7 +425,7 @@ func (m *Manager) RegisterServices(cfg Configurator) error { // InitGenesis performs init genesis functionality for modules. Exactly one // module must return a non-empty validator set update to correctly initialize // the chain. -func (m *Manager) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, genesisData map[string]json.RawMessage) (*abci.ResponseInitChain, error) { +func (m *Manager) InitGenesis(ctx sdk.Context, _ codec.JSONCodec, genesisData map[string]json.RawMessage) (*abci.ResponseInitChain, error) { var validatorUpdates []abci.ValidatorUpdate ctx.Logger().Info("initializing blockchain state from genesis.json") for _, moduleName := range m.OrderInitGenesis { @@ -437,7 +435,7 @@ func (m *Manager) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, genesisData mod := m.Modules[moduleName] // we might get an adapted module, a native core API module or a legacy module - if module, ok := mod.(appmodule.HasGenesis); ok { + if module, ok := mod.(appmodule.HasGenesisAuto); ok { ctx.Logger().Debug("running initialization for module", "module", moduleName) // core API genesis source, err := genesis.SourceFromRawJSON(genesisData[moduleName]) @@ -451,10 +449,12 @@ func (m *Manager) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, genesisData } } else if module, ok := mod.(HasGenesis); ok { ctx.Logger().Debug("running initialization for module", "module", moduleName) - module.InitGenesis(ctx, cdc, genesisData[moduleName]) + if err := module.InitGenesis(ctx, genesisData[moduleName]); err != nil { + return &abci.ResponseInitChain{}, err + } } else if module, ok := mod.(HasABCIGenesis); ok { ctx.Logger().Debug("running initialization for module", "module", moduleName) - moduleValUpdates := module.InitGenesis(ctx, cdc, genesisData[moduleName]) + moduleValUpdates := module.InitGenesis(ctx, genesisData[moduleName]) // use these validator updates if provided, the module manager assumes // only one module will update the validator set @@ -478,12 +478,12 @@ func (m *Manager) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, genesisData } // ExportGenesis performs export genesis functionality for modules -func (m *Manager) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) (map[string]json.RawMessage, error) { - return m.ExportGenesisForModules(ctx, cdc, []string{}) +func (m *Manager) ExportGenesis(ctx sdk.Context) (map[string]json.RawMessage, error) { + return m.ExportGenesisForModules(ctx, []string{}) } // ExportGenesisForModules performs export genesis functionality for modules -func (m *Manager) ExportGenesisForModules(ctx sdk.Context, cdc codec.JSONCodec, modulesToExport []string) (map[string]json.RawMessage, error) { +func (m *Manager) ExportGenesisForModules(ctx sdk.Context, modulesToExport []string) (map[string]json.RawMessage, error) { if len(modulesToExport) == 0 { modulesToExport = m.OrderExportGenesis } @@ -500,10 +500,10 @@ func (m *Manager) ExportGenesisForModules(ctx sdk.Context, cdc codec.JSONCodec, channels := make(map[string]chan genesisResult) for _, moduleName := range modulesToExport { mod := m.Modules[moduleName] - if module, ok := mod.(appmodule.HasGenesis); ok { + if module, ok := mod.(appmodule.HasGenesisAuto); ok { // core API genesis channels[moduleName] = make(chan genesisResult) - go func(module appmodule.HasGenesis, ch chan genesisResult) { + go func(module appmodule.HasGenesisAuto, ch chan genesisResult) { ctx := ctx.WithGasMeter(storetypes.NewInfiniteGasMeter()) // avoid race conditions target := genesis.RawJSONTarget{} err := module.ExportGenesis(ctx, target.Target()) @@ -524,13 +524,18 @@ func (m *Manager) ExportGenesisForModules(ctx sdk.Context, cdc codec.JSONCodec, channels[moduleName] = make(chan genesisResult) go func(module HasGenesis, ch chan genesisResult) { ctx := ctx.WithGasMeter(storetypes.NewInfiniteGasMeter()) // avoid race conditions - ch <- genesisResult{module.ExportGenesis(ctx, cdc), nil} + jm, err := module.ExportGenesis(ctx) + if err != nil { + ch <- genesisResult{nil, err} + return + } + ch <- genesisResult{jm, nil} }(module, channels[moduleName]) } else if module, ok := mod.(HasABCIGenesis); ok { channels[moduleName] = make(chan genesisResult) go func(module HasABCIGenesis, ch chan genesisResult) { ctx := ctx.WithGasMeter(storetypes.NewInfiniteGasMeter()) // avoid race conditions - ch <- genesisResult{module.ExportGenesis(ctx, cdc), nil} + ch <- genesisResult{module.ExportGenesis(ctx), nil} }(module, channels[moduleName]) } } @@ -678,10 +683,12 @@ func (m Manager) RunMigrations(ctx context.Context, cfg Configurator, fromVM Ver } else { sdkCtx.Logger().Info(fmt.Sprintf("adding a new module: %s", moduleName)) if module, ok := m.Modules[moduleName].(HasGenesis); ok { - module.InitGenesis(sdkCtx, c.cdc, module.DefaultGenesis(c.cdc)) + if err := module.InitGenesis(sdkCtx, module.DefaultGenesis()); err != nil { + return nil, err + } } if module, ok := m.Modules[moduleName].(HasABCIGenesis); ok { - moduleValUpdates := module.InitGenesis(sdkCtx, c.cdc, module.DefaultGenesis(c.cdc)) + moduleValUpdates := module.InitGenesis(sdkCtx, module.DefaultGenesis()) // The module manager assumes only one module will update the // validator set, and it can't be a new module. if len(moduleValUpdates) > 0 { diff --git a/types/module/module_test.go b/types/module/module_test.go index 23a95e583426..535a856448e4 100644 --- a/types/module/module_test.go +++ b/types/module/module_test.go @@ -177,7 +177,7 @@ func TestManager_InitGenesis(t *testing.T) { genesisData := map[string]json.RawMessage{"module1": json.RawMessage(`{"key": "value"}`)} // this should panic since the validator set is empty even after init genesis - mockAppModule1.EXPECT().InitGenesis(gomock.Eq(ctx), gomock.Eq(cdc), gomock.Eq(genesisData["module1"])).Times(1) + mockAppModule1.EXPECT().InitGenesis(gomock.Eq(ctx), gomock.Eq(genesisData["module1"])).Times(1) _, err := mm.InitGenesis(ctx, cdc, genesisData) require.ErrorContains(t, err, "validator set is empty after InitGenesis") @@ -194,16 +194,16 @@ func TestManager_InitGenesis(t *testing.T) { mockAppModuleABCI2.EXPECT().Name().Times(2).Return("module2") mmABCI := module.NewManager(mockAppModuleABCI1, mockAppModuleABCI2) // panic because more than one module returns validator set updates - mockAppModuleABCI1.EXPECT().InitGenesis(gomock.Eq(ctx), gomock.Eq(cdc), gomock.Eq(genesisData["module1"])).Times(1).Return([]abci.ValidatorUpdate{{}}) - mockAppModuleABCI2.EXPECT().InitGenesis(gomock.Eq(ctx), gomock.Eq(cdc), gomock.Eq(genesisData["module2"])).Times(1).Return([]abci.ValidatorUpdate{{}}) + mockAppModuleABCI1.EXPECT().InitGenesis(gomock.Eq(ctx), gomock.Eq(genesisData["module1"])).Times(1).Return([]abci.ValidatorUpdate{{}}) + mockAppModuleABCI2.EXPECT().InitGenesis(gomock.Eq(ctx), gomock.Eq(genesisData["module2"])).Times(1).Return([]abci.ValidatorUpdate{{}}) _, err = mmABCI.InitGenesis(ctx, cdc, genesisData) require.ErrorContains(t, err, "validator InitGenesis updates already set by a previous module") // happy path mm2 := module.NewManager(mockAppModuleABCI1, mockAppModule2, module.CoreAppModuleAdaptor("module3", mockAppModule3)) - mockAppModuleABCI1.EXPECT().InitGenesis(gomock.Eq(ctx), gomock.Eq(cdc), gomock.Eq(genesisData["module1"])).Times(1).Return([]abci.ValidatorUpdate{{}}) - mockAppModule2.EXPECT().InitGenesis(gomock.Eq(ctx), gomock.Eq(cdc), gomock.Eq(genesisData["module2"])).Times(1) + mockAppModuleABCI1.EXPECT().InitGenesis(gomock.Eq(ctx), gomock.Eq(genesisData["module1"])).Times(1).Return([]abci.ValidatorUpdate{{}}) + mockAppModule2.EXPECT().InitGenesis(gomock.Eq(ctx), gomock.Eq(genesisData["module2"])).Times(1) mockAppModule3.EXPECT().InitGenesis(gomock.Eq(ctx), gomock.Any()).Times(1).Return(nil) _, err = mm2.InitGenesis(ctx, cdc, genesisData) require.NoError(t, err) @@ -223,10 +223,8 @@ func TestManager_ExportGenesis(t *testing.T) { require.Equal(t, 3, len(mm.Modules)) ctx := sdk.NewContext(nil, false, log.NewNopLogger()) - interfaceRegistry := types.NewInterfaceRegistry() - cdc := codec.NewProtoCodec(interfaceRegistry) - mockAppModule1.EXPECT().ExportGenesis(gomock.Eq(ctx), gomock.Eq(cdc)).AnyTimes().Return(json.RawMessage(`{"key1": "value1"}`)) - mockAppModule2.EXPECT().ExportGenesis(gomock.Eq(ctx), gomock.Eq(cdc)).AnyTimes().Return(json.RawMessage(`{"key2": "value2"}`)) + mockAppModule1.EXPECT().ExportGenesis(gomock.Eq(ctx)).AnyTimes().Return(json.RawMessage(`{"key1": "value1"}`), nil) + mockAppModule2.EXPECT().ExportGenesis(gomock.Eq(ctx)).AnyTimes().Return(json.RawMessage(`{"key2": "value2"}`), nil) want := map[string]json.RawMessage{ "module1": json.RawMessage(`{"key1": "value1"}`), @@ -236,23 +234,23 @@ func TestManager_ExportGenesis(t *testing.T) { }`), } - res, err := mm.ExportGenesis(ctx, cdc) + res, err := mm.ExportGenesis(ctx) require.NoError(t, err) require.Equal(t, want, res) - res, err = mm.ExportGenesisForModules(ctx, cdc, []string{}) + res, err = mm.ExportGenesisForModules(ctx, []string{}) require.NoError(t, err) require.Equal(t, want, res) - res, err = mm.ExportGenesisForModules(ctx, cdc, []string{"module1"}) + res, err = mm.ExportGenesisForModules(ctx, []string{"module1"}) require.NoError(t, err) require.Equal(t, map[string]json.RawMessage{"module1": json.RawMessage(`{"key1": "value1"}`)}, res) - res, err = mm.ExportGenesisForModules(ctx, cdc, []string{"module2"}) + res, err = mm.ExportGenesisForModules(ctx, []string{"module2"}) require.NoError(t, err) require.NotEqual(t, map[string]json.RawMessage{"module1": json.RawMessage(`{"key1": "value1"}`)}, res) - _, err = mm.ExportGenesisForModules(ctx, cdc, []string{"module1", "modulefoo"}) + _, err = mm.ExportGenesisForModules(ctx, []string{"module1", "modulefoo"}) require.Error(t, err) } @@ -333,8 +331,6 @@ func TestCoreAPIManager_ExportGenesis(t *testing.T) { require.Equal(t, 2, len(mm.Modules)) ctx := sdk.NewContext(nil, false, log.NewNopLogger()) - interfaceRegistry := types.NewInterfaceRegistry() - cdc := codec.NewProtoCodec(interfaceRegistry) want := map[string]json.RawMessage{ "module1": json.RawMessage(`{ "someField": "someKey" @@ -344,23 +340,23 @@ func TestCoreAPIManager_ExportGenesis(t *testing.T) { }`), } - res, err := mm.ExportGenesis(ctx, cdc) + res, err := mm.ExportGenesis(ctx) require.NoError(t, err) require.Equal(t, want, res) - res, err = mm.ExportGenesisForModules(ctx, cdc, []string{}) + res, err = mm.ExportGenesisForModules(ctx, []string{}) require.NoError(t, err) require.Equal(t, want, res) - res, err = mm.ExportGenesisForModules(ctx, cdc, []string{"module1"}) + res, err = mm.ExportGenesisForModules(ctx, []string{"module1"}) require.NoError(t, err) require.Equal(t, map[string]json.RawMessage{"module1": want["module1"]}, res) - res, err = mm.ExportGenesisForModules(ctx, cdc, []string{"module2"}) + res, err = mm.ExportGenesisForModules(ctx, []string{"module2"}) require.NoError(t, err) require.NotEqual(t, map[string]json.RawMessage{"module1": want["module1"]}, res) - _, err = mm.ExportGenesisForModules(ctx, cdc, []string{"module1", "modulefoo"}) + _, err = mm.ExportGenesisForModules(ctx, []string{"module1", "modulefoo"}) require.Error(t, err) } @@ -583,7 +579,7 @@ func (MockCoreAppModule) ExportGenesis(ctx context.Context, target appmodule.Gen } var ( - _ appmodule.AppModule = MockCoreAppModule{} - _ appmodule.HasGenesis = MockCoreAppModule{} - _ appmodule.HasServices = MockCoreAppModule{} + _ appmodule.AppModule = MockCoreAppModule{} + _ appmodule.HasGenesisAuto = MockCoreAppModule{} + _ appmodule.HasServices = MockCoreAppModule{} ) diff --git a/x/accounts/go.mod b/x/accounts/go.mod index 4efa374c2578..4f133da66974 100644 --- a/x/accounts/go.mod +++ b/x/accounts/go.mod @@ -8,14 +8,14 @@ require ( cosmossdk.io/core v0.12.1-0.20231114100755-569e3ff6a0d7 cosmossdk.io/depinject v1.0.0-alpha.4 cosmossdk.io/log v1.3.1 - cosmossdk.io/x/tx v0.13.0 + cosmossdk.io/x/tx v0.13.1 github.com/cosmos/cosmos-sdk v0.51.0 github.com/cosmos/gogoproto v1.4.11 github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 github.com/spf13/cobra v1.8.0 github.com/stretchr/testify v1.9.0 - google.golang.org/grpc v1.62.0 - google.golang.org/protobuf v1.32.0 + google.golang.org/grpc v1.62.1 + google.golang.org/protobuf v1.33.0 ) require ( @@ -74,7 +74,7 @@ require ( github.com/gogo/googleapis v1.4.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/glog v1.2.0 // indirect - github.com/golang/protobuf v1.5.3 // indirect + github.com/golang/protobuf v1.5.4 // 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 @@ -119,7 +119,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.19.0 // indirect github.com/prometheus/client_model v0.6.0 // indirect - github.com/prometheus/common v0.49.0 // indirect + github.com/prometheus/common v0.50.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect @@ -146,7 +146,7 @@ require ( golang.org/x/crypto v0.21.0 // indirect golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect golang.org/x/mod v0.15.0 // indirect - golang.org/x/net v0.21.0 // indirect + golang.org/x/net v0.22.0 // indirect golang.org/x/sync v0.6.0 // indirect golang.org/x/sys v0.18.0 // indirect golang.org/x/term v0.18.0 // indirect @@ -175,5 +175,4 @@ replace ( cosmossdk.io/x/mint => ../mint cosmossdk.io/x/slashing => ../slashing cosmossdk.io/x/staking => ../staking - cosmossdk.io/x/tx => ../tx ) diff --git a/x/accounts/go.sum b/x/accounts/go.sum index ee0266fe8b11..66db8db0555c 100644 --- a/x/accounts/go.sum +++ b/x/accounts/go.sum @@ -14,6 +14,8 @@ cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/store v1.0.2 h1:lSg5BTvJBHUDwswNNyeh4K/CbqiHER73VU4nDNb8uk0= cosmossdk.io/store v1.0.2/go.mod h1:EFtENTqVTuWwitGW1VwaBct+yDagk7oG/axBMPH+FXs= +cosmossdk.io/x/tx v0.13.1 h1:Mg+EMp67Pz+NukbJqYxuo8uRp7N/a9uR+oVS9pONtj8= +cosmossdk.io/x/tx v0.13.1/go.mod h1:CBCU6fsRVz23QGFIQBb1DNX2DztJCf3jWyEkHY2nJQ0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= @@ -296,8 +298,8 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -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/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.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -593,8 +595,8 @@ github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt2 github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.49.0 h1:ToNTdK4zSnPVJmh698mGFkDor9wBI/iGaJy5dbH1EgI= -github.com/prometheus/common v0.49.0/go.mod h1:Kxm+EULxRbUkjGU6WFsQqo3ORzB4tyKvlWFOE9mB2sE= +github.com/prometheus/common v0.50.0 h1:YSZE6aa9+luNa2da6/Tik0q0A5AbR+U003TItK57CPQ= +github.com/prometheus/common v0.50.0/go.mod h1:wHFBCEVWVmHMUpg7pYcOm2QUR/ocQdYSJVQJKnHc3xQ= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= @@ -795,8 +797,8 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= 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.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= +golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -944,8 +946,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk= -google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -960,8 +962,9 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= 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-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/x/accounts/module.go b/x/accounts/module.go index b60ebafb57fa..71a16cff195a 100644 --- a/x/accounts/module.go +++ b/x/accounts/module.go @@ -8,11 +8,11 @@ import ( "google.golang.org/grpc" "cosmossdk.io/core/appmodule" + appmodulev2 "cosmossdk.io/core/appmodule/v2" "cosmossdk.io/core/registry" "cosmossdk.io/x/accounts/cli" v1 "cosmossdk.io/x/accounts/v1" - "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/types/address" "github.com/cosmos/cosmos-sdk/types/module" @@ -36,16 +36,17 @@ var ( _ appmodule.HasServices = AppModule{} _ module.HasName = AppModule{} - _ module.HasGenesis = AppModule{} + _ appmodulev2.HasGenesis = AppModule{} _ module.HasConsensusVersion = AppModule{} ) -func NewAppModule(k Keeper) AppModule { - return AppModule{k: k} +func NewAppModule(cdc codec.Codec, k Keeper) AppModule { + return AppModule{k: k, cdc: cdc} } type AppModule struct { - k Keeper + cdc codec.Codec + k Keeper } func (m AppModule) IsAppModule() {} @@ -67,34 +68,37 @@ func (m AppModule) RegisterServices(registar grpc.ServiceRegistrar) error { // App module genesis -func (AppModule) DefaultGenesis(jsonCodec codec.JSONCodec) json.RawMessage { - return jsonCodec.MustMarshalJSON(&v1.GenesisState{}) +func (am AppModule) DefaultGenesis() json.RawMessage { + return am.cdc.MustMarshalJSON(&v1.GenesisState{}) } -func (AppModule) ValidateGenesis(jsonCodec codec.JSONCodec, config client.TxEncodingConfig, message json.RawMessage) error { +func (am AppModule) ValidateGenesis(message json.RawMessage) error { gs := &v1.GenesisState{} - if err := jsonCodec.UnmarshalJSON(message, gs); err != nil { + if err := am.cdc.UnmarshalJSON(message, gs); err != nil { return err } // Add validation logic for gs here return nil } -func (m AppModule) InitGenesis(ctx context.Context, jsonCodec codec.JSONCodec, message json.RawMessage) { +func (am AppModule) InitGenesis(ctx context.Context, message json.RawMessage) error { gs := &v1.GenesisState{} - jsonCodec.MustUnmarshalJSON(message, gs) - err := m.k.ImportState(ctx, gs) + if err := am.cdc.UnmarshalJSON(message, gs); err != nil { + return err + } + err := am.k.ImportState(ctx, gs) if err != nil { - panic(err) + return err } + return nil } -func (m AppModule) ExportGenesis(ctx context.Context, jsonCodec codec.JSONCodec) json.RawMessage { - gs, err := m.k.ExportState(ctx) +func (am AppModule) ExportGenesis(ctx context.Context) (json.RawMessage, error) { + gs, err := am.k.ExportState(ctx) if err != nil { - panic(err) + return nil, err } - return jsonCodec.MustMarshalJSON(gs) + return am.cdc.MarshalJSON(gs) } func (AppModule) GetTxCmd() *cobra.Command { diff --git a/x/auth/go.mod b/x/auth/go.mod index 4a61bbc152a5..b15108ae1959 100644 --- a/x/auth/go.mod +++ b/x/auth/go.mod @@ -14,22 +14,22 @@ require ( cosmossdk.io/x/accounts v0.0.0-00010101000000-000000000000 cosmossdk.io/x/bank v0.0.0-00010101000000-000000000000 cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 - cosmossdk.io/x/tx v0.13.0 + cosmossdk.io/x/tx v0.13.1 github.com/cometbft/cometbft v0.38.5 github.com/cosmos/cosmos-proto v1.0.0-beta.4 github.com/cosmos/cosmos-sdk v0.51.0 github.com/cosmos/gogoproto v1.4.11 github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 github.com/golang/mock v1.6.0 - github.com/golang/protobuf v1.5.3 + github.com/golang/protobuf v1.5.4 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/spf13/cobra v1.8.0 github.com/spf13/viper v1.18.2 github.com/stretchr/testify v1.9.0 golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014 - google.golang.org/grpc v1.62.0 - google.golang.org/protobuf v1.32.0 + google.golang.org/grpc v1.62.1 + google.golang.org/protobuf v1.33.0 gotest.tools/v3 v3.5.1 pgregory.net/rapid v1.1.0 sigs.k8s.io/yaml v1.4.0 @@ -126,7 +126,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.19.0 // indirect github.com/prometheus/client_model v0.6.0 // indirect - github.com/prometheus/common v0.49.0 // indirect + github.com/prometheus/common v0.50.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect @@ -151,7 +151,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.21.0 // indirect golang.org/x/mod v0.15.0 // indirect - golang.org/x/net v0.21.0 // indirect + golang.org/x/net v0.22.0 // indirect golang.org/x/sync v0.6.0 // indirect golang.org/x/sys v0.18.0 // indirect golang.org/x/term v0.18.0 // indirect @@ -174,5 +174,4 @@ replace ( cosmossdk.io/x/accounts => ../accounts cosmossdk.io/x/bank => ../bank cosmossdk.io/x/staking => ../staking - cosmossdk.io/x/tx => ../tx ) diff --git a/x/auth/go.sum b/x/auth/go.sum index 3fd57a0055b6..119c6de469be 100644 --- a/x/auth/go.sum +++ b/x/auth/go.sum @@ -14,6 +14,8 @@ cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/store v1.0.2 h1:lSg5BTvJBHUDwswNNyeh4K/CbqiHER73VU4nDNb8uk0= cosmossdk.io/store v1.0.2/go.mod h1:EFtENTqVTuWwitGW1VwaBct+yDagk7oG/axBMPH+FXs= +cosmossdk.io/x/tx v0.13.1 h1:Mg+EMp67Pz+NukbJqYxuo8uRp7N/a9uR+oVS9pONtj8= +cosmossdk.io/x/tx v0.13.1/go.mod h1:CBCU6fsRVz23QGFIQBb1DNX2DztJCf3jWyEkHY2nJQ0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= @@ -296,8 +298,8 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -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/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.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -593,8 +595,8 @@ github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt2 github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.49.0 h1:ToNTdK4zSnPVJmh698mGFkDor9wBI/iGaJy5dbH1EgI= -github.com/prometheus/common v0.49.0/go.mod h1:Kxm+EULxRbUkjGU6WFsQqo3ORzB4tyKvlWFOE9mB2sE= +github.com/prometheus/common v0.50.0 h1:YSZE6aa9+luNa2da6/Tik0q0A5AbR+U003TItK57CPQ= +github.com/prometheus/common v0.50.0/go.mod h1:wHFBCEVWVmHMUpg7pYcOm2QUR/ocQdYSJVQJKnHc3xQ= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= @@ -797,8 +799,8 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= 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.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= +golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -948,8 +950,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk= -google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -964,8 +966,9 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= 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-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/x/auth/migrations/legacytx/stdsign.go b/x/auth/migrations/legacytx/stdsign.go index e5a4e454cb90..e8d00f67594c 100644 --- a/x/auth/migrations/legacytx/stdsign.go +++ b/x/auth/migrations/legacytx/stdsign.go @@ -23,7 +23,7 @@ import ( type LegacyMsg interface { sdk.Msg - // Get the canonical byte representation of the Msg. + // GetSignBytes get the canonical byte representation of the Msg. GetSignBytes() []byte } @@ -92,7 +92,7 @@ type StdSignature struct { Signature []byte `json:"signature" yaml:"signature"` } -// Deprecated +// Deprecated: NewStdSignature returns a std signature func NewStdSignature(pk cryptotypes.PubKey, sig []byte) StdSignature { return StdSignature{PubKey: pk, Signature: sig} } diff --git a/x/auth/module.go b/x/auth/module.go index 2a94ab4bad53..d92176043dfb 100644 --- a/x/auth/module.go +++ b/x/auth/module.go @@ -9,6 +9,7 @@ import ( "google.golang.org/grpc" "cosmossdk.io/core/appmodule" + appmodulev2 "cosmossdk.io/core/appmodule/v2" "cosmossdk.io/core/registry" "cosmossdk.io/x/auth/keeper" "cosmossdk.io/x/auth/simulation" @@ -29,7 +30,7 @@ const ( var ( _ module.AppModuleSimulation = AppModule{} _ module.HasName = AppModule{} - _ module.HasGenesis = AppModule{} + _ appmodulev2.HasGenesis = AppModule{} _ appmodule.AppModule = AppModule{} _ appmodule.HasServices = AppModule{} @@ -40,6 +41,7 @@ var ( type AppModule struct { accountKeeper keeper.AccountKeeper randGenAccountsFn types.RandomGenesisAccountsFn + cdc codec.Codec } // IsAppModule implements the appmodule.AppModule interface. @@ -50,6 +52,7 @@ func NewAppModule(cdc codec.Codec, accountKeeper keeper.AccountKeeper, randGenAc return AppModule{ accountKeeper: accountKeeper, randGenAccountsFn: randGenAccountsFn, + cdc: cdc, } } @@ -104,14 +107,14 @@ func (am AppModule) RegisterMigrations(mr appmodule.MigrationRegistrar) error { } // DefaultGenesis returns default genesis state as raw bytes for the auth module. -func (AppModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(types.DefaultGenesisState()) +func (am AppModule) DefaultGenesis() json.RawMessage { + return am.cdc.MustMarshalJSON(types.DefaultGenesisState()) } // ValidateGenesis performs genesis state validation for the auth module. -func (AppModule) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { +func (am AppModule) ValidateGenesis(bz json.RawMessage) error { var data types.GenesisState - if err := cdc.UnmarshalJSON(bz, &data); err != nil { + if err := am.cdc.UnmarshalJSON(bz, &data); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) } @@ -119,23 +122,22 @@ func (AppModule) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingCo } // InitGenesis performs genesis initialization for the auth module. -func (am AppModule) InitGenesis(ctx context.Context, cdc codec.JSONCodec, data json.RawMessage) { +func (am AppModule) InitGenesis(ctx context.Context, data json.RawMessage) error { var genesisState types.GenesisState - cdc.MustUnmarshalJSON(data, &genesisState) - err := am.accountKeeper.InitGenesis(ctx, genesisState) - if err != nil { - panic(err) + if err := am.cdc.UnmarshalJSON(data, &genesisState); err != nil { + return err } + return am.accountKeeper.InitGenesis(ctx, genesisState) } // ExportGenesis returns the exported genesis state as raw bytes for the auth // module. -func (am AppModule) ExportGenesis(ctx context.Context, cdc codec.JSONCodec) json.RawMessage { +func (am AppModule) ExportGenesis(ctx context.Context) (json.RawMessage, error) { gs, err := am.accountKeeper.ExportGenesis(ctx) if err != nil { - panic(err) + return nil, err } - return cdc.MustMarshalJSON(gs) + return am.cdc.MarshalJSON(gs) } // ConsensusVersion implements HasConsensusVersion diff --git a/x/auth/tx/config/depinject.go b/x/auth/tx/config/depinject.go index 85ce366c9b7c..8b553520e929 100644 --- a/x/auth/tx/config/depinject.go +++ b/x/auth/tx/config/depinject.go @@ -164,7 +164,7 @@ func newAnteHandler(txConfig client.TxConfig, in ModuleInputs) (sdk.AnteHandler, // NewBankKeeperCoinMetadataQueryFn creates a new Textual struct using the given // BankKeeper to retrieve coin metadata. // -// This function should be used in the server (app.go) and is already injected thanks to app wiring for app_v2. +// This function should be used in the server (app.go) and is already injected thanks to app wiring for app_di. func NewBankKeeperCoinMetadataQueryFn(bk BankKeeper) textual.CoinMetadataQueryFn { return func(ctx context.Context, denom string) (*bankv1beta1.Metadata, error) { res, err := bk.DenomMetadataV2(ctx, &bankv1beta1.QueryDenomMetadataRequest{Denom: denom}) diff --git a/x/authz/client/cli/tx_test.go b/x/authz/client/cli/tx_test.go index d4b2b5f0aa9f..a9c4d87a96f6 100644 --- a/x/authz/client/cli/tx_test.go +++ b/x/authz/client/cli/tx_test.go @@ -339,7 +339,7 @@ func (s *CLITestSuite) TestCLITxGrantAuthorization() { fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(10))).String()), }, true, - "invalid decimal coin expression", + "invalid character in denomination", }, { "invalid authorization type", diff --git a/x/authz/go.mod b/x/authz/go.mod index a42315213789..8544eaaae5f3 100644 --- a/x/authz/go.mod +++ b/x/authz/go.mod @@ -15,20 +15,20 @@ require ( cosmossdk.io/x/accounts v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/bank v0.0.0-00010101000000-000000000000 cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 - cosmossdk.io/x/tx v0.13.0 + cosmossdk.io/x/tx v0.13.1 github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect github.com/cometbft/cometbft v0.38.5 github.com/cosmos/cosmos-proto v1.0.0-beta.4 github.com/cosmos/cosmos-sdk v0.51.0 github.com/cosmos/gogoproto v1.4.11 github.com/golang/mock v1.6.0 - github.com/golang/protobuf v1.5.3 + github.com/golang/protobuf v1.5.4 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/spf13/cobra v1.8.0 github.com/stretchr/testify v1.9.0 google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014 - google.golang.org/grpc v1.62.0 - google.golang.org/protobuf v1.32.0 + google.golang.org/grpc v1.62.1 + google.golang.org/protobuf v1.33.0 ) require ( @@ -122,7 +122,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.19.0 // indirect github.com/prometheus/client_model v0.6.0 // indirect - github.com/prometheus/common v0.49.0 // indirect + github.com/prometheus/common v0.50.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect @@ -149,7 +149,7 @@ require ( golang.org/x/crypto v0.21.0 // indirect golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect golang.org/x/mod v0.15.0 // indirect - golang.org/x/net v0.21.0 // indirect + golang.org/x/net v0.22.0 // indirect golang.org/x/sync v0.6.0 // indirect golang.org/x/sys v0.18.0 // indirect golang.org/x/term v0.18.0 // indirect @@ -176,5 +176,4 @@ replace ( cosmossdk.io/x/auth => ../auth cosmossdk.io/x/bank => ../bank cosmossdk.io/x/staking => ../staking - cosmossdk.io/x/tx => ../tx ) diff --git a/x/authz/go.sum b/x/authz/go.sum index 3fd57a0055b6..119c6de469be 100644 --- a/x/authz/go.sum +++ b/x/authz/go.sum @@ -14,6 +14,8 @@ cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/store v1.0.2 h1:lSg5BTvJBHUDwswNNyeh4K/CbqiHER73VU4nDNb8uk0= cosmossdk.io/store v1.0.2/go.mod h1:EFtENTqVTuWwitGW1VwaBct+yDagk7oG/axBMPH+FXs= +cosmossdk.io/x/tx v0.13.1 h1:Mg+EMp67Pz+NukbJqYxuo8uRp7N/a9uR+oVS9pONtj8= +cosmossdk.io/x/tx v0.13.1/go.mod h1:CBCU6fsRVz23QGFIQBb1DNX2DztJCf3jWyEkHY2nJQ0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= @@ -296,8 +298,8 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -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/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.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -593,8 +595,8 @@ github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt2 github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.49.0 h1:ToNTdK4zSnPVJmh698mGFkDor9wBI/iGaJy5dbH1EgI= -github.com/prometheus/common v0.49.0/go.mod h1:Kxm+EULxRbUkjGU6WFsQqo3ORzB4tyKvlWFOE9mB2sE= +github.com/prometheus/common v0.50.0 h1:YSZE6aa9+luNa2da6/Tik0q0A5AbR+U003TItK57CPQ= +github.com/prometheus/common v0.50.0/go.mod h1:wHFBCEVWVmHMUpg7pYcOm2QUR/ocQdYSJVQJKnHc3xQ= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= @@ -797,8 +799,8 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= 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.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= +golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -948,8 +950,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk= -google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -964,8 +966,9 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= 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-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/x/authz/keeper/genesis.go b/x/authz/keeper/genesis.go index d7f28d1b07c3..e014f5265748 100644 --- a/x/authz/keeper/genesis.go +++ b/x/authz/keeper/genesis.go @@ -9,7 +9,7 @@ import ( ) // InitGenesis initializes new authz genesis -func (k Keeper) InitGenesis(ctx context.Context, data *authz.GenesisState) { +func (k Keeper) InitGenesis(ctx context.Context, data *authz.GenesisState) error { now := k.environment.HeaderService.GetHeaderInfo(ctx).Time for _, entry := range data.Authorization { // ignore expired authorizations @@ -19,11 +19,11 @@ func (k Keeper) InitGenesis(ctx context.Context, data *authz.GenesisState) { grantee, err := k.authKeeper.AddressCodec().StringToBytes(entry.Grantee) if err != nil { - panic(err) + return err } granter, err := k.authKeeper.AddressCodec().StringToBytes(entry.Granter) if err != nil { - panic(err) + return err } a, ok := entry.Authorization.GetCachedValue().(authz.Authorization) @@ -33,9 +33,10 @@ func (k Keeper) InitGenesis(ctx context.Context, data *authz.GenesisState) { err = k.SaveGrant(ctx, grantee, granter, a, entry.Expiration) if err != nil { - panic(err) + return err } } + return nil } // ExportGenesis returns a GenesisState for a given context. diff --git a/x/authz/keeper/genesis_test.go b/x/authz/keeper/genesis_test.go index 78c15797d297..d913c3bef304 100644 --- a/x/authz/keeper/genesis_test.go +++ b/x/authz/keeper/genesis_test.go @@ -83,7 +83,6 @@ func (suite *GenesisTestSuite) TestImportExportGenesis() { suite.Require().NoError(err) genesis := suite.keeper.ExportGenesis(suite.ctx) - // TODO, recheck! // Clear keeper err = suite.keeper.DeleteGrant(suite.ctx, granteeAddr, granterAddr, grant.MsgTypeURL()) suite.Require().NoError(err) @@ -91,7 +90,8 @@ func (suite *GenesisTestSuite) TestImportExportGenesis() { suite.Require().NotEqual(genesis, newGenesis) suite.Require().Empty(newGenesis) - suite.keeper.InitGenesis(suite.ctx, genesis) + err = suite.keeper.InitGenesis(suite.ctx, genesis) + suite.Require().NoError(err) newGenesis = suite.keeper.ExportGenesis(suite.ctx) suite.Require().Equal(genesis, newGenesis) } diff --git a/x/authz/module/module.go b/x/authz/module/module.go index d11db1bcad8f..65a9d00a97e5 100644 --- a/x/authz/module/module.go +++ b/x/authz/module/module.go @@ -10,6 +10,7 @@ import ( "google.golang.org/grpc" "cosmossdk.io/core/appmodule" + appmodulev2 "cosmossdk.io/core/appmodule/v2" "cosmossdk.io/core/registry" "cosmossdk.io/errors" "cosmossdk.io/x/authz" @@ -32,7 +33,7 @@ var ( _ module.HasGRPCGateway = AppModule{} _ appmodule.HasRegisterInterfaces = AppModule{} _ module.AppModuleSimulation = AppModule{} - _ module.HasGenesis = AppModule{} + _ appmodulev2.HasGenesis = AppModule{} _ appmodule.AppModule = AppModule{} _ appmodule.HasBeginBlocker = AppModule{} @@ -109,14 +110,14 @@ func (AppModule) GetTxCmd() *cobra.Command { } // DefaultGenesis returns default genesis state as raw bytes for the authz module. -func (AppModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(authz.DefaultGenesisState()) +func (am AppModule) DefaultGenesis() json.RawMessage { + return am.cdc.MustMarshalJSON(authz.DefaultGenesisState()) } // ValidateGenesis performs genesis state validation for the authz module. -func (AppModule) ValidateGenesis(cdc codec.JSONCodec, config sdkclient.TxEncodingConfig, bz json.RawMessage) error { +func (am AppModule) ValidateGenesis(bz json.RawMessage) error { var data authz.GenesisState - if err := cdc.UnmarshalJSON(bz, &data); err != nil { + if err := am.cdc.UnmarshalJSON(bz, &data); err != nil { return errors.Wrapf(err, "failed to unmarshal %s genesis state", authz.ModuleName) } @@ -124,16 +125,18 @@ func (AppModule) ValidateGenesis(cdc codec.JSONCodec, config sdkclient.TxEncodin } // InitGenesis performs genesis initialization for the authz module. -func (am AppModule) InitGenesis(ctx context.Context, cdc codec.JSONCodec, data json.RawMessage) { +func (am AppModule) InitGenesis(ctx context.Context, data json.RawMessage) error { var genesisState authz.GenesisState - cdc.MustUnmarshalJSON(data, &genesisState) - am.keeper.InitGenesis(ctx, &genesisState) + if err := am.cdc.UnmarshalJSON(data, &genesisState); err != nil { + return err + } + return am.keeper.InitGenesis(ctx, &genesisState) } // ExportGenesis returns the exported genesis state as raw bytes for the authz module. -func (am AppModule) ExportGenesis(ctx context.Context, cdc codec.JSONCodec) json.RawMessage { +func (am AppModule) ExportGenesis(ctx context.Context) (json.RawMessage, error) { gs := am.keeper.ExportGenesis(ctx) - return cdc.MustMarshalJSON(gs) + return am.cdc.MarshalJSON(gs) } // ConsensusVersion implements HasConsensusVersion. diff --git a/x/bank/CHANGELOG.md b/x/bank/CHANGELOG.md index 8a03515679fe..fc76c3c85efd 100644 --- a/x/bank/CHANGELOG.md +++ b/x/bank/CHANGELOG.md @@ -25,10 +25,6 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] -### Consens Breaking Changes - -* [#19188](https://github.com/cosmos/cosmos-sdk/pull/19188) Remove creation of `BaseAccount` when sending a message to an account that does not exist - ### Features * [#17569](https://github.com/cosmos/cosmos-sdk/pull/17569) Introduce a new message type, `MsgBurn`, to burn coins. @@ -41,5 +37,8 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [#17569](https://github.com/cosmos/cosmos-sdk/pull/17569) `BurnCoins` takes an address instead of a module name * [#19477](https://github.com/cosmos/cosmos-sdk/pull/19477) `appmodule.Environment` is passed to bank `NewKeeper` +* [#19627](https://github.com/cosmos/cosmos-sdk/pull/19627) The genesis api has been updated to match `appmodule.HasGenesis`. -### Bug Fixes +### Consensus Breaking Changes + +* [#19188](https://github.com/cosmos/cosmos-sdk/pull/19188) Remove creation of `BaseAccount` when sending a message to an account that does not exist diff --git a/x/bank/go.mod b/x/bank/go.mod index 66b28c4aa40e..0aeba2661a84 100644 --- a/x/bank/go.mod +++ b/x/bank/go.mod @@ -18,13 +18,13 @@ require ( github.com/cosmos/cosmos-sdk v0.51.0 github.com/cosmos/gogoproto v1.4.11 github.com/golang/mock v1.6.0 - github.com/golang/protobuf v1.5.3 + github.com/golang/protobuf v1.5.4 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/hashicorp/go-metrics v0.5.3 github.com/spf13/cobra v1.8.0 github.com/stretchr/testify v1.9.0 google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014 - google.golang.org/grpc v1.62.0 + google.golang.org/grpc v1.62.1 gotest.tools/v3 v3.5.1 ) @@ -33,7 +33,7 @@ require ( buf.build/gen/go/tendermint/tendermint/protocolbuffers/go v1.32.0-20231117195010-33ed361a9051.1 // indirect cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 // indirect - cosmossdk.io/x/tx v0.13.0 // indirect + cosmossdk.io/x/tx v0.13.1 // indirect filippo.io/edwards25519 v1.1.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.2 // indirect @@ -121,7 +121,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.19.0 // indirect github.com/prometheus/client_model v0.6.0 // indirect - github.com/prometheus/common v0.49.0 // indirect + github.com/prometheus/common v0.50.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect @@ -148,7 +148,7 @@ require ( golang.org/x/crypto v0.21.0 // indirect golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect golang.org/x/mod v0.15.0 // indirect - golang.org/x/net v0.21.0 // indirect + golang.org/x/net v0.22.0 // indirect golang.org/x/sync v0.6.0 // indirect golang.org/x/sys v0.18.0 // indirect golang.org/x/term v0.18.0 // indirect @@ -156,7 +156,7 @@ require ( golang.org/x/tools v0.18.0 // indirect google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c // indirect - google.golang.org/protobuf v1.32.0 // indirect + google.golang.org/protobuf v1.33.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect nhooyr.io/websocket v1.8.6 // indirect @@ -174,5 +174,4 @@ replace ( cosmossdk.io/x/accounts => ../accounts cosmossdk.io/x/auth => ../auth cosmossdk.io/x/staking => ../staking - cosmossdk.io/x/tx => ../tx ) diff --git a/x/bank/go.sum b/x/bank/go.sum index 3fd57a0055b6..119c6de469be 100644 --- a/x/bank/go.sum +++ b/x/bank/go.sum @@ -14,6 +14,8 @@ cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/store v1.0.2 h1:lSg5BTvJBHUDwswNNyeh4K/CbqiHER73VU4nDNb8uk0= cosmossdk.io/store v1.0.2/go.mod h1:EFtENTqVTuWwitGW1VwaBct+yDagk7oG/axBMPH+FXs= +cosmossdk.io/x/tx v0.13.1 h1:Mg+EMp67Pz+NukbJqYxuo8uRp7N/a9uR+oVS9pONtj8= +cosmossdk.io/x/tx v0.13.1/go.mod h1:CBCU6fsRVz23QGFIQBb1DNX2DztJCf3jWyEkHY2nJQ0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= @@ -296,8 +298,8 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -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/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.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -593,8 +595,8 @@ github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt2 github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.49.0 h1:ToNTdK4zSnPVJmh698mGFkDor9wBI/iGaJy5dbH1EgI= -github.com/prometheus/common v0.49.0/go.mod h1:Kxm+EULxRbUkjGU6WFsQqo3ORzB4tyKvlWFOE9mB2sE= +github.com/prometheus/common v0.50.0 h1:YSZE6aa9+luNa2da6/Tik0q0A5AbR+U003TItK57CPQ= +github.com/prometheus/common v0.50.0/go.mod h1:wHFBCEVWVmHMUpg7pYcOm2QUR/ocQdYSJVQJKnHc3xQ= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= @@ -797,8 +799,8 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= 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.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= +golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -948,8 +950,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk= -google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -964,8 +966,9 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= 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-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/x/bank/keeper/genesis.go b/x/bank/keeper/genesis.go index 150f40389666..61a0729becab 100644 --- a/x/bank/keeper/genesis.go +++ b/x/bank/keeper/genesis.go @@ -12,9 +12,9 @@ import ( ) // InitGenesis initializes the bank module's state from a given genesis state. -func (k BaseKeeper) InitGenesis(ctx context.Context, genState *types.GenesisState) { +func (k BaseKeeper) InitGenesis(ctx context.Context, genState *types.GenesisState) error { if err := k.SetParams(ctx, genState.Params); err != nil { - panic(err) + return err } for _, se := range genState.GetAllSendEnabled() { @@ -28,13 +28,13 @@ func (k BaseKeeper) InitGenesis(ctx context.Context, genState *types.GenesisStat addr := balance.GetAddress() bz, err := k.ak.AddressCodec().StringToBytes(addr) if err != nil { - panic(err) + return err } for _, coin := range balance.Coins { err := k.Balances.Set(ctx, collections.Join(sdk.AccAddress(bz), coin.Denom), coin.Amount) if err != nil { - panic(err) + return err } } @@ -43,7 +43,7 @@ func (k BaseKeeper) InitGenesis(ctx context.Context, genState *types.GenesisStat totalSupply := totalSupplyMap.ToCoins() if !genState.Supply.Empty() && !genState.Supply.Equal(totalSupply) { - panic(fmt.Errorf("genesis supply is incorrect, expected %v, got %v", genState.Supply, totalSupply)) + return fmt.Errorf("genesis supply is incorrect, expected %v, got %v", genState.Supply, totalSupply) } for _, supply := range totalSupply { @@ -53,6 +53,7 @@ func (k BaseKeeper) InitGenesis(ctx context.Context, genState *types.GenesisStat for _, meta := range genState.DenomMetadata { k.SetDenomMetaData(ctx, meta) } + return nil } // ExportGenesis returns the bank module's genesis state. diff --git a/x/bank/keeper/genesis_test.go b/x/bank/keeper/genesis_test.go index 85f982c8465e..8798c51d5044 100644 --- a/x/bank/keeper/genesis_test.go +++ b/x/bank/keeper/genesis_test.go @@ -67,7 +67,7 @@ func (suite *KeeperTestSuite) TestInitGenesis() { g := types.DefaultGenesisState() g.DenomMetadata = []types.Metadata{m} bk := suite.bankKeeper - bk.InitGenesis(suite.ctx, g) + suite.Require().NoError(bk.InitGenesis(suite.ctx, g)) m2, found := bk.GetDenomMetaData(suite.ctx, m.Base) suite.Require().True(found) @@ -88,36 +88,35 @@ func (suite *KeeperTestSuite) TestTotalSupply() { suite.Require().NoError(err) testcases := []struct { - name string - genesis *types.GenesisState - expSupply sdk.Coins - expPanic bool - expPanicMsg string + name string + genesis *types.GenesisState + expSupply sdk.Coins + expErrMsg string }{ { "calculation NOT matching genesis Supply field", types.NewGenesisState(defaultGenesis.Params, balances, sdk.NewCoins(sdk.NewCoin("wrongcoin", sdkmath.NewInt(1))), defaultGenesis.DenomMetadata, defaultGenesis.SendEnabled), - nil, true, "genesis supply is incorrect, expected 1wrongcoin, got 21barcoin,11foocoin", + nil, "genesis supply is incorrect, expected 1wrongcoin, got 21barcoin,11foocoin", }, { "calculation matches genesis Supply field", types.NewGenesisState(defaultGenesis.Params, balances, totalSupply, defaultGenesis.DenomMetadata, defaultGenesis.SendEnabled), - totalSupply, false, "", + totalSupply, "", }, { "calculation is correct, empty genesis Supply field", types.NewGenesisState(defaultGenesis.Params, balances, nil, defaultGenesis.DenomMetadata, defaultGenesis.SendEnabled), - totalSupply, false, "", + totalSupply, "", }, } for _, tc := range testcases { tc := tc suite.Run(tc.name, func() { - if tc.expPanic { - suite.PanicsWithError(tc.expPanicMsg, func() { suite.bankKeeper.InitGenesis(suite.ctx, tc.genesis) }) + if tc.expErrMsg != "" { + suite.Require().ErrorContains(suite.bankKeeper.InitGenesis(suite.ctx, tc.genesis), tc.expErrMsg) } else { - suite.bankKeeper.InitGenesis(suite.ctx, tc.genesis) + suite.Require().NoError(suite.bankKeeper.InitGenesis(suite.ctx, tc.genesis)) totalSupply, _, err := suite.bankKeeper.GetPaginatedTotalSupply(suite.ctx, &query.PageRequest{Limit: query.PaginationMaxLimit}) suite.Require().NoError(err) diff --git a/x/bank/keeper/keeper.go b/x/bank/keeper/keeper.go index e52ae355e61f..e4d76312a419 100644 --- a/x/bank/keeper/keeper.go +++ b/x/bank/keeper/keeper.go @@ -26,7 +26,7 @@ type Keeper interface { SendKeeper WithMintCoinsRestriction(types.MintingRestrictionFn) BaseKeeper - InitGenesis(context.Context, *types.GenesisState) + InitGenesis(context.Context, *types.GenesisState) error ExportGenesis(context.Context) *types.GenesisState GetSupply(ctx context.Context, denom string) sdk.Coin diff --git a/x/bank/module.go b/x/bank/module.go index 184996dd82e4..cee6253cd31a 100644 --- a/x/bank/module.go +++ b/x/bank/module.go @@ -4,13 +4,13 @@ import ( "context" "encoding/json" "fmt" - "time" gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" "google.golang.org/grpc" "cosmossdk.io/core/appmodule" + appmodulev2 "cosmossdk.io/core/appmodule/v2" "cosmossdk.io/core/registry" "cosmossdk.io/x/bank/client/cli" "cosmossdk.io/x/bank/keeper" @@ -19,7 +19,6 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" @@ -34,7 +33,7 @@ var ( _ module.HasGRPCGateway = AppModule{} _ appmodule.HasRegisterInterfaces = AppModule{} _ module.AppModuleSimulation = AppModule{} - _ module.HasGenesis = AppModule{} + _ appmodulev2.HasGenesis = AppModule{} _ module.HasInvariants = AppModule{} _ appmodule.AppModule = AppModule{} @@ -119,14 +118,14 @@ func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) { } // DefaultGenesis returns default genesis state as raw bytes for the bank module. -func (AppModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(types.DefaultGenesisState()) +func (am AppModule) DefaultGenesis() json.RawMessage { + return am.cdc.MustMarshalJSON(types.DefaultGenesisState()) } // ValidateGenesis performs genesis state validation for the bank module. -func (AppModule) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { +func (am AppModule) ValidateGenesis(bz json.RawMessage) error { var data types.GenesisState - if err := cdc.UnmarshalJSON(bz, &data); err != nil { + if err := am.cdc.UnmarshalJSON(bz, &data); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) } @@ -134,20 +133,20 @@ func (AppModule) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, } // InitGenesis performs genesis initialization for the bank module. -func (am AppModule) InitGenesis(ctx context.Context, cdc codec.JSONCodec, data json.RawMessage) { - start := time.Now() +func (am AppModule) InitGenesis(ctx context.Context, data json.RawMessage) error { var genesisState types.GenesisState - cdc.MustUnmarshalJSON(data, &genesisState) - telemetry.MeasureSince(start, "InitGenesis", "crisis", "unmarshal") + if err := am.cdc.UnmarshalJSON(data, &genesisState); err != nil { + return err + } - am.keeper.InitGenesis(ctx, &genesisState) + return am.keeper.InitGenesis(ctx, &genesisState) } // ExportGenesis returns the exported genesis state as raw bytes for the bank // module. -func (am AppModule) ExportGenesis(ctx context.Context, cdc codec.JSONCodec) json.RawMessage { +func (am AppModule) ExportGenesis(ctx context.Context) (json.RawMessage, error) { gs := am.keeper.ExportGenesis(ctx) - return cdc.MustMarshalJSON(gs) + return am.cdc.MarshalJSON(gs) } // ConsensusVersion implements HasConsensusVersion diff --git a/x/circuit/go.mod b/x/circuit/go.mod index 87558974b1df..4dca0e8874f0 100644 --- a/x/circuit/go.mod +++ b/x/circuit/go.mod @@ -14,11 +14,11 @@ require ( github.com/cockroachdb/errors v1.11.1 github.com/cosmos/cosmos-sdk v0.51.0 github.com/cosmos/gogoproto v1.4.11 - github.com/golang/protobuf v1.5.3 + github.com/golang/protobuf v1.5.4 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/stretchr/testify v1.9.0 google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014 - google.golang.org/grpc v1.62.0 + google.golang.org/grpc v1.62.1 ) require ( @@ -28,7 +28,7 @@ require ( cosmossdk.io/x/accounts v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/bank v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 // indirect - cosmossdk.io/x/tx v0.13.0 // indirect + cosmossdk.io/x/tx v0.13.1 // indirect filippo.io/edwards25519 v1.1.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.2 // indirect @@ -120,7 +120,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.19.0 // indirect github.com/prometheus/client_model v0.6.0 // indirect - github.com/prometheus/common v0.49.0 // indirect + github.com/prometheus/common v0.50.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect @@ -148,7 +148,7 @@ require ( golang.org/x/crypto v0.21.0 // indirect golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect golang.org/x/mod v0.15.0 // indirect - golang.org/x/net v0.21.0 // indirect + golang.org/x/net v0.22.0 // indirect golang.org/x/sync v0.6.0 // indirect golang.org/x/sys v0.18.0 // indirect golang.org/x/term v0.18.0 // indirect @@ -156,7 +156,7 @@ require ( golang.org/x/tools v0.18.0 // indirect google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c // indirect - google.golang.org/protobuf v1.32.0 // indirect + google.golang.org/protobuf v1.33.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gotest.tools/v3 v3.5.1 // indirect @@ -175,5 +175,4 @@ replace ( cosmossdk.io/x/auth => ../auth cosmossdk.io/x/bank => ../bank cosmossdk.io/x/staking => ../staking - cosmossdk.io/x/tx => ../tx ) diff --git a/x/circuit/go.sum b/x/circuit/go.sum index 3fd57a0055b6..119c6de469be 100644 --- a/x/circuit/go.sum +++ b/x/circuit/go.sum @@ -14,6 +14,8 @@ cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/store v1.0.2 h1:lSg5BTvJBHUDwswNNyeh4K/CbqiHER73VU4nDNb8uk0= cosmossdk.io/store v1.0.2/go.mod h1:EFtENTqVTuWwitGW1VwaBct+yDagk7oG/axBMPH+FXs= +cosmossdk.io/x/tx v0.13.1 h1:Mg+EMp67Pz+NukbJqYxuo8uRp7N/a9uR+oVS9pONtj8= +cosmossdk.io/x/tx v0.13.1/go.mod h1:CBCU6fsRVz23QGFIQBb1DNX2DztJCf3jWyEkHY2nJQ0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= @@ -296,8 +298,8 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -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/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.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -593,8 +595,8 @@ github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt2 github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.49.0 h1:ToNTdK4zSnPVJmh698mGFkDor9wBI/iGaJy5dbH1EgI= -github.com/prometheus/common v0.49.0/go.mod h1:Kxm+EULxRbUkjGU6WFsQqo3ORzB4tyKvlWFOE9mB2sE= +github.com/prometheus/common v0.50.0 h1:YSZE6aa9+luNa2da6/Tik0q0A5AbR+U003TItK57CPQ= +github.com/prometheus/common v0.50.0/go.mod h1:wHFBCEVWVmHMUpg7pYcOm2QUR/ocQdYSJVQJKnHc3xQ= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= @@ -797,8 +799,8 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= 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.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= +golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -948,8 +950,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk= -google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -964,8 +966,9 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= 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-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/x/circuit/keeper/genesis.go b/x/circuit/keeper/genesis.go index d6747d442908..01407852da94 100644 --- a/x/circuit/keeper/genesis.go +++ b/x/circuit/keeper/genesis.go @@ -6,13 +6,13 @@ import ( "cosmossdk.io/x/circuit/types" ) -func (k *Keeper) ExportGenesis(ctx context.Context) (data *types.GenesisState) { +func (k *Keeper) ExportGenesis(ctx context.Context) (data *types.GenesisState, err error) { var ( permissions []*types.GenesisAccountPermissions disabledMsgs []string ) - err := k.Permissions.Walk(ctx, nil, func(address []byte, perm types.Permissions) (stop bool, err error) { + err = k.Permissions.Walk(ctx, nil, func(address []byte, perm types.Permissions) (stop bool, err error) { add, err := k.addressCodec.BytesToString(address) if err != nil { return true, err @@ -26,7 +26,7 @@ func (k *Keeper) ExportGenesis(ctx context.Context) (data *types.GenesisState) { return false, nil }) if err != nil { - panic(err) + return nil, err } err = k.DisableList.Walk(ctx, nil, func(msgUrl string) (stop bool, err error) { @@ -34,32 +34,34 @@ func (k *Keeper) ExportGenesis(ctx context.Context) (data *types.GenesisState) { return false, nil }) if err != nil { - panic(err) + return nil, err } return &types.GenesisState{ AccountPermissions: permissions, DisabledTypeUrls: disabledMsgs, - } + }, nil } // InitGenesis initializes the circuit module's state from a given genesis state. -func (k *Keeper) InitGenesis(ctx context.Context, genState *types.GenesisState) { +func (k *Keeper) InitGenesis(ctx context.Context, genState *types.GenesisState) error { for _, accounts := range genState.AccountPermissions { add, err := k.addressCodec.StringToBytes(accounts.Address) if err != nil { - panic(err) + return err } // Set the permissions for the account if err := k.Permissions.Set(ctx, add, *accounts.Permissions); err != nil { - panic(err) + return err } } for _, url := range genState.DisabledTypeUrls { // Set the disabled type urls if err := k.DisableList.Set(ctx, url); err != nil { - panic(err) + return err } } + + return nil } diff --git a/x/circuit/keeper/genesis_test.go b/x/circuit/keeper/genesis_test.go index cc4e3b6cbaad..e77c474923ca 100644 --- a/x/circuit/keeper/genesis_test.go +++ b/x/circuit/keeper/genesis_test.go @@ -75,9 +75,11 @@ func (s *GenesisTestSuite) TestInitExportGenesis() { DisabledTypeUrls: []string{url}, } - s.keeper.InitGenesis(s.ctx, genesisState) + err = s.keeper.InitGenesis(s.ctx, genesisState) + s.Require().NoError(err) - exported := s.keeper.ExportGenesis(s.ctx) + exported, err := s.keeper.ExportGenesis(s.ctx) + s.Require().NoError(err) bz, err := s.cdc.MarshalJSON(exported) s.Require().NoError(err) diff --git a/x/circuit/module.go b/x/circuit/module.go index 9468ce0c9f68..71dc7ca417dc 100644 --- a/x/circuit/module.go +++ b/x/circuit/module.go @@ -10,6 +10,7 @@ import ( "google.golang.org/grpc" "cosmossdk.io/core/appmodule" + appmodulev2 "cosmossdk.io/core/appmodule/v2" "cosmossdk.io/core/registry" "cosmossdk.io/x/circuit/keeper" "cosmossdk.io/x/circuit/types" @@ -27,7 +28,7 @@ var ( _ module.HasName = AppModule{} _ module.HasGRPCGateway = AppModule{} _ appmodule.HasRegisterInterfaces = AppModule{} - _ module.HasGenesis = AppModule{} + _ appmodulev2.HasGenesis = AppModule{} _ appmodule.AppModule = AppModule{} _ appmodule.HasServices = AppModule{} @@ -77,14 +78,14 @@ func NewAppModule(cdc codec.Codec, keeper keeper.Keeper) AppModule { func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion } // DefaultGenesis returns default genesis state as raw bytes for the circuit module. -func (AppModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(types.DefaultGenesisState()) +func (am AppModule) DefaultGenesis() json.RawMessage { + return am.cdc.MustMarshalJSON(types.DefaultGenesisState()) } // ValidateGenesis performs genesis state validation for the circuit module. -func (AppModule) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { +func (am AppModule) ValidateGenesis(bz json.RawMessage) error { var data types.GenesisState - if err := cdc.UnmarshalJSON(bz, &data); err != nil { + if err := am.cdc.UnmarshalJSON(bz, &data); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) } @@ -92,18 +93,23 @@ func (AppModule) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, } // InitGenesis performs genesis initialization for the circuit module. -func (am AppModule) InitGenesis(ctx context.Context, cdc codec.JSONCodec, data json.RawMessage) { +func (am AppModule) InitGenesis(ctx context.Context, data json.RawMessage) error { start := time.Now() var genesisState types.GenesisState - cdc.MustUnmarshalJSON(data, &genesisState) + if err := am.cdc.UnmarshalJSON(data, &genesisState); err != nil { + return err + } telemetry.MeasureSince(start, "InitGenesis", "crisis", "unmarshal") - am.keeper.InitGenesis(ctx, &genesisState) + return am.keeper.InitGenesis(ctx, &genesisState) } // ExportGenesis returns the exported genesis state as raw bytes for the circuit // module. -func (am AppModule) ExportGenesis(ctx context.Context, cdc codec.JSONCodec) json.RawMessage { - gs := am.keeper.ExportGenesis(ctx) - return cdc.MustMarshalJSON(gs) +func (am AppModule) ExportGenesis(ctx context.Context) (json.RawMessage, error) { + gs, err := am.keeper.ExportGenesis(ctx) + if err != nil { + return nil, err + } + return am.cdc.MarshalJSON(gs) } diff --git a/x/crisis/depinject.go b/x/crisis/depinject.go index 4bbbd3417daa..3879333c1602 100644 --- a/x/crisis/depinject.go +++ b/x/crisis/depinject.go @@ -81,7 +81,7 @@ func ProvideModule(in ModuleInputs) ModuleOutputs { skipGenesisInvariants = cast.ToBool(in.AppOpts.Get(FlagSkipGenesisInvariants)) } - m := NewAppModule(k, skipGenesisInvariants) + m := NewAppModule(k, in.Codec, skipGenesisInvariants) return ModuleOutputs{CrisisKeeper: k, Module: m} } diff --git a/x/crisis/module.go b/x/crisis/module.go index 1707baf033d7..3773561197aa 100644 --- a/x/crisis/module.go +++ b/x/crisis/module.go @@ -10,9 +10,9 @@ import ( "google.golang.org/grpc" "cosmossdk.io/core/appmodule" + appmodulev2 "cosmossdk.io/core/appmodule/v2" "cosmossdk.io/core/registry" - "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/telemetry" "github.com/cosmos/cosmos-sdk/types/module" @@ -27,7 +27,7 @@ var ( _ module.HasName = AppModule{} _ module.HasAminoCodec = AppModule{} _ appmodule.HasRegisterInterfaces = AppModule{} - _ module.HasGenesis = AppModule{} + _ appmodulev2.HasGenesis = AppModule{} _ appmodule.AppModule = AppModule{} _ appmodule.HasEndBlocker = AppModule{} @@ -43,8 +43,8 @@ type AppModule struct { // NOTE: We store a reference to the keeper here so that after a module // manager is created, the invariants can be properly registered and // executed. - keeper *keeper.Keeper - + keeper *keeper.Keeper + cdc codec.Codec skipGenesisInvariants bool } @@ -52,10 +52,11 @@ type AppModule struct { // we will call keeper.AssertInvariants during InitGenesis (it may take a significant time) // - which doesn't impact the chain security unless 66+% of validators have a wrongly // modified genesis file. -func NewAppModule(keeper *keeper.Keeper, skipGenesisInvariants bool) AppModule { +func NewAppModule(keeper *keeper.Keeper, cdc codec.Codec, skipGenesisInvariants bool) AppModule { return AppModule{ keeper: keeper, skipGenesisInvariants: skipGenesisInvariants, + cdc: cdc, } } @@ -102,14 +103,14 @@ func (am AppModule) RegisterMigrations(mr appmodule.MigrationRegistrar) error { } // DefaultGenesis returns default genesis state as raw bytes for the crisis module. -func (AppModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(types.DefaultGenesisState()) +func (am AppModule) DefaultGenesis() json.RawMessage { + return am.cdc.MustMarshalJSON(types.DefaultGenesisState()) } // ValidateGenesis performs genesis state validation for the crisis module. -func (AppModule) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { +func (am AppModule) ValidateGenesis(bz json.RawMessage) error { var data types.GenesisState - if err := cdc.UnmarshalJSON(bz, &data); err != nil { + if err := am.cdc.UnmarshalJSON(bz, &data); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) } @@ -117,22 +118,25 @@ func (AppModule) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingCo } // InitGenesis performs genesis initialization for the crisis module. -func (am AppModule) InitGenesis(ctx context.Context, cdc codec.JSONCodec, data json.RawMessage) { +func (am AppModule) InitGenesis(ctx context.Context, data json.RawMessage) error { start := time.Now() var genesisState types.GenesisState - cdc.MustUnmarshalJSON(data, &genesisState) + if err := am.cdc.UnmarshalJSON(data, &genesisState); err != nil { + return err + } telemetry.MeasureSince(start, "InitGenesis", "crisis", "unmarshal") am.keeper.InitGenesis(ctx, &genesisState) if !am.skipGenesisInvariants { am.keeper.AssertInvariants(ctx) } + return nil } // ExportGenesis returns the exported genesis state as raw bytes for the crisis module. -func (am AppModule) ExportGenesis(ctx context.Context, cdc codec.JSONCodec) json.RawMessage { +func (am AppModule) ExportGenesis(ctx context.Context) (json.RawMessage, error) { gs := am.keeper.ExportGenesis(ctx) - return cdc.MustMarshalJSON(gs) + return am.cdc.MarshalJSON(gs) } // ConsensusVersion implements HasConsensusVersion diff --git a/x/distribution/go.mod b/x/distribution/go.mod index 871b95e4c8b1..e41ea84c458a 100644 --- a/x/distribution/go.mod +++ b/x/distribution/go.mod @@ -19,14 +19,14 @@ require ( github.com/cosmos/cosmos-sdk v0.51.0 github.com/cosmos/gogoproto v1.4.11 github.com/golang/mock v1.6.0 - github.com/golang/protobuf v1.5.3 + github.com/golang/protobuf v1.5.4 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/hashicorp/go-metrics v0.5.3 github.com/pkg/errors v0.9.1 github.com/spf13/cobra v1.8.0 github.com/stretchr/testify v1.9.0 google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014 - google.golang.org/grpc v1.62.0 + google.golang.org/grpc v1.62.1 gotest.tools/v3 v3.5.1 ) @@ -35,7 +35,7 @@ require ( buf.build/gen/go/tendermint/tendermint/protocolbuffers/go v1.32.0-20231117195010-33ed361a9051.1 // indirect cosmossdk.io/x/accounts v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 - cosmossdk.io/x/tx v0.13.0 // indirect + cosmossdk.io/x/tx v0.13.1 // indirect filippo.io/edwards25519 v1.1.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.2 // indirect @@ -123,7 +123,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.19.0 // indirect github.com/prometheus/client_model v0.6.0 // indirect - github.com/prometheus/common v0.49.0 // indirect + github.com/prometheus/common v0.50.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect @@ -150,7 +150,7 @@ require ( golang.org/x/crypto v0.21.0 // indirect golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect golang.org/x/mod v0.15.0 // indirect - golang.org/x/net v0.21.0 // indirect + golang.org/x/net v0.22.0 // indirect golang.org/x/sync v0.6.0 // indirect golang.org/x/sys v0.18.0 // indirect golang.org/x/term v0.18.0 // indirect @@ -158,7 +158,7 @@ require ( golang.org/x/tools v0.18.0 // indirect google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c // indirect - google.golang.org/protobuf v1.32.0 // indirect + google.golang.org/protobuf v1.33.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect nhooyr.io/websocket v1.8.6 // indirect @@ -176,5 +176,4 @@ replace ( cosmossdk.io/x/auth => ../auth cosmossdk.io/x/bank => ../bank cosmossdk.io/x/staking => ../staking - cosmossdk.io/x/tx => ../tx ) diff --git a/x/distribution/go.sum b/x/distribution/go.sum index dfe3daf70777..aa4e4ab12d66 100644 --- a/x/distribution/go.sum +++ b/x/distribution/go.sum @@ -16,6 +16,8 @@ cosmossdk.io/store v1.0.2 h1:lSg5BTvJBHUDwswNNyeh4K/CbqiHER73VU4nDNb8uk0= cosmossdk.io/store v1.0.2/go.mod h1:EFtENTqVTuWwitGW1VwaBct+yDagk7oG/axBMPH+FXs= cosmossdk.io/x/protocolpool v0.0.0-20230925135524-a1bc045b3190 h1:XQJj9Dv9Gtze0l2TF79BU5lkP6MkUveTUuKICmxoz+o= cosmossdk.io/x/protocolpool v0.0.0-20230925135524-a1bc045b3190/go.mod h1:7WUGupOvmlHJoIMBz1JbObQxeo6/TDiuDBxmtod8HRg= +cosmossdk.io/x/tx v0.13.1 h1:Mg+EMp67Pz+NukbJqYxuo8uRp7N/a9uR+oVS9pONtj8= +cosmossdk.io/x/tx v0.13.1/go.mod h1:CBCU6fsRVz23QGFIQBb1DNX2DztJCf3jWyEkHY2nJQ0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= @@ -298,8 +300,8 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -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/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.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -595,8 +597,8 @@ github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt2 github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.49.0 h1:ToNTdK4zSnPVJmh698mGFkDor9wBI/iGaJy5dbH1EgI= -github.com/prometheus/common v0.49.0/go.mod h1:Kxm+EULxRbUkjGU6WFsQqo3ORzB4tyKvlWFOE9mB2sE= +github.com/prometheus/common v0.50.0 h1:YSZE6aa9+luNa2da6/Tik0q0A5AbR+U003TItK57CPQ= +github.com/prometheus/common v0.50.0/go.mod h1:wHFBCEVWVmHMUpg7pYcOm2QUR/ocQdYSJVQJKnHc3xQ= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= @@ -799,8 +801,8 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= 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.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= +golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -950,8 +952,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk= -google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -966,8 +968,9 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= 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-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/x/distribution/keeper/genesis.go b/x/distribution/keeper/genesis.go index ce4a178401e4..e77a1475551f 100644 --- a/x/distribution/keeper/genesis.go +++ b/x/distribution/keeper/genesis.go @@ -11,29 +11,29 @@ import ( ) // InitGenesis sets distribution information for genesis -func (k Keeper) InitGenesis(ctx context.Context, data types.GenesisState) { +func (k Keeper) InitGenesis(ctx context.Context, data types.GenesisState) error { var moduleHoldings sdk.DecCoins if err := k.FeePool.Set(ctx, data.FeePool); err != nil { - panic(err) + return err } if err := k.Params.Set(ctx, data.Params); err != nil { - panic(err) + return err } for _, dwi := range data.DelegatorWithdrawInfos { delegatorAddress, err := k.authKeeper.AddressCodec().StringToBytes(dwi.DelegatorAddress) if err != nil { - panic(err) + return err } withdrawAddress, err := k.authKeeper.AddressCodec().StringToBytes(dwi.WithdrawAddress) if err != nil { - panic(err) + return err } err = k.DelegatorsWithdrawAddress.Set(ctx, delegatorAddress, withdrawAddress) if err != nil { - panic(err) + return err } } @@ -42,74 +42,74 @@ func (k Keeper) InitGenesis(ctx context.Context, data types.GenesisState) { var err error previousProposer, err = k.stakingKeeper.ConsensusAddressCodec().StringToBytes(data.PreviousProposer) if err != nil { - panic(err) + return err } } if err := k.PreviousProposer.Set(ctx, previousProposer); err != nil { - panic(err) + return err } for _, rew := range data.OutstandingRewards { valAddr, err := k.stakingKeeper.ValidatorAddressCodec().StringToBytes(rew.ValidatorAddress) if err != nil { - panic(err) + return err } err = k.ValidatorOutstandingRewards.Set(ctx, valAddr, types.ValidatorOutstandingRewards{Rewards: rew.OutstandingRewards}) if err != nil { - panic(err) + return err } moduleHoldings = moduleHoldings.Add(rew.OutstandingRewards...) } for _, acc := range data.ValidatorAccumulatedCommissions { valAddr, err := k.stakingKeeper.ValidatorAddressCodec().StringToBytes(acc.ValidatorAddress) if err != nil { - panic(err) + return err } err = k.ValidatorsAccumulatedCommission.Set(ctx, valAddr, acc.Accumulated) if err != nil { - panic(err) + return err } } for _, his := range data.ValidatorHistoricalRewards { valAddr, err := k.stakingKeeper.ValidatorAddressCodec().StringToBytes(his.ValidatorAddress) if err != nil { - panic(err) + return err } err = k.ValidatorHistoricalRewards.Set(ctx, collections.Join(sdk.ValAddress(valAddr), his.Period), his.Rewards) if err != nil { - panic(err) + return err } } for _, cur := range data.ValidatorCurrentRewards { valAddr, err := k.stakingKeeper.ValidatorAddressCodec().StringToBytes(cur.ValidatorAddress) if err != nil { - panic(err) + return err } err = k.ValidatorCurrentRewards.Set(ctx, valAddr, cur.Rewards) if err != nil { - panic(err) + return err } } for _, del := range data.DelegatorStartingInfos { valAddr, err := k.stakingKeeper.ValidatorAddressCodec().StringToBytes(del.ValidatorAddress) if err != nil { - panic(err) + return err } delegatorAddress, err := k.authKeeper.AddressCodec().StringToBytes(del.DelegatorAddress) if err != nil { - panic(err) + return err } err = k.DelegatorStartingInfo.Set(ctx, collections.Join(sdk.ValAddress(valAddr), sdk.AccAddress(delegatorAddress)), del.StartingInfo) if err != nil { - panic(err) + return err } } for _, evt := range data.ValidatorSlashEvents { valAddr, err := k.stakingKeeper.ValidatorAddressCodec().StringToBytes(evt.ValidatorAddress) if err != nil { - panic(err) + return err } err = k.ValidatorSlashEvents.Set( @@ -122,7 +122,7 @@ func (k Keeper) InitGenesis(ctx context.Context, data types.GenesisState) { evt.ValidatorSlashEvent, ) if err != nil { - panic(err) + return err } } @@ -142,18 +142,19 @@ func (k Keeper) InitGenesis(ctx context.Context, data types.GenesisState) { if !balances.Equal(moduleHoldingsInt) { panic(fmt.Sprintf("distribution module balance does not match the module holdings: %s <-> %s", balances, moduleHoldingsInt)) } + return nil } // ExportGenesis returns a GenesisState for a given context and keeper. -func (k Keeper) ExportGenesis(ctx context.Context) *types.GenesisState { +func (k Keeper) ExportGenesis(ctx context.Context) (*types.GenesisState, error) { feePool, err := k.FeePool.Get(ctx) if err != nil { - panic(err) + return nil, err } params, err := k.Params.Get(ctx) if err != nil { - panic(err) + return nil, err } var dwi []types.DelegatorWithdrawInfo @@ -165,12 +166,12 @@ func (k Keeper) ExportGenesis(ctx context.Context) *types.GenesisState { return false, nil }) if err != nil { - panic(err) + return nil, err } pp, err := k.PreviousProposer.Get(ctx) if err != nil { - panic(err) + return nil, err } outstanding := make([]types.ValidatorOutstandingRewardsRecord, 0) @@ -184,7 +185,7 @@ func (k Keeper) ExportGenesis(ctx context.Context) *types.GenesisState { }, ) if err != nil { - panic(err) + return nil, err } acc := make([]types.ValidatorAccumulatedCommissionRecord, 0) @@ -196,7 +197,7 @@ func (k Keeper) ExportGenesis(ctx context.Context) *types.GenesisState { return false, nil }) if err != nil { - panic(err) + return nil, err } his := make([]types.ValidatorHistoricalRewardsRecord, 0) @@ -211,7 +212,7 @@ func (k Keeper) ExportGenesis(ctx context.Context) *types.GenesisState { }, ) if err != nil { - panic(err) + return nil, err } cur := make([]types.ValidatorCurrentRewardsRecord, 0) @@ -225,7 +226,7 @@ func (k Keeper) ExportGenesis(ctx context.Context) *types.GenesisState { }, ) if err != nil { - panic(err) + return nil, err } dels := make([]types.DelegatorStartingInfoRecord, 0) @@ -238,7 +239,7 @@ func (k Keeper) ExportGenesis(ctx context.Context) *types.GenesisState { return false, nil }) if err != nil { - panic(err) + return nil, err } slashes := make([]types.ValidatorSlashEventRecord, 0) @@ -256,8 +257,8 @@ func (k Keeper) ExportGenesis(ctx context.Context) *types.GenesisState { }, ) if err != nil { - panic(err) + return nil, err } - return types.NewGenesisState(params, feePool, dwi, pp, outstanding, acc, his, cur, dels, slashes) + return types.NewGenesisState(params, feePool, dwi, pp, outstanding, acc, his, cur, dels, slashes), nil } diff --git a/x/distribution/module.go b/x/distribution/module.go index 3591b448b9bc..116c613190ed 100644 --- a/x/distribution/module.go +++ b/x/distribution/module.go @@ -10,6 +10,7 @@ import ( "google.golang.org/grpc" "cosmossdk.io/core/appmodule" + appmodulev2 "cosmossdk.io/core/appmodule/v2" "cosmossdk.io/core/registry" "cosmossdk.io/x/distribution/client/cli" "cosmossdk.io/x/distribution/keeper" @@ -32,7 +33,7 @@ var ( _ module.HasGRPCGateway = AppModule{} _ appmodule.HasRegisterInterfaces = AppModule{} _ module.AppModuleSimulation = AppModule{} - _ module.HasGenesis = AppModule{} + _ appmodulev2.HasGenesis = AppModule{} _ module.HasInvariants = AppModule{} _ appmodule.AppModule = AppModule{} @@ -128,14 +129,14 @@ func (am AppModule) RegisterMigrations(mr appmodule.MigrationRegistrar) error { } // DefaultGenesis returns default genesis state as raw bytes for the distribution module. -func (AppModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(types.DefaultGenesisState()) +func (am AppModule) DefaultGenesis() json.RawMessage { + return am.cdc.MustMarshalJSON(types.DefaultGenesisState()) } // ValidateGenesis performs genesis state validation for the distribution module. -func (AppModule) ValidateGenesis(cdc codec.JSONCodec, _ sdkclient.TxEncodingConfig, bz json.RawMessage) error { +func (am AppModule) ValidateGenesis(bz json.RawMessage) error { var data types.GenesisState - if err := cdc.UnmarshalJSON(bz, &data); err != nil { + if err := am.cdc.UnmarshalJSON(bz, &data); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) } @@ -143,17 +144,22 @@ func (AppModule) ValidateGenesis(cdc codec.JSONCodec, _ sdkclient.TxEncodingConf } // InitGenesis performs genesis initialization for the distribution module. -func (am AppModule) InitGenesis(ctx context.Context, cdc codec.JSONCodec, data json.RawMessage) { +func (am AppModule) InitGenesis(ctx context.Context, data json.RawMessage) error { var genesisState types.GenesisState - cdc.MustUnmarshalJSON(data, &genesisState) - am.keeper.InitGenesis(ctx, genesisState) + if err := am.cdc.UnmarshalJSON(data, &genesisState); err != nil { + return err + } + return am.keeper.InitGenesis(ctx, genesisState) } // ExportGenesis returns the exported genesis state as raw bytes for the distribution // module. -func (am AppModule) ExportGenesis(ctx context.Context, cdc codec.JSONCodec) json.RawMessage { - gs := am.keeper.ExportGenesis(ctx) - return cdc.MustMarshalJSON(gs) +func (am AppModule) ExportGenesis(ctx context.Context) (json.RawMessage, error) { + gs, err := am.keeper.ExportGenesis(ctx) + if err != nil { + return nil, err + } + return am.cdc.MarshalJSON(gs) } // ConsensusVersion implements HasConsensusVersion diff --git a/x/evidence/CHANGELOG.md b/x/evidence/CHANGELOG.md index f00a7953f1ec..eba342d7870d 100644 --- a/x/evidence/CHANGELOG.md +++ b/x/evidence/CHANGELOG.md @@ -28,6 +28,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Api Breaking Changes * [#19482](https://github.com/cosmos/cosmos-sdk/pull/19482) `appmodule.Environment` is passed to `NewKeeper` instead of individual services +* [#19627](https://github.com/cosmos/cosmos-sdk/pull/19627) `NewAppModule` now takes in a `codec.Codec` as its first arguement ## [v0.1.0](https://github.com/cosmos/cosmos-sdk/releases/tag/x/evidence/v0.1.0) - 2023-11-07 diff --git a/x/evidence/depinject.go b/x/evidence/depinject.go index 49af8a23639c..335cef402ef5 100644 --- a/x/evidence/depinject.go +++ b/x/evidence/depinject.go @@ -45,7 +45,7 @@ type ModuleOutputs struct { func ProvideModule(in ModuleInputs) ModuleOutputs { k := keeper.NewKeeper(in.Cdc, in.Environment, in.StakingKeeper, in.SlashingKeeper, in.AddressCodec) - m := NewAppModule(*k, in.EvidenceHandlers...) + m := NewAppModule(in.Cdc, *k, in.EvidenceHandlers...) return ModuleOutputs{EvidenceKeeper: *k, Module: m} } diff --git a/x/evidence/genesis.go b/x/evidence/genesis.go index 3c632607ea4e..0ffe655600d9 100644 --- a/x/evidence/genesis.go +++ b/x/evidence/genesis.go @@ -2,6 +2,7 @@ package evidence import ( "context" + "errors" "fmt" "cosmossdk.io/x/evidence/exported" @@ -13,28 +14,29 @@ import ( // InitGenesis initializes the evidence module's state from a provided genesis // state. -func InitGenesis(ctx context.Context, k keeper.Keeper, gs *types.GenesisState) { +func InitGenesis(ctx context.Context, k keeper.Keeper, gs *types.GenesisState) error { if err := gs.Validate(); err != nil { - panic(fmt.Sprintf("failed to validate %s genesis state: %s", types.ModuleName, err)) + return fmt.Errorf("failed to validate %s genesis state: %s", types.ModuleName, err) } for _, e := range gs.Evidence { evi, ok := e.GetCachedValue().(exported.Evidence) if !ok { - panic("expected evidence") + return errors.New("expected evidence") } if _, err := k.Evidences.Get(ctx, evi.Hash()); err == nil { - panic(fmt.Sprintf("evidence with hash %s already exists", evi.Hash())) + return fmt.Errorf("evidence with hash %s already exists", evi.Hash()) } if err := k.Evidences.Set(ctx, evi.Hash(), evi); err != nil { - panic(err) + return err } } + return nil } // ExportGenesis returns the evidence module's exported genesis. -func ExportGenesis(ctx context.Context, k keeper.Keeper) *types.GenesisState { +func ExportGenesis(ctx context.Context, k keeper.Keeper) (*types.GenesisState, error) { gs := new(types.GenesisState) err := k.Evidences.Walk(ctx, nil, func(_ []byte, value exported.Evidence) (stop bool, err error) { anyEvi, err := codectypes.NewAnyWithValue(value) @@ -45,7 +47,7 @@ func ExportGenesis(ctx context.Context, k keeper.Keeper) *types.GenesisState { return false, nil }) if err != nil { - panic(err) + return nil, err } - return gs + return gs, nil } diff --git a/x/evidence/go.mod b/x/evidence/go.mod index bc02677eff8a..ecc058267a45 100644 --- a/x/evidence/go.mod +++ b/x/evidence/go.mod @@ -16,13 +16,13 @@ require ( github.com/cosmos/cosmos-sdk v0.51.0 github.com/cosmos/gogoproto v1.4.11 github.com/golang/mock v1.6.0 - github.com/golang/protobuf v1.5.3 + github.com/golang/protobuf v1.5.4 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/spf13/cobra v1.8.0 github.com/stretchr/testify v1.9.0 google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014 - google.golang.org/grpc v1.62.0 - google.golang.org/protobuf v1.32.0 + google.golang.org/grpc v1.62.1 + google.golang.org/protobuf v1.33.0 ) require ( @@ -32,7 +32,7 @@ require ( cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/bank v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 // indirect - cosmossdk.io/x/tx v0.13.0 // indirect + cosmossdk.io/x/tx v0.13.1 // indirect filippo.io/edwards25519 v1.1.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.2 // indirect @@ -122,7 +122,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.19.0 // indirect github.com/prometheus/client_model v0.6.0 // indirect - github.com/prometheus/common v0.49.0 // indirect + github.com/prometheus/common v0.50.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect @@ -149,7 +149,7 @@ require ( golang.org/x/crypto v0.21.0 // indirect golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect golang.org/x/mod v0.15.0 // indirect - golang.org/x/net v0.21.0 // indirect + golang.org/x/net v0.22.0 // indirect golang.org/x/sync v0.6.0 // indirect golang.org/x/sys v0.18.0 // indirect golang.org/x/term v0.18.0 // indirect @@ -175,5 +175,4 @@ replace ( cosmossdk.io/x/auth => ../auth cosmossdk.io/x/bank => ../bank cosmossdk.io/x/staking => ../staking - cosmossdk.io/x/tx => ../tx ) diff --git a/x/evidence/go.sum b/x/evidence/go.sum index 3fd57a0055b6..119c6de469be 100644 --- a/x/evidence/go.sum +++ b/x/evidence/go.sum @@ -14,6 +14,8 @@ cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/store v1.0.2 h1:lSg5BTvJBHUDwswNNyeh4K/CbqiHER73VU4nDNb8uk0= cosmossdk.io/store v1.0.2/go.mod h1:EFtENTqVTuWwitGW1VwaBct+yDagk7oG/axBMPH+FXs= +cosmossdk.io/x/tx v0.13.1 h1:Mg+EMp67Pz+NukbJqYxuo8uRp7N/a9uR+oVS9pONtj8= +cosmossdk.io/x/tx v0.13.1/go.mod h1:CBCU6fsRVz23QGFIQBb1DNX2DztJCf3jWyEkHY2nJQ0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= @@ -296,8 +298,8 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -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/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.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -593,8 +595,8 @@ github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt2 github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.49.0 h1:ToNTdK4zSnPVJmh698mGFkDor9wBI/iGaJy5dbH1EgI= -github.com/prometheus/common v0.49.0/go.mod h1:Kxm+EULxRbUkjGU6WFsQqo3ORzB4tyKvlWFOE9mB2sE= +github.com/prometheus/common v0.50.0 h1:YSZE6aa9+luNa2da6/Tik0q0A5AbR+U003TItK57CPQ= +github.com/prometheus/common v0.50.0/go.mod h1:wHFBCEVWVmHMUpg7pYcOm2QUR/ocQdYSJVQJKnHc3xQ= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= @@ -797,8 +799,8 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= 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.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= +golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -948,8 +950,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk= -google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -964,8 +966,9 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= 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-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/x/evidence/module.go b/x/evidence/module.go index 854ada04705a..85ae9866b078 100644 --- a/x/evidence/module.go +++ b/x/evidence/module.go @@ -10,6 +10,7 @@ import ( "google.golang.org/grpc" "cosmossdk.io/core/appmodule" + appmodulev2 "cosmossdk.io/core/appmodule/v2" "cosmossdk.io/core/registry" eviclient "cosmossdk.io/x/evidence/client" "cosmossdk.io/x/evidence/client/cli" @@ -29,7 +30,7 @@ var ( _ module.HasGRPCGateway = AppModule{} _ appmodule.HasRegisterInterfaces = AppModule{} _ module.AppModuleSimulation = AppModule{} - _ module.HasGenesis = AppModule{} + _ appmodulev2.HasGenesis = AppModule{} _ appmodule.AppModule = AppModule{} _ appmodule.HasBeginBlocker = AppModule{} @@ -39,15 +40,17 @@ const ConsensusVersion = 1 // AppModule implements the AppModule interface for the evidence module. type AppModule struct { + cdc codec.Codec evidenceHandlers []eviclient.EvidenceHandler keeper keeper.Keeper } // NewAppModule creates a new AppModule object. -func NewAppModule(keeper keeper.Keeper, evidenceHandlers ...eviclient.EvidenceHandler) AppModule { +func NewAppModule(cdc codec.Codec, keeper keeper.Keeper, evidenceHandlers ...eviclient.EvidenceHandler) AppModule { return AppModule{ keeper: keeper, evidenceHandlers: evidenceHandlers, + cdc: cdc, } } @@ -94,14 +97,14 @@ func (am AppModule) RegisterServices(registrar grpc.ServiceRegistrar) error { } // DefaultGenesis returns the evidence module's default genesis state. -func (AppModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(types.DefaultGenesisState()) +func (am AppModule) DefaultGenesis() json.RawMessage { + return am.cdc.MustMarshalJSON(types.DefaultGenesisState()) } // ValidateGenesis performs genesis state validation for the evidence module. -func (AppModule) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { +func (am AppModule) ValidateGenesis(bz json.RawMessage) error { var gs types.GenesisState - if err := cdc.UnmarshalJSON(bz, &gs); err != nil { + if err := am.cdc.UnmarshalJSON(bz, &gs); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) } @@ -109,19 +112,23 @@ func (AppModule) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingCo } // InitGenesis performs the evidence module's genesis initialization -func (am AppModule) InitGenesis(ctx context.Context, cdc codec.JSONCodec, bz json.RawMessage) { +func (am AppModule) InitGenesis(ctx context.Context, bz json.RawMessage) error { var gs types.GenesisState - err := cdc.UnmarshalJSON(bz, &gs) + err := am.cdc.UnmarshalJSON(bz, &gs) if err != nil { - panic(fmt.Sprintf("failed to unmarshal %s genesis state: %s", types.ModuleName, err)) + return err } - InitGenesis(ctx, am.keeper, &gs) + return InitGenesis(ctx, am.keeper, &gs) } // ExportGenesis returns the evidence module's exported genesis state as raw JSON bytes. -func (am AppModule) ExportGenesis(ctx context.Context, cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(ExportGenesis(ctx, am.keeper)) +func (am AppModule) ExportGenesis(ctx context.Context) (json.RawMessage, error) { + gs, err := ExportGenesis(ctx, am.keeper) + if err != nil { + return nil, err + } + return am.cdc.MarshalJSON(gs) } // ConsensusVersion implements HasConsensusVersion diff --git a/x/feegrant/go.mod b/x/feegrant/go.mod index 39b2fc7d7faa..06317301b706 100644 --- a/x/feegrant/go.mod +++ b/x/feegrant/go.mod @@ -20,13 +20,13 @@ require ( github.com/cosmos/cosmos-sdk v0.51.0 github.com/cosmos/gogoproto v1.4.11 github.com/golang/mock v1.6.0 - github.com/golang/protobuf v1.5.3 + github.com/golang/protobuf v1.5.4 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/spf13/cobra v1.8.0 github.com/stretchr/testify v1.9.0 google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014 - google.golang.org/grpc v1.62.0 - google.golang.org/protobuf v1.32.0 + google.golang.org/grpc v1.62.1 + google.golang.org/protobuf v1.33.0 gotest.tools/v3 v3.5.1 ) @@ -36,7 +36,7 @@ require ( cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 cosmossdk.io/x/protocolpool v0.0.0-20230925135524-a1bc045b3190 // indirect cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 // indirect - cosmossdk.io/x/tx v0.13.0 // indirect + cosmossdk.io/x/tx v0.13.1 // indirect filippo.io/edwards25519 v1.1.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.2 // indirect @@ -127,7 +127,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.19.0 // indirect github.com/prometheus/client_model v0.6.0 // indirect - github.com/prometheus/common v0.49.0 // indirect + github.com/prometheus/common v0.50.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect @@ -154,7 +154,7 @@ require ( golang.org/x/crypto v0.21.0 // indirect golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect golang.org/x/mod v0.15.0 // indirect - golang.org/x/net v0.21.0 // indirect + golang.org/x/net v0.22.0 // indirect golang.org/x/sync v0.6.0 // indirect golang.org/x/sys v0.18.0 // indirect golang.org/x/term v0.18.0 // indirect @@ -180,5 +180,4 @@ replace ( cosmossdk.io/x/bank => ../bank cosmossdk.io/x/gov => ../gov cosmossdk.io/x/staking => ../staking - cosmossdk.io/x/tx => ../tx ) diff --git a/x/feegrant/go.sum b/x/feegrant/go.sum index d7d2e2650014..c7f8dff91b04 100644 --- a/x/feegrant/go.sum +++ b/x/feegrant/go.sum @@ -16,6 +16,8 @@ cosmossdk.io/store v1.0.2 h1:lSg5BTvJBHUDwswNNyeh4K/CbqiHER73VU4nDNb8uk0= cosmossdk.io/store v1.0.2/go.mod h1:EFtENTqVTuWwitGW1VwaBct+yDagk7oG/axBMPH+FXs= cosmossdk.io/x/protocolpool v0.0.0-20230925135524-a1bc045b3190 h1:XQJj9Dv9Gtze0l2TF79BU5lkP6MkUveTUuKICmxoz+o= cosmossdk.io/x/protocolpool v0.0.0-20230925135524-a1bc045b3190/go.mod h1:7WUGupOvmlHJoIMBz1JbObQxeo6/TDiuDBxmtod8HRg= +cosmossdk.io/x/tx v0.13.1 h1:Mg+EMp67Pz+NukbJqYxuo8uRp7N/a9uR+oVS9pONtj8= +cosmossdk.io/x/tx v0.13.1/go.mod h1:CBCU6fsRVz23QGFIQBb1DNX2DztJCf3jWyEkHY2nJQ0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= @@ -304,8 +306,8 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -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/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.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -603,8 +605,8 @@ github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt2 github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.49.0 h1:ToNTdK4zSnPVJmh698mGFkDor9wBI/iGaJy5dbH1EgI= -github.com/prometheus/common v0.49.0/go.mod h1:Kxm+EULxRbUkjGU6WFsQqo3ORzB4tyKvlWFOE9mB2sE= +github.com/prometheus/common v0.50.0 h1:YSZE6aa9+luNa2da6/Tik0q0A5AbR+U003TItK57CPQ= +github.com/prometheus/common v0.50.0/go.mod h1:wHFBCEVWVmHMUpg7pYcOm2QUR/ocQdYSJVQJKnHc3xQ= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= @@ -807,8 +809,8 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= 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.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= +golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -959,8 +961,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk= -google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -975,8 +977,9 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= 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-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/x/feegrant/module/module.go b/x/feegrant/module/module.go index d950ae6a285d..42edb16f1ded 100644 --- a/x/feegrant/module/module.go +++ b/x/feegrant/module/module.go @@ -10,6 +10,7 @@ import ( "google.golang.org/grpc" "cosmossdk.io/core/appmodule" + appmodulev2 "cosmossdk.io/core/appmodule/v2" "cosmossdk.io/core/registry" "cosmossdk.io/errors" "cosmossdk.io/x/feegrant" @@ -28,7 +29,7 @@ var ( _ module.HasGRPCGateway = AppModule{} _ appmodule.HasRegisterInterfaces = AppModule{} _ module.AppModuleSimulation = AppModule{} - _ module.HasGenesis = AppModule{} + _ appmodulev2.HasGenesis = AppModule{} _ appmodule.AppModule = AppModule{} _ appmodule.HasEndBlocker = AppModule{} @@ -107,14 +108,14 @@ func (am AppModule) RegisterMigrations(mr appmodule.MigrationRegistrar) error { } // DefaultGenesis returns default genesis state as raw bytes for the feegrant module. -func (AppModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(feegrant.DefaultGenesisState()) +func (am AppModule) DefaultGenesis() json.RawMessage { + return am.cdc.MustMarshalJSON(feegrant.DefaultGenesisState()) } // ValidateGenesis performs genesis state validation for the feegrant module. -func (AppModule) ValidateGenesis(cdc codec.JSONCodec, config sdkclient.TxEncodingConfig, bz json.RawMessage) error { +func (am AppModule) ValidateGenesis(bz json.RawMessage) error { var data feegrant.GenesisState - if err := cdc.UnmarshalJSON(bz, &data); err != nil { + if err := am.cdc.UnmarshalJSON(bz, &data); err != nil { return errors.Wrapf(err, "failed to unmarshal %s genesis state", feegrant.ModuleName) } @@ -122,24 +123,27 @@ func (AppModule) ValidateGenesis(cdc codec.JSONCodec, config sdkclient.TxEncodin } // InitGenesis performs genesis initialization for the feegrant module. -func (am AppModule) InitGenesis(ctx context.Context, cdc codec.JSONCodec, bz json.RawMessage) { +func (am AppModule) InitGenesis(ctx context.Context, bz json.RawMessage) error { var gs feegrant.GenesisState - cdc.MustUnmarshalJSON(bz, &gs) + if err := am.cdc.UnmarshalJSON(bz, &gs); err != nil { + return err + } err := am.keeper.InitGenesis(ctx, &gs) if err != nil { - panic(err) + return err } + return nil } // ExportGenesis returns the exported genesis state as raw bytes for the feegrant module. -func (am AppModule) ExportGenesis(ctx context.Context, cdc codec.JSONCodec) json.RawMessage { +func (am AppModule) ExportGenesis(ctx context.Context) (json.RawMessage, error) { gs, err := am.keeper.ExportGenesis(ctx) if err != nil { - panic(err) + return nil, err } - return cdc.MustMarshalJSON(gs) + return am.cdc.MarshalJSON(gs) } // ConsensusVersion implements HasConsensusVersion diff --git a/x/genutil/client/cli/gentx.go b/x/genutil/client/cli/gentx.go index d82b0476b81a..2c44794c23f2 100644 --- a/x/genutil/client/cli/gentx.go +++ b/x/genutil/client/cli/gentx.go @@ -90,7 +90,7 @@ $ %s gentx my-key-name 1000000stake --home=/path/to/home/dir --keyring-backend=o return errors.Wrap(err, "failed to unmarshal genesis state") } - if err = mm.ValidateGenesis(cdc, txEncCfg, genesisState); err != nil { + if err = mm.ValidateGenesis(genesisState); err != nil { return errors.Wrap(err, "failed to validate genesis state") } diff --git a/x/genutil/client/cli/init.go b/x/genutil/client/cli/init.go index 227acbe25f50..da33a1060b29 100644 --- a/x/genutil/client/cli/init.go +++ b/x/genutil/client/cli/init.go @@ -76,7 +76,6 @@ func InitCmd(mm *module.Manager) *cobra.Command { Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { clientCtx := client.GetClientContextFromCmd(cmd) - cdc := clientCtx.Codec serverCtx := server.GetServerContextFromCmd(cmd) config := serverCtx.Config @@ -133,7 +132,7 @@ func InitCmd(mm *module.Manager) *cobra.Command { if defaultDenom != "" { sdk.DefaultBondDenom = defaultDenom } - appGenState := mm.DefaultGenesis(cdc) + appGenState := mm.DefaultGenesis() appState, err := json.MarshalIndent(appGenState, "", " ") if err != nil { diff --git a/x/genutil/client/cli/init_test.go b/x/genutil/client/cli/init_test.go index 82ad4ad64c7a..a958a47544e9 100644 --- a/x/genutil/client/cli/init_test.go +++ b/x/genutil/client/cli/init_test.go @@ -35,8 +35,8 @@ import ( ) var testMbm = module.NewManager( - staking.AppModule{}, - genutil.AppModule{}, + staking.NewAppModule(makeCodec(), nil, nil, nil), + genutil.NewAppModule(makeCodec(), nil, nil, nil, nil, nil), ) func TestInitCmd(t *testing.T) { @@ -71,7 +71,7 @@ func TestInitCmd(t *testing.T) { marshaler := codec.NewProtoCodec(interfaceRegistry) clientCtx := client.Context{}. WithCodec(marshaler). - WithLegacyAmino(makeCodec()). + WithLegacyAmino(makeAminoCodec()). WithHomeDir(home) ctx := context.Background() @@ -104,7 +104,7 @@ func TestInitRecover(t *testing.T) { marshaler := codec.NewProtoCodec(interfaceRegistry) clientCtx := client.Context{}. WithCodec(marshaler). - WithLegacyAmino(makeCodec()). + WithLegacyAmino(makeAminoCodec()). WithHomeDir(home) ctx := context.Background() @@ -135,7 +135,7 @@ func TestInitDefaultBondDenom(t *testing.T) { marshaler := codec.NewProtoCodec(interfaceRegistry) clientCtx := client.Context{}. WithCodec(marshaler). - WithLegacyAmino(makeCodec()). + WithLegacyAmino(makeAminoCodec()). WithHomeDir(home) ctx := context.Background() @@ -163,7 +163,7 @@ func TestEmptyState(t *testing.T) { marshaler := codec.NewProtoCodec(interfaceRegistry) clientCtx := client.Context{}. WithCodec(marshaler). - WithLegacyAmino(makeCodec()). + WithLegacyAmino(makeAminoCodec()). WithHomeDir(home) ctx := context.Background() @@ -256,7 +256,7 @@ func TestInitConfig(t *testing.T) { marshaler := codec.NewProtoCodec(interfaceRegistry) clientCtx := client.Context{}. WithCodec(marshaler). - WithLegacyAmino(makeCodec()). + WithLegacyAmino(makeAminoCodec()). WithChainID("foo"). // add chain-id to clientCtx WithHomeDir(home) @@ -302,7 +302,7 @@ func TestInitWithHeight(t *testing.T) { marshaler := codec.NewProtoCodec(interfaceRegistry) clientCtx := client.Context{}. WithCodec(marshaler). - WithLegacyAmino(makeCodec()). + WithLegacyAmino(makeAminoCodec()). WithChainID("foo"). // add chain-id to clientCtx WithHomeDir(home) @@ -334,7 +334,7 @@ func TestInitWithNegativeHeight(t *testing.T) { marshaler := codec.NewProtoCodec(interfaceRegistry) clientCtx := client.Context{}. WithCodec(marshaler). - WithLegacyAmino(makeCodec()). + WithLegacyAmino(makeAminoCodec()). WithChainID("foo"). // add chain-id to clientCtx WithHomeDir(home) @@ -356,9 +356,14 @@ func TestInitWithNegativeHeight(t *testing.T) { } // custom tx codec -func makeCodec() *codec.LegacyAmino { +func makeAminoCodec() *codec.LegacyAmino { cdc := codec.NewLegacyAmino() sdk.RegisterLegacyAminoCodec(cdc) cryptocodec.RegisterCrypto(cdc) return cdc } + +func makeCodec() codec.Codec { + interfaceRegistry := types.NewInterfaceRegistry() + return codec.NewProtoCodec(interfaceRegistry) +} diff --git a/x/genutil/client/cli/validate_genesis.go b/x/genutil/client/cli/validate_genesis.go index 71011f1f0989..232097cda5c0 100644 --- a/x/genutil/client/cli/validate_genesis.go +++ b/x/genutil/client/cli/validate_genesis.go @@ -6,7 +6,6 @@ import ( "github.com/spf13/cobra" - "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/server" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/x/genutil/types" @@ -23,9 +22,6 @@ func ValidateGenesisCmd(mm *module.Manager) *cobra.Command { Short: "Validates the genesis file at the default location or at the location passed as an arg", RunE: func(cmd *cobra.Command, args []string) (err error) { serverCtx := server.GetServerContextFromCmd(cmd) - clientCtx := client.GetClientContextFromCmd(cmd) - - cdc := clientCtx.Codec // Load default if passed no args, otherwise load passed file var genesis string @@ -50,7 +46,7 @@ func ValidateGenesisCmd(mm *module.Manager) *cobra.Command { } if mm != nil { - if err = mm.ValidateGenesis(cdc, clientCtx.TxConfig, genState); err != nil { + if err = mm.ValidateGenesis(genState); err != nil { return fmt.Errorf("error validating genesis file %s: %w", genesis, err) } } diff --git a/x/genutil/depinject.go b/x/genutil/depinject.go index d8fb7ee6ed79..6b6f2beabfa0 100644 --- a/x/genutil/depinject.go +++ b/x/genutil/depinject.go @@ -8,6 +8,7 @@ import ( "cosmossdk.io/depinject/appconfig" "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/x/genutil/types" ) @@ -30,6 +31,7 @@ type ModuleInputs struct { StakingKeeper types.StakingKeeper DeliverTx genesis.TxHandler Config client.TxConfig + Cdc codec.Codec GenTxValidator types.MessageValidator `optional:"true"` } @@ -38,6 +40,6 @@ func ProvideModule(in ModuleInputs) appmodule.AppModule { in.GenTxValidator = types.DefaultMessageValidator } - m := NewAppModule(in.AccountKeeper, in.StakingKeeper, in.DeliverTx, in.Config, in.GenTxValidator) + m := NewAppModule(in.Cdc, in.AccountKeeper, in.StakingKeeper, in.DeliverTx, in.Config, in.GenTxValidator) return m } diff --git a/x/genutil/module.go b/x/genutil/module.go index 118cd2ea3d49..b16694ec2f6e 100644 --- a/x/genutil/module.go +++ b/x/genutil/module.go @@ -26,6 +26,7 @@ var ( // AppModule implements an application module for the genutil module. type AppModule struct { + cdc codec.Codec accountKeeper types.AccountKeeper stakingKeeper types.StakingKeeper deliverTx genesis.TxHandler @@ -35,6 +36,7 @@ type AppModule struct { // NewAppModule creates a new AppModule object func NewAppModule( + cdc codec.Codec, accountKeeper types.AccountKeeper, stakingKeeper types.StakingKeeper, deliverTx genesis.TxHandler, @@ -42,6 +44,7 @@ func NewAppModule( genTxValidator types.MessageValidator, ) module.AppModule { return AppModule{ + cdc: cdc, accountKeeper: accountKeeper, stakingKeeper: stakingKeeper, deliverTx: deliverTx, @@ -59,24 +62,24 @@ func (AppModule) Name() string { } // DefaultGenesis returns default genesis state as raw bytes for the genutil module. -func (AppModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(types.DefaultGenesisState()) +func (am AppModule) DefaultGenesis() json.RawMessage { + return am.cdc.MustMarshalJSON(types.DefaultGenesisState()) } // ValidateGenesis performs genesis state validation for the genutil module. -func (b AppModule) ValidateGenesis(cdc codec.JSONCodec, txEncodingConfig client.TxEncodingConfig, bz json.RawMessage) error { +func (am AppModule) ValidateGenesis(bz json.RawMessage) error { var data types.GenesisState - if err := cdc.UnmarshalJSON(bz, &data); err != nil { + if err := am.cdc.UnmarshalJSON(bz, &data); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) } - return types.ValidateGenesis(&data, txEncodingConfig.TxJSONDecoder(), b.genTxValidator) + return types.ValidateGenesis(&data, am.txEncodingConfig.TxJSONDecoder(), am.genTxValidator) } // InitGenesis performs genesis initialization for the genutil module. -func (am AppModule) InitGenesis(ctx context.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { +func (am AppModule) InitGenesis(ctx context.Context, data json.RawMessage) []abci.ValidatorUpdate { var genesisState types.GenesisState - cdc.MustUnmarshalJSON(data, &genesisState) + am.cdc.MustUnmarshalJSON(data, &genesisState) validators, err := InitGenesis(ctx, am.stakingKeeper, am.deliverTx, genesisState, am.txEncodingConfig) if err != nil { panic(err) @@ -85,8 +88,8 @@ func (am AppModule) InitGenesis(ctx context.Context, cdc codec.JSONCodec, data j } // ExportGenesis returns the exported genesis state as raw bytes for the genutil module. -func (am AppModule) ExportGenesis(_ context.Context, cdc codec.JSONCodec) json.RawMessage { - return am.DefaultGenesis(cdc) +func (am AppModule) ExportGenesis(_ context.Context) json.RawMessage { + return am.DefaultGenesis() } // GenTxValidator returns the genutil module's genesis transaction validator. diff --git a/x/gov/client/cli/tx_test.go b/x/gov/client/cli/tx_test.go index 4cbaf6972d96..dd903034e109 100644 --- a/x/gov/client/cli/tx_test.go +++ b/x/gov/client/cli/tx_test.go @@ -144,7 +144,7 @@ func (s *CLITestSuite) TestNewCmdSubmitProposal() { fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(10))).String()), }, - "invalid decimal coin expression", + "invalid character in coin string", }, { "valid proposal", diff --git a/x/gov/client/cli/util_test.go b/x/gov/client/cli/util_test.go index bc8245df63aa..702d6d448ef6 100644 --- a/x/gov/client/cli/util_test.go +++ b/x/gov/client/cli/util_test.go @@ -368,7 +368,7 @@ func TestReadGovPropFlags(t *testing.T) { name: "only deposit invalid coins", fromAddr: nil, args: []string{argDeposit, "not really coins"}, - expErr: []string{"invalid deposit", "invalid decimal coin expression", "not really coins"}, + expErr: []string{"invalid deposit", "invalid character in denomination"}, }, { name: "only deposit two coins", @@ -398,19 +398,19 @@ func TestReadGovPropFlags(t *testing.T) { name: "only deposit coin 1 of 3 bad", fromAddr: nil, args: []string{argDeposit, "1bad^coin,2bcoin,3ccoin"}, - expErr: []string{"invalid deposit", "invalid decimal coin expression", "1bad^coin"}, + expErr: []string{"invalid deposit", "invalid character in denomination"}, }, { name: "only deposit coin 2 of 3 bad", fromAddr: nil, args: []string{argDeposit, "1acoin,2bad^coin,3ccoin"}, - expErr: []string{"invalid deposit", "invalid decimal coin expression", "2bad^coin"}, + expErr: []string{"invalid deposit", "invalid character in denomination"}, }, { name: "only deposit coin 3 of 3 bad", fromAddr: nil, args: []string{argDeposit, "1acoin,2bcoin,3bad^coin"}, - expErr: []string{"invalid deposit", "invalid decimal coin expression", "3bad^coin"}, + expErr: []string{"invalid deposit", "invalid character in denomination"}, }, // As far as I can tell, there's no way to make flagSet.GetString return an error for a defined string flag. // So I don't have a test for the "could not read deposit" error case. diff --git a/x/gov/genesis.go b/x/gov/genesis.go index 65fa70b4b216..09975f458bf4 100644 --- a/x/gov/genesis.go +++ b/x/gov/genesis.go @@ -13,20 +13,20 @@ import ( ) // InitGenesis - store genesis parameters -func InitGenesis(ctx context.Context, ak types.AccountKeeper, bk types.BankKeeper, k *keeper.Keeper, data *v1.GenesisState) { +func InitGenesis(ctx context.Context, ak types.AccountKeeper, bk types.BankKeeper, k *keeper.Keeper, data *v1.GenesisState) error { err := k.ProposalID.Set(ctx, data.StartingProposalId) if err != nil { - panic(err) + return err } err = k.Params.Set(ctx, *data.Params) if err != nil { - panic(err) + return err } err = k.Constitution.Set(ctx, data.Constitution) if err != nil { - panic(err) + return err } // check if the deposits pool account exists @@ -39,7 +39,7 @@ func InitGenesis(ctx context.Context, ak types.AccountKeeper, bk types.BankKeepe for _, deposit := range data.Deposits { err := k.SetDeposit(ctx, *deposit) if err != nil { - panic(err) + return err } totalDeposits = totalDeposits.Add(deposit.Amount...) } @@ -47,11 +47,11 @@ func InitGenesis(ctx context.Context, ak types.AccountKeeper, bk types.BankKeepe for _, vote := range data.Votes { addr, err := ak.AddressCodec().StringToBytes(vote.Voter) if err != nil { - panic(err) + return err } err = k.Votes.Set(ctx, collections.Join(vote.ProposalId, sdk.AccAddress(addr)), *vote) if err != nil { - panic(err) + return err } } @@ -60,16 +60,16 @@ func InitGenesis(ctx context.Context, ak types.AccountKeeper, bk types.BankKeepe case v1.StatusDepositPeriod: err := k.InactiveProposalsQueue.Set(ctx, collections.Join(*proposal.DepositEndTime, proposal.Id), proposal.Id) if err != nil { - panic(err) + return err } case v1.StatusVotingPeriod: err := k.ActiveProposalsQueue.Set(ctx, collections.Join(*proposal.VotingEndTime, proposal.Id), proposal.Id) if err != nil { - panic(err) + return err } } if err := k.Proposals.Set(ctx, proposal.Id, *proposal); err != nil { - panic(err) + return err } } @@ -83,6 +83,7 @@ func InitGenesis(ctx context.Context, ak types.AccountKeeper, bk types.BankKeepe if !balance.Equal(totalDeposits) { panic(fmt.Sprintf("expected module account was %s but we got %s", balance.String(), totalDeposits.String())) } + return nil } // ExportGenesis - output genesis parameters @@ -117,7 +118,7 @@ func ExportGenesis(ctx context.Context, k *keeper.Keeper) (*v1.GenesisState, err return false, nil }) if err != nil { - panic(err) + return nil, err } // export proposals votes @@ -127,7 +128,7 @@ func ExportGenesis(ctx context.Context, k *keeper.Keeper) (*v1.GenesisState, err return false, nil }) if err != nil { - panic(err) + return nil, err } return &v1.GenesisState{ diff --git a/x/gov/go.mod b/x/gov/go.mod index faa9f700e79c..03b3dffd3404 100644 --- a/x/gov/go.mod +++ b/x/gov/go.mod @@ -24,7 +24,7 @@ require ( github.com/cosmos/cosmos-sdk v0.51.0 github.com/cosmos/gogoproto v1.4.11 github.com/golang/mock v1.6.0 - github.com/golang/protobuf v1.5.3 + github.com/golang/protobuf v1.5.4 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/manifoldco/promptui v0.9.0 github.com/spf13/cobra v1.8.0 @@ -32,14 +32,14 @@ require ( github.com/stretchr/testify v1.9.0 golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014 - google.golang.org/grpc v1.62.0 - google.golang.org/protobuf v1.32.0 + google.golang.org/grpc v1.62.1 + google.golang.org/protobuf v1.33.0 gotest.tools/v3 v3.5.1 ) require ( cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 - cosmossdk.io/x/tx v0.13.0 // indirect + cosmossdk.io/x/tx v0.13.1 // indirect filippo.io/edwards25519 v1.1.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.2 // indirect @@ -128,7 +128,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.19.0 // indirect github.com/prometheus/client_model v0.6.0 // indirect - github.com/prometheus/common v0.49.0 // indirect + github.com/prometheus/common v0.50.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect @@ -153,7 +153,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.21.0 // indirect golang.org/x/mod v0.15.0 // indirect - golang.org/x/net v0.21.0 // indirect + golang.org/x/net v0.22.0 // indirect golang.org/x/sync v0.6.0 golang.org/x/sys v0.18.0 // indirect golang.org/x/term v0.18.0 // indirect @@ -178,5 +178,4 @@ replace ( cosmossdk.io/x/auth => ../auth cosmossdk.io/x/bank => ../bank cosmossdk.io/x/staking => ../staking - cosmossdk.io/x/tx => ../tx ) diff --git a/x/gov/go.sum b/x/gov/go.sum index d7d2e2650014..c7f8dff91b04 100644 --- a/x/gov/go.sum +++ b/x/gov/go.sum @@ -16,6 +16,8 @@ cosmossdk.io/store v1.0.2 h1:lSg5BTvJBHUDwswNNyeh4K/CbqiHER73VU4nDNb8uk0= cosmossdk.io/store v1.0.2/go.mod h1:EFtENTqVTuWwitGW1VwaBct+yDagk7oG/axBMPH+FXs= cosmossdk.io/x/protocolpool v0.0.0-20230925135524-a1bc045b3190 h1:XQJj9Dv9Gtze0l2TF79BU5lkP6MkUveTUuKICmxoz+o= cosmossdk.io/x/protocolpool v0.0.0-20230925135524-a1bc045b3190/go.mod h1:7WUGupOvmlHJoIMBz1JbObQxeo6/TDiuDBxmtod8HRg= +cosmossdk.io/x/tx v0.13.1 h1:Mg+EMp67Pz+NukbJqYxuo8uRp7N/a9uR+oVS9pONtj8= +cosmossdk.io/x/tx v0.13.1/go.mod h1:CBCU6fsRVz23QGFIQBb1DNX2DztJCf3jWyEkHY2nJQ0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= @@ -304,8 +306,8 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -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/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.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -603,8 +605,8 @@ github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt2 github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.49.0 h1:ToNTdK4zSnPVJmh698mGFkDor9wBI/iGaJy5dbH1EgI= -github.com/prometheus/common v0.49.0/go.mod h1:Kxm+EULxRbUkjGU6WFsQqo3ORzB4tyKvlWFOE9mB2sE= +github.com/prometheus/common v0.50.0 h1:YSZE6aa9+luNa2da6/Tik0q0A5AbR+U003TItK57CPQ= +github.com/prometheus/common v0.50.0/go.mod h1:wHFBCEVWVmHMUpg7pYcOm2QUR/ocQdYSJVQJKnHc3xQ= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= @@ -807,8 +809,8 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= 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.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= +golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -959,8 +961,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk= -google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -975,8 +977,9 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= 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-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/x/gov/module.go b/x/gov/module.go index f169e4b8c754..aa5069183b86 100644 --- a/x/gov/module.go +++ b/x/gov/module.go @@ -10,6 +10,7 @@ import ( "google.golang.org/grpc" "cosmossdk.io/core/appmodule" + appmodulev2 "cosmossdk.io/core/appmodule/v2" "cosmossdk.io/core/registry" govclient "cosmossdk.io/x/gov/client" "cosmossdk.io/x/gov/client/cli" @@ -34,7 +35,7 @@ var ( _ module.HasGRPCGateway = AppModule{} _ appmodule.HasRegisterInterfaces = AppModule{} _ module.AppModuleSimulation = AppModule{} - _ module.HasGenesis = AppModule{} + _ appmodulev2.HasGenesis = AppModule{} _ module.HasInvariants = AppModule{} _ appmodule.AppModule = AppModule{} @@ -159,14 +160,14 @@ func (am AppModule) RegisterMigrations(mr appmodule.MigrationRegistrar) error { } // DefaultGenesis returns default genesis state as raw bytes for the gov module. -func (AppModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(v1.DefaultGenesisState()) +func (am AppModule) DefaultGenesis() json.RawMessage { + return am.cdc.MustMarshalJSON(v1.DefaultGenesisState()) } // ValidateGenesis performs genesis state validation for the gov module. -func (am AppModule) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { +func (am AppModule) ValidateGenesis(bz json.RawMessage) error { var data v1.GenesisState - if err := cdc.UnmarshalJSON(bz, &data); err != nil { + if err := am.cdc.UnmarshalJSON(bz, &data); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", govtypes.ModuleName, err) } @@ -174,19 +175,21 @@ func (am AppModule) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodin } // InitGenesis performs genesis initialization for the gov module. -func (am AppModule) InitGenesis(ctx context.Context, cdc codec.JSONCodec, data json.RawMessage) { +func (am AppModule) InitGenesis(ctx context.Context, data json.RawMessage) error { var genesisState v1.GenesisState - cdc.MustUnmarshalJSON(data, &genesisState) - InitGenesis(ctx, am.accountKeeper, am.bankKeeper, am.keeper, &genesisState) + if err := am.cdc.UnmarshalJSON(data, &genesisState); err != nil { + return err + } + return InitGenesis(ctx, am.accountKeeper, am.bankKeeper, am.keeper, &genesisState) } // ExportGenesis returns the exported genesis state as raw bytes for the gov module. -func (am AppModule) ExportGenesis(ctx context.Context, cdc codec.JSONCodec) json.RawMessage { +func (am AppModule) ExportGenesis(ctx context.Context) (json.RawMessage, error) { gs, err := ExportGenesis(ctx, am.keeper) if err != nil { - panic(err) + return nil, err } - return cdc.MustMarshalJSON(gs) + return am.cdc.MarshalJSON(gs) } // ConsensusVersion implements HasConsensusVersion diff --git a/x/gov/testutil/expected_keepers_mocks.go b/x/gov/testutil/expected_keepers_mocks.go index 78c9e669385f..3784d76377cd 100644 --- a/x/gov/testutil/expected_keepers_mocks.go +++ b/x/gov/testutil/expected_keepers_mocks.go @@ -574,9 +574,11 @@ func (mr *MockBankKeeperMockRecorder) HasSupply(ctx, denom interface{}) *gomock. } // InitGenesis mocks base method. -func (m *MockBankKeeper) InitGenesis(arg0 context.Context, arg1 *types.GenesisState) { +func (m *MockBankKeeper) InitGenesis(arg0 context.Context, arg1 *types.GenesisState) error { m.ctrl.T.Helper() - m.ctrl.Call(m, "InitGenesis", arg0, arg1) + ret := m.ctrl.Call(m, "InitGenesis", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 } // InitGenesis indicates an expected call of InitGenesis. diff --git a/x/group/go.mod b/x/group/go.mod index 29da9d5d8311..0588e354d2a5 100644 --- a/x/group/go.mod +++ b/x/group/go.mod @@ -23,15 +23,15 @@ require ( github.com/cosmos/cosmos-sdk v0.51.0 github.com/cosmos/gogoproto v1.4.11 github.com/golang/mock v1.6.0 - github.com/golang/protobuf v1.5.3 + github.com/golang/protobuf v1.5.4 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/manifoldco/promptui v0.9.0 github.com/spf13/cobra v1.8.0 github.com/stretchr/testify v1.9.0 golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014 - google.golang.org/grpc v1.62.0 - google.golang.org/protobuf v1.32.0 + google.golang.org/grpc v1.62.1 + google.golang.org/protobuf v1.33.0 pgregory.net/rapid v1.1.0 ) @@ -40,7 +40,7 @@ require ( buf.build/gen/go/tendermint/tendermint/protocolbuffers/go v1.32.0-20231117195010-33ed361a9051.1 // indirect cosmossdk.io/collections v0.4.0 // indirect cosmossdk.io/x/accounts v0.0.0-00010101000000-000000000000 // indirect - cosmossdk.io/x/tx v0.13.0 // indirect + cosmossdk.io/x/tx v0.13.1 // indirect filippo.io/edwards25519 v1.1.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.2 // indirect @@ -130,7 +130,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.19.0 // indirect github.com/prometheus/client_model v0.6.0 // indirect - github.com/prometheus/common v0.49.0 // indirect + github.com/prometheus/common v0.50.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect @@ -156,7 +156,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.21.0 // indirect golang.org/x/mod v0.15.0 // indirect - golang.org/x/net v0.21.0 // indirect + golang.org/x/net v0.22.0 // indirect golang.org/x/sync v0.6.0 // indirect golang.org/x/sys v0.18.0 // indirect golang.org/x/term v0.18.0 // indirect @@ -187,5 +187,4 @@ replace ( cosmossdk.io/x/protocolpool => ../protocolpool cosmossdk.io/x/slashing => ../slashing cosmossdk.io/x/staking => ../staking - cosmossdk.io/x/tx => ../tx ) diff --git a/x/group/go.sum b/x/group/go.sum index b7ec93bae2bd..9678247d1f7c 100644 --- a/x/group/go.sum +++ b/x/group/go.sum @@ -14,6 +14,8 @@ cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/store v1.0.2 h1:lSg5BTvJBHUDwswNNyeh4K/CbqiHER73VU4nDNb8uk0= cosmossdk.io/store v1.0.2/go.mod h1:EFtENTqVTuWwitGW1VwaBct+yDagk7oG/axBMPH+FXs= +cosmossdk.io/x/tx v0.13.1 h1:Mg+EMp67Pz+NukbJqYxuo8uRp7N/a9uR+oVS9pONtj8= +cosmossdk.io/x/tx v0.13.1/go.mod h1:CBCU6fsRVz23QGFIQBb1DNX2DztJCf3jWyEkHY2nJQ0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= @@ -304,8 +306,8 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -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/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.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -603,8 +605,8 @@ github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt2 github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.49.0 h1:ToNTdK4zSnPVJmh698mGFkDor9wBI/iGaJy5dbH1EgI= -github.com/prometheus/common v0.49.0/go.mod h1:Kxm+EULxRbUkjGU6WFsQqo3ORzB4tyKvlWFOE9mB2sE= +github.com/prometheus/common v0.50.0 h1:YSZE6aa9+luNa2da6/Tik0q0A5AbR+U003TItK57CPQ= +github.com/prometheus/common v0.50.0/go.mod h1:wHFBCEVWVmHMUpg7pYcOm2QUR/ocQdYSJVQJKnHc3xQ= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= @@ -807,8 +809,8 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= 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.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= +golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -959,8 +961,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk= -google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -975,8 +977,9 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= 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-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/x/group/keeper/genesis.go b/x/group/keeper/genesis.go index f378f3775799..70d61ff69230 100644 --- a/x/group/keeper/genesis.go +++ b/x/group/keeper/genesis.go @@ -4,8 +4,6 @@ import ( "context" "encoding/json" - abci "github.com/cometbft/cometbft/abci/types" - "cosmossdk.io/errors" "cosmossdk.io/x/group" @@ -13,37 +11,37 @@ import ( ) // InitGenesis initializes the group module's genesis state. -func (k Keeper) InitGenesis(ctx context.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { +func (k Keeper) InitGenesis(ctx context.Context, cdc codec.JSONCodec, data json.RawMessage) error { var genesisState group.GenesisState cdc.MustUnmarshalJSON(data, &genesisState) store := k.environment.KVStoreService.OpenKVStore(ctx) if err := k.groupTable.Import(store, genesisState.Groups, genesisState.GroupSeq); err != nil { - panic(errors.Wrap(err, "groups")) + return errors.Wrap(err, "groups") } if err := k.groupMemberTable.Import(store, genesisState.GroupMembers, 0); err != nil { - panic(errors.Wrap(err, "group members")) + return errors.Wrap(err, "group members") } if err := k.groupPolicyTable.Import(store, genesisState.GroupPolicies, 0); err != nil { - panic(errors.Wrap(err, "group policies")) + return errors.Wrap(err, "group policies") } if err := k.groupPolicySeq.InitVal(store, genesisState.GroupPolicySeq); err != nil { - panic(errors.Wrap(err, "group policy account seq")) + return errors.Wrap(err, "group policy account seq") } if err := k.proposalTable.Import(store, genesisState.Proposals, genesisState.ProposalSeq); err != nil { - panic(errors.Wrap(err, "proposals")) + return errors.Wrap(err, "proposals") } if err := k.voteTable.Import(store, genesisState.Votes, 0); err != nil { - panic(errors.Wrap(err, "votes")) + return errors.Wrap(err, "votes") } - return []abci.ValidatorUpdate{} + return nil } // ExportGenesis returns the group module's exported genesis. diff --git a/x/group/keeper/genesis_test.go b/x/group/keeper/genesis_test.go index 0af3c8678d86..967867a1f271 100644 --- a/x/group/keeper/genesis_test.go +++ b/x/group/keeper/genesis_test.go @@ -145,7 +145,8 @@ func (s *GenesisTestSuite) TestInitExportGenesis() { group.ModuleName: genesisBytes, } - s.keeper.InitGenesis(sdkCtx, cdc, genesisData[group.ModuleName]) + err = s.keeper.InitGenesis(sdkCtx, cdc, genesisData[group.ModuleName]) + s.Require().NoError(err) for i, g := range genesisState.Groups { res, err := s.keeper.GroupInfo(ctx, &group.QueryGroupInfoRequest{ diff --git a/x/group/module/module.go b/x/group/module/module.go index 4a232b9c142f..ab323da0b01f 100644 --- a/x/group/module/module.go +++ b/x/group/module/module.go @@ -10,6 +10,7 @@ import ( "google.golang.org/grpc" "cosmossdk.io/core/appmodule" + appmodulev2 "cosmossdk.io/core/appmodule/v2" "cosmossdk.io/core/registry" "cosmossdk.io/x/group" "cosmossdk.io/x/group/client/cli" @@ -33,7 +34,7 @@ var ( _ module.HasGRPCGateway = AppModule{} _ appmodule.HasRegisterInterfaces = AppModule{} _ module.AppModuleSimulation = AppModule{} - _ module.HasGenesis = AppModule{} + _ appmodulev2.HasGenesis = AppModule{} _ module.HasInvariants = AppModule{} _ appmodule.AppModule = AppModule{} @@ -124,28 +125,28 @@ func (am AppModule) EndBlock(ctx context.Context) error { } // DefaultGenesis returns default genesis state as raw bytes for the group module. -func (AppModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(group.NewGenesisState()) +func (am AppModule) DefaultGenesis() json.RawMessage { + return am.cdc.MustMarshalJSON(group.NewGenesisState()) } // ValidateGenesis performs genesis state validation for the group module. -func (AppModule) ValidateGenesis(cdc codec.JSONCodec, config sdkclient.TxEncodingConfig, bz json.RawMessage) error { +func (am AppModule) ValidateGenesis(bz json.RawMessage) error { var data group.GenesisState - if err := cdc.UnmarshalJSON(bz, &data); err != nil { + if err := am.cdc.UnmarshalJSON(bz, &data); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", group.ModuleName, err) } return data.Validate() } // InitGenesis performs genesis initialization for the group module. -func (am AppModule) InitGenesis(ctx context.Context, cdc codec.JSONCodec, data json.RawMessage) { - am.keeper.InitGenesis(ctx, cdc, data) +func (am AppModule) InitGenesis(ctx context.Context, data json.RawMessage) error { + return am.keeper.InitGenesis(ctx, am.cdc, data) } // ExportGenesis returns the exported genesis state as raw bytes for the group module. -func (am AppModule) ExportGenesis(ctx context.Context, cdc codec.JSONCodec) json.RawMessage { - gs := am.keeper.ExportGenesis(ctx, cdc) - return cdc.MustMarshalJSON(gs) +func (am AppModule) ExportGenesis(ctx context.Context) (json.RawMessage, error) { + gs := am.keeper.ExportGenesis(ctx, am.cdc) + return am.cdc.MarshalJSON(gs) } // GenerateGenesisState creates a randomized GenState of the group module. diff --git a/x/mint/go.mod b/x/mint/go.mod index 0ca1057bbb55..eecffb89381e 100644 --- a/x/mint/go.mod +++ b/x/mint/go.mod @@ -17,11 +17,11 @@ require ( github.com/cosmos/cosmos-sdk v0.51.0 github.com/cosmos/gogoproto v1.4.11 github.com/golang/mock v1.6.0 - github.com/golang/protobuf v1.5.3 + github.com/golang/protobuf v1.5.4 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/stretchr/testify v1.9.0 google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014 - google.golang.org/grpc v1.62.0 + google.golang.org/grpc v1.62.1 gotest.tools/v3 v3.5.1 ) @@ -31,7 +31,7 @@ require ( cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 cosmossdk.io/x/bank v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 // indirect - cosmossdk.io/x/tx v0.13.0 // indirect + cosmossdk.io/x/tx v0.13.1 // indirect filippo.io/edwards25519 v1.1.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.2 // indirect @@ -121,7 +121,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.19.0 // indirect github.com/prometheus/client_model v0.6.0 // indirect - github.com/prometheus/common v0.49.0 // indirect + github.com/prometheus/common v0.50.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect @@ -149,7 +149,7 @@ require ( golang.org/x/crypto v0.21.0 // indirect golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect golang.org/x/mod v0.15.0 // indirect - golang.org/x/net v0.21.0 // indirect + golang.org/x/net v0.22.0 // indirect golang.org/x/sync v0.6.0 // indirect golang.org/x/sys v0.18.0 // indirect golang.org/x/term v0.18.0 // indirect @@ -157,7 +157,7 @@ require ( golang.org/x/tools v0.18.0 // indirect google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c // indirect - google.golang.org/protobuf v1.32.0 // indirect + google.golang.org/protobuf v1.33.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect nhooyr.io/websocket v1.8.6 // indirect @@ -176,5 +176,4 @@ replace ( cosmossdk.io/x/auth => ../auth cosmossdk.io/x/bank => ../bank cosmossdk.io/x/staking => ../staking - cosmossdk.io/x/tx => ../tx ) diff --git a/x/mint/go.sum b/x/mint/go.sum index 3fd57a0055b6..119c6de469be 100644 --- a/x/mint/go.sum +++ b/x/mint/go.sum @@ -14,6 +14,8 @@ cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/store v1.0.2 h1:lSg5BTvJBHUDwswNNyeh4K/CbqiHER73VU4nDNb8uk0= cosmossdk.io/store v1.0.2/go.mod h1:EFtENTqVTuWwitGW1VwaBct+yDagk7oG/axBMPH+FXs= +cosmossdk.io/x/tx v0.13.1 h1:Mg+EMp67Pz+NukbJqYxuo8uRp7N/a9uR+oVS9pONtj8= +cosmossdk.io/x/tx v0.13.1/go.mod h1:CBCU6fsRVz23QGFIQBb1DNX2DztJCf3jWyEkHY2nJQ0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= @@ -296,8 +298,8 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -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/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.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -593,8 +595,8 @@ github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt2 github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.49.0 h1:ToNTdK4zSnPVJmh698mGFkDor9wBI/iGaJy5dbH1EgI= -github.com/prometheus/common v0.49.0/go.mod h1:Kxm+EULxRbUkjGU6WFsQqo3ORzB4tyKvlWFOE9mB2sE= +github.com/prometheus/common v0.50.0 h1:YSZE6aa9+luNa2da6/Tik0q0A5AbR+U003TItK57CPQ= +github.com/prometheus/common v0.50.0/go.mod h1:wHFBCEVWVmHMUpg7pYcOm2QUR/ocQdYSJVQJKnHc3xQ= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= @@ -797,8 +799,8 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= 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.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= +golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -948,8 +950,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk= -google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -964,8 +966,9 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= 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-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/x/mint/keeper/genesis.go b/x/mint/keeper/genesis.go index 57b2faf5adb9..446b9066512d 100644 --- a/x/mint/keeper/genesis.go +++ b/x/mint/keeper/genesis.go @@ -7,29 +7,31 @@ import ( ) // InitGenesis new mint genesis -func (keeper Keeper) InitGenesis(ctx context.Context, ak types.AccountKeeper, data *types.GenesisState) { +func (keeper Keeper) InitGenesis(ctx context.Context, ak types.AccountKeeper, data *types.GenesisState) error { if err := keeper.Minter.Set(ctx, data.Minter); err != nil { - panic(err) + return err } if err := keeper.Params.Set(ctx, data.Params); err != nil { - panic(err) + return err } ak.GetModuleAccount(ctx, types.ModuleName) + + return nil } // ExportGenesis returns a GenesisState for a given context and keeper. -func (keeper Keeper) ExportGenesis(ctx context.Context) *types.GenesisState { +func (keeper Keeper) ExportGenesis(ctx context.Context) (*types.GenesisState, error) { minter, err := keeper.Minter.Get(ctx) if err != nil { - panic(err) + return nil, err } params, err := keeper.Params.Get(ctx) if err != nil { - panic(err) + return nil, err } - return types.NewGenesisState(minter, params) + return types.NewGenesisState(minter, params), nil } diff --git a/x/mint/keeper/genesis_test.go b/x/mint/keeper/genesis_test.go index 5fc6e9e03678..4dce9bf881da 100644 --- a/x/mint/keeper/genesis_test.go +++ b/x/mint/keeper/genesis_test.go @@ -73,7 +73,8 @@ func (s *GenesisTestSuite) TestImportExportGenesis() { uint64(60*60*8766/5), ) - s.keeper.InitGenesis(s.sdkCtx, s.accountKeeper, genesisState) + err := s.keeper.InitGenesis(s.sdkCtx, s.accountKeeper, genesisState) + s.Require().NoError(err) minter, err := s.keeper.Minter.Get(s.sdkCtx) s.Require().Equal(genesisState.Minter, minter) @@ -87,6 +88,7 @@ func (s *GenesisTestSuite) TestImportExportGenesis() { s.Require().Equal(genesisState.Params, params) s.Require().NoError(err) - genesisState2 := s.keeper.ExportGenesis(s.sdkCtx) + genesisState2, err := s.keeper.ExportGenesis(s.sdkCtx) + s.Require().NoError(err) s.Require().Equal(genesisState, genesisState2) } diff --git a/x/mint/module.go b/x/mint/module.go index 8f228900c8d8..2336c6306ef0 100644 --- a/x/mint/module.go +++ b/x/mint/module.go @@ -9,6 +9,7 @@ import ( "google.golang.org/grpc" "cosmossdk.io/core/appmodule" + appmodulev2 "cosmossdk.io/core/appmodule/v2" "cosmossdk.io/core/registry" "cosmossdk.io/x/mint/keeper" "cosmossdk.io/x/mint/simulation" @@ -29,7 +30,7 @@ var ( _ module.HasGRPCGateway = AppModule{} _ appmodule.HasRegisterInterfaces = AppModule{} _ module.AppModuleSimulation = AppModule{} - _ module.HasGenesis = AppModule{} + _ appmodulev2.HasGenesis = AppModule{} _ appmodule.AppModule = AppModule{} _ appmodule.HasBeginBlocker = AppModule{} @@ -113,14 +114,14 @@ func (am AppModule) RegisterMigrations(mr appmodule.MigrationRegistrar) error { } // DefaultGenesis returns default genesis state as raw bytes for the mint module. -func (AppModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(types.DefaultGenesisState()) +func (am AppModule) DefaultGenesis() json.RawMessage { + return am.cdc.MustMarshalJSON(types.DefaultGenesisState()) } // ValidateGenesis performs genesis state validation for the mint module. -func (AppModule) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { +func (am AppModule) ValidateGenesis(bz json.RawMessage) error { var data types.GenesisState - if err := cdc.UnmarshalJSON(bz, &data); err != nil { + if err := am.cdc.UnmarshalJSON(bz, &data); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) } @@ -128,18 +129,23 @@ func (AppModule) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingCo } // InitGenesis performs genesis initialization for the mint module. -func (am AppModule) InitGenesis(ctx context.Context, cdc codec.JSONCodec, data json.RawMessage) { +func (am AppModule) InitGenesis(ctx context.Context, data json.RawMessage) error { var genesisState types.GenesisState - cdc.MustUnmarshalJSON(data, &genesisState) + if err := am.cdc.UnmarshalJSON(data, &genesisState); err != nil { + return err + } - am.keeper.InitGenesis(ctx, am.authKeeper, &genesisState) + return am.keeper.InitGenesis(ctx, am.authKeeper, &genesisState) } // ExportGenesis returns the exported genesis state as raw bytes for the mint // module. -func (am AppModule) ExportGenesis(ctx context.Context, cdc codec.JSONCodec) json.RawMessage { - gs := am.keeper.ExportGenesis(ctx) - return cdc.MustMarshalJSON(gs) +func (am AppModule) ExportGenesis(ctx context.Context) (json.RawMessage, error) { + gs, err := am.keeper.ExportGenesis(ctx) + if err != nil { + return nil, err + } + return am.cdc.MarshalJSON(gs) } // ConsensusVersion implements HasConsensusVersion diff --git a/x/nft/go.mod b/x/nft/go.mod index 4242c952404e..b95c4a618226 100644 --- a/x/nft/go.mod +++ b/x/nft/go.mod @@ -14,11 +14,11 @@ require ( github.com/cosmos/cosmos-sdk v0.51.0 github.com/cosmos/gogoproto v1.4.11 github.com/golang/mock v1.6.0 - github.com/golang/protobuf v1.5.3 + github.com/golang/protobuf v1.5.4 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/stretchr/testify v1.9.0 google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014 - google.golang.org/grpc v1.62.0 + google.golang.org/grpc v1.62.1 ) require ( @@ -29,7 +29,7 @@ require ( cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/bank v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 // indirect - cosmossdk.io/x/tx v0.13.0 // indirect + cosmossdk.io/x/tx v0.13.1 // indirect filippo.io/edwards25519 v1.1.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.2 // indirect @@ -120,7 +120,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.19.0 // indirect github.com/prometheus/client_model v0.6.0 // indirect - github.com/prometheus/common v0.49.0 // indirect + github.com/prometheus/common v0.50.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect @@ -148,7 +148,7 @@ require ( golang.org/x/crypto v0.21.0 // indirect golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect golang.org/x/mod v0.15.0 // indirect - golang.org/x/net v0.21.0 // indirect + golang.org/x/net v0.22.0 // indirect golang.org/x/sync v0.6.0 // indirect golang.org/x/sys v0.18.0 // indirect golang.org/x/term v0.18.0 // indirect @@ -156,7 +156,7 @@ require ( golang.org/x/tools v0.18.0 // indirect google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c // indirect - google.golang.org/protobuf v1.32.0 // indirect + google.golang.org/protobuf v1.33.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gotest.tools/v3 v3.5.1 // indirect @@ -175,5 +175,4 @@ replace ( cosmossdk.io/x/auth => ../auth cosmossdk.io/x/bank => ../bank cosmossdk.io/x/staking => ../staking - cosmossdk.io/x/tx => ../tx ) diff --git a/x/nft/go.sum b/x/nft/go.sum index 3fd57a0055b6..119c6de469be 100644 --- a/x/nft/go.sum +++ b/x/nft/go.sum @@ -14,6 +14,8 @@ cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/store v1.0.2 h1:lSg5BTvJBHUDwswNNyeh4K/CbqiHER73VU4nDNb8uk0= cosmossdk.io/store v1.0.2/go.mod h1:EFtENTqVTuWwitGW1VwaBct+yDagk7oG/axBMPH+FXs= +cosmossdk.io/x/tx v0.13.1 h1:Mg+EMp67Pz+NukbJqYxuo8uRp7N/a9uR+oVS9pONtj8= +cosmossdk.io/x/tx v0.13.1/go.mod h1:CBCU6fsRVz23QGFIQBb1DNX2DztJCf3jWyEkHY2nJQ0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= @@ -296,8 +298,8 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -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/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.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -593,8 +595,8 @@ github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt2 github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.49.0 h1:ToNTdK4zSnPVJmh698mGFkDor9wBI/iGaJy5dbH1EgI= -github.com/prometheus/common v0.49.0/go.mod h1:Kxm+EULxRbUkjGU6WFsQqo3ORzB4tyKvlWFOE9mB2sE= +github.com/prometheus/common v0.50.0 h1:YSZE6aa9+luNa2da6/Tik0q0A5AbR+U003TItK57CPQ= +github.com/prometheus/common v0.50.0/go.mod h1:wHFBCEVWVmHMUpg7pYcOm2QUR/ocQdYSJVQJKnHc3xQ= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= @@ -797,8 +799,8 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= 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.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= +golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -948,8 +950,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk= -google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -964,8 +966,9 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= 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-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/x/nft/keeper/genesis.go b/x/nft/keeper/genesis.go index b0a435dafb44..5e5dcae184fd 100644 --- a/x/nft/keeper/genesis.go +++ b/x/nft/keeper/genesis.go @@ -9,24 +9,25 @@ import ( // InitGenesis initializes the nft module's genesis state from a given // genesis state. -func (k Keeper) InitGenesis(ctx context.Context, data *nft.GenesisState) { +func (k Keeper) InitGenesis(ctx context.Context, data *nft.GenesisState) error { for _, class := range data.Classes { if err := k.SaveClass(ctx, *class); err != nil { - panic(err) + return err } } for _, entry := range data.Entries { for _, nft := range entry.Nfts { owner, err := k.ac.StringToBytes(entry.Owner) if err != nil { - panic(err) + return err } if err := k.Mint(ctx, *nft, owner); err != nil { - panic(err) + return err } } } + return nil } // ExportGenesis returns a GenesisState for a given context. diff --git a/x/nft/keeper/keeper_test.go b/x/nft/keeper/keeper_test.go index 823553727bd5..e3ac2dfd0563 100644 --- a/x/nft/keeper/keeper_test.go +++ b/x/nft/keeper/keeper_test.go @@ -386,7 +386,8 @@ func (s *TestSuite) TestInitGenesis() { Nfts: []*nft.NFT{&expNFT}, }}, } - s.nftKeeper.InitGenesis(s.ctx, expGenesis) + err := s.nftKeeper.InitGenesis(s.ctx, expGenesis) + s.Require().NoError(err) actual, has := s.nftKeeper.GetClass(s.ctx, testClassID) s.Require().True(has) diff --git a/x/nft/module/module.go b/x/nft/module/module.go index b782d14c39fb..9a5ca47effa0 100644 --- a/x/nft/module/module.go +++ b/x/nft/module/module.go @@ -8,6 +8,7 @@ import ( "google.golang.org/grpc" "cosmossdk.io/core/appmodule" + appmodulev2 "cosmossdk.io/core/appmodule/v2" "cosmossdk.io/core/registry" "cosmossdk.io/errors" "cosmossdk.io/x/nft" @@ -26,7 +27,7 @@ var ( _ module.HasGRPCGateway = AppModule{} _ appmodule.HasRegisterInterfaces = AppModule{} _ module.AppModuleSimulation = AppModule{} - _ module.HasGenesis = AppModule{} + _ appmodulev2.HasGenesis = AppModule{} _ appmodule.AppModule = AppModule{} ) @@ -83,14 +84,14 @@ func (AppModule) RegisterGRPCGatewayRoutes(clientCtx sdkclient.Context, mux *gwr } // DefaultGenesis returns default genesis state as raw bytes for the nft module. -func (AppModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(nft.DefaultGenesisState()) +func (am AppModule) DefaultGenesis() json.RawMessage { + return am.cdc.MustMarshalJSON(nft.DefaultGenesisState()) } // ValidateGenesis performs genesis state validation for the nft module. -func (am AppModule) ValidateGenesis(cdc codec.JSONCodec, config sdkclient.TxEncodingConfig, bz json.RawMessage) error { +func (am AppModule) ValidateGenesis(bz json.RawMessage) error { var data nft.GenesisState - if err := cdc.UnmarshalJSON(bz, &data); err != nil { + if err := am.cdc.UnmarshalJSON(bz, &data); err != nil { return errors.Wrapf(err, "failed to unmarshal %s genesis state", nft.ModuleName) } @@ -98,16 +99,18 @@ func (am AppModule) ValidateGenesis(cdc codec.JSONCodec, config sdkclient.TxEnco } // InitGenesis performs genesis initialization for the nft module. -func (am AppModule) InitGenesis(ctx context.Context, cdc codec.JSONCodec, data json.RawMessage) { +func (am AppModule) InitGenesis(ctx context.Context, data json.RawMessage) error { var genesisState nft.GenesisState - cdc.MustUnmarshalJSON(data, &genesisState) - am.keeper.InitGenesis(ctx, &genesisState) + if err := am.cdc.UnmarshalJSON(data, &genesisState); err != nil { + return err + } + return am.keeper.InitGenesis(ctx, &genesisState) } // ExportGenesis returns the exported genesis state as raw bytes for the nft module. -func (am AppModule) ExportGenesis(ctx context.Context, cdc codec.JSONCodec) json.RawMessage { +func (am AppModule) ExportGenesis(ctx context.Context) (json.RawMessage, error) { gs := am.keeper.ExportGenesis(ctx) - return cdc.MustMarshalJSON(gs) + return am.cdc.MarshalJSON(gs) } // ConsensusVersion implements HasConsensusVersion diff --git a/x/params/go.mod b/x/params/go.mod index 4458b3a04543..01345428b3a9 100644 --- a/x/params/go.mod +++ b/x/params/go.mod @@ -17,12 +17,12 @@ require ( github.com/cosmos/cosmos-sdk v0.51.0 github.com/cosmos/gogoproto v1.4.11 github.com/golang/mock v1.6.0 - github.com/golang/protobuf v1.5.3 + github.com/golang/protobuf v1.5.4 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/spf13/cobra v1.8.0 github.com/stretchr/testify v1.9.0 google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014 - google.golang.org/grpc v1.62.0 + google.golang.org/grpc v1.62.1 ) require ( @@ -33,7 +33,7 @@ require ( cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/bank v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 // indirect - cosmossdk.io/x/tx v0.13.0 // indirect + cosmossdk.io/x/tx v0.13.1 // indirect filippo.io/edwards25519 v1.1.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.2 // indirect @@ -122,7 +122,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.19.0 // indirect github.com/prometheus/client_model v0.6.0 // indirect - github.com/prometheus/common v0.49.0 // indirect + github.com/prometheus/common v0.50.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect @@ -149,7 +149,7 @@ require ( golang.org/x/crypto v0.21.0 // indirect golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect golang.org/x/mod v0.15.0 // indirect - golang.org/x/net v0.21.0 // indirect + golang.org/x/net v0.22.0 // indirect golang.org/x/sync v0.6.0 // indirect golang.org/x/sys v0.18.0 // indirect golang.org/x/term v0.18.0 // indirect @@ -157,7 +157,7 @@ require ( golang.org/x/tools v0.18.0 // indirect google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c // indirect - google.golang.org/protobuf v1.32.0 // indirect + google.golang.org/protobuf v1.33.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gotest.tools/v3 v3.5.1 // indirect @@ -181,5 +181,4 @@ replace ( cosmossdk.io/x/protocolpool => ../protocolpool cosmossdk.io/x/slashing => ../slashing cosmossdk.io/x/staking => ../staking - cosmossdk.io/x/tx => ../tx ) diff --git a/x/params/go.sum b/x/params/go.sum index 3fd57a0055b6..119c6de469be 100644 --- a/x/params/go.sum +++ b/x/params/go.sum @@ -14,6 +14,8 @@ cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/store v1.0.2 h1:lSg5BTvJBHUDwswNNyeh4K/CbqiHER73VU4nDNb8uk0= cosmossdk.io/store v1.0.2/go.mod h1:EFtENTqVTuWwitGW1VwaBct+yDagk7oG/axBMPH+FXs= +cosmossdk.io/x/tx v0.13.1 h1:Mg+EMp67Pz+NukbJqYxuo8uRp7N/a9uR+oVS9pONtj8= +cosmossdk.io/x/tx v0.13.1/go.mod h1:CBCU6fsRVz23QGFIQBb1DNX2DztJCf3jWyEkHY2nJQ0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= @@ -296,8 +298,8 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -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/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.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -593,8 +595,8 @@ github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt2 github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.49.0 h1:ToNTdK4zSnPVJmh698mGFkDor9wBI/iGaJy5dbH1EgI= -github.com/prometheus/common v0.49.0/go.mod h1:Kxm+EULxRbUkjGU6WFsQqo3ORzB4tyKvlWFOE9mB2sE= +github.com/prometheus/common v0.50.0 h1:YSZE6aa9+luNa2da6/Tik0q0A5AbR+U003TItK57CPQ= +github.com/prometheus/common v0.50.0/go.mod h1:wHFBCEVWVmHMUpg7pYcOm2QUR/ocQdYSJVQJKnHc3xQ= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= @@ -797,8 +799,8 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= 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.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= +golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -948,8 +950,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk= -google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -964,8 +966,9 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= 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-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/x/protocolpool/go.mod b/x/protocolpool/go.mod index 25300183f94d..0bb4361f7caa 100644 --- a/x/protocolpool/go.mod +++ b/x/protocolpool/go.mod @@ -16,12 +16,12 @@ require ( github.com/cosmos/cosmos-sdk v0.51.0 github.com/cosmos/gogoproto v1.4.11 github.com/golang/mock v1.6.0 - github.com/golang/protobuf v1.5.3 + github.com/golang/protobuf v1.5.4 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/stretchr/testify v1.9.0 google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014 - google.golang.org/grpc v1.62.0 - google.golang.org/protobuf v1.32.0 + google.golang.org/grpc v1.62.1 + google.golang.org/protobuf v1.33.0 gotest.tools/v3 v3.5.1 ) @@ -31,7 +31,7 @@ require ( cosmossdk.io/x/accounts v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/bank v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 // indirect - cosmossdk.io/x/tx v0.13.0 // indirect + cosmossdk.io/x/tx v0.13.1 // indirect filippo.io/edwards25519 v1.1.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.2 // indirect @@ -122,7 +122,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.19.0 // indirect github.com/prometheus/client_model v0.6.0 // indirect - github.com/prometheus/common v0.49.0 // indirect + github.com/prometheus/common v0.50.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect @@ -150,7 +150,7 @@ require ( golang.org/x/crypto v0.21.0 // indirect golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect golang.org/x/mod v0.15.0 // indirect - golang.org/x/net v0.21.0 // indirect + golang.org/x/net v0.22.0 // indirect golang.org/x/sync v0.6.0 // indirect golang.org/x/sys v0.18.0 // indirect golang.org/x/term v0.18.0 // indirect @@ -175,5 +175,4 @@ replace ( cosmossdk.io/x/auth => ../auth cosmossdk.io/x/bank => ../bank cosmossdk.io/x/staking => ../staking - cosmossdk.io/x/tx => ../tx ) diff --git a/x/protocolpool/go.sum b/x/protocolpool/go.sum index 3fd57a0055b6..119c6de469be 100644 --- a/x/protocolpool/go.sum +++ b/x/protocolpool/go.sum @@ -14,6 +14,8 @@ cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/store v1.0.2 h1:lSg5BTvJBHUDwswNNyeh4K/CbqiHER73VU4nDNb8uk0= cosmossdk.io/store v1.0.2/go.mod h1:EFtENTqVTuWwitGW1VwaBct+yDagk7oG/axBMPH+FXs= +cosmossdk.io/x/tx v0.13.1 h1:Mg+EMp67Pz+NukbJqYxuo8uRp7N/a9uR+oVS9pONtj8= +cosmossdk.io/x/tx v0.13.1/go.mod h1:CBCU6fsRVz23QGFIQBb1DNX2DztJCf3jWyEkHY2nJQ0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= @@ -296,8 +298,8 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -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/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.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -593,8 +595,8 @@ github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt2 github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.49.0 h1:ToNTdK4zSnPVJmh698mGFkDor9wBI/iGaJy5dbH1EgI= -github.com/prometheus/common v0.49.0/go.mod h1:Kxm+EULxRbUkjGU6WFsQqo3ORzB4tyKvlWFOE9mB2sE= +github.com/prometheus/common v0.50.0 h1:YSZE6aa9+luNa2da6/Tik0q0A5AbR+U003TItK57CPQ= +github.com/prometheus/common v0.50.0/go.mod h1:wHFBCEVWVmHMUpg7pYcOm2QUR/ocQdYSJVQJKnHc3xQ= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= @@ -797,8 +799,8 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= 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.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= +golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -948,8 +950,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk= -google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -964,8 +966,9 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= 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-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/x/protocolpool/module.go b/x/protocolpool/module.go index 03c56baed7ac..4539e9b1ab28 100644 --- a/x/protocolpool/module.go +++ b/x/protocolpool/module.go @@ -9,6 +9,7 @@ import ( "google.golang.org/grpc" "cosmossdk.io/core/appmodule" + appmodulev2 "cosmossdk.io/core/appmodule/v2" "cosmossdk.io/core/registry" "cosmossdk.io/x/protocolpool/keeper" "cosmossdk.io/x/protocolpool/types" @@ -22,13 +23,13 @@ import ( const ConsensusVersion = 1 var ( - _ module.HasName = AppModule{} - _ module.HasAminoCodec = AppModule{} - _ module.HasGRPCGateway = AppModule{} - _ appmodule.HasRegisterInterfaces = AppModule{} - _ module.AppModule = AppModule{} - _ module.AppModuleSimulation = AppModule{} - _ module.HasGenesis = AppModule{} + _ module.HasName = AppModule{} + _ module.HasAminoCodec = AppModule{} + _ module.HasGRPCGateway = AppModule{} + _ module.HasRegisterInterfaces = AppModule{} + _ module.AppModule = AppModule{} + _ module.AppModuleSimulation = AppModule{} + _ appmodulev2.HasGenesis = AppModule{} _ appmodule.AppModule = AppModule{} _ appmodule.HasServices = AppModule{} @@ -84,14 +85,14 @@ func (am AppModule) RegisterServices(registrar grpc.ServiceRegistrar) error { } // DefaultGenesis returns default genesis state as raw bytes for the protocolpool module. -func (AppModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(types.DefaultGenesisState()) +func (am AppModule) DefaultGenesis() json.RawMessage { + return am.cdc.MustMarshalJSON(types.DefaultGenesisState()) } // ValidateGenesis performs genesis state validation for the protocolpool module. -func (AppModule) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { +func (am AppModule) ValidateGenesis(bz json.RawMessage) error { var data types.GenesisState - if err := cdc.UnmarshalJSON(bz, &data); err != nil { + if err := am.cdc.UnmarshalJSON(bz, &data); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) } @@ -99,21 +100,24 @@ func (AppModule) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingCo } // InitGenesis performs genesis initialization for the protocolpool module. -func (am AppModule) InitGenesis(ctx context.Context, cdc codec.JSONCodec, data json.RawMessage) { +func (am AppModule) InitGenesis(ctx context.Context, data json.RawMessage) error { var genesisState types.GenesisState - cdc.MustUnmarshalJSON(data, &genesisState) + if err := am.cdc.UnmarshalJSON(data, &genesisState); err != nil { + return err + } if err := am.keeper.InitGenesis(ctx, &genesisState); err != nil { - panic(err) + return err } + return nil } // ExportGenesis returns the exported genesis state as raw bytes for the protocolpool module. -func (am AppModule) ExportGenesis(ctx context.Context, cdc codec.JSONCodec) json.RawMessage { +func (am AppModule) ExportGenesis(ctx context.Context) (json.RawMessage, error) { gs, err := am.keeper.ExportGenesis(ctx) if err != nil { - panic(err) + return nil, err } - return cdc.MustMarshalJSON(gs) + return am.cdc.MarshalJSON(gs) } // ConsensusVersion implements HasConsensusVersion diff --git a/x/slashing/go.mod b/x/slashing/go.mod index 7f3bd71aa9a0..0027c5231320 100644 --- a/x/slashing/go.mod +++ b/x/slashing/go.mod @@ -20,12 +20,12 @@ require ( github.com/cosmos/cosmos-sdk v0.51.0 github.com/cosmos/gogoproto v1.4.11 github.com/golang/mock v1.6.0 - github.com/golang/protobuf v1.5.3 + github.com/golang/protobuf v1.5.4 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/stretchr/testify v1.9.0 google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014 - google.golang.org/grpc v1.62.0 - google.golang.org/protobuf v1.32.0 + google.golang.org/grpc v1.62.1 + google.golang.org/protobuf v1.33.0 gotest.tools/v3 v3.5.1 ) @@ -34,7 +34,7 @@ require ( buf.build/gen/go/tendermint/tendermint/protocolbuffers/go v1.32.0-20231117195010-33ed361a9051.1 // indirect cosmossdk.io/x/accounts v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/bank v0.0.0-00010101000000-000000000000 // indirect - cosmossdk.io/x/tx v0.13.0 // indirect + cosmossdk.io/x/tx v0.13.1 // indirect filippo.io/edwards25519 v1.1.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.2 // indirect @@ -123,7 +123,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.19.0 // indirect github.com/prometheus/client_model v0.6.0 // indirect - github.com/prometheus/common v0.49.0 // indirect + github.com/prometheus/common v0.50.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect @@ -151,7 +151,7 @@ require ( golang.org/x/crypto v0.21.0 // indirect golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect golang.org/x/mod v0.15.0 // indirect - golang.org/x/net v0.21.0 // indirect + golang.org/x/net v0.22.0 // indirect golang.org/x/sync v0.6.0 // indirect golang.org/x/sys v0.18.0 // indirect golang.org/x/term v0.18.0 // indirect @@ -177,5 +177,4 @@ replace ( cosmossdk.io/x/auth => ../auth cosmossdk.io/x/bank => ../bank cosmossdk.io/x/staking => ../staking - cosmossdk.io/x/tx => ../tx ) diff --git a/x/slashing/go.sum b/x/slashing/go.sum index 815ad1a6e3e7..fbc1a49a504f 100644 --- a/x/slashing/go.sum +++ b/x/slashing/go.sum @@ -14,6 +14,8 @@ cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/store v1.0.2 h1:lSg5BTvJBHUDwswNNyeh4K/CbqiHER73VU4nDNb8uk0= cosmossdk.io/store v1.0.2/go.mod h1:EFtENTqVTuWwitGW1VwaBct+yDagk7oG/axBMPH+FXs= +cosmossdk.io/x/tx v0.13.1 h1:Mg+EMp67Pz+NukbJqYxuo8uRp7N/a9uR+oVS9pONtj8= +cosmossdk.io/x/tx v0.13.1/go.mod h1:CBCU6fsRVz23QGFIQBb1DNX2DztJCf3jWyEkHY2nJQ0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= @@ -298,8 +300,8 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -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/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.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -595,8 +597,8 @@ github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt2 github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.49.0 h1:ToNTdK4zSnPVJmh698mGFkDor9wBI/iGaJy5dbH1EgI= -github.com/prometheus/common v0.49.0/go.mod h1:Kxm+EULxRbUkjGU6WFsQqo3ORzB4tyKvlWFOE9mB2sE= +github.com/prometheus/common v0.50.0 h1:YSZE6aa9+luNa2da6/Tik0q0A5AbR+U003TItK57CPQ= +github.com/prometheus/common v0.50.0/go.mod h1:wHFBCEVWVmHMUpg7pYcOm2QUR/ocQdYSJVQJKnHc3xQ= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= @@ -799,8 +801,8 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= 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.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= +golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -950,8 +952,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk= -google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -966,8 +968,9 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= 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-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/x/slashing/keeper/genesis.go b/x/slashing/keeper/genesis.go index d0528fa0a0eb..ac4af63f0054 100644 --- a/x/slashing/keeper/genesis.go +++ b/x/slashing/keeper/genesis.go @@ -10,7 +10,7 @@ import ( // InitGenesis initializes default parameters and the keeper's address to // pubkey map. -func (keeper Keeper) InitGenesis(ctx context.Context, stakingKeeper types.StakingKeeper, data *types.GenesisState) { +func (keeper Keeper) InitGenesis(ctx context.Context, stakingKeeper types.StakingKeeper, data *types.GenesisState) error { err := stakingKeeper.IterateValidators(ctx, func(index int64, validator sdk.ValidatorI) bool { consPk, err := validator.ConsPubKey() @@ -26,36 +26,37 @@ func (keeper Keeper) InitGenesis(ctx context.Context, stakingKeeper types.Stakin }, ) if err != nil { - panic(err) + return err } for _, info := range data.SigningInfos { address, err := keeper.sk.ConsensusAddressCodec().StringToBytes(info.Address) if err != nil { - panic(err) + return err } err = keeper.ValidatorSigningInfo.Set(ctx, address, info.ValidatorSigningInfo) if err != nil { - panic(err) + return err } } for _, array := range data.MissedBlocks { address, err := keeper.sk.ConsensusAddressCodec().StringToBytes(array.Address) if err != nil { - panic(err) + return err } for _, missed := range array.MissedBlocks { if err := keeper.SetMissedBlockBitmapValue(ctx, address, missed.Index, missed.Missed); err != nil { - panic(err) + return err } } } if err := keeper.Params.Set(ctx, data.Params); err != nil { - panic(err) + return err } + return nil } // ExportGenesis writes the current store values diff --git a/x/slashing/keeper/genesis_test.go b/x/slashing/keeper/genesis_test.go index eee5bfe98d57..c8ba1131da7c 100644 --- a/x/slashing/keeper/genesis_test.go +++ b/x/slashing/keeper/genesis_test.go @@ -50,7 +50,8 @@ func (s *KeeperTestSuite) TestExportAndInitGenesis() { // Initialize genesis with genesis state before tombstone s.stakingKeeper.EXPECT().IterateValidators(ctx, gomock.Any()).Return(nil) - keeper.InitGenesis(ctx, s.stakingKeeper, genesisState) + err = keeper.InitGenesis(ctx, s.stakingKeeper, genesisState) + s.Require().NoError(err) // Validator isTombstoned should return false as GenesisState is initialized ok = keeper.IsTombstoned(ctx, consAddr1) diff --git a/x/slashing/module.go b/x/slashing/module.go index 6c78a386166d..875727d62c0b 100644 --- a/x/slashing/module.go +++ b/x/slashing/module.go @@ -9,6 +9,7 @@ import ( "google.golang.org/grpc" "cosmossdk.io/core/appmodule" + appmodulev2 "cosmossdk.io/core/appmodule/v2" "cosmossdk.io/core/registry" "cosmossdk.io/x/slashing/keeper" "cosmossdk.io/x/slashing/simulation" @@ -25,12 +26,12 @@ import ( const ConsensusVersion = 4 var ( - _ module.HasName = AppModule{} - _ module.HasAminoCodec = AppModule{} - _ module.HasGRPCGateway = AppModule{} - _ appmodule.HasRegisterInterfaces = AppModule{} - _ module.AppModuleSimulation = AppModule{} - _ module.HasGenesis = AppModule{} + _ module.HasName = AppModule{} + _ module.HasAminoCodec = AppModule{} + _ module.HasGRPCGateway = AppModule{} + _ module.HasRegisterInterfaces = AppModule{} + _ module.AppModuleSimulation = AppModule{} + _ appmodulev2.HasGenesis = AppModule{} _ appmodule.AppModule = AppModule{} _ appmodule.HasBeginBlocker = AppModule{} @@ -121,14 +122,14 @@ func (am AppModule) RegisterMigrations(mr appmodule.MigrationRegistrar) error { } // DefaultGenesis returns default genesis state as raw bytes for the slashing module. -func (AppModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(types.DefaultGenesisState()) +func (am AppModule) DefaultGenesis() json.RawMessage { + return am.cdc.MustMarshalJSON(types.DefaultGenesisState()) } // ValidateGenesis performs genesis state validation for the slashing module. -func (AppModule) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { +func (am AppModule) ValidateGenesis(bz json.RawMessage) error { var data types.GenesisState - if err := cdc.UnmarshalJSON(bz, &data); err != nil { + if err := am.cdc.UnmarshalJSON(bz, &data); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) } @@ -136,16 +137,18 @@ func (AppModule) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingCo } // InitGenesis performs genesis initialization for the slashing module. -func (am AppModule) InitGenesis(ctx context.Context, cdc codec.JSONCodec, data json.RawMessage) { +func (am AppModule) InitGenesis(ctx context.Context, data json.RawMessage) error { var genesisState types.GenesisState - cdc.MustUnmarshalJSON(data, &genesisState) - am.keeper.InitGenesis(ctx, am.stakingKeeper, &genesisState) + if err := am.cdc.UnmarshalJSON(data, &genesisState); err != nil { + return err + } + return am.keeper.InitGenesis(ctx, am.stakingKeeper, &genesisState) } // ExportGenesis returns the exported genesis state as raw bytes for the slashing module. -func (am AppModule) ExportGenesis(ctx context.Context, cdc codec.JSONCodec) json.RawMessage { +func (am AppModule) ExportGenesis(ctx context.Context) (json.RawMessage, error) { gs := am.keeper.ExportGenesis(ctx) - return cdc.MustMarshalJSON(gs) + return am.cdc.MarshalJSON(gs) } // ConsensusVersion implements HasConsensusVersion diff --git a/x/staking/go.mod b/x/staking/go.mod index c9b4fed66756..51574a695cb1 100644 --- a/x/staking/go.mod +++ b/x/staking/go.mod @@ -17,7 +17,7 @@ require ( github.com/cosmos/cosmos-sdk v0.51.0 github.com/cosmos/gogoproto v1.4.11 github.com/golang/mock v1.6.0 - github.com/golang/protobuf v1.5.3 + github.com/golang/protobuf v1.5.4 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/hashicorp/go-metrics v0.5.3 github.com/spf13/cobra v1.8.0 @@ -25,8 +25,8 @@ require ( github.com/stretchr/testify v1.9.0 golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014 - google.golang.org/grpc v1.62.0 - google.golang.org/protobuf v1.32.0 + google.golang.org/grpc v1.62.1 + google.golang.org/protobuf v1.33.0 gotest.tools/v3 v3.5.1 ) @@ -35,7 +35,7 @@ require ( buf.build/gen/go/tendermint/tendermint/protocolbuffers/go v1.32.0-20231117195010-33ed361a9051.1 // indirect cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 cosmossdk.io/x/bank v0.0.0-00010101000000-000000000000 // indirect - cosmossdk.io/x/tx v0.13.0 // indirect + cosmossdk.io/x/tx v0.13.1 // indirect filippo.io/edwards25519 v1.1.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.2 // indirect @@ -124,7 +124,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.19.0 // indirect github.com/prometheus/client_model v0.6.0 // indirect - github.com/prometheus/common v0.49.0 // indirect + github.com/prometheus/common v0.50.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect @@ -149,7 +149,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.21.0 // indirect golang.org/x/mod v0.15.0 // indirect - golang.org/x/net v0.21.0 // indirect + golang.org/x/net v0.22.0 // indirect golang.org/x/sync v0.6.0 // indirect golang.org/x/sys v0.18.0 // indirect golang.org/x/term v0.18.0 // indirect @@ -174,5 +174,4 @@ replace ( cosmossdk.io/x/accounts => ../accounts cosmossdk.io/x/auth => ../auth cosmossdk.io/x/bank => ../bank - cosmossdk.io/x/tx => ../tx ) diff --git a/x/staking/go.sum b/x/staking/go.sum index 3fd57a0055b6..119c6de469be 100644 --- a/x/staking/go.sum +++ b/x/staking/go.sum @@ -14,6 +14,8 @@ cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/store v1.0.2 h1:lSg5BTvJBHUDwswNNyeh4K/CbqiHER73VU4nDNb8uk0= cosmossdk.io/store v1.0.2/go.mod h1:EFtENTqVTuWwitGW1VwaBct+yDagk7oG/axBMPH+FXs= +cosmossdk.io/x/tx v0.13.1 h1:Mg+EMp67Pz+NukbJqYxuo8uRp7N/a9uR+oVS9pONtj8= +cosmossdk.io/x/tx v0.13.1/go.mod h1:CBCU6fsRVz23QGFIQBb1DNX2DztJCf3jWyEkHY2nJQ0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= @@ -296,8 +298,8 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -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/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.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -593,8 +595,8 @@ github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt2 github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.49.0 h1:ToNTdK4zSnPVJmh698mGFkDor9wBI/iGaJy5dbH1EgI= -github.com/prometheus/common v0.49.0/go.mod h1:Kxm+EULxRbUkjGU6WFsQqo3ORzB4tyKvlWFOE9mB2sE= +github.com/prometheus/common v0.50.0 h1:YSZE6aa9+luNa2da6/Tik0q0A5AbR+U003TItK57CPQ= +github.com/prometheus/common v0.50.0/go.mod h1:wHFBCEVWVmHMUpg7pYcOm2QUR/ocQdYSJVQJKnHc3xQ= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= @@ -797,8 +799,8 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= 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.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= +golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -948,8 +950,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk= -google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -964,8 +966,9 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= 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-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/x/staking/module.go b/x/staking/module.go index d3d28ce25043..bbeefee67e85 100644 --- a/x/staking/module.go +++ b/x/staking/module.go @@ -131,14 +131,14 @@ func (am AppModule) RegisterMigrations(mr appmodule.MigrationRegistrar) error { } // DefaultGenesis returns default genesis state as raw bytes for the staking module. -func (AppModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(types.DefaultGenesisState()) +func (am AppModule) DefaultGenesis() json.RawMessage { + return am.cdc.MustMarshalJSON(types.DefaultGenesisState()) } // ValidateGenesis performs genesis state validation for the staking module. -func (AppModule) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { +func (am AppModule) ValidateGenesis(bz json.RawMessage) error { var data types.GenesisState - if err := cdc.UnmarshalJSON(bz, &data); err != nil { + if err := am.cdc.UnmarshalJSON(bz, &data); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) } @@ -146,18 +146,18 @@ func (AppModule) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingCo } // InitGenesis performs genesis initialization for the staking module. -func (am AppModule) InitGenesis(ctx context.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { +func (am AppModule) InitGenesis(ctx context.Context, data json.RawMessage) []abci.ValidatorUpdate { var genesisState types.GenesisState - cdc.MustUnmarshalJSON(data, &genesisState) + am.cdc.MustUnmarshalJSON(data, &genesisState) return am.keeper.InitGenesis(ctx, &genesisState) } // ExportGenesis returns the exported genesis state as raw bytes for the staking // module. -func (am AppModule) ExportGenesis(ctx context.Context, cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(am.keeper.ExportGenesis(ctx)) +func (am AppModule) ExportGenesis(ctx context.Context) json.RawMessage { + return am.cdc.MustMarshalJSON(am.keeper.ExportGenesis(ctx)) } // ConsensusVersion implements HasConsensusVersion diff --git a/x/tx/go.mod b/x/tx/go.mod index b6841dc64c4c..4f89786f559d 100644 --- a/x/tx/go.mod +++ b/x/tx/go.mod @@ -15,14 +15,14 @@ require ( github.com/pkg/errors v0.9.1 github.com/stretchr/testify v1.9.0 github.com/tendermint/go-amino v0.16.0 - google.golang.org/protobuf v1.32.0 + google.golang.org/protobuf v1.33.0 gotest.tools/v3 v3.5.1 pgregory.net/rapid v1.1.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/golang/protobuf v1.5.3 // indirect + github.com/golang/protobuf v1.5.4 // 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.21.0 // indirect @@ -31,7 +31,7 @@ require ( google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c // indirect - google.golang.org/grpc v1.62.0 // indirect + google.golang.org/grpc v1.62.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/x/tx/go.sum b/x/tx/go.sum index 68c6a1e7ee63..ace680bf4848 100644 --- a/x/tx/go.sum +++ b/x/tx/go.sum @@ -14,10 +14,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -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.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= 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 v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= @@ -52,7 +50,6 @@ golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 h1:9+tzLLstTlPTRyJTh+ah5wIMsBW5c4tQwGTN3thOW9Y= google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9/go.mod h1:mqHbVIp48Muh7Ywss/AD6I5kNVKZMmAa/QEW58Gxp2s= @@ -60,12 +57,10 @@ google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014 h1: google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014/go.mod h1:rbHMSEDyoYX62nRVLOCc4Qt1HbsdytAYoVwgjiOhF3I= google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c h1:NUsgEN92SQQqzfA+YtqYNqYmB3DMMYLlIwUZAQFVFbo= google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c/go.mod h1:H4O17MA/PE9BsGx3w+a+W2VOLLD1Qf7oJneAoU6WktY= -google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk= -google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= -google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= 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= diff --git a/x/upgrade/go.mod b/x/upgrade/go.mod index 6d56912b5ee4..31811c5113a0 100644 --- a/x/upgrade/go.mod +++ b/x/upgrade/go.mod @@ -16,7 +16,7 @@ require ( github.com/cosmos/cosmos-proto v1.0.0-beta.4 github.com/cosmos/cosmos-sdk v0.51.0 github.com/cosmos/gogoproto v1.4.11 - github.com/golang/protobuf v1.5.3 + github.com/golang/protobuf v1.5.4 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/hashicorp/go-cleanhttp v0.5.2 github.com/hashicorp/go-getter v1.7.3 @@ -26,8 +26,8 @@ require ( github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.9.0 google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014 - google.golang.org/grpc v1.62.0 - google.golang.org/protobuf v1.32.0 + google.golang.org/grpc v1.62.1 + google.golang.org/protobuf v1.33.0 ) require ( @@ -43,7 +43,7 @@ require ( cosmossdk.io/x/accounts v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/bank v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 // indirect - cosmossdk.io/x/tx v0.13.0 // indirect + cosmossdk.io/x/tx v0.13.1 // indirect filippo.io/edwards25519 v1.1.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.2 // indirect @@ -147,7 +147,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.19.0 // indirect github.com/prometheus/client_model v0.6.0 // indirect - github.com/prometheus/common v0.49.0 // indirect + github.com/prometheus/common v0.50.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect @@ -179,8 +179,8 @@ require ( golang.org/x/crypto v0.21.0 // indirect golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect golang.org/x/mod v0.15.0 // indirect - golang.org/x/net v0.21.0 // indirect - golang.org/x/oauth2 v0.17.0 // indirect + golang.org/x/net v0.22.0 // indirect + golang.org/x/oauth2 v0.18.0 // indirect golang.org/x/sync v0.6.0 // indirect golang.org/x/sys v0.18.0 // indirect golang.org/x/term v0.18.0 // indirect @@ -211,5 +211,4 @@ replace ( cosmossdk.io/x/bank => ../bank cosmossdk.io/x/gov => ../gov cosmossdk.io/x/staking => ../staking - cosmossdk.io/x/tx => ../tx ) diff --git a/x/upgrade/go.sum b/x/upgrade/go.sum index 3d95da986863..0de07a6c87d6 100644 --- a/x/upgrade/go.sum +++ b/x/upgrade/go.sum @@ -200,6 +200,8 @@ cosmossdk.io/store v1.0.2 h1:lSg5BTvJBHUDwswNNyeh4K/CbqiHER73VU4nDNb8uk0= cosmossdk.io/store v1.0.2/go.mod h1:EFtENTqVTuWwitGW1VwaBct+yDagk7oG/axBMPH+FXs= cosmossdk.io/x/protocolpool v0.0.0-20230925135524-a1bc045b3190 h1:XQJj9Dv9Gtze0l2TF79BU5lkP6MkUveTUuKICmxoz+o= cosmossdk.io/x/protocolpool v0.0.0-20230925135524-a1bc045b3190/go.mod h1:7WUGupOvmlHJoIMBz1JbObQxeo6/TDiuDBxmtod8HRg= +cosmossdk.io/x/tx v0.13.1 h1:Mg+EMp67Pz+NukbJqYxuo8uRp7N/a9uR+oVS9pONtj8= +cosmossdk.io/x/tx v0.13.1/go.mod h1:CBCU6fsRVz23QGFIQBb1DNX2DztJCf3jWyEkHY2nJQ0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= @@ -523,8 +525,8 @@ github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -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/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.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -890,8 +892,8 @@ github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt2 github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.49.0 h1:ToNTdK4zSnPVJmh698mGFkDor9wBI/iGaJy5dbH1EgI= -github.com/prometheus/common v0.49.0/go.mod h1:Kxm+EULxRbUkjGU6WFsQqo3ORzB4tyKvlWFOE9mB2sE= +github.com/prometheus/common v0.50.0 h1:YSZE6aa9+luNa2da6/Tik0q0A5AbR+U003TItK57CPQ= +github.com/prometheus/common v0.50.0/go.mod h1:wHFBCEVWVmHMUpg7pYcOm2QUR/ocQdYSJVQJKnHc3xQ= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= @@ -1175,8 +1177,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= -golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= +golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1202,8 +1204,8 @@ golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A= -golang.org/x/oauth2 v0.17.0 h1:6m3ZPmLEFdVxKKWnKq4VqZ60gutO35zm+zrAHVmHyDQ= -golang.org/x/oauth2 v0.17.0/go.mod h1:OzPDGQiuQMguemayvdylqddI7qcD9lnSDb+1FiwQ5HA= +golang.org/x/oauth2 v0.18.0 h1:09qnuIAgzdx1XplqJvW6CQqMCtGZykZWcXzPMPUusvI= +golang.org/x/oauth2 v0.18.0/go.mod h1:Wf7knwG0MPoWIMMBgFlEaSUDaKskp0dCfrlJRJXbBi8= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 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= @@ -1630,8 +1632,8 @@ google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk= -google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -1648,8 +1650,9 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= 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-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/x/upgrade/module.go b/x/upgrade/module.go index 72ba2e94b43d..7b7dbc50ec4d 100644 --- a/x/upgrade/module.go +++ b/x/upgrade/module.go @@ -10,6 +10,7 @@ import ( "google.golang.org/grpc" "cosmossdk.io/core/appmodule" + appmodulev2 "cosmossdk.io/core/appmodule/v2" "cosmossdk.io/core/registry" "cosmossdk.io/x/upgrade/client/cli" "cosmossdk.io/x/upgrade/keeper" @@ -28,11 +29,11 @@ func init() { const ConsensusVersion uint64 = 3 var ( - _ module.HasName = AppModule{} - _ module.HasAminoCodec = AppModule{} - _ module.HasGRPCGateway = AppModule{} - _ appmodule.HasRegisterInterfaces = AppModule{} - _ module.HasGenesis = AppModule{} + _ module.HasName = AppModule{} + _ module.HasAminoCodec = AppModule{} + _ module.HasGRPCGateway = AppModule{} + _ module.HasRegisterInterfaces = AppModule{} + _ appmodulev2.HasGenesis = AppModule{} _ appmodule.AppModule = AppModule{} _ appmodule.HasPreBlocker = AppModule{} @@ -105,24 +106,24 @@ func (am AppModule) RegisterMigrations(mr appmodule.MigrationRegistrar) error { } // DefaultGenesis is an empty object -func (AppModule) DefaultGenesis(_ codec.JSONCodec) json.RawMessage { +func (AppModule) DefaultGenesis() json.RawMessage { return []byte("{}") } // ValidateGenesis is always successful, as we ignore the value -func (AppModule) ValidateGenesis(_ codec.JSONCodec, _ client.TxEncodingConfig, _ json.RawMessage) error { +func (AppModule) ValidateGenesis(_ json.RawMessage) error { return nil } // InitGenesis is ignored, no sense in serializing future upgrades -func (am AppModule) InitGenesis(ctx context.Context, _ codec.JSONCodec, _ json.RawMessage) { +func (am AppModule) InitGenesis(ctx context.Context, _ json.RawMessage) error { // set version map automatically if available if versionMap := am.keeper.GetInitVersionMap(); versionMap != nil { // chains can still use a custom init chainer for setting the version map // this means that we need to combine the manually wired modules version map with app wiring enabled modules version map moduleVM, err := am.keeper.GetModuleVersionMap(ctx) if err != nil { - panic(err) + return err } for name, version := range moduleVM { @@ -133,14 +134,15 @@ func (am AppModule) InitGenesis(ctx context.Context, _ codec.JSONCodec, _ json.R err = am.keeper.SetModuleVersionMap(ctx, versionMap) if err != nil { - panic(err) + return err } } + return nil } // ExportGenesis is always empty, as InitGenesis does nothing either -func (am AppModule) ExportGenesis(_ context.Context, cdc codec.JSONCodec) json.RawMessage { - return am.DefaultGenesis(cdc) +func (am AppModule) ExportGenesis(_ context.Context) (json.RawMessage, error) { + return am.DefaultGenesis(), nil } // ConsensusVersion implements HasConsensusVersion