diff --git a/.github/pr_labeler.yml b/.github/pr_labeler.yml index 53ccb932225c..f196ff46d060 100644 --- a/.github/pr_labeler.yml +++ b/.github/pr_labeler.yml @@ -4,8 +4,6 @@ - x/authz/**/* "C:x/bank": - x/bank/**/* -"C:x/capability": - - x/capability/**/* "C:x/crisis": - x/crisis/**/* "C:x/distribution": diff --git a/.github/workflows/proto-registry.yml b/.github/workflows/proto-registry.yml index 8d9f64b22b30..70a70213a777 100644 --- a/.github/workflows/proto-registry.yml +++ b/.github/workflows/proto-registry.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: bufbuild/buf-setup-action@v1.15.0 + - uses: bufbuild/buf-setup-action@v1.15.1 - uses: bufbuild/buf-push-action@v1 with: input: "proto" diff --git a/.github/workflows/proto.yml b/.github/workflows/proto.yml index 60dabcca7e28..db3ba0d0a96d 100644 --- a/.github/workflows/proto.yml +++ b/.github/workflows/proto.yml @@ -15,7 +15,7 @@ jobs: timeout-minutes: 5 steps: - uses: actions/checkout@v3 - - uses: bufbuild/buf-setup-action@v1.15.0 + - uses: bufbuild/buf-setup-action@v1.15.1 - uses: bufbuild/buf-lint-action@v1 with: input: "proto" @@ -24,7 +24,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: bufbuild/buf-setup-action@v1.15.0 + - uses: bufbuild/buf-setup-action@v1.15.1 - uses: bufbuild/buf-breaking-action@v1 with: input: "proto" diff --git a/CHANGELOG.md b/CHANGELOG.md index 193dea1b302b..8002ca65cc77 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,7 +45,6 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (x/gov) [#14373](https://github.com/cosmos/cosmos-sdk/pull/14057) Add new proto field `constitution` of type `string` to gov module genesis state, which allows chain builders to lay a strong foundation by specifying purpose. * (x/genutil) [#15301](https://github.com/cosmos/cosmos-sdk/pull/15031) Add application genesis. The genesis is now entirely managed by the application and passed to CometBFT at note instantiation. Functions that were taking a `cmttypes.GenesisDoc{}` now takes a `genutiltypes.AppGenesis{}`. * (cli) [#14659](https://github.com/cosmos/cosmos-sdk/pull/14659) Added ability to query blocks by events with queries directly passed to Tendermint, which will allow for full query operator support, e.g. `>`. -* [#14897](https://github.com/cosmos/cosmos-sdk/pull/14897) Migrate the Cosmos SDK to CometBFT. * (x/gov) [#14720](https://github.com/cosmos/cosmos-sdk/pull/14720) Upstream expedited proposals from Osmosis. * (x/auth) [#14650](https://github.com/cosmos/cosmos-sdk/pull/14650) Add Textual SignModeHandler. It is however **NOT** enabled by default, and should only be used for **TESTING** purposes until `SIGN_MODE_TEXTUAL` is fully released. * (cli) [#14655](https://github.com/cosmos/cosmos-sdk/pull/14655) Add a new command to list supported algos. @@ -53,10 +52,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (client) [#14342](https://github.com/cosmos/cosmos-sdk/pull/14342) Add ` config` command is now a sub-command, for setting, getting and migrating Cosmos SDK configuration files. * (query) [#14468](https://github.com/cosmos/cosmos-sdk/pull/14468) Implement pagination for collections. * (x/distribution) [#14322](https://github.com/cosmos/cosmos-sdk/pull/14322) Introduce a new gRPC message handler, `DepositValidatorRewardsPool`, that allows explicit funding of a validator's reward pool. -* (client) [#12936](https://github.com/cosmos/cosmos-sdk/pull/12936) Add capability to pre-process transactions before broadcasting from a higher level chain. * [#13473](https://github.com/cosmos/cosmos-sdk/pull/13473) ADR-038: Go plugin system proposal -* [#14356](https://github.com/cosmos/cosmos-sdk/pull/14356) Add `events.GetAttributes` and `event.GetAttribute` methods to simplify the retrieval of an attribute from event(s). -* [#14472](https://github.com/cosmos/cosmos-sdk/pull/14356) The recommended metadata format for x/gov and x/group proposals now uses an array of strings (instead of a single string) for the `authors` field. * (mempool) [#14484](https://github.com/cosmos/cosmos-sdk/pull/14484) Add priority nonce mempool option for transaction replacement. * (x/gov,cli) [#14718](https://github.com/cosmos/cosmos-sdk/pull/14718) Added `AddGovPropFlagsToCmd` and `ReadGovPropFlags` functions. * (x/bank) [#14894](https://github.com/cosmos/cosmos-sdk/pull/14894) Return a human readable denomination for IBC vouchers when querying bank balances. Added a `ResolveDenom` parameter to `types.QueryAllBalancesRequest` and `--resolve-denom` flag to `GetBalancesCmd()`. @@ -66,6 +62,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Improvements +* (server) [#15358](https://github.com/cosmos/cosmos-sdk/pull/15358) Add `server.InterceptConfigsAndCreateContext` as alternative to `server.InterceptConfigsPreRunHandler` which does not set the server context and the default SDK logger. * [#15011](https://github.com/cosmos/cosmos-sdk/pull/15011) Introduce `cosmossdk.io/log` package to provide a consistent logging interface through the SDK. CometBFT logger is now replaced by `cosmossdk.io/log.Logger`. * (x/auth) [#14758](https://github.com/cosmos/cosmos-sdk/pull/14758) Allow transaction event queries to directly passed to Tendermint, which will allow for full query operator support, e.g. `>`. * (server) [#15041](https://github.com/cosmos/cosmos-sdk/pull/15041) Remove unnecessary sleeps from gRPC and API server initiation. The servers will start and accept requests as soon as they're ready. @@ -88,9 +85,9 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (store) [#14439](https://github.com/cosmos/cosmos-sdk/pull/14439) Remove global metric gatherer from store. * By default store has a no op metric gatherer, the application developer must set another metric gatherer or us the provided one in `store/metrics`. * [#14406](https://github.com/cosmos/cosmos-sdk/issues/14406) Migrate usage of types/store.go to store/types/.. -* (x/staking) [#14590](https://github.com/cosmos/cosmos-sdk/pull/14590) Return undelegate amount in MsgUndelegateResponse +* (x/staking) [#14590](https://github.com/cosmos/cosmos-sdk/pull/14590) Return undelegate amount in MsgUndelegateResponse. * (baseapp) [#15023](https://github.com/cosmos/cosmos-sdk/pull/15023) & [#15213](https://github.com/cosmos/cosmos-sdk/pull/15213) Add `MessageRouter` interface to baseapp and pass it to authz, gov and groups instead of concrete type. -* (simapp) [#15305](https://github.com/cosmos/cosmos-sdk/pull/15305) Add `AppStateFnWithExtendedCb` with callback function to extend rawState. +* (simtestutil) [#15305](https://github.com/cosmos/cosmos-sdk/pull/15305) Add `AppStateFnWithExtendedCb` with callback function to extend rawState. ### State Machine Breaking @@ -99,6 +96,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### API Breaking Changes +* (server) [#15358](https://github.com/cosmos/cosmos-sdk/pull/15358) Remove `server.ErrorCode` that was not used anywhere. * [#15211](https://github.com/cosmos/cosmos-sdk/pull/15211) Remove usage of `github.com/cometbft/cometbft/libs/bytes.HexBytes` in favor of `[]byte` thorough the SDK. * [#15011](https://github.com/cosmos/cosmos-sdk/pull/15011) All functions that were taking a CometBFT logger, now take `cosmossdk.io/log.Logger` instead. * (x/auth) [#14758](https://github.com/cosmos/cosmos-sdk/pull/14758) Refactor transaction searching: @@ -132,10 +130,11 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (baseapp) [#14050](https://github.com/cosmos/cosmos-sdk/pull/14050) refactor `ABCIListener` interface to accept go contexts * (store/streaming)[#14603](https://github.com/cosmos/cosmos-sdk/pull/14603) `StoreDecoderRegistry` moved from store to `types/simulations` this breaks the `AppModuleSimulation` interface. * (x/staking) [#14590](https://github.com/cosmos/cosmos-sdk/pull/14590) `MsgUndelegateResponse` now includes undelegated amount. `x/staking` module's `keeper.Undelegate` now returns 3 values (completionTime,undelegateAmount,error) instead of 2. -* (x/feegrant) [14649](https://github.com/cosmos/cosmos-sdk/pull/14649) Extract Feegrant in its own go.mod and rename the package to `cosmossdk.io/x/feegrant`. +* (x/feegrant) [#14649](https://github.com/cosmos/cosmos-sdk/pull/14649) Extract Feegrant in its own go.mod and rename the package to `cosmossdk.io/x/feegrant`. * (x/bank) [#14894](https://github.com/cosmos/cosmos-sdk/pull/14894) Allow a human readable denomination for coins when querying bank balances. Added a `ResolveDenom` parameter to `types.QueryAllBalancesRequest`. * (crypto) [#15070](https://github.com/cosmos/cosmos-sdk/pull/15070) `GenerateFromPassword` and `Cost` from `bcrypt.go` now take a `uint32` instead of a `int` type. * (client) [#15123](https://github.com/cosmos/cosmos-sdk/pull/15123) `NewFactoryCLI` now returns an error, in addition to the `Factory`. +* (x/capability) [#15344](https://github.com/cosmos/cosmos-sdk/pull/15344) Capability module was removed and is now housed in [IBC-GO](https://github.com/cosmos/ibc-go). ### Client Breaking Changes @@ -144,7 +143,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### CLI Breaking Changes * (x/staking) [#14864](https://github.com/cosmos/cosmos-sdk/pull/14864) `create-validator` CLI command now takes a json file as an arg instead of having a bunch of required flags to it. -* (cli) [#14659](https://github.com/cosmos/cosmos-sdk/pull/14659) ` q block ` is removed as it just output json. The new command allows either height/hash and is ` q block --type=height|hash `. +* (cli) [#14659](https://github.com/cosmos/cosmos-sdk/pull/14659) ` q block ` is removed as it just output json. The new command allows either height/hash and is ` q block --type=height|hash `. * (x/gov) [#14880](https://github.com/cosmos/cosmos-sdk/pull/14880) Remove ` tx gov submit-legacy-proposal cancel-software-upgrade` and `software-upgrade` commands. These commands are now in the `x/upgrade` module and using gov v1. Use `tx upgrade software-upgrade` instead. * (grpc-web) [#14652](https://github.com/cosmos/cosmos-sdk/pull/14652) Remove `grpc-web.address` flag. * (client) [#14342](https://github.com/cosmos/cosmos-sdk/pull/14342) ` config` command is now a sub-command. Use ` config --help` to learn more. @@ -168,6 +167,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Features +* [#14897](https://github.com/cosmos/cosmos-sdk/pull/14897) Migrate the Cosmos SDK to CometBFT. * (client) [#14509](https://github.com/cosmos/cosmos-sdk/pull/#14509) Added `AddKeyringFlags` function. * (x/bank) [#14045](https://github.com/cosmos/cosmos-sdk/pull/14045) Add CLI command `spendable-balances`, which also accepts the flag `--denom`. * (x/slashing, x/staking) [#14363](https://github.com/cosmos/cosmos-sdk/pull/14363) Add the infraction a validator commited type as an argument to a `SlashWithInfractionReason` keeper method. @@ -202,7 +202,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (snapshots) [#14608](https://github.com/cosmos/cosmos-sdk/pull/14608/) Deprecate unused structs `SnapshotKVItem` and `SnapshotSchema`. * (x/group, x/gov) [#14483](https://github.com/cosmos/cosmos-sdk/pull/14483) Add support for `[]string` and `[]int` in `draft-proposal` prompt. * (protobuf) [#14476](https://github.com/cosmos/cosmos-sdk/pull/14476) Clean up protobuf annotations `{accepts,implements}_interface`. -* (x/gov, x/group) [#14472](https://github.com/cosmos/cosmos-sdk/pull/14356) The recommended metadata format for x/gov and x/group proposals now uses an array of strings (instead of a single string) for the `authors` field. +* (x/gov, x/group) [#14472](https://github.com/cosmos/cosmos-sdk/pull/14472) The recommended metadata format for x/gov and x/group proposals now uses an array of strings (instead of a single string) for the `authors` field. * (crypto) [#14460](https://github.com/cosmos/cosmos-sdk/pull/14460) Check the signature returned by a ledger device against the public key in the keyring. * (baseapp) [#14356](https://github.com/cosmos/cosmos-sdk/pull/14356) Add `events.GetAttributes` and `event.GetAttribute` methods to simplify the retrieval of an attribute from event(s). * (types) [#14332](https://github.com/cosmos/cosmos-sdk/issues/14332) Reduce state export time by 50%. diff --git a/SECURITY.md b/SECURITY.md index 707c936a9499..70c47678f651 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -26,7 +26,6 @@ in for CometBFT and other lower-level libraries (eg. [IAVL](https://github.com/c * [`x/auth`](https://github.com/cosmos/cosmos-sdk/tree/main/x/auth) * [`x/bank`](https://github.com/cosmos/cosmos-sdk/tree/main/x/bank) -* [`x/capability`](https://github.com/cosmos/cosmos-sdk/tree/main/x/capability) * [`x/staking`](https://github.com/cosmos/cosmos-sdk/tree/main/x/staking) * [`x/slashing`](https://github.com/cosmos/cosmos-sdk/tree/main/x/slashing) * [`x/evidence`](https://github.com/cosmos/cosmos-sdk/tree/main/x/evidence) diff --git a/UPGRADING.md b/UPGRADING.md index 973d913d1c1d..aa57db85f8e3 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -62,12 +62,6 @@ The `gogoproto.goproto_stringer = false` annotation has been removed from most p Previously, all modules were required to be set in `OrderBeginBlockers`, `OrderEndBlockers` and `OrderInitGenesis / OrderExportGenesis` in `app.go` / `app_config.go`. This is no longer the case, the assertion has been loosened to only require modules implementing, respectively, the `module.BeginBlockAppModule`, `module.EndBlockAppModule` and `module.HasGenesis` interfaces. -#### Replaces - -* `GoLevelDB` version has been pinned to `v1.0.1-0.20210819022825-2ae1ddf74ef7`, following versions might cause unexpected behavior. - * [issue #14949 on cosmos-sdk](https://github.com/cosmos/cosmos-sdk/issues/14949) - * [issue #25413 on go-ethereum](https://github.com/ethereum/go-ethereum/pull/25413) - ### Packages #### Store @@ -81,6 +75,10 @@ All the store imports are now renamed to use `cosmossdk.io/store` instead of `gi ### Modules +#### `x/capability` + +Capability was moved to [IBC-GO](https://github.com/cosmos/ibc-go). IBC V8 will contain the necessary changes to incorporate the new module location + #### `x/gov` ##### Expedited Proposals @@ -141,6 +139,8 @@ Due to the import changes, this is a breaking change. Chains need to remove **en Other than that, the migration should be seamless. On the SDK side, clean-up of variables, functions to reflect the new name will only happen from v0.48 (part 2). +Note: It is possible that these steps must first be performed by your dependencies before you can perform them on your own codebase. + ### Simulation Remove `RandomizedParams` from `AppModuleSimulation` interface. Previously, it used to generate random parameter changes during simulations, however, it does so through ParamChangeProposal which is now legacy. Since all modules were migrated, we can now safely remove this from `AppModuleSimulation` interface. @@ -206,6 +206,14 @@ This means you can replace your usage of `simapp.MakeTestEncodingConfig` in test `ExportAppStateAndValidators` takes an extra argument, `modulesToExport`, which is a list of module names to export. That argument should be passed to the module maanager `ExportGenesisFromModules` method. +#### Replaces + +The `GoLevelDB` version must pinned to `v1.0.1-0.20210819022825-2ae1ddf74ef7` in the application, following versions might cause unexpected behavior. +This can be done adding `replace github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7` to the `go.mod` file. + +* [issue #14949 on cosmos-sdk](https://github.com/cosmos/cosmos-sdk/issues/14949) +* [issue #25413 on go-ethereum](https://github.com/ethereum/go-ethereum/pull/25413) + ### Protobuf The SDK has migrated from `gogo/protobuf` (which is currently unmaintained), to our own maintained fork, [`cosmos/gogoproto`](https://github.com/cosmos/gogoproto). @@ -266,7 +274,7 @@ the correct code. #### `**all**` `EventTypeMessage` events, with `sdk.AttributeKeyModule` and `sdk.AttributeKeySender` are now emitted directly at message excecution (in `baseapp`). -This means that you can remove the following boilerplate from all your custom modules: +This means that the following boilerplate should be removed from all your custom modules: ```go ctx.EventManager().EmitEvent( @@ -280,7 +288,7 @@ ctx.EventManager().EmitEvent( The module name is assumed by `baseapp` to be the second element of the message route: `"cosmos.bank.v1beta1.MsgSend" -> "bank"`. In case a module does not follow the standard message path, (e.g. IBC), it is advised to keep emitting the module name event. -`Baseapp` only emits that event if the module have not already done so. +`Baseapp` only emits that event if the module has not already done so. #### `x/params` diff --git a/api/cosmos/capability/module/v1/module.pulsar.go b/api/cosmos/capability/module/v1/module.pulsar.go deleted file mode 100644 index 800b6589a870..000000000000 --- a/api/cosmos/capability/module/v1/module.pulsar.go +++ /dev/null @@ -1,572 +0,0 @@ -// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. -package modulev1 - -import ( - _ "cosmossdk.io/api/cosmos/app/v1alpha1" - fmt "fmt" - runtime "github.com/cosmos/cosmos-proto/runtime" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoiface "google.golang.org/protobuf/runtime/protoiface" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - io "io" - reflect "reflect" - sync "sync" -) - -var ( - md_Module protoreflect.MessageDescriptor - fd_Module_seal_keeper protoreflect.FieldDescriptor -) - -func init() { - file_cosmos_capability_module_v1_module_proto_init() - md_Module = File_cosmos_capability_module_v1_module_proto.Messages().ByName("Module") - fd_Module_seal_keeper = md_Module.Fields().ByName("seal_keeper") -} - -var _ protoreflect.Message = (*fastReflection_Module)(nil) - -type fastReflection_Module Module - -func (x *Module) ProtoReflect() protoreflect.Message { - return (*fastReflection_Module)(x) -} - -func (x *Module) slowProtoReflect() protoreflect.Message { - mi := &file_cosmos_capability_module_v1_module_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_Module_messageType fastReflection_Module_messageType -var _ protoreflect.MessageType = fastReflection_Module_messageType{} - -type fastReflection_Module_messageType struct{} - -func (x fastReflection_Module_messageType) Zero() protoreflect.Message { - return (*fastReflection_Module)(nil) -} -func (x fastReflection_Module_messageType) New() protoreflect.Message { - return new(fastReflection_Module) -} -func (x fastReflection_Module_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_Module -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_Module) Descriptor() protoreflect.MessageDescriptor { - return md_Module -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_Module) Type() protoreflect.MessageType { - return _fastReflection_Module_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_Module) New() protoreflect.Message { - return new(fastReflection_Module) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_Module) Interface() protoreflect.ProtoMessage { - return (*Module)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_Module) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.SealKeeper != false { - value := protoreflect.ValueOfBool(x.SealKeeper) - if !f(fd_Module_seal_keeper, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_Module) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "cosmos.capability.module.v1.Module.seal_keeper": - return x.SealKeeper != false - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.capability.module.v1.Module")) - } - panic(fmt.Errorf("message cosmos.capability.module.v1.Module does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Module) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "cosmos.capability.module.v1.Module.seal_keeper": - x.SealKeeper = false - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.capability.module.v1.Module")) - } - panic(fmt.Errorf("message cosmos.capability.module.v1.Module does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_Module) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "cosmos.capability.module.v1.Module.seal_keeper": - value := x.SealKeeper - return protoreflect.ValueOfBool(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.capability.module.v1.Module")) - } - panic(fmt.Errorf("message cosmos.capability.module.v1.Module does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Module) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "cosmos.capability.module.v1.Module.seal_keeper": - x.SealKeeper = value.Bool() - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.capability.module.v1.Module")) - } - panic(fmt.Errorf("message cosmos.capability.module.v1.Module does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Module) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "cosmos.capability.module.v1.Module.seal_keeper": - panic(fmt.Errorf("field seal_keeper of message cosmos.capability.module.v1.Module is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.capability.module.v1.Module")) - } - panic(fmt.Errorf("message cosmos.capability.module.v1.Module does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_Module) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "cosmos.capability.module.v1.Module.seal_keeper": - return protoreflect.ValueOfBool(false) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.capability.module.v1.Module")) - } - panic(fmt.Errorf("message cosmos.capability.module.v1.Module does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_Module) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in cosmos.capability.module.v1.Module", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_Module) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Module) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_Module) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_Module) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*Module) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if x.SealKeeper { - n += 2 - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*Module) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if x.SealKeeper { - i-- - if x.SealKeeper { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x8 - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*Module) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field SealKeeper", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - x.SealKeeper = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.0 -// protoc (unknown) -// source: cosmos/capability/module/v1/module.proto - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// Module is the config object of the capability module. -type Module struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // seal_keeper defines if keeper.Seal() will run on BeginBlock() to prevent further modules from creating a scoped - // keeper. For more details check x/capability/keeper.go. - SealKeeper bool `protobuf:"varint,1,opt,name=seal_keeper,json=sealKeeper,proto3" json:"seal_keeper,omitempty"` -} - -func (x *Module) Reset() { - *x = Module{} - if protoimpl.UnsafeEnabled { - mi := &file_cosmos_capability_module_v1_module_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Module) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Module) ProtoMessage() {} - -// Deprecated: Use Module.ProtoReflect.Descriptor instead. -func (*Module) Descriptor() ([]byte, []int) { - return file_cosmos_capability_module_v1_module_proto_rawDescGZIP(), []int{0} -} - -func (x *Module) GetSealKeeper() bool { - if x != nil { - return x.SealKeeper - } - return false -} - -var File_cosmos_capability_module_v1_module_proto protoreflect.FileDescriptor - -var file_cosmos_capability_module_v1_module_proto_rawDesc = []byte{ - 0x0a, 0x28, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, - 0x69, 0x74, 0x79, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x6f, - 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1b, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2e, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2e, 0x6d, 0x6f, - 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x20, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, - 0x61, 0x70, 0x70, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x6d, 0x6f, 0x64, - 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x5c, 0x0a, 0x06, 0x4d, 0x6f, 0x64, - 0x75, 0x6c, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x65, 0x61, 0x6c, 0x5f, 0x6b, 0x65, 0x65, 0x70, - 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x73, 0x65, 0x61, 0x6c, 0x4b, 0x65, - 0x65, 0x70, 0x65, 0x72, 0x3a, 0x31, 0xba, 0xc0, 0x96, 0xda, 0x01, 0x2b, 0x0a, 0x29, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x78, 0x2f, 0x63, 0x61, 0x70, - 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x42, 0xf4, 0x01, 0x0a, 0x1f, 0x63, 0x6f, 0x6d, 0x2e, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, - 0x79, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x4d, 0x6f, 0x64, - 0x75, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x35, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2f, 0x6d, - 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x76, - 0x31, 0xa2, 0x02, 0x03, 0x43, 0x43, 0x4d, 0xaa, 0x02, 0x1b, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x43, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2e, 0x4d, 0x6f, 0x64, 0x75, - 0x6c, 0x65, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x1b, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x43, - 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, - 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x27, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x43, 0x61, 0x70, - 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, - 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x1e, - 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x43, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, - 0x74, 0x79, 0x3a, 0x3a, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_cosmos_capability_module_v1_module_proto_rawDescOnce sync.Once - file_cosmos_capability_module_v1_module_proto_rawDescData = file_cosmos_capability_module_v1_module_proto_rawDesc -) - -func file_cosmos_capability_module_v1_module_proto_rawDescGZIP() []byte { - file_cosmos_capability_module_v1_module_proto_rawDescOnce.Do(func() { - file_cosmos_capability_module_v1_module_proto_rawDescData = protoimpl.X.CompressGZIP(file_cosmos_capability_module_v1_module_proto_rawDescData) - }) - return file_cosmos_capability_module_v1_module_proto_rawDescData -} - -var file_cosmos_capability_module_v1_module_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_cosmos_capability_module_v1_module_proto_goTypes = []interface{}{ - (*Module)(nil), // 0: cosmos.capability.module.v1.Module -} -var file_cosmos_capability_module_v1_module_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_cosmos_capability_module_v1_module_proto_init() } -func file_cosmos_capability_module_v1_module_proto_init() { - if File_cosmos_capability_module_v1_module_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_cosmos_capability_module_v1_module_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Module); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_cosmos_capability_module_v1_module_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_cosmos_capability_module_v1_module_proto_goTypes, - DependencyIndexes: file_cosmos_capability_module_v1_module_proto_depIdxs, - MessageInfos: file_cosmos_capability_module_v1_module_proto_msgTypes, - }.Build() - File_cosmos_capability_module_v1_module_proto = out.File - file_cosmos_capability_module_v1_module_proto_rawDesc = nil - file_cosmos_capability_module_v1_module_proto_goTypes = nil - file_cosmos_capability_module_v1_module_proto_depIdxs = nil -} diff --git a/api/cosmos/capability/v1beta1/capability.pulsar.go b/api/cosmos/capability/v1beta1/capability.pulsar.go deleted file mode 100644 index 774b9bf8526d..000000000000 --- a/api/cosmos/capability/v1beta1/capability.pulsar.go +++ /dev/null @@ -1,1659 +0,0 @@ -// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. -package capabilityv1beta1 - -import ( - _ "cosmossdk.io/api/amino" - fmt "fmt" - runtime "github.com/cosmos/cosmos-proto/runtime" - _ "github.com/cosmos/gogoproto/gogoproto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoiface "google.golang.org/protobuf/runtime/protoiface" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - io "io" - reflect "reflect" - sync "sync" -) - -var ( - md_Capability protoreflect.MessageDescriptor - fd_Capability_index protoreflect.FieldDescriptor -) - -func init() { - file_cosmos_capability_v1beta1_capability_proto_init() - md_Capability = File_cosmos_capability_v1beta1_capability_proto.Messages().ByName("Capability") - fd_Capability_index = md_Capability.Fields().ByName("index") -} - -var _ protoreflect.Message = (*fastReflection_Capability)(nil) - -type fastReflection_Capability Capability - -func (x *Capability) ProtoReflect() protoreflect.Message { - return (*fastReflection_Capability)(x) -} - -func (x *Capability) slowProtoReflect() protoreflect.Message { - mi := &file_cosmos_capability_v1beta1_capability_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_Capability_messageType fastReflection_Capability_messageType -var _ protoreflect.MessageType = fastReflection_Capability_messageType{} - -type fastReflection_Capability_messageType struct{} - -func (x fastReflection_Capability_messageType) Zero() protoreflect.Message { - return (*fastReflection_Capability)(nil) -} -func (x fastReflection_Capability_messageType) New() protoreflect.Message { - return new(fastReflection_Capability) -} -func (x fastReflection_Capability_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_Capability -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_Capability) Descriptor() protoreflect.MessageDescriptor { - return md_Capability -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_Capability) Type() protoreflect.MessageType { - return _fastReflection_Capability_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_Capability) New() protoreflect.Message { - return new(fastReflection_Capability) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_Capability) Interface() protoreflect.ProtoMessage { - return (*Capability)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_Capability) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Index != uint64(0) { - value := protoreflect.ValueOfUint64(x.Index) - if !f(fd_Capability_index, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_Capability) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "cosmos.capability.v1beta1.Capability.index": - return x.Index != uint64(0) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.capability.v1beta1.Capability")) - } - panic(fmt.Errorf("message cosmos.capability.v1beta1.Capability does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Capability) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "cosmos.capability.v1beta1.Capability.index": - x.Index = uint64(0) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.capability.v1beta1.Capability")) - } - panic(fmt.Errorf("message cosmos.capability.v1beta1.Capability does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_Capability) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "cosmos.capability.v1beta1.Capability.index": - value := x.Index - return protoreflect.ValueOfUint64(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.capability.v1beta1.Capability")) - } - panic(fmt.Errorf("message cosmos.capability.v1beta1.Capability does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Capability) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "cosmos.capability.v1beta1.Capability.index": - x.Index = value.Uint() - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.capability.v1beta1.Capability")) - } - panic(fmt.Errorf("message cosmos.capability.v1beta1.Capability does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Capability) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "cosmos.capability.v1beta1.Capability.index": - panic(fmt.Errorf("field index of message cosmos.capability.v1beta1.Capability is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.capability.v1beta1.Capability")) - } - panic(fmt.Errorf("message cosmos.capability.v1beta1.Capability does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_Capability) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "cosmos.capability.v1beta1.Capability.index": - return protoreflect.ValueOfUint64(uint64(0)) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.capability.v1beta1.Capability")) - } - panic(fmt.Errorf("message cosmos.capability.v1beta1.Capability does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_Capability) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in cosmos.capability.v1beta1.Capability", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_Capability) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Capability) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_Capability) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_Capability) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*Capability) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if x.Index != 0 { - n += 1 + runtime.Sov(uint64(x.Index)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*Capability) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if x.Index != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.Index)) - i-- - dAtA[i] = 0x8 - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*Capability) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Capability: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Capability: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) - } - x.Index = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - x.Index |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_Owner protoreflect.MessageDescriptor - fd_Owner_module protoreflect.FieldDescriptor - fd_Owner_name protoreflect.FieldDescriptor -) - -func init() { - file_cosmos_capability_v1beta1_capability_proto_init() - md_Owner = File_cosmos_capability_v1beta1_capability_proto.Messages().ByName("Owner") - fd_Owner_module = md_Owner.Fields().ByName("module") - fd_Owner_name = md_Owner.Fields().ByName("name") -} - -var _ protoreflect.Message = (*fastReflection_Owner)(nil) - -type fastReflection_Owner Owner - -func (x *Owner) ProtoReflect() protoreflect.Message { - return (*fastReflection_Owner)(x) -} - -func (x *Owner) slowProtoReflect() protoreflect.Message { - mi := &file_cosmos_capability_v1beta1_capability_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_Owner_messageType fastReflection_Owner_messageType -var _ protoreflect.MessageType = fastReflection_Owner_messageType{} - -type fastReflection_Owner_messageType struct{} - -func (x fastReflection_Owner_messageType) Zero() protoreflect.Message { - return (*fastReflection_Owner)(nil) -} -func (x fastReflection_Owner_messageType) New() protoreflect.Message { - return new(fastReflection_Owner) -} -func (x fastReflection_Owner_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_Owner -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_Owner) Descriptor() protoreflect.MessageDescriptor { - return md_Owner -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_Owner) Type() protoreflect.MessageType { - return _fastReflection_Owner_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_Owner) New() protoreflect.Message { - return new(fastReflection_Owner) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_Owner) Interface() protoreflect.ProtoMessage { - return (*Owner)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_Owner) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Module != "" { - value := protoreflect.ValueOfString(x.Module) - if !f(fd_Owner_module, value) { - return - } - } - if x.Name != "" { - value := protoreflect.ValueOfString(x.Name) - if !f(fd_Owner_name, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_Owner) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "cosmos.capability.v1beta1.Owner.module": - return x.Module != "" - case "cosmos.capability.v1beta1.Owner.name": - return x.Name != "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.capability.v1beta1.Owner")) - } - panic(fmt.Errorf("message cosmos.capability.v1beta1.Owner does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Owner) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "cosmos.capability.v1beta1.Owner.module": - x.Module = "" - case "cosmos.capability.v1beta1.Owner.name": - x.Name = "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.capability.v1beta1.Owner")) - } - panic(fmt.Errorf("message cosmos.capability.v1beta1.Owner does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_Owner) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "cosmos.capability.v1beta1.Owner.module": - value := x.Module - return protoreflect.ValueOfString(value) - case "cosmos.capability.v1beta1.Owner.name": - value := x.Name - return protoreflect.ValueOfString(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.capability.v1beta1.Owner")) - } - panic(fmt.Errorf("message cosmos.capability.v1beta1.Owner does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Owner) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "cosmos.capability.v1beta1.Owner.module": - x.Module = value.Interface().(string) - case "cosmos.capability.v1beta1.Owner.name": - x.Name = value.Interface().(string) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.capability.v1beta1.Owner")) - } - panic(fmt.Errorf("message cosmos.capability.v1beta1.Owner does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Owner) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "cosmos.capability.v1beta1.Owner.module": - panic(fmt.Errorf("field module of message cosmos.capability.v1beta1.Owner is not mutable")) - case "cosmos.capability.v1beta1.Owner.name": - panic(fmt.Errorf("field name of message cosmos.capability.v1beta1.Owner is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.capability.v1beta1.Owner")) - } - panic(fmt.Errorf("message cosmos.capability.v1beta1.Owner does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_Owner) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "cosmos.capability.v1beta1.Owner.module": - return protoreflect.ValueOfString("") - case "cosmos.capability.v1beta1.Owner.name": - return protoreflect.ValueOfString("") - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.capability.v1beta1.Owner")) - } - panic(fmt.Errorf("message cosmos.capability.v1beta1.Owner does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_Owner) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in cosmos.capability.v1beta1.Owner", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_Owner) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Owner) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_Owner) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_Owner) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*Owner) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - l = len(x.Module) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - l = len(x.Name) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*Owner) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.Name) > 0 { - i -= len(x.Name) - copy(dAtA[i:], x.Name) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Name))) - i-- - dAtA[i] = 0x12 - } - if len(x.Module) > 0 { - i -= len(x.Module) - copy(dAtA[i:], x.Module) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Module))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*Owner) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Owner: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Owner: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Module", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Module = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var _ protoreflect.List = (*_CapabilityOwners_1_list)(nil) - -type _CapabilityOwners_1_list struct { - list *[]*Owner -} - -func (x *_CapabilityOwners_1_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_CapabilityOwners_1_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) -} - -func (x *_CapabilityOwners_1_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*Owner) - (*x.list)[i] = concreteValue -} - -func (x *_CapabilityOwners_1_list) Append(value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*Owner) - *x.list = append(*x.list, concreteValue) -} - -func (x *_CapabilityOwners_1_list) AppendMutable() protoreflect.Value { - v := new(Owner) - *x.list = append(*x.list, v) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_CapabilityOwners_1_list) Truncate(n int) { - for i := n; i < len(*x.list); i++ { - (*x.list)[i] = nil - } - *x.list = (*x.list)[:n] -} - -func (x *_CapabilityOwners_1_list) NewElement() protoreflect.Value { - v := new(Owner) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_CapabilityOwners_1_list) IsValid() bool { - return x.list != nil -} - -var ( - md_CapabilityOwners protoreflect.MessageDescriptor - fd_CapabilityOwners_owners protoreflect.FieldDescriptor -) - -func init() { - file_cosmos_capability_v1beta1_capability_proto_init() - md_CapabilityOwners = File_cosmos_capability_v1beta1_capability_proto.Messages().ByName("CapabilityOwners") - fd_CapabilityOwners_owners = md_CapabilityOwners.Fields().ByName("owners") -} - -var _ protoreflect.Message = (*fastReflection_CapabilityOwners)(nil) - -type fastReflection_CapabilityOwners CapabilityOwners - -func (x *CapabilityOwners) ProtoReflect() protoreflect.Message { - return (*fastReflection_CapabilityOwners)(x) -} - -func (x *CapabilityOwners) slowProtoReflect() protoreflect.Message { - mi := &file_cosmos_capability_v1beta1_capability_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_CapabilityOwners_messageType fastReflection_CapabilityOwners_messageType -var _ protoreflect.MessageType = fastReflection_CapabilityOwners_messageType{} - -type fastReflection_CapabilityOwners_messageType struct{} - -func (x fastReflection_CapabilityOwners_messageType) Zero() protoreflect.Message { - return (*fastReflection_CapabilityOwners)(nil) -} -func (x fastReflection_CapabilityOwners_messageType) New() protoreflect.Message { - return new(fastReflection_CapabilityOwners) -} -func (x fastReflection_CapabilityOwners_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_CapabilityOwners -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_CapabilityOwners) Descriptor() protoreflect.MessageDescriptor { - return md_CapabilityOwners -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_CapabilityOwners) Type() protoreflect.MessageType { - return _fastReflection_CapabilityOwners_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_CapabilityOwners) New() protoreflect.Message { - return new(fastReflection_CapabilityOwners) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_CapabilityOwners) Interface() protoreflect.ProtoMessage { - return (*CapabilityOwners)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_CapabilityOwners) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.Owners) != 0 { - value := protoreflect.ValueOfList(&_CapabilityOwners_1_list{list: &x.Owners}) - if !f(fd_CapabilityOwners_owners, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_CapabilityOwners) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "cosmos.capability.v1beta1.CapabilityOwners.owners": - return len(x.Owners) != 0 - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.capability.v1beta1.CapabilityOwners")) - } - panic(fmt.Errorf("message cosmos.capability.v1beta1.CapabilityOwners does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_CapabilityOwners) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "cosmos.capability.v1beta1.CapabilityOwners.owners": - x.Owners = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.capability.v1beta1.CapabilityOwners")) - } - panic(fmt.Errorf("message cosmos.capability.v1beta1.CapabilityOwners does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_CapabilityOwners) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "cosmos.capability.v1beta1.CapabilityOwners.owners": - if len(x.Owners) == 0 { - return protoreflect.ValueOfList(&_CapabilityOwners_1_list{}) - } - listValue := &_CapabilityOwners_1_list{list: &x.Owners} - return protoreflect.ValueOfList(listValue) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.capability.v1beta1.CapabilityOwners")) - } - panic(fmt.Errorf("message cosmos.capability.v1beta1.CapabilityOwners does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_CapabilityOwners) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "cosmos.capability.v1beta1.CapabilityOwners.owners": - lv := value.List() - clv := lv.(*_CapabilityOwners_1_list) - x.Owners = *clv.list - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.capability.v1beta1.CapabilityOwners")) - } - panic(fmt.Errorf("message cosmos.capability.v1beta1.CapabilityOwners does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_CapabilityOwners) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "cosmos.capability.v1beta1.CapabilityOwners.owners": - if x.Owners == nil { - x.Owners = []*Owner{} - } - value := &_CapabilityOwners_1_list{list: &x.Owners} - return protoreflect.ValueOfList(value) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.capability.v1beta1.CapabilityOwners")) - } - panic(fmt.Errorf("message cosmos.capability.v1beta1.CapabilityOwners does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_CapabilityOwners) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "cosmos.capability.v1beta1.CapabilityOwners.owners": - list := []*Owner{} - return protoreflect.ValueOfList(&_CapabilityOwners_1_list{list: &list}) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.capability.v1beta1.CapabilityOwners")) - } - panic(fmt.Errorf("message cosmos.capability.v1beta1.CapabilityOwners does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_CapabilityOwners) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in cosmos.capability.v1beta1.CapabilityOwners", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_CapabilityOwners) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_CapabilityOwners) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_CapabilityOwners) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_CapabilityOwners) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*CapabilityOwners) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if len(x.Owners) > 0 { - for _, e := range x.Owners { - l = options.Size(e) - n += 1 + l + runtime.Sov(uint64(l)) - } - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*CapabilityOwners) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.Owners) > 0 { - for iNdEx := len(x.Owners) - 1; iNdEx >= 0; iNdEx-- { - encoded, err := options.Marshal(x.Owners[iNdEx]) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa - } - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*CapabilityOwners) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: CapabilityOwners: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: CapabilityOwners: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Owners", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Owners = append(x.Owners, &Owner{}) - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Owners[len(x.Owners)-1]); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.0 -// protoc (unknown) -// source: cosmos/capability/v1beta1/capability.proto - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// Capability defines an implementation of an object capability. The index -// provided to a Capability must be globally unique. -type Capability struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Index uint64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"` -} - -func (x *Capability) Reset() { - *x = Capability{} - if protoimpl.UnsafeEnabled { - mi := &file_cosmos_capability_v1beta1_capability_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Capability) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Capability) ProtoMessage() {} - -// Deprecated: Use Capability.ProtoReflect.Descriptor instead. -func (*Capability) Descriptor() ([]byte, []int) { - return file_cosmos_capability_v1beta1_capability_proto_rawDescGZIP(), []int{0} -} - -func (x *Capability) GetIndex() uint64 { - if x != nil { - return x.Index - } - return 0 -} - -// Owner defines a single capability owner. An owner is defined by the name of -// capability and the module name. -type Owner struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Module string `protobuf:"bytes,1,opt,name=module,proto3" json:"module,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` -} - -func (x *Owner) Reset() { - *x = Owner{} - if protoimpl.UnsafeEnabled { - mi := &file_cosmos_capability_v1beta1_capability_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Owner) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Owner) ProtoMessage() {} - -// Deprecated: Use Owner.ProtoReflect.Descriptor instead. -func (*Owner) Descriptor() ([]byte, []int) { - return file_cosmos_capability_v1beta1_capability_proto_rawDescGZIP(), []int{1} -} - -func (x *Owner) GetModule() string { - if x != nil { - return x.Module - } - return "" -} - -func (x *Owner) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -// CapabilityOwners defines a set of owners of a single Capability. The set of -// owners must be unique. -type CapabilityOwners struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Owners []*Owner `protobuf:"bytes,1,rep,name=owners,proto3" json:"owners,omitempty"` -} - -func (x *CapabilityOwners) Reset() { - *x = CapabilityOwners{} - if protoimpl.UnsafeEnabled { - mi := &file_cosmos_capability_v1beta1_capability_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CapabilityOwners) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CapabilityOwners) ProtoMessage() {} - -// Deprecated: Use CapabilityOwners.ProtoReflect.Descriptor instead. -func (*CapabilityOwners) Descriptor() ([]byte, []int) { - return file_cosmos_capability_v1beta1_capability_proto_rawDescGZIP(), []int{2} -} - -func (x *CapabilityOwners) GetOwners() []*Owner { - if x != nil { - return x.Owners - } - return nil -} - -var File_cosmos_capability_v1beta1_capability_proto protoreflect.FileDescriptor - -var file_cosmos_capability_v1beta1_capability_proto_rawDesc = []byte{ - 0x0a, 0x2a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, - 0x69, 0x74, 0x79, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x61, 0x70, 0x61, - 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x19, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2e, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x11, 0x61, - 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x22, 0x22, 0x0a, 0x0a, 0x43, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x12, 0x14, - 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x69, - 0x6e, 0x64, 0x65, 0x78, 0x22, 0x39, 0x0a, 0x05, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x16, 0x0a, - 0x06, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, - 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x3a, 0x04, 0x88, 0xa0, 0x1f, 0x00, 0x22, - 0x57, 0x0a, 0x10, 0x43, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x4f, 0x77, 0x6e, - 0x65, 0x72, 0x73, 0x12, 0x43, 0x0a, 0x06, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63, 0x61, 0x70, - 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, - 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, - 0x52, 0x06, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x73, 0x42, 0xf4, 0x01, 0x0a, 0x1d, 0x63, 0x6f, 0x6d, - 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, - 0x74, 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x0f, 0x43, 0x61, 0x70, 0x61, - 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3c, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, - 0x79, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, - 0x6c, 0x69, 0x74, 0x79, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x43, - 0x58, 0xaa, 0x02, 0x19, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x43, 0x61, 0x70, 0x61, 0x62, - 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x19, - 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x43, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, - 0x79, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x25, 0x43, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x5c, 0x43, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x5c, 0x56, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0xea, 0x02, 0x1b, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x43, 0x61, 0x70, 0x61, - 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_cosmos_capability_v1beta1_capability_proto_rawDescOnce sync.Once - file_cosmos_capability_v1beta1_capability_proto_rawDescData = file_cosmos_capability_v1beta1_capability_proto_rawDesc -) - -func file_cosmos_capability_v1beta1_capability_proto_rawDescGZIP() []byte { - file_cosmos_capability_v1beta1_capability_proto_rawDescOnce.Do(func() { - file_cosmos_capability_v1beta1_capability_proto_rawDescData = protoimpl.X.CompressGZIP(file_cosmos_capability_v1beta1_capability_proto_rawDescData) - }) - return file_cosmos_capability_v1beta1_capability_proto_rawDescData -} - -var file_cosmos_capability_v1beta1_capability_proto_msgTypes = make([]protoimpl.MessageInfo, 3) -var file_cosmos_capability_v1beta1_capability_proto_goTypes = []interface{}{ - (*Capability)(nil), // 0: cosmos.capability.v1beta1.Capability - (*Owner)(nil), // 1: cosmos.capability.v1beta1.Owner - (*CapabilityOwners)(nil), // 2: cosmos.capability.v1beta1.CapabilityOwners -} -var file_cosmos_capability_v1beta1_capability_proto_depIdxs = []int32{ - 1, // 0: cosmos.capability.v1beta1.CapabilityOwners.owners:type_name -> cosmos.capability.v1beta1.Owner - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_cosmos_capability_v1beta1_capability_proto_init() } -func file_cosmos_capability_v1beta1_capability_proto_init() { - if File_cosmos_capability_v1beta1_capability_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_cosmos_capability_v1beta1_capability_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Capability); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cosmos_capability_v1beta1_capability_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Owner); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cosmos_capability_v1beta1_capability_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CapabilityOwners); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_cosmos_capability_v1beta1_capability_proto_rawDesc, - NumEnums: 0, - NumMessages: 3, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_cosmos_capability_v1beta1_capability_proto_goTypes, - DependencyIndexes: file_cosmos_capability_v1beta1_capability_proto_depIdxs, - MessageInfos: file_cosmos_capability_v1beta1_capability_proto_msgTypes, - }.Build() - File_cosmos_capability_v1beta1_capability_proto = out.File - file_cosmos_capability_v1beta1_capability_proto_rawDesc = nil - file_cosmos_capability_v1beta1_capability_proto_goTypes = nil - file_cosmos_capability_v1beta1_capability_proto_depIdxs = nil -} diff --git a/api/cosmos/capability/v1beta1/genesis.pulsar.go b/api/cosmos/capability/v1beta1/genesis.pulsar.go deleted file mode 100644 index 171eb7f67660..000000000000 --- a/api/cosmos/capability/v1beta1/genesis.pulsar.go +++ /dev/null @@ -1,1272 +0,0 @@ -// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. -package capabilityv1beta1 - -import ( - _ "cosmossdk.io/api/amino" - fmt "fmt" - runtime "github.com/cosmos/cosmos-proto/runtime" - _ "github.com/cosmos/gogoproto/gogoproto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoiface "google.golang.org/protobuf/runtime/protoiface" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - io "io" - reflect "reflect" - sync "sync" -) - -var ( - md_GenesisOwners protoreflect.MessageDescriptor - fd_GenesisOwners_index protoreflect.FieldDescriptor - fd_GenesisOwners_index_owners protoreflect.FieldDescriptor -) - -func init() { - file_cosmos_capability_v1beta1_genesis_proto_init() - md_GenesisOwners = File_cosmos_capability_v1beta1_genesis_proto.Messages().ByName("GenesisOwners") - fd_GenesisOwners_index = md_GenesisOwners.Fields().ByName("index") - fd_GenesisOwners_index_owners = md_GenesisOwners.Fields().ByName("index_owners") -} - -var _ protoreflect.Message = (*fastReflection_GenesisOwners)(nil) - -type fastReflection_GenesisOwners GenesisOwners - -func (x *GenesisOwners) ProtoReflect() protoreflect.Message { - return (*fastReflection_GenesisOwners)(x) -} - -func (x *GenesisOwners) slowProtoReflect() protoreflect.Message { - mi := &file_cosmos_capability_v1beta1_genesis_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_GenesisOwners_messageType fastReflection_GenesisOwners_messageType -var _ protoreflect.MessageType = fastReflection_GenesisOwners_messageType{} - -type fastReflection_GenesisOwners_messageType struct{} - -func (x fastReflection_GenesisOwners_messageType) Zero() protoreflect.Message { - return (*fastReflection_GenesisOwners)(nil) -} -func (x fastReflection_GenesisOwners_messageType) New() protoreflect.Message { - return new(fastReflection_GenesisOwners) -} -func (x fastReflection_GenesisOwners_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_GenesisOwners -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_GenesisOwners) Descriptor() protoreflect.MessageDescriptor { - return md_GenesisOwners -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_GenesisOwners) Type() protoreflect.MessageType { - return _fastReflection_GenesisOwners_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_GenesisOwners) New() protoreflect.Message { - return new(fastReflection_GenesisOwners) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_GenesisOwners) Interface() protoreflect.ProtoMessage { - return (*GenesisOwners)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_GenesisOwners) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Index != uint64(0) { - value := protoreflect.ValueOfUint64(x.Index) - if !f(fd_GenesisOwners_index, value) { - return - } - } - if x.IndexOwners != nil { - value := protoreflect.ValueOfMessage(x.IndexOwners.ProtoReflect()) - if !f(fd_GenesisOwners_index_owners, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_GenesisOwners) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "cosmos.capability.v1beta1.GenesisOwners.index": - return x.Index != uint64(0) - case "cosmos.capability.v1beta1.GenesisOwners.index_owners": - return x.IndexOwners != nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.capability.v1beta1.GenesisOwners")) - } - panic(fmt.Errorf("message cosmos.capability.v1beta1.GenesisOwners does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GenesisOwners) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "cosmos.capability.v1beta1.GenesisOwners.index": - x.Index = uint64(0) - case "cosmos.capability.v1beta1.GenesisOwners.index_owners": - x.IndexOwners = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.capability.v1beta1.GenesisOwners")) - } - panic(fmt.Errorf("message cosmos.capability.v1beta1.GenesisOwners does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_GenesisOwners) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "cosmos.capability.v1beta1.GenesisOwners.index": - value := x.Index - return protoreflect.ValueOfUint64(value) - case "cosmos.capability.v1beta1.GenesisOwners.index_owners": - value := x.IndexOwners - return protoreflect.ValueOfMessage(value.ProtoReflect()) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.capability.v1beta1.GenesisOwners")) - } - panic(fmt.Errorf("message cosmos.capability.v1beta1.GenesisOwners does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GenesisOwners) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "cosmos.capability.v1beta1.GenesisOwners.index": - x.Index = value.Uint() - case "cosmos.capability.v1beta1.GenesisOwners.index_owners": - x.IndexOwners = value.Message().Interface().(*CapabilityOwners) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.capability.v1beta1.GenesisOwners")) - } - panic(fmt.Errorf("message cosmos.capability.v1beta1.GenesisOwners does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GenesisOwners) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "cosmos.capability.v1beta1.GenesisOwners.index_owners": - if x.IndexOwners == nil { - x.IndexOwners = new(CapabilityOwners) - } - return protoreflect.ValueOfMessage(x.IndexOwners.ProtoReflect()) - case "cosmos.capability.v1beta1.GenesisOwners.index": - panic(fmt.Errorf("field index of message cosmos.capability.v1beta1.GenesisOwners is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.capability.v1beta1.GenesisOwners")) - } - panic(fmt.Errorf("message cosmos.capability.v1beta1.GenesisOwners does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_GenesisOwners) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "cosmos.capability.v1beta1.GenesisOwners.index": - return protoreflect.ValueOfUint64(uint64(0)) - case "cosmos.capability.v1beta1.GenesisOwners.index_owners": - m := new(CapabilityOwners) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.capability.v1beta1.GenesisOwners")) - } - panic(fmt.Errorf("message cosmos.capability.v1beta1.GenesisOwners does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_GenesisOwners) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in cosmos.capability.v1beta1.GenesisOwners", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_GenesisOwners) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GenesisOwners) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_GenesisOwners) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_GenesisOwners) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*GenesisOwners) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if x.Index != 0 { - n += 1 + runtime.Sov(uint64(x.Index)) - } - if x.IndexOwners != nil { - l = options.Size(x.IndexOwners) - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*GenesisOwners) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if x.IndexOwners != nil { - encoded, err := options.Marshal(x.IndexOwners) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x12 - } - if x.Index != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.Index)) - i-- - dAtA[i] = 0x8 - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*GenesisOwners) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GenesisOwners: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GenesisOwners: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) - } - x.Index = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - x.Index |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field IndexOwners", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if x.IndexOwners == nil { - x.IndexOwners = &CapabilityOwners{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.IndexOwners); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var _ protoreflect.List = (*_GenesisState_2_list)(nil) - -type _GenesisState_2_list struct { - list *[]*GenesisOwners -} - -func (x *_GenesisState_2_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_GenesisState_2_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) -} - -func (x *_GenesisState_2_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*GenesisOwners) - (*x.list)[i] = concreteValue -} - -func (x *_GenesisState_2_list) Append(value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*GenesisOwners) - *x.list = append(*x.list, concreteValue) -} - -func (x *_GenesisState_2_list) AppendMutable() protoreflect.Value { - v := new(GenesisOwners) - *x.list = append(*x.list, v) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_GenesisState_2_list) Truncate(n int) { - for i := n; i < len(*x.list); i++ { - (*x.list)[i] = nil - } - *x.list = (*x.list)[:n] -} - -func (x *_GenesisState_2_list) NewElement() protoreflect.Value { - v := new(GenesisOwners) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_GenesisState_2_list) IsValid() bool { - return x.list != nil -} - -var ( - md_GenesisState protoreflect.MessageDescriptor - fd_GenesisState_index protoreflect.FieldDescriptor - fd_GenesisState_owners protoreflect.FieldDescriptor -) - -func init() { - file_cosmos_capability_v1beta1_genesis_proto_init() - md_GenesisState = File_cosmos_capability_v1beta1_genesis_proto.Messages().ByName("GenesisState") - fd_GenesisState_index = md_GenesisState.Fields().ByName("index") - fd_GenesisState_owners = md_GenesisState.Fields().ByName("owners") -} - -var _ protoreflect.Message = (*fastReflection_GenesisState)(nil) - -type fastReflection_GenesisState GenesisState - -func (x *GenesisState) ProtoReflect() protoreflect.Message { - return (*fastReflection_GenesisState)(x) -} - -func (x *GenesisState) slowProtoReflect() protoreflect.Message { - mi := &file_cosmos_capability_v1beta1_genesis_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_GenesisState_messageType fastReflection_GenesisState_messageType -var _ protoreflect.MessageType = fastReflection_GenesisState_messageType{} - -type fastReflection_GenesisState_messageType struct{} - -func (x fastReflection_GenesisState_messageType) Zero() protoreflect.Message { - return (*fastReflection_GenesisState)(nil) -} -func (x fastReflection_GenesisState_messageType) New() protoreflect.Message { - return new(fastReflection_GenesisState) -} -func (x fastReflection_GenesisState_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_GenesisState -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_GenesisState) Descriptor() protoreflect.MessageDescriptor { - return md_GenesisState -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_GenesisState) Type() protoreflect.MessageType { - return _fastReflection_GenesisState_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_GenesisState) New() protoreflect.Message { - return new(fastReflection_GenesisState) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_GenesisState) Interface() protoreflect.ProtoMessage { - return (*GenesisState)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_GenesisState) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Index != uint64(0) { - value := protoreflect.ValueOfUint64(x.Index) - if !f(fd_GenesisState_index, value) { - return - } - } - if len(x.Owners) != 0 { - value := protoreflect.ValueOfList(&_GenesisState_2_list{list: &x.Owners}) - if !f(fd_GenesisState_owners, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_GenesisState) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "cosmos.capability.v1beta1.GenesisState.index": - return x.Index != uint64(0) - case "cosmos.capability.v1beta1.GenesisState.owners": - return len(x.Owners) != 0 - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.capability.v1beta1.GenesisState")) - } - panic(fmt.Errorf("message cosmos.capability.v1beta1.GenesisState does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GenesisState) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "cosmos.capability.v1beta1.GenesisState.index": - x.Index = uint64(0) - case "cosmos.capability.v1beta1.GenesisState.owners": - x.Owners = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.capability.v1beta1.GenesisState")) - } - panic(fmt.Errorf("message cosmos.capability.v1beta1.GenesisState does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_GenesisState) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "cosmos.capability.v1beta1.GenesisState.index": - value := x.Index - return protoreflect.ValueOfUint64(value) - case "cosmos.capability.v1beta1.GenesisState.owners": - if len(x.Owners) == 0 { - return protoreflect.ValueOfList(&_GenesisState_2_list{}) - } - listValue := &_GenesisState_2_list{list: &x.Owners} - return protoreflect.ValueOfList(listValue) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.capability.v1beta1.GenesisState")) - } - panic(fmt.Errorf("message cosmos.capability.v1beta1.GenesisState does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GenesisState) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "cosmos.capability.v1beta1.GenesisState.index": - x.Index = value.Uint() - case "cosmos.capability.v1beta1.GenesisState.owners": - lv := value.List() - clv := lv.(*_GenesisState_2_list) - x.Owners = *clv.list - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.capability.v1beta1.GenesisState")) - } - panic(fmt.Errorf("message cosmos.capability.v1beta1.GenesisState does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GenesisState) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "cosmos.capability.v1beta1.GenesisState.owners": - if x.Owners == nil { - x.Owners = []*GenesisOwners{} - } - value := &_GenesisState_2_list{list: &x.Owners} - return protoreflect.ValueOfList(value) - case "cosmos.capability.v1beta1.GenesisState.index": - panic(fmt.Errorf("field index of message cosmos.capability.v1beta1.GenesisState is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.capability.v1beta1.GenesisState")) - } - panic(fmt.Errorf("message cosmos.capability.v1beta1.GenesisState does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_GenesisState) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "cosmos.capability.v1beta1.GenesisState.index": - return protoreflect.ValueOfUint64(uint64(0)) - case "cosmos.capability.v1beta1.GenesisState.owners": - list := []*GenesisOwners{} - return protoreflect.ValueOfList(&_GenesisState_2_list{list: &list}) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.capability.v1beta1.GenesisState")) - } - panic(fmt.Errorf("message cosmos.capability.v1beta1.GenesisState does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_GenesisState) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in cosmos.capability.v1beta1.GenesisState", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_GenesisState) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GenesisState) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_GenesisState) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*GenesisState) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if x.Index != 0 { - n += 1 + runtime.Sov(uint64(x.Index)) - } - if len(x.Owners) > 0 { - for _, e := range x.Owners { - l = options.Size(e) - n += 1 + l + runtime.Sov(uint64(l)) - } - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*GenesisState) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.Owners) > 0 { - for iNdEx := len(x.Owners) - 1; iNdEx >= 0; iNdEx-- { - encoded, err := options.Marshal(x.Owners[iNdEx]) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x12 - } - } - if x.Index != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.Index)) - i-- - dAtA[i] = 0x8 - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*GenesisState) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GenesisState: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) - } - x.Index = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - x.Index |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Owners", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Owners = append(x.Owners, &GenesisOwners{}) - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Owners[len(x.Owners)-1]); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.0 -// protoc (unknown) -// source: cosmos/capability/v1beta1/genesis.proto - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// GenesisOwners defines the capability owners with their corresponding index. -type GenesisOwners struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // index is the index of the capability owner. - Index uint64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"` - // index_owners are the owners at the given index. - IndexOwners *CapabilityOwners `protobuf:"bytes,2,opt,name=index_owners,json=indexOwners,proto3" json:"index_owners,omitempty"` -} - -func (x *GenesisOwners) Reset() { - *x = GenesisOwners{} - if protoimpl.UnsafeEnabled { - mi := &file_cosmos_capability_v1beta1_genesis_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GenesisOwners) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GenesisOwners) ProtoMessage() {} - -// Deprecated: Use GenesisOwners.ProtoReflect.Descriptor instead. -func (*GenesisOwners) Descriptor() ([]byte, []int) { - return file_cosmos_capability_v1beta1_genesis_proto_rawDescGZIP(), []int{0} -} - -func (x *GenesisOwners) GetIndex() uint64 { - if x != nil { - return x.Index - } - return 0 -} - -func (x *GenesisOwners) GetIndexOwners() *CapabilityOwners { - if x != nil { - return x.IndexOwners - } - return nil -} - -// GenesisState defines the capability module's genesis state. -type GenesisState struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // index is the capability global index. - Index uint64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"` - // owners represents a map from index to owners of the capability index - // index key is string to allow amino marshalling. - Owners []*GenesisOwners `protobuf:"bytes,2,rep,name=owners,proto3" json:"owners,omitempty"` -} - -func (x *GenesisState) Reset() { - *x = GenesisState{} - if protoimpl.UnsafeEnabled { - mi := &file_cosmos_capability_v1beta1_genesis_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GenesisState) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GenesisState) ProtoMessage() {} - -// Deprecated: Use GenesisState.ProtoReflect.Descriptor instead. -func (*GenesisState) Descriptor() ([]byte, []int) { - return file_cosmos_capability_v1beta1_genesis_proto_rawDescGZIP(), []int{1} -} - -func (x *GenesisState) GetIndex() uint64 { - if x != nil { - return x.Index - } - return 0 -} - -func (x *GenesisState) GetOwners() []*GenesisOwners { - if x != nil { - return x.Owners - } - return nil -} - -var File_cosmos_capability_v1beta1_genesis_proto protoreflect.FileDescriptor - -var file_cosmos_capability_v1beta1_genesis_proto_rawDesc = []byte{ - 0x0a, 0x27, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, - 0x69, 0x74, 0x79, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x67, 0x65, 0x6e, 0x65, - 0x73, 0x69, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2e, 0x76, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, - 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2a, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2f, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2f, 0x76, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, - 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x80, 0x01, 0x0a, 0x0d, 0x47, 0x65, - 0x6e, 0x65, 0x73, 0x69, 0x73, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x69, - 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, - 0x78, 0x12, 0x59, 0x0a, 0x0c, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x5f, 0x6f, 0x77, 0x6e, 0x65, 0x72, - 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x2e, 0x43, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x4f, 0x77, - 0x6e, 0x65, 0x72, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, - 0x0b, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x73, 0x22, 0x71, 0x0a, 0x0c, - 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05, - 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x69, 0x6e, 0x64, - 0x65, 0x78, 0x12, 0x4b, 0x0a, 0x06, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63, 0x61, 0x70, 0x61, - 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x47, - 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x73, 0x42, 0x09, 0xc8, 0xde, - 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x73, 0x42, - 0xf1, 0x01, 0x0a, 0x1d, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63, - 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, - 0x31, 0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, - 0x01, 0x5a, 0x3c, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, - 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x61, 0x70, 0x61, 0x62, - 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x63, 0x61, - 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, - 0x02, 0x03, 0x43, 0x43, 0x58, 0xaa, 0x02, 0x19, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x43, - 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, - 0x31, 0xca, 0x02, 0x19, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x43, 0x61, 0x70, 0x61, 0x62, - 0x69, 0x6c, 0x69, 0x74, 0x79, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x25, - 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x43, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, - 0x79, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x1b, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, - 0x43, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_cosmos_capability_v1beta1_genesis_proto_rawDescOnce sync.Once - file_cosmos_capability_v1beta1_genesis_proto_rawDescData = file_cosmos_capability_v1beta1_genesis_proto_rawDesc -) - -func file_cosmos_capability_v1beta1_genesis_proto_rawDescGZIP() []byte { - file_cosmos_capability_v1beta1_genesis_proto_rawDescOnce.Do(func() { - file_cosmos_capability_v1beta1_genesis_proto_rawDescData = protoimpl.X.CompressGZIP(file_cosmos_capability_v1beta1_genesis_proto_rawDescData) - }) - return file_cosmos_capability_v1beta1_genesis_proto_rawDescData -} - -var file_cosmos_capability_v1beta1_genesis_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_cosmos_capability_v1beta1_genesis_proto_goTypes = []interface{}{ - (*GenesisOwners)(nil), // 0: cosmos.capability.v1beta1.GenesisOwners - (*GenesisState)(nil), // 1: cosmos.capability.v1beta1.GenesisState - (*CapabilityOwners)(nil), // 2: cosmos.capability.v1beta1.CapabilityOwners -} -var file_cosmos_capability_v1beta1_genesis_proto_depIdxs = []int32{ - 2, // 0: cosmos.capability.v1beta1.GenesisOwners.index_owners:type_name -> cosmos.capability.v1beta1.CapabilityOwners - 0, // 1: cosmos.capability.v1beta1.GenesisState.owners:type_name -> cosmos.capability.v1beta1.GenesisOwners - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name -} - -func init() { file_cosmos_capability_v1beta1_genesis_proto_init() } -func file_cosmos_capability_v1beta1_genesis_proto_init() { - if File_cosmos_capability_v1beta1_genesis_proto != nil { - return - } - file_cosmos_capability_v1beta1_capability_proto_init() - if !protoimpl.UnsafeEnabled { - file_cosmos_capability_v1beta1_genesis_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GenesisOwners); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cosmos_capability_v1beta1_genesis_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GenesisState); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_cosmos_capability_v1beta1_genesis_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_cosmos_capability_v1beta1_genesis_proto_goTypes, - DependencyIndexes: file_cosmos_capability_v1beta1_genesis_proto_depIdxs, - MessageInfos: file_cosmos_capability_v1beta1_genesis_proto_msgTypes, - }.Build() - File_cosmos_capability_v1beta1_genesis_proto = out.File - file_cosmos_capability_v1beta1_genesis_proto_rawDesc = nil - file_cosmos_capability_v1beta1_genesis_proto_goTypes = nil - file_cosmos_capability_v1beta1_genesis_proto_depIdxs = nil -} diff --git a/api/go.mod b/api/go.mod index a950b5ebea40..09954be8e8c1 100644 --- a/api/go.mod +++ b/api/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/api go 1.20 require ( - github.com/cosmos/cosmos-proto v1.0.0-beta.2 + github.com/cosmos/cosmos-proto v1.0.0-beta.3 github.com/cosmos/gogoproto v1.4.6 google.golang.org/genproto v0.0.0-20230202175211-008b39050e57 google.golang.org/grpc v1.53.0 diff --git a/api/go.sum b/api/go.sum index dc899fc186a8..b515d68e1bcf 100644 --- a/api/go.sum +++ b/api/go.sum @@ -1,5 +1,5 @@ -github.com/cosmos/cosmos-proto v1.0.0-beta.2 h1:X3OKvWgK9Gsejo0F1qs5l8Qn6xJV/AzgIWR2wZ8Nua8= -github.com/cosmos/cosmos-proto v1.0.0-beta.2/go.mod h1:+XRCLJ14pr5HFEHIUcn51IKXD1Fy3rkEQqt4WqmN4V0= +github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= +github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= github.com/cosmos/gogoproto v1.4.6 h1:Ee7z15dWJaGlgM2rWrK8N2IX7PQcuccu8oG68jp5RL4= github.com/cosmos/gogoproto v1.4.6/go.mod h1:VS/ASYmPgv6zkPKLjR9EB91lwbLHOzaGCirmKKhncfI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= diff --git a/client/v2/go.mod b/client/v2/go.mod index e9b2003ced4d..eabd2458d09c 100644 --- a/client/v2/go.mod +++ b/client/v2/go.mod @@ -4,10 +4,10 @@ go 1.20 require ( cosmossdk.io/api v0.3.1 - cosmossdk.io/core v0.6.0 + cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba cosmossdk.io/depinject v1.0.0-alpha.3 github.com/cockroachdb/errors v1.9.1 - github.com/cosmos/cosmos-proto v1.0.0-beta.2 + github.com/cosmos/cosmos-proto v1.0.0-beta.3 github.com/cosmos/cosmos-sdk v0.46.0-beta2.0.20230306220716-5e55f56d39d5 github.com/spf13/cobra v1.6.1 github.com/spf13/pflag v1.0.5 @@ -23,7 +23,7 @@ require ( cosmossdk.io/log v0.0.0-20230306220716-5e55f56d39d5 // indirect cosmossdk.io/math v1.0.0-beta.6.0.20230216172121-959ce49135e4 // indirect cosmossdk.io/store v0.0.0-20230227103508-bbe7f8a11b44 // indirect - cosmossdk.io/x/tx v0.2.2 // indirect + cosmossdk.io/x/tx v0.2.3-0.20230309163709-87da587416ba // indirect filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect diff --git a/client/v2/go.sum b/client/v2/go.sum index 73c5e66b346a..25027569319f 100644 --- a/client/v2/go.sum +++ b/client/v2/go.sum @@ -39,8 +39,8 @@ cosmossdk.io/api v0.3.1 h1:NNiOclKRR0AOlO4KIqeaG6PS6kswOMhHD0ir0SscNXE= cosmossdk.io/api v0.3.1/go.mod h1:DfHfMkiNA2Uhy8fj0JJlOCYOBp4eWUUJ1te5zBGNyIw= cosmossdk.io/collections v0.0.0-20230214153846-b6c6e4e99177 h1:At2M0aYQKEAWqr6JtZrJPOlfhdvENiGwJg2NCNHwIdc= cosmossdk.io/collections v0.0.0-20230214153846-b6c6e4e99177/go.mod h1:uqCi8FG+Bh2vv/qf5xZ8iab0E0c/DMA/cwafbp8dkcU= -cosmossdk.io/core v0.6.0 h1:V2zyaMVFN6hJSVENYx2XE9CMhzqwJPMjzSQpj0MyXAU= -cosmossdk.io/core v0.6.0/go.mod h1:YSFzBcKOf/U24e/sa6WFaYSrlZl5zgNvnWwjfFyPniw= +cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba h1:kSnaDzbwMInpQYwz8ESgvi6ceUQWcXAJdEVZW454dX0= +cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba/go.mod h1:WiFk9ZQbFVBHk9AqQIkLFqyj30NPQB6C45CIeAZxDcw= cosmossdk.io/depinject v1.0.0-alpha.3 h1:6evFIgj//Y3w09bqOUOzEpFj5tsxBqdc5CfkO7z+zfw= cosmossdk.io/depinject v1.0.0-alpha.3/go.mod h1:eRbcdQ7MRpIPEM5YUJh8k97nxHpYbc3sMUnEtt8HPWU= cosmossdk.io/errors v1.0.0-beta.7 h1:gypHW76pTQGVnHKo6QBkb4yFOJjC+sUGRc5Al3Odj1w= @@ -51,8 +51,8 @@ cosmossdk.io/math v1.0.0-beta.6.0.20230216172121-959ce49135e4 h1:/jnzJ9zFsL7qkV8 cosmossdk.io/math v1.0.0-beta.6.0.20230216172121-959ce49135e4/go.mod h1:gUVtWwIzfSXqcOT+lBVz2jyjfua8DoBdzRsIyaUAT/8= cosmossdk.io/store v0.0.0-20230227103508-bbe7f8a11b44 h1:/pKsj/ApzO4+zMwpgLiPG5iakoHxziGpMiJcz4S+r4w= cosmossdk.io/store v0.0.0-20230227103508-bbe7f8a11b44/go.mod h1:flrxUykloEW1asE9p+Q+d8LSuNI3fBRdzISg9HTpYlQ= -cosmossdk.io/x/tx v0.2.2 h1:pD4TEbzOOerVQNI+M9anQIncl+4wFELpGds3N7RzPiQ= -cosmossdk.io/x/tx v0.2.2/go.mod h1:cur19OSg8P6ifrZ00yJOyY6HT75FEhLBX2Ir3Sl0ubY= +cosmossdk.io/x/tx v0.2.3-0.20230309163709-87da587416ba h1:NmWXkl0voj3dN96Qmk4rfrze6dLLLxB4qTCxXZTXBpM= +cosmossdk.io/x/tx v0.2.3-0.20230309163709-87da587416ba/go.mod h1:dhIxZhZF2glIA9hkkildy/JmSqVH3FIU/OhSU8is7PM= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek= filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= @@ -136,8 +136,8 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= github.com/cosmos/cosmos-db v1.0.0-rc.1 h1:SjnT8B6WKMW9WEIX32qMhnEEKcI7ZP0+G1Sa9HD3nmY= github.com/cosmos/cosmos-db v1.0.0-rc.1/go.mod h1:Dnmk3flSf5lkwCqvvjNpoxjpXzhxnCAFzKHlbaForso= -github.com/cosmos/cosmos-proto v1.0.0-beta.2 h1:X3OKvWgK9Gsejo0F1qs5l8Qn6xJV/AzgIWR2wZ8Nua8= -github.com/cosmos/cosmos-proto v1.0.0-beta.2/go.mod h1:+XRCLJ14pr5HFEHIUcn51IKXD1Fy3rkEQqt4WqmN4V0= +github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= +github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= github.com/cosmos/cosmos-sdk v0.46.0-beta2.0.20230306220716-5e55f56d39d5 h1:/6AWQpNJO7Kt8KcWlNOeR6RxHWz9jKE3xXaSJ1ijqDU= github.com/cosmos/cosmos-sdk v0.46.0-beta2.0.20230306220716-5e55f56d39d5/go.mod h1:yEwevSvOObLNzTLXERD1tdyoHoowNyeKB4GmPej6DO4= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= diff --git a/collections/go.mod b/collections/go.mod index 99eef88de583..8b7ab2d48fe8 100644 --- a/collections/go.mod +++ b/collections/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/collections go 1.20 require ( - cosmossdk.io/core v0.6.0 + cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba github.com/cosmos/cosmos-db v1.0.0-rc.1 github.com/stretchr/testify v1.8.2 pgregory.net/rapid v0.5.5 @@ -19,7 +19,7 @@ require ( github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect github.com/cockroachdb/pebble v0.0.0-20230226194802-02d779ffbc46 // indirect github.com/cockroachdb/redact v1.1.3 // indirect - github.com/cosmos/cosmos-proto v1.0.0-beta.2 // indirect + github.com/cosmos/cosmos-proto v1.0.0-beta.3 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/getsentry/sentry-go v0.18.0 // indirect diff --git a/collections/go.sum b/collections/go.sum index 46328883d264..b3e5719d9149 100644 --- a/collections/go.sum +++ b/collections/go.sum @@ -1,8 +1,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/api v0.3.1 h1:NNiOclKRR0AOlO4KIqeaG6PS6kswOMhHD0ir0SscNXE= cosmossdk.io/api v0.3.1/go.mod h1:DfHfMkiNA2Uhy8fj0JJlOCYOBp4eWUUJ1te5zBGNyIw= -cosmossdk.io/core v0.6.0 h1:V2zyaMVFN6hJSVENYx2XE9CMhzqwJPMjzSQpj0MyXAU= -cosmossdk.io/core v0.6.0/go.mod h1:YSFzBcKOf/U24e/sa6WFaYSrlZl5zgNvnWwjfFyPniw= +cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba h1:kSnaDzbwMInpQYwz8ESgvi6ceUQWcXAJdEVZW454dX0= +cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba/go.mod h1:WiFk9ZQbFVBHk9AqQIkLFqyj30NPQB6C45CIeAZxDcw= cosmossdk.io/depinject v1.0.0-alpha.3 h1:6evFIgj//Y3w09bqOUOzEpFj5tsxBqdc5CfkO7z+zfw= cosmossdk.io/depinject v1.0.0-alpha.3/go.mod h1:eRbcdQ7MRpIPEM5YUJh8k97nxHpYbc3sMUnEtt8HPWU= github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= @@ -45,8 +45,8 @@ github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8Nz github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/cosmos/cosmos-db v1.0.0-rc.1 h1:SjnT8B6WKMW9WEIX32qMhnEEKcI7ZP0+G1Sa9HD3nmY= github.com/cosmos/cosmos-db v1.0.0-rc.1/go.mod h1:Dnmk3flSf5lkwCqvvjNpoxjpXzhxnCAFzKHlbaForso= -github.com/cosmos/cosmos-proto v1.0.0-beta.2 h1:X3OKvWgK9Gsejo0F1qs5l8Qn6xJV/AzgIWR2wZ8Nua8= -github.com/cosmos/cosmos-proto v1.0.0-beta.2/go.mod h1:+XRCLJ14pr5HFEHIUcn51IKXD1Fy3rkEQqt4WqmN4V0= +github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= +github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/cucumber/common/gherkin/go/v22 v22.0.0 h1:4K8NqptbvdOrjL9DEea6HFjSpbdT9+Q5kgLpmmsHYl0= diff --git a/contrib/devtools/Dockerfile b/contrib/devtools/Dockerfile index e5d5be7439d9..30d61a97ec87 100644 --- a/contrib/devtools/Dockerfile +++ b/contrib/devtools/Dockerfile @@ -2,7 +2,7 @@ # docker build --pull --rm -f "contrib/devtools/Dockerfile" -t cosmossdk-proto:latest "contrib/devtools" # docker run --rm -v $(pwd):/workspace --workdir /workspace cosmossdk-proto sh ./scripts/protocgen.sh -FROM bufbuild/buf:1.15.0 as BUILDER +FROM bufbuild/buf:1.15.1 as BUILDER FROM golang:1.20-alpine RUN apk add --no-cache \ @@ -23,9 +23,9 @@ ENV GOLANG_PROTOBUF_VERSION=1.28.1 \ GRPC_GATEWAY_VERSION=1.16.0 RUN go install github.com/cosmos/cosmos-proto/cmd/protoc-gen-go-pulsar@latest && \ - go install google.golang.org/protobuf/cmd/protoc-gen-go@v${GOLANG_PROTOBUF_VERSION} && \ - go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@v${GRPC_GATEWAY_VERSION} \ - github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@v${GRPC_GATEWAY_VERSION} + go install google.golang.org/protobuf/cmd/protoc-gen-go@v${GOLANG_PROTOBUF_VERSION} && \ + go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@v${GRPC_GATEWAY_VERSION} \ + github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@v${GRPC_GATEWAY_VERSION} # install all gogo protobuf binaries RUN git clone https://github.com/cosmos/gogoproto.git; \ diff --git a/core/address/codec.go b/core/address/codec.go new file mode 100644 index 000000000000..5f20690cbcc7 --- /dev/null +++ b/core/address/codec.go @@ -0,0 +1,9 @@ +package address + +// Codec defines an interface to convert addresses from and to string/bytes. +type Codec interface { + // StringToBytes decodes text to bytes + StringToBytes(text string) ([]byte, error) + // BytesToString encodes bytes to text + BytesToString(bz []byte) (string, error) +} diff --git a/docs/.gitignore b/docs/.gitignore index bdd277eccad8..fc7eb7e9ba84 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -13,6 +13,7 @@ docs/node_modules docs/docs/modules docs/docs/spec docs/docs/architecture +docs/docs/rfc docs/docs/tooling/01-cosmovisor.md docs/docs/tooling/02-depinject.md docs/docs/tooling/03-confix.md diff --git a/docs/architecture/adr-059-test-scopes.md b/docs/architecture/adr-059-test-scopes.md index 51f06621c859..6180df5928c0 100644 --- a/docs/architecture/adr-059-test-scopes.md +++ b/docs/architecture/adr-059-test-scopes.md @@ -127,7 +127,6 @@ gap in current simulation test coverage. Modules not returning simulation operations: * `auth` -* `capability` * `evidence` * `mint` * `params` diff --git a/docs/docs/building-modules/01-module-manager.md b/docs/docs/building-modules/01-module-manager.md index 8003e37dda34..bd226c730c8f 100644 --- a/docs/docs/building-modules/01-module-manager.md +++ b/docs/docs/building-modules/01-module-manager.md @@ -224,7 +224,7 @@ The module manager is used throughout the application whenever an action on a co * `NewManager(modules ...AppModule)`: Constructor function. It takes a list of the application's `AppModule`s and builds a new `Manager`. It is generally called from the application's main [constructor function](../basics/00-app-anatomy.md#constructor-function). * `SetOrderInitGenesis(moduleNames ...string)`: Sets the order in which the [`InitGenesis`](./08-genesis.md#initgenesis) function of each module will be called when the application is first started. This function is generally called from the application's main [constructor function](../basics/00-app-anatomy.md#constructor-function). - To initialize modules successfully, module dependencies should be considered. For example, the `genutil` module must occur after `staking` module so that the pools are properly initialized with tokens from genesis accounts, the `genutils` module must also occur after `auth` so that it can access the params from auth, `capability` module should be initialized before all other modules so that it can initialize any capabilities. + To initialize modules successfully, module dependencies should be considered. For example, the `genutil` module must occur after `staking` module so that the pools are properly initialized with tokens from genesis accounts, the `genutils` module must also occur after `auth` so that it can access the params from auth, IBC's `capability` module should be initialized before all other modules so that it can initialize any capabilities. * `SetOrderExportGenesis(moduleNames ...string)`: Sets the order in which the [`ExportGenesis`](./08-genesis.md#exportgenesis) function of each module will be called in case of an export. This function is generally called from the application's main [constructor function](../basics/00-app-anatomy.md#constructor-function). * `SetOrderBeginBlockers(moduleNames ...string)`: Sets the order in which the `BeginBlock()` function of each module will be called at the beginning of each block. This function is generally called from the application's main [constructor function](../basics/00-app-anatomy.md#constructor-function). * `SetOrderEndBlockers(moduleNames ...string)`: Sets the order in which the `EndBlock()` function of each module will be called at the end of each block. This function is generally called from the application's main [constructor function](../basics/00-app-anatomy.md#constructor-function). diff --git a/docs/docs/core/07-cli.md b/docs/docs/core/07-cli.md index 651507899aeb..107bc76e53c9 100644 --- a/docs/docs/core/07-cli.md +++ b/docs/docs/core/07-cli.md @@ -168,4 +168,28 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/simapp/simd/cmd/root.go#L6 The `SetCmdClientContextHandler` call reads persistent flags via `ReadPersistentCommandFlags` which creates a `client.Context` and sets that on the root command's `Context`. -The `InterceptConfigsPreRunHandler` call creates a viper literal, default `server.Context`, and a logger and sets that on the root command's `Context`. The `server.Context` will be modified and saved to disk via the internal `interceptConfigs` call, which either reads or creates a Tendermint configuration based on the home path provided. In addition, `interceptConfigs` also reads and loads the application configuration, `app.toml`, and binds that to the `server.Context` viper literal. This is vital so the application can get access to not only the CLI flags, but also to the application configuration values provided by this file. +The `InterceptConfigsPreRunHandler` call creates a viper literal, default `server.Context`, and a logger and sets that on the root command's `Context`. The `server.Context` will be modified and saved to disk. The internal `interceptConfigs` call reads or creates a Tendermint configuration based on the home path provided. In addition, `interceptConfigs` also reads and loads the application configuration, `app.toml`, and binds that to the `server.Context` viper literal. This is vital so the application can get access to not only the CLI flags, but also to the application configuration values provided by this file. + +:::tip +When willing to configure which logger is used, do not to use `InterceptConfigsPreRunHandler`, which sets the default SDK logger, but instead use `InterceptConfigsAndCreateContext` and set the server context and the logger manually: + +```diff +-return server.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig, customCMTConfig) + ++serverCtx, err := server.InterceptConfigsAndCreateContext(cmd, customAppTemplate, customAppConfig, customCMTConfig) ++if err != nil { ++ return err ++} + ++// overwrite default server logger ++logger, err := server.CreateSDKLogger(serverCtx, cmd.OutOrStdout()) ++if err != nil { ++ return err ++} ++serverCtx.Logger = logger.With(log.ModuleKey, "server") + ++// set server context ++return server.SetCmdServerContext(cmd, serverCtx) +``` + +::: diff --git a/docs/docs/tooling/00-protobuf.md b/docs/docs/tooling/00-protobuf.md index 42e9d3bf03fb..53decb74d8b7 100644 --- a/docs/docs/tooling/00-protobuf.md +++ b/docs/docs/tooling/00-protobuf.md @@ -6,7 +6,7 @@ sidebar_position: 1 It is known that Cosmos SDK uses protocol buffers extensively, this docuemnt is meant to provide a guide on how it is used in the cosmos-sdk. -To generate the proto file, the Cosmos SDK uses a docker image, this image is provided to all to use as well. The latest version is `ghcr.io/cosmos/proto-builder:0.11.2` +To generate the proto file, the Cosmos SDK uses a docker image, this image is provided to all to use as well. The latest version is `ghcr.io/cosmos/proto-builder:0.12.x` Below is the example of the Cosmos SDK's commands for generating, linting, and formatting protobuf files that can be reused in any applications makefile. diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index bccacc885830..48ce23b4bc9c 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -252,13 +252,6 @@ const config = { ], to: "/main/modules/bank", }, - { - from: [ - "/main/modules/capability/01_concepts", - "/main/modules/capability/02_state", - ], - to: "/main/modules/capability", - }, { from: [ "/main/modules/crisis/01_state", diff --git a/docs/post.sh b/docs/post.sh index 7bc2c2b2d299..fef3afc4719b 100755 --- a/docs/post.sh +++ b/docs/post.sh @@ -8,4 +8,5 @@ rm -rf docs/tooling/04-hubl.md rm -rf docs/run-node/04-rosetta.md rm -rf docs/architecture rm -rf docs/spec +rm -rf docs/rfc rm -rf versioned_docs versioned_sidebars versions.json \ No newline at end of file diff --git a/docs/pre.sh b/docs/pre.sh index 8e841e575eef..921a678f1d6f 100755 --- a/docs/pre.sh +++ b/docs/pre.sh @@ -30,4 +30,7 @@ cp ../tools/rosetta/README.md ./docs/run-node/04-rosetta.md cp -r ./architecture ./docs ## Add spec documentation -cp -r ./spec ./docs \ No newline at end of file +cp -r ./spec ./docs + +## Add rfc documentation +cp -r ./rfc ./docs \ No newline at end of file diff --git a/docs/rfc/README.md b/docs/rfc/README.md new file mode 100644 index 000000000000..24887ac3f668 --- /dev/null +++ b/docs/rfc/README.md @@ -0,0 +1,38 @@ +--- +sidebar_position: 1 +--- + +# Requests for Comments + +A Request for Comments (RFC) is a record of discussion on an open-ended topic +related to the design and implementation of the Cosmos SDK, for which no +immediate decision is required. + +The purpose of an RFC is to serve as a historical record of a high-level +discussion that might otherwise only be recorded in an ad-hoc way (for example, +via gists or Google docs) that are difficult to discover for someone after the +fact. An RFC _may_ give rise to more specific architectural _decisions_ for +the Cosmos SDK, but those decisions must be recorded separately in +[Architecture Decision Records (ADR)](../architecture/). + +As a rule of thumb, if you can articulate a specific question that needs to be +answered, write an ADR. If you need to explore the topic and get input from +others to know what questions need to be answered, an RFC may be appropriate. + +## RFC Content + +An RFC should provide: + +* A **changelog**, documenting when and how the RFC has changed. +* An **abstract**, briefly summarizing the topic so the reader can quickly tell + whether it is relevant to their interest. +* Any **background** a reader will need to understand and participate in the + substance of the discussion (links to other documents are fine here). +* The **discussion**, the primary content of the document. + +The [rfc-template.md](./rfc-template.md) file includes placeholders for these +sections. + +## Table of Contents + + diff --git a/docs/rfc/_category.json b/docs/rfc/_category.json new file mode 100644 index 000000000000..8a6007a966f8 --- /dev/null +++ b/docs/rfc/_category.json @@ -0,0 +1,5 @@ +{ + "label": "RFCs", + "position": 12, + "link": null +} diff --git a/docs/rfc/rfc-template.md b/docs/rfc/rfc-template.md new file mode 100644 index 000000000000..b3f404775199 --- /dev/null +++ b/docs/rfc/rfc-template.md @@ -0,0 +1,35 @@ +# RFC {RFC-NUMBER}: {TITLE} + +## Changelog + +- {date}: {changelog} + +## Abstract + +> A brief high-level synopsis of the topic of discussion for this RFC, ideally +> just a few sentences. This should help the reader quickly decide whether the +> rest of the discussion is relevant to their interest. + +## Background + +> Any context or orientation needed for a reader to understand and participate +> in the substance of the Discussion. If necessary, this section may include +> links to other documentation or sources rather than restating existing +> material, but should provide enough detail that the reader can tell what they +> need to read to be up-to-date. + +### References + +> Links to external materials needed to follow the discussion may be added here. +> +> In addition, if the discussion in a request for comments leads to any design +> decisions, it may be helpful to add links to the ADR documents here after the +> discussion has settled. + +## Discussion + +> This section contains the core of the discussion. +> +> There is no fixed format for this section, but ideally changes to this +> section should be updated before merging to reflect any discussion that took +> place on the PR that made those changes. diff --git a/go.mod b/go.mod index 694cb1382832..acd1ba102151 100644 --- a/go.mod +++ b/go.mod @@ -4,14 +4,14 @@ module github.com/cosmos/cosmos-sdk require ( cosmossdk.io/api v0.3.1 - cosmossdk.io/collections v0.0.0-20230306161821-d6240a43e6e8 - cosmossdk.io/core v0.6.0 + cosmossdk.io/collections v0.0.0-20230309163709-87da587416ba + cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba cosmossdk.io/depinject v1.0.0-alpha.3 cosmossdk.io/errors v1.0.0-beta.7 cosmossdk.io/log v0.0.0-20230306220716-5e55f56d39d5 cosmossdk.io/math v1.0.0-beta.6.0.20230216172121-959ce49135e4 cosmossdk.io/store v0.0.0-20230227103508-bbe7f8a11b44 - cosmossdk.io/x/tx v0.2.2 + cosmossdk.io/x/tx v0.2.3-0.20230309163709-87da587416ba github.com/99designs/keyring v1.2.1 github.com/armon/go-metrics v0.4.1 github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 @@ -152,12 +152,6 @@ require ( nhooyr.io/websocket v1.8.6 // indirect ) -// Below are the short-lived replace of the Cosmos SDK -replace ( - cosmossdk.io/core => ./core - cosmossdk.io/x/tx => ./x/tx -) - // 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 ff820a7f6c10..e6566d3cc93f 100644 --- a/go.sum +++ b/go.sum @@ -37,8 +37,10 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9 cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= cosmossdk.io/api v0.3.1 h1:NNiOclKRR0AOlO4KIqeaG6PS6kswOMhHD0ir0SscNXE= cosmossdk.io/api v0.3.1/go.mod h1:DfHfMkiNA2Uhy8fj0JJlOCYOBp4eWUUJ1te5zBGNyIw= -cosmossdk.io/collections v0.0.0-20230306161821-d6240a43e6e8 h1:TmhLZxHM/TlyiF1bS7ObHBzMdXW0nEJC3i+nQ/nt4Zs= -cosmossdk.io/collections v0.0.0-20230306161821-d6240a43e6e8/go.mod h1:RoEzMOLLsorYvlNTm1wzYzlI5yQ0QSWeJqkMdfDVgHE= +cosmossdk.io/collections v0.0.0-20230309163709-87da587416ba h1:S4PYij/tX3Op/hwenVEN9D+M27JRcwSwVqE3UA0BnwM= +cosmossdk.io/collections v0.0.0-20230309163709-87da587416ba/go.mod h1:lpS+G8bGC2anqzWdndTzjnQnuMO/qAcgZUkGJp4i3rc= +cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba h1:kSnaDzbwMInpQYwz8ESgvi6ceUQWcXAJdEVZW454dX0= +cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba/go.mod h1:WiFk9ZQbFVBHk9AqQIkLFqyj30NPQB6C45CIeAZxDcw= cosmossdk.io/depinject v1.0.0-alpha.3 h1:6evFIgj//Y3w09bqOUOzEpFj5tsxBqdc5CfkO7z+zfw= cosmossdk.io/depinject v1.0.0-alpha.3/go.mod h1:eRbcdQ7MRpIPEM5YUJh8k97nxHpYbc3sMUnEtt8HPWU= cosmossdk.io/errors v1.0.0-beta.7 h1:gypHW76pTQGVnHKo6QBkb4yFOJjC+sUGRc5Al3Odj1w= @@ -49,6 +51,8 @@ cosmossdk.io/math v1.0.0-beta.6.0.20230216172121-959ce49135e4 h1:/jnzJ9zFsL7qkV8 cosmossdk.io/math v1.0.0-beta.6.0.20230216172121-959ce49135e4/go.mod h1:gUVtWwIzfSXqcOT+lBVz2jyjfua8DoBdzRsIyaUAT/8= cosmossdk.io/store v0.0.0-20230227103508-bbe7f8a11b44 h1:/pKsj/ApzO4+zMwpgLiPG5iakoHxziGpMiJcz4S+r4w= cosmossdk.io/store v0.0.0-20230227103508-bbe7f8a11b44/go.mod h1:flrxUykloEW1asE9p+Q+d8LSuNI3fBRdzISg9HTpYlQ= +cosmossdk.io/x/tx v0.2.3-0.20230309163709-87da587416ba h1:NmWXkl0voj3dN96Qmk4rfrze6dLLLxB4qTCxXZTXBpM= +cosmossdk.io/x/tx v0.2.3-0.20230309163709-87da587416ba/go.mod h1:dhIxZhZF2glIA9hkkildy/JmSqVH3FIU/OhSU8is7PM= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek= filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= diff --git a/orm/CHANGELOG.md b/orm/CHANGELOG.md index e7abd1f38908..b8bb40c78dfe 100644 --- a/orm/CHANGELOG.md +++ b/orm/CHANGELOG.md @@ -36,10 +36,14 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] +### Feature + +* [#15320](https://github.com/cosmos/cosmos-sdk/pull/15320) Add current sequence getter (`LastInsertedSequence`) for auto increment tables. + ### API Breaking Changes -- [14822](https://github.com/cosmos/cosmos-sdk/pull/14822) Migrate to cosmossdk.io/core genesis API +* [#14822](https://github.com/cosmos/cosmos-sdk/pull/14822) Migrate to cosmossdk.io/core genesis API ### State-machine Breaking Changes -- [12273](https://github.com/cosmos/cosmos-sdk/pull/12273) The timestamp key encoding was reworked to properly handle nil values. Existing users will need to manually migrate their data to the new encoding before upgrading. +* [#12273](https://github.com/cosmos/cosmos-sdk/pull/12273) The timestamp key encoding was reworked to properly handle nil values. Existing users will need to manually migrate their data to the new encoding before upgrading. diff --git a/orm/go.mod b/orm/go.mod index 73fccbc6df13..d8b661fe9555 100644 --- a/orm/go.mod +++ b/orm/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( cosmossdk.io/api v0.3.1 - cosmossdk.io/core v0.6.0 + cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba cosmossdk.io/depinject v1.0.0-alpha.3 cosmossdk.io/errors v1.0.0-beta.7 github.com/cosmos/cosmos-db v1.0.0-rc.1 @@ -66,9 +66,3 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect sigs.k8s.io/yaml v1.3.0 // indirect ) - -// Here are the short-lived replace for orm -replace ( - cosmossdk.io/core => ../core - cosmossdk.io/x/tx => ../x/tx -) diff --git a/orm/go.sum b/orm/go.sum index 1da68bb7241f..503bdc993df2 100644 --- a/orm/go.sum +++ b/orm/go.sum @@ -1,6 +1,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/api v0.3.1 h1:NNiOclKRR0AOlO4KIqeaG6PS6kswOMhHD0ir0SscNXE= cosmossdk.io/api v0.3.1/go.mod h1:DfHfMkiNA2Uhy8fj0JJlOCYOBp4eWUUJ1te5zBGNyIw= +cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba h1:kSnaDzbwMInpQYwz8ESgvi6ceUQWcXAJdEVZW454dX0= +cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba/go.mod h1:WiFk9ZQbFVBHk9AqQIkLFqyj30NPQB6C45CIeAZxDcw= cosmossdk.io/depinject v1.0.0-alpha.3 h1:6evFIgj//Y3w09bqOUOzEpFj5tsxBqdc5CfkO7z+zfw= cosmossdk.io/depinject v1.0.0-alpha.3/go.mod h1:eRbcdQ7MRpIPEM5YUJh8k97nxHpYbc3sMUnEtt8HPWU= cosmossdk.io/errors v1.0.0-beta.7 h1:gypHW76pTQGVnHKo6QBkb4yFOJjC+sUGRc5Al3Odj1w= diff --git a/orm/internal/codegen/table.go b/orm/internal/codegen/table.go index b1f21cececa6..d629b0c29802 100644 --- a/orm/internal/codegen/table.go +++ b/orm/internal/codegen/table.go @@ -62,6 +62,7 @@ func (t tableGen) getTableInterface() { t.P("Insert(ctx ", contextPkg.Ident("Context"), ", ", t.param(t.msg.GoIdent.GoName), " *", t.QualifiedGoIdent(t.msg.GoIdent), ") error") if t.table.PrimaryKey.AutoIncrement { t.P("InsertReturning", fieldsToCamelCase(t.table.PrimaryKey.Fields), "(ctx ", contextPkg.Ident("Context"), ", ", t.param(t.msg.GoIdent.GoName), " *", t.QualifiedGoIdent(t.msg.GoIdent), ") (uint64, error)") + t.P("LastInsertedSequence(ctx ", contextPkg.Ident("Context"), ") (uint64, error)") } t.P("Update(ctx ", contextPkg.Ident("Context"), ", ", t.param(t.msg.GoIdent.GoName), " *", t.QualifiedGoIdent(t.msg.GoIdent), ") error") t.P("Save(ctx ", contextPkg.Ident("Context"), ", ", t.param(t.msg.GoIdent.GoName), " *", t.QualifiedGoIdent(t.msg.GoIdent), ") error") @@ -184,6 +185,11 @@ func (t tableGen) genTableImpl() { t.P("return ", receiverVar, ".table.InsertReturningPKey(ctx, ", varName, ")") t.P("}") t.P() + + t.P(receiver, "LastInsertedSequence(ctx ", contextPkg.Ident("Context"), ") (uint64, error) {") + t.P("return ", receiverVar, ".table.LastInsertedSequence(ctx)") + t.P("}") + t.P() } // Has diff --git a/orm/internal/testpb/bank.pb.go b/orm/internal/testpb/bank.pb.go index 83c50055fd26..8366c79dc574 100644 --- a/orm/internal/testpb/bank.pb.go +++ b/orm/internal/testpb/bank.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 +// protoc-gen-go v1.28.1 // protoc (unknown) // source: testpb/bank.proto diff --git a/orm/internal/testpb/bank_query.pb.go b/orm/internal/testpb/bank_query.pb.go index f0a2e21f0263..487235337cf9 100644 --- a/orm/internal/testpb/bank_query.pb.go +++ b/orm/internal/testpb/bank_query.pb.go @@ -2,7 +2,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 +// protoc-gen-go v1.28.1 // protoc (unknown) // source: testpb/bank_query.proto @@ -139,6 +139,7 @@ type ListBalanceRequest struct { // query specifies the type of query - either a prefix or range query. // // Types that are assignable to Query: + // // *ListBalanceRequest_PrefixQuery // *ListBalanceRequest_RangeQuery_ Query isListBalanceRequest_Query `protobuf_oneof:"query"` @@ -389,6 +390,7 @@ type ListSupplyRequest struct { // query specifies the type of query - either a prefix or range query. // // Types that are assignable to Query: + // // *ListSupplyRequest_PrefixQuery // *ListSupplyRequest_RangeQuery_ Query isListSupplyRequest_Query `protobuf_oneof:"query"` @@ -541,6 +543,7 @@ type ListBalanceRequest_IndexKey struct { // key specifies the index key value. // // Types that are assignable to Key: + // // *ListBalanceRequest_IndexKey_AddressDenom_ // *ListBalanceRequest_IndexKey_Denom_ Key isListBalanceRequest_IndexKey_Key `protobuf_oneof:"key"` @@ -795,6 +798,7 @@ type ListSupplyRequest_IndexKey struct { // key specifies the index key value. // // Types that are assignable to Key: + // // *ListSupplyRequest_IndexKey_Denom_ Key isListSupplyRequest_IndexKey_Key `protobuf_oneof:"key"` } diff --git a/orm/internal/testpb/test_schema.cosmos_orm.go b/orm/internal/testpb/test_schema.cosmos_orm.go index a5cf2a6fbd11..93ce0cda021f 100644 --- a/orm/internal/testpb/test_schema.cosmos_orm.go +++ b/orm/internal/testpb/test_schema.cosmos_orm.go @@ -216,6 +216,7 @@ func NewExampleTableTable(db ormtable.Schema) (ExampleTableTable, error) { type ExampleAutoIncrementTableTable interface { Insert(ctx context.Context, exampleAutoIncrementTable *ExampleAutoIncrementTable) error InsertReturningId(ctx context.Context, exampleAutoIncrementTable *ExampleAutoIncrementTable) (uint64, error) + LastInsertedSequence(ctx context.Context) (uint64, error) Update(ctx context.Context, exampleAutoIncrementTable *ExampleAutoIncrementTable) error Save(ctx context.Context, exampleAutoIncrementTable *ExampleAutoIncrementTable) error Delete(ctx context.Context, exampleAutoIncrementTable *ExampleAutoIncrementTable) error @@ -302,6 +303,10 @@ func (this exampleAutoIncrementTableTable) InsertReturningId(ctx context.Context return this.table.InsertReturningPKey(ctx, exampleAutoIncrementTable) } +func (this exampleAutoIncrementTableTable) LastInsertedSequence(ctx context.Context) (uint64, error) { + return this.table.LastInsertedSequence(ctx) +} + func (this exampleAutoIncrementTableTable) Has(ctx context.Context, id uint64) (found bool, err error) { return this.table.PrimaryKey().Has(ctx, id) } @@ -401,6 +406,7 @@ func NewExampleSingletonTable(db ormtable.Schema) (ExampleSingletonTable, error) type ExampleTimestampTable interface { Insert(ctx context.Context, exampleTimestamp *ExampleTimestamp) error InsertReturningId(ctx context.Context, exampleTimestamp *ExampleTimestamp) (uint64, error) + LastInsertedSequence(ctx context.Context) (uint64, error) Update(ctx context.Context, exampleTimestamp *ExampleTimestamp) error Save(ctx context.Context, exampleTimestamp *ExampleTimestamp) error Delete(ctx context.Context, exampleTimestamp *ExampleTimestamp) error @@ -484,6 +490,10 @@ func (this exampleTimestampTable) InsertReturningId(ctx context.Context, example return this.table.InsertReturningPKey(ctx, exampleTimestamp) } +func (this exampleTimestampTable) LastInsertedSequence(ctx context.Context) (uint64, error) { + return this.table.LastInsertedSequence(ctx) +} + func (this exampleTimestampTable) Has(ctx context.Context, id uint64) (found bool, err error) { return this.table.PrimaryKey().Has(ctx, id) } @@ -683,6 +693,7 @@ func NewSimpleExampleTable(db ormtable.Schema) (SimpleExampleTable, error) { type ExampleAutoIncFieldNameTable interface { Insert(ctx context.Context, exampleAutoIncFieldName *ExampleAutoIncFieldName) error InsertReturningFoo(ctx context.Context, exampleAutoIncFieldName *ExampleAutoIncFieldName) (uint64, error) + LastInsertedSequence(ctx context.Context) (uint64, error) Update(ctx context.Context, exampleAutoIncFieldName *ExampleAutoIncFieldName) error Save(ctx context.Context, exampleAutoIncFieldName *ExampleAutoIncFieldName) error Delete(ctx context.Context, exampleAutoIncFieldName *ExampleAutoIncFieldName) error @@ -753,6 +764,10 @@ func (this exampleAutoIncFieldNameTable) InsertReturningFoo(ctx context.Context, return this.table.InsertReturningPKey(ctx, exampleAutoIncFieldName) } +func (this exampleAutoIncFieldNameTable) LastInsertedSequence(ctx context.Context) (uint64, error) { + return this.table.LastInsertedSequence(ctx) +} + func (this exampleAutoIncFieldNameTable) Has(ctx context.Context, foo uint64) (found bool, err error) { return this.table.PrimaryKey().Has(ctx, foo) } diff --git a/orm/internal/testpb/test_schema.pb.go b/orm/internal/testpb/test_schema.pb.go index 4f98d3208c47..8dc30bfc36e4 100644 --- a/orm/internal/testpb/test_schema.pb.go +++ b/orm/internal/testpb/test_schema.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 +// protoc-gen-go v1.28.1 // protoc (unknown) // source: testpb/test_schema.proto @@ -105,6 +105,7 @@ type ExampleTable struct { Map map[string]uint32 `protobuf:"bytes,18,rep,name=map,proto3" json:"map,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` Msg *ExampleTable_ExampleMessage `protobuf:"bytes,19,opt,name=msg,proto3" json:"msg,omitempty"` // Types that are assignable to Sum: + // // *ExampleTable_Oneof Sum isExampleTable_Sum `protobuf_oneof:"sum"` } diff --git a/orm/internal/testpb/test_schema_query.pb.go b/orm/internal/testpb/test_schema_query.pb.go index b72ddd34494d..484624eb6492 100644 --- a/orm/internal/testpb/test_schema_query.pb.go +++ b/orm/internal/testpb/test_schema_query.pb.go @@ -2,7 +2,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 +// protoc-gen-go v1.28.1 // protoc (unknown) // source: testpb/test_schema_query.proto @@ -253,6 +253,7 @@ type ListExampleTableRequest struct { // query specifies the type of query - either a prefix or range query. // // Types that are assignable to Query: + // // *ListExampleTableRequest_PrefixQuery // *ListExampleTableRequest_RangeQuery_ Query isListExampleTableRequest_Query `protobuf_oneof:"query"` @@ -599,6 +600,7 @@ type ListExampleAutoIncrementTableRequest struct { // query specifies the type of query - either a prefix or range query. // // Types that are assignable to Query: + // // *ListExampleAutoIncrementTableRequest_PrefixQuery // *ListExampleAutoIncrementTableRequest_RangeQuery_ Query isListExampleAutoIncrementTableRequest_Query `protobuf_oneof:"query"` @@ -938,6 +940,7 @@ type ListExampleTimestampRequest struct { // query specifies the type of query - either a prefix or range query. // // Types that are assignable to Query: + // // *ListExampleTimestampRequest_PrefixQuery // *ListExampleTimestampRequest_RangeQuery_ Query isListExampleTimestampRequest_Query `protobuf_oneof:"query"` @@ -1284,6 +1287,7 @@ type ListSimpleExampleRequest struct { // query specifies the type of query - either a prefix or range query. // // Types that are assignable to Query: + // // *ListSimpleExampleRequest_PrefixQuery // *ListSimpleExampleRequest_RangeQuery_ Query isListSimpleExampleRequest_Query `protobuf_oneof:"query"` @@ -1534,6 +1538,7 @@ type ListExampleAutoIncFieldNameRequest struct { // query specifies the type of query - either a prefix or range query. // // Types that are assignable to Query: + // // *ListExampleAutoIncFieldNameRequest_PrefixQuery // *ListExampleAutoIncFieldNameRequest_RangeQuery_ Query isListExampleAutoIncFieldNameRequest_Query `protobuf_oneof:"query"` @@ -1686,6 +1691,7 @@ type ListExampleTableRequest_IndexKey struct { // key specifies the index key value. // // Types that are assignable to Key: + // // *ListExampleTableRequest_IndexKey_U_32I_64Str // *ListExampleTableRequest_IndexKey_U_64Str // *ListExampleTableRequest_IndexKey_StrU_32 @@ -2108,6 +2114,7 @@ type ListExampleAutoIncrementTableRequest_IndexKey struct { // key specifies the index key value. // // Types that are assignable to Key: + // // *ListExampleAutoIncrementTableRequest_IndexKey_Id_ // *ListExampleAutoIncrementTableRequest_IndexKey_X_ Key isListExampleAutoIncrementTableRequest_IndexKey_Key `protobuf_oneof:"key"` @@ -2354,6 +2361,7 @@ type ListExampleTimestampRequest_IndexKey struct { // key specifies the index key value. // // Types that are assignable to Key: + // // *ListExampleTimestampRequest_IndexKey_Id_ // *ListExampleTimestampRequest_IndexKey_Ts_ Key isListExampleTimestampRequest_IndexKey_Key `protobuf_oneof:"key"` @@ -2598,6 +2606,7 @@ type ListSimpleExampleRequest_IndexKey struct { // key specifies the index key value. // // Types that are assignable to Key: + // // *ListSimpleExampleRequest_IndexKey_Name_ // *ListSimpleExampleRequest_IndexKey_Unique_ Key isListSimpleExampleRequest_IndexKey_Key `protobuf_oneof:"key"` @@ -2842,6 +2851,7 @@ type ListExampleAutoIncFieldNameRequest_IndexKey struct { // key specifies the index key value. // // Types that are assignable to Key: + // // *ListExampleAutoIncFieldNameRequest_IndexKey_Foo_ Key isListExampleAutoIncFieldNameRequest_IndexKey_Key `protobuf_oneof:"key"` } diff --git a/orm/model/ormtable/auto_increment.go b/orm/model/ormtable/auto_increment.go index 2a0eed6f94b6..982ce7987248 100644 --- a/orm/model/ormtable/auto_increment.go +++ b/orm/model/ormtable/auto_increment.go @@ -61,6 +61,15 @@ func (t autoIncrementTable) Update(ctx context.Context, message proto.Message) e return err } +func (t autoIncrementTable) LastInsertedSequence(ctx context.Context) (uint64, error) { + backend, err := t.getBackend(ctx) + if err != nil { + return 0, err + } + + return t.curSeqValue(backend.IndexStoreReader()) +} + func (t *autoIncrementTable) save(ctx context.Context, backend Backend, message proto.Message, mode saveMode) (newPK uint64, err error) { messageRef := message.ProtoReflect() val := messageRef.Get(t.autoIncField).Uint() diff --git a/orm/model/ormtable/auto_increment_test.go b/orm/model/ormtable/auto_increment_test.go index c3180000dc5a..5ba1fa4ed05a 100644 --- a/orm/model/ormtable/auto_increment_test.go +++ b/orm/model/ormtable/auto_increment_test.go @@ -52,12 +52,18 @@ func runAutoIncrementScenario(t *testing.T, table ormtable.AutoIncrementTable, c ex1 := &testpb.ExampleAutoIncrementTable{X: "foo", Y: 5} assert.NilError(t, store.Save(ctx, ex1)) assert.Equal(t, uint64(1), ex1.Id) + curSeq, err := table.LastInsertedSequence(ctx) + assert.NilError(t, err) + assert.Equal(t, curSeq, uint64(1)) ex2 := &testpb.ExampleAutoIncrementTable{X: "bar", Y: 10} newId, err := table.InsertReturningPKey(ctx, ex2) assert.NilError(t, err) assert.Equal(t, uint64(2), ex2.Id) assert.Equal(t, newId, ex2.Id) + curSeq, err = table.LastInsertedSequence(ctx) + assert.NilError(t, err) + assert.Equal(t, curSeq, uint64(2)) buf := &bytes.Buffer{} assert.NilError(t, table.ExportJSON(ctx, buf)) @@ -78,6 +84,9 @@ func runAutoIncrementScenario(t *testing.T, table ormtable.AutoIncrementTable, c ex1.Id = 0 assert.NilError(t, table.Insert(store3, ex1)) assert.Equal(t, uint64(3), ex1.Id) // should equal 3 because the sequence number 2 should have been imported from JSON + curSeq, err = table.LastInsertedSequence(store3) + assert.NilError(t, err) + assert.Equal(t, curSeq, uint64(3)) } func TestBadJSON(t *testing.T) { diff --git a/orm/model/ormtable/build.go b/orm/model/ormtable/build.go index 4b9dae4f8a97..3e9137665d0a 100644 --- a/orm/model/ormtable/build.go +++ b/orm/model/ormtable/build.go @@ -3,18 +3,15 @@ package ormtable import ( "fmt" - "github.com/cosmos/cosmos-sdk/orm/internal/fieldnames" - - "github.com/cosmos/cosmos-sdk/orm/encoding/encodeutil" - - "google.golang.org/protobuf/reflect/protoregistry" - "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/reflect/protoregistry" ormv1 "cosmossdk.io/api/cosmos/orm/v1" + "github.com/cosmos/cosmos-sdk/orm/encoding/encodeutil" "github.com/cosmos/cosmos-sdk/orm/encoding/ormkv" + "github.com/cosmos/cosmos-sdk/orm/internal/fieldnames" "github.com/cosmos/cosmos-sdk/orm/types/ormerrors" ) diff --git a/orm/model/ormtable/table.go b/orm/model/ormtable/table.go index b66520ac8e61..221757463649 100644 --- a/orm/model/ormtable/table.go +++ b/orm/model/ormtable/table.go @@ -143,6 +143,7 @@ type Table interface { // Schema is an interface for things that contain tables and can encode and // decode kv-store pairs. + type Schema interface { ormkv.EntryCodec @@ -156,4 +157,8 @@ type AutoIncrementTable interface { // InsertReturningPKey inserts the provided entry in the store and returns the newly // generated primary key for the message or an error. InsertReturningPKey(ctx context.Context, message proto.Message) (newPK uint64, err error) + + // LastInsertedSequence retrieves the sequence number of the last entry inserted into the table. + // The LastInsertedSequence is 0 if no entries have been inserted into the table. + LastInsertedSequence(ctx context.Context) (uint64, error) } diff --git a/orm/model/ormtable/testdata/test_auto_inc.golden b/orm/model/ormtable/testdata/test_auto_inc.golden index 07a1fc466356..432c3a371c9b 100644 --- a/orm/model/ormtable/testdata/test_auto_inc.golden +++ b/orm/model/ormtable/testdata/test_auto_inc.golden @@ -14,6 +14,8 @@ SET 03808002 01 SET 0301666f6f 0001 UNIQ testpb.ExampleAutoIncrementTable x : foo -> 1 ORM AFTER INSERT testpb.ExampleAutoIncrementTable {"id":1,"x":"foo","y":5} +GET 03808002 01 + SEQ testpb.ExampleAutoIncrementTable 1 GET 03808002 01 SEQ testpb.ExampleAutoIncrementTable 1 GET 03000002 @@ -28,6 +30,8 @@ SET 03808002 02 SET 0301626172 0002 UNIQ testpb.ExampleAutoIncrementTable x : bar -> 2 ORM AFTER INSERT testpb.ExampleAutoIncrementTable {"id":2,"x":"bar","y":10} +GET 03808002 02 + SEQ testpb.ExampleAutoIncrementTable 2 GET 03808002 02 SEQ testpb.ExampleAutoIncrementTable 2 ITERATOR 0300 -> 0301 diff --git a/proto/cosmos/capability/module/v1/module.proto b/proto/cosmos/capability/module/v1/module.proto deleted file mode 100644 index eabaadc1c22e..000000000000 --- a/proto/cosmos/capability/module/v1/module.proto +++ /dev/null @@ -1,16 +0,0 @@ -syntax = "proto3"; - -package cosmos.capability.module.v1; - -import "cosmos/app/v1alpha1/module.proto"; - -// Module is the config object of the capability module. -message Module { - option (cosmos.app.v1alpha1.module) = { - go_import: "github.com/cosmos/cosmos-sdk/x/capability" - }; - - // seal_keeper defines if keeper.Seal() will run on BeginBlock() to prevent further modules from creating a scoped - // keeper. For more details check x/capability/keeper.go. - bool seal_keeper = 1; -} \ No newline at end of file diff --git a/proto/cosmos/capability/v1beta1/capability.proto b/proto/cosmos/capability/v1beta1/capability.proto deleted file mode 100644 index 6a71acf3eece..000000000000 --- a/proto/cosmos/capability/v1beta1/capability.proto +++ /dev/null @@ -1,28 +0,0 @@ -syntax = "proto3"; -package cosmos.capability.v1beta1; - -option go_package = "github.com/cosmos/cosmos-sdk/x/capability/types"; - -import "gogoproto/gogo.proto"; -import "amino/amino.proto"; - -// Capability defines an implementation of an object capability. The index -// provided to a Capability must be globally unique. -message Capability { - uint64 index = 1; -} - -// Owner defines a single capability owner. An owner is defined by the name of -// capability and the module name. -message Owner { - option (gogoproto.goproto_getters) = false; - - string module = 1; - string name = 2; -} - -// CapabilityOwners defines a set of owners of a single Capability. The set of -// owners must be unique. -message CapabilityOwners { - repeated Owner owners = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; -} diff --git a/proto/cosmos/capability/v1beta1/genesis.proto b/proto/cosmos/capability/v1beta1/genesis.proto deleted file mode 100644 index f119244e464a..000000000000 --- a/proto/cosmos/capability/v1beta1/genesis.proto +++ /dev/null @@ -1,27 +0,0 @@ -syntax = "proto3"; -package cosmos.capability.v1beta1; - -import "gogoproto/gogo.proto"; -import "cosmos/capability/v1beta1/capability.proto"; -import "amino/amino.proto"; - -option go_package = "github.com/cosmos/cosmos-sdk/x/capability/types"; - -// GenesisOwners defines the capability owners with their corresponding index. -message GenesisOwners { - // index is the index of the capability owner. - uint64 index = 1; - - // index_owners are the owners at the given index. - CapabilityOwners index_owners = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; -} - -// GenesisState defines the capability module's genesis state. -message GenesisState { - // index is the capability global index. - uint64 index = 1; - - // owners represents a map from index to owners of the capability index - // index key is string to allow amino marshalling. - repeated GenesisOwners owners = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; -} diff --git a/server/util.go b/server/util.go index f15c62fb8eed..b2e47bd05a36 100644 --- a/server/util.go +++ b/server/util.go @@ -10,7 +10,6 @@ import ( "os/signal" "path" "path/filepath" - "strconv" "strings" "syscall" "time" @@ -51,20 +50,11 @@ type Context struct { Logger log.Logger } -// ErrorCode contains the exit code for server exit. -type ErrorCode struct { - Code int -} - -func (e ErrorCode) Error() string { - return strconv.Itoa(e.Code) -} - func NewDefaultContext() *Context { return NewContext( viper.New(), cmtcfg.DefaultConfig(), - log.NewLogger(os.Stdout), // TODO(mr): update NewDefaultContext to accept log destination. + log.NewLogger(os.Stdout), ) } @@ -106,7 +96,26 @@ func bindFlags(basename string, cmd *cobra.Command, v *viper.Viper) (err error) return err } -// InterceptConfigsPreRunHandler performs a pre-run function for the root daemon +// InterceptConfigsPreRunHandler is identical to InterceptConfigsAndCreateContext +// except it also sets the server context on the command and the server logger. +func InterceptConfigsPreRunHandler(cmd *cobra.Command, customAppConfigTemplate string, customAppConfig interface{}, cmtConfig *cmtcfg.Config) error { + serverCtx, err := InterceptConfigsAndCreateContext(cmd, customAppConfigTemplate, customAppConfig, cmtConfig) + if err != nil { + return err + } + + // overwrite default server logger + logger, err := CreateSDKLogger(serverCtx, cmd.OutOrStdout()) + if err != nil { + return err + } + serverCtx.Logger = logger.With(log.ModuleKey, "server") + + // set server context + return SetCmdServerContext(cmd, serverCtx) +} + +// InterceptConfigsAndCreateContext performs a pre-run function for the root daemon // application command. It will create a Viper literal and a default server // Context. The server CometBFT configuration will either be read and parsed // or created and saved to disk, where the server Context is updated to reflect @@ -116,7 +125,7 @@ func bindFlags(basename string, cmd *cobra.Command, v *viper.Viper) (err error) // is used to read and parse the application configuration. Command handlers can // fetch the server Context to get the CometBFT configuration or to get access // to Viper. -func InterceptConfigsPreRunHandler(cmd *cobra.Command, customAppConfigTemplate string, customAppConfig interface{}, cmtConfig *cmtcfg.Config) error { +func InterceptConfigsAndCreateContext(cmd *cobra.Command, customAppConfigTemplate string, customAppConfig interface{}, cmtConfig *cmtcfg.Config) (*Context, error) { serverCtx := NewDefaultContext() // Get the executable name and configure the viper instance so that environmental @@ -124,17 +133,17 @@ func InterceptConfigsPreRunHandler(cmd *cobra.Command, customAppConfigTemplate s // as a separator. executableName, err := os.Executable() if err != nil { - return err + return nil, err } basename := path.Base(executableName) // configure the viper instance if err := serverCtx.Viper.BindPFlags(cmd.Flags()); err != nil { - return err + return nil, err } if err := serverCtx.Viper.BindPFlags(cmd.PersistentFlags()); err != nil { - return err + return nil, err } serverCtx.Viper.SetEnvPrefix(basename) @@ -144,31 +153,37 @@ func InterceptConfigsPreRunHandler(cmd *cobra.Command, customAppConfigTemplate s // intercept configuration files, using both Viper instances separately config, err := interceptConfigs(serverCtx.Viper, customAppConfigTemplate, customAppConfig, cmtConfig) if err != nil { - return err + return nil, err } // return value is a CometBFT configuration object serverCtx.Config = config if err = bindFlags(basename, cmd, serverCtx.Viper); err != nil { - return err + return nil, err } + return serverCtx, nil +} + +// CreateSDKLogger creates a the default SDK logger. +// It reads the log level and format from the server context. +func CreateSDKLogger(ctx *Context, out io.Writer) (log.Logger, error) { var logger log.Logger - if serverCtx.Viper.GetString(flags.FlagLogFormat) == cmtcfg.LogFormatJSON { - zl := zerolog.New(cmd.OutOrStdout()).With().Timestamp().Logger() + if ctx.Viper.GetString(flags.FlagLogFormat) == cmtcfg.LogFormatJSON { + zl := zerolog.New(out).With().Timestamp().Logger() logger = log.NewCustomLogger(zl) } else { - logger = log.NewLogger(cmd.OutOrStdout()) + logger = log.NewLogger(out) } // set filter level or keys for the logger if any - logLvlStr := serverCtx.Viper.GetString(flags.FlagLogLevel) + logLvlStr := ctx.Viper.GetString(flags.FlagLogLevel) logLvl, err := zerolog.ParseLevel(logLvlStr) if err != nil { // If the log level is not a valid zerolog level, then we try to parse it as a key filter. filterFunc, err := log.ParseLogLevel(logLvlStr, zerolog.InfoLevel.String()) if err != nil { - return fmt.Errorf("failed to parse log level (%s): %w", logLvlStr, err) + return nil, fmt.Errorf("failed to parse log level (%s): %w", logLvlStr, err) } logger = log.FilterKeys(logger, filterFunc) @@ -176,16 +191,14 @@ func InterceptConfigsPreRunHandler(cmd *cobra.Command, customAppConfigTemplate s zl := logger.Impl().(*zerolog.Logger) // Check if the CometBFT flag for trace logging is set if it is then setup a tracing logger in this app as well. // Note it overrides log level passed in `log_levels`. - if serverCtx.Viper.GetBool(cmtcli.TraceFlag) { + if ctx.Viper.GetBool(cmtcli.TraceFlag) { logger = log.NewCustomLogger(zl.Level(zerolog.TraceLevel)) } else { logger = log.NewCustomLogger(zl.Level(logLvl)) } } - serverCtx.Logger = logger.With("module", "server") - - return SetCmdServerContext(cmd, serverCtx) + return logger, nil } // GetServerContextFromCmd returns a Context from a command or an empty Context diff --git a/server/util_test.go b/server/util_test.go index d60446f6b386..ce5dfd521a80 100644 --- a/server/util_test.go +++ b/server/util_test.go @@ -30,8 +30,7 @@ var errCanceledInPreRun = errors.New("canceled in prerun") // Used in each test to run the function under test via Cobra // but to always halt the command func preRunETestImpl(cmd *cobra.Command, args []string) error { - err := server.InterceptConfigsPreRunHandler(cmd, "", nil, cmtcfg.DefaultConfig()) - if err != nil { + if err := server.InterceptConfigsPreRunHandler(cmd, "", nil, cmtcfg.DefaultConfig()); err != nil { return err } @@ -435,7 +434,12 @@ func TestEmptyMinGasPrices(t *testing.T) { // Run StartCmd. cmd = server.StartCmd(nil, tempDir) cmd.PreRunE = func(cmd *cobra.Command, _ []string) error { - return server.InterceptConfigsPreRunHandler(cmd, "", nil, cmtcfg.DefaultConfig()) + ctx, err := server.InterceptConfigsAndCreateContext(cmd, "", nil, cmtcfg.DefaultConfig()) + if err != nil { + return err + } + + return server.SetCmdServerContext(cmd, ctx) } err = cmd.ExecuteContext(ctx) require.Errorf(t, err, sdkerrors.ErrAppConfig.Error()) diff --git a/simapp/app.go b/simapp/app.go index d28a40c9f484..6dbdc5f8969e 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -66,9 +66,6 @@ import ( "github.com/cosmos/cosmos-sdk/x/bank" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/cosmos/cosmos-sdk/x/capability" - capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" consensus "github.com/cosmos/cosmos-sdk/x/consensus" consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types" @@ -117,7 +114,6 @@ var ( auth.AppModuleBasic{}, genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator), bank.AppModuleBasic{}, - capability.AppModuleBasic{}, staking.AppModuleBasic{}, mint.AppModuleBasic{}, distr.AppModuleBasic{}, @@ -174,7 +170,6 @@ type SimApp struct { // keepers AccountKeeper authkeeper.AccountKeeper BankKeeper bankkeeper.Keeper - CapabilityKeeper *capabilitykeeper.Keeper StakingKeeper *stakingkeeper.Keeper SlashingKeeper slashingkeeper.Keeper MintKeeper mintkeeper.Keeper @@ -261,14 +256,13 @@ func NewSimApp( authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, crisistypes.StoreKey, minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, govtypes.StoreKey, paramstypes.StoreKey, consensusparamtypes.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey, - evidencetypes.StoreKey, capabilitytypes.StoreKey, - authzkeeper.StoreKey, nftkeeper.StoreKey, group.StoreKey, + evidencetypes.StoreKey, authzkeeper.StoreKey, nftkeeper.StoreKey, group.StoreKey, ) tkeys := storetypes.NewTransientStoreKeys(paramstypes.TStoreKey) // NOTE: The testingkey is just mounted for testing purposes. Actual applications should // not include this key. - memKeys := storetypes.NewMemoryStoreKeys(capabilitytypes.MemStoreKey, "testingkey") + memKeys := storetypes.NewMemoryStoreKeys("testingkey") // register the streaming service with the BaseApp if err := bApp.SetStreamingService(appOpts, appCodec, keys); err != nil { @@ -292,11 +286,6 @@ func NewSimApp( app.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper(appCodec, keys[consensusparamtypes.StoreKey], authtypes.NewModuleAddress(govtypes.ModuleName).String()) bApp.SetParamStore(&app.ConsensusParamsKeeper) - app.CapabilityKeeper = capabilitykeeper.NewKeeper(appCodec, keys[capabilitytypes.StoreKey], memKeys[capabilitytypes.MemStoreKey]) - // Applications that wish to enforce statically created ScopedKeepers should call `Seal` after creating - // their scoped modules in `NewApp` with `ScopeToModule` - app.CapabilityKeeper.Seal() - // add keepers app.AccountKeeper = authkeeper.NewAccountKeeper(appCodec, keys[authtypes.StoreKey], authtypes.ProtoBaseAccount, maccPerms, sdk.Bech32MainPrefix, authtypes.NewModuleAddress(govtypes.ModuleName).String()) @@ -400,7 +389,6 @@ func NewSimApp( auth.NewAppModule(appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)), vesting.NewAppModule(app.AccountKeeper, app.BankKeeper), bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper, app.GetSubspace(banktypes.ModuleName)), - capability.NewAppModule(appCodec, *app.CapabilityKeeper, false), crisis.NewAppModule(app.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)), feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), gov.NewAppModule(appCodec, &app.GovKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(govtypes.ModuleName)), @@ -421,10 +409,8 @@ func NewSimApp( // there is nothing left over in the validator fee pool, so as to keep the // CanWithdrawInvariant invariant. // NOTE: staking module is required if HistoricalEntries param > 0 - // NOTE: capability module's beginblocker must come before any modules using capabilities (e.g. IBC) app.ModuleManager.SetOrderBeginBlockers( upgradetypes.ModuleName, - capabilitytypes.ModuleName, minttypes.ModuleName, distrtypes.ModuleName, slashingtypes.ModuleName, @@ -445,11 +431,7 @@ func NewSimApp( // NOTE: The genutils module must occur after staking so that pools are // properly initialized with tokens from genesis accounts. // NOTE: The genutils module must also occur after auth so that it can access the params from auth. - // NOTE: Capability module must occur first so that it can initialize any capabilities - // so that other modules that want to create or claim capabilities afterwards in InitChain - // can do so safely. - genesisModuleOrder := []string{ - capabilitytypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, + genesisModuleOrder := []string{authtypes.ModuleName, banktypes.ModuleName, distrtypes.ModuleName, stakingtypes.ModuleName, slashingtypes.ModuleName, govtypes.ModuleName, minttypes.ModuleName, crisistypes.ModuleName, genutiltypes.ModuleName, evidencetypes.ModuleName, authz.ModuleName, feegrant.ModuleName, nft.ModuleName, group.ModuleName, paramstypes.ModuleName, upgradetypes.ModuleName, diff --git a/simapp/app_config.go b/simapp/app_config.go index b6c88458e766..cbf3c291b733 100644 --- a/simapp/app_config.go +++ b/simapp/app_config.go @@ -8,7 +8,6 @@ import ( authmodulev1 "cosmossdk.io/api/cosmos/auth/module/v1" authzmodulev1 "cosmossdk.io/api/cosmos/authz/module/v1" bankmodulev1 "cosmossdk.io/api/cosmos/bank/module/v1" - capabilitymodulev1 "cosmossdk.io/api/cosmos/capability/module/v1" consensusmodulev1 "cosmossdk.io/api/cosmos/consensus/module/v1" crisismodulev1 "cosmossdk.io/api/cosmos/crisis/module/v1" distrmodulev1 "cosmossdk.io/api/cosmos/distribution/module/v1" @@ -38,7 +37,6 @@ import ( vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" "github.com/cosmos/cosmos-sdk/x/authz" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" consensustypes "github.com/cosmos/cosmos-sdk/x/consensus/types" crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" @@ -86,10 +84,8 @@ var ( // there is nothing left over in the validator fee pool, so as to keep the // CanWithdrawInvariant invariant. // NOTE: staking module is required if HistoricalEntries param > 0 - // NOTE: capability module's beginblocker must come before any modules using capabilities (e.g. IBC) BeginBlockers: []string{ upgradetypes.ModuleName, - capabilitytypes.ModuleName, minttypes.ModuleName, distrtypes.ModuleName, slashingtypes.ModuleName, @@ -115,11 +111,7 @@ var ( // NOTE: The genutils module must occur after staking so that pools are // properly initialized with tokens from genesis accounts. // NOTE: The genutils module must also occur after auth so that it can access the params from auth. - // NOTE: Capability module must occur first so that it can initialize any capabilities - // so that other modules that want to create or claim capabilities afterwards in InitChain - // can do so safely. InitGenesis: []string{ - capabilitytypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, distrtypes.ModuleName, @@ -198,12 +190,6 @@ var ( Name: distrtypes.ModuleName, Config: appconfig.WrapAny(&distrmodulev1.Module{}), }, - { - Name: capabilitytypes.ModuleName, - Config: appconfig.WrapAny(&capabilitymodulev1.Module{ - SealKeeper: true, - }), - }, { Name: evidencetypes.ModuleName, Config: appconfig.WrapAny(&evidencemodulev1.Module{}), diff --git a/simapp/app_test.go b/simapp/app_test.go index a29c38c81cbd..0b251a46af86 100644 --- a/simapp/app_test.go +++ b/simapp/app_test.go @@ -27,7 +27,6 @@ import ( authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module" "github.com/cosmos/cosmos-sdk/x/bank" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/cosmos/cosmos-sdk/x/capability" "github.com/cosmos/cosmos-sdk/x/crisis" "github.com/cosmos/cosmos-sdk/x/distribution" "github.com/cosmos/cosmos-sdk/x/genutil" @@ -199,7 +198,6 @@ func TestRunMigrations(t *testing.T) { "evidence": evidence.AppModule{}.ConsensusVersion(), "crisis": crisis.AppModule{}.ConsensusVersion(), "genutil": genutil.AppModule{}.ConsensusVersion(), - "capability": capability.AppModule{}.ConsensusVersion(), }, ) if tc.expRunErr { @@ -249,7 +247,6 @@ func TestInitGenesisOnMigration(t *testing.T) { "evidence": evidence.AppModule{}.ConsensusVersion(), "crisis": crisis.AppModule{}.ConsensusVersion(), "genutil": genutil.AppModule{}.ConsensusVersion(), - "capability": capability.AppModule{}.ConsensusVersion(), }, ) require.NoError(t, err) diff --git a/simapp/app_v2.go b/simapp/app_v2.go index 6f92be3fe0b8..1ca91b7d03ad 100644 --- a/simapp/app_v2.go +++ b/simapp/app_v2.go @@ -46,8 +46,6 @@ import ( authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module" "github.com/cosmos/cosmos-sdk/x/bank" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" - "github.com/cosmos/cosmos-sdk/x/capability" - capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" consensus "github.com/cosmos/cosmos-sdk/x/consensus" consensuskeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" "github.com/cosmos/cosmos-sdk/x/crisis" @@ -84,7 +82,6 @@ var ( auth.AppModuleBasic{}, genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator), bank.AppModuleBasic{}, - capability.AppModuleBasic{}, staking.AppModuleBasic{}, mint.AppModuleBasic{}, distr.AppModuleBasic{}, @@ -126,7 +123,6 @@ type SimApp struct { // keepers AccountKeeper authkeeper.AccountKeeper BankKeeper bankkeeper.Keeper - CapabilityKeeper *capabilitykeeper.Keeper StakingKeeper *stakingkeeper.Keeper SlashingKeeper slashingkeeper.Keeper MintKeeper mintkeeper.Keeper @@ -210,7 +206,6 @@ func NewSimApp( &app.autoCliOpts, &app.AccountKeeper, &app.BankKeeper, - &app.CapabilityKeeper, &app.StakingKeeper, &app.SlashingKeeper, &app.MintKeeper, diff --git a/simapp/go.mod b/simapp/go.mod index 73b5412d7b7c..f4837898c07b 100644 --- a/simapp/go.mod +++ b/simapp/go.mod @@ -4,12 +4,12 @@ go 1.20 require ( cosmossdk.io/api v0.3.1 - cosmossdk.io/client/v2 v2.0.0-20230220152935-67f04e629623 - cosmossdk.io/core v0.6.0 + cosmossdk.io/client/v2 v2.0.0-20230309163709-87da587416ba + cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba cosmossdk.io/depinject v1.0.0-alpha.3 cosmossdk.io/log v0.0.0-20230306220716-5e55f56d39d5 cosmossdk.io/math v1.0.0-beta.6.0.20230216172121-959ce49135e4 - cosmossdk.io/store v0.0.0-20230227103508-bbe7f8a11b44 + cosmossdk.io/store v0.0.0-20230309163709-87da587416ba cosmossdk.io/tools/confix v0.0.0-20230120150717-4f6f6c00021f cosmossdk.io/tools/rosetta v0.2.0 cosmossdk.io/x/evidence v0.1.0 @@ -36,9 +36,9 @@ require ( cloud.google.com/go/compute/metadata v0.2.3 // indirect cloud.google.com/go/iam v0.11.0 // indirect cloud.google.com/go/storage v1.29.0 // indirect - cosmossdk.io/collections v0.0.0-20230306161821-d6240a43e6e8 // indirect + cosmossdk.io/collections v0.0.0-20230309163709-87da587416ba // indirect cosmossdk.io/errors v1.0.0-beta.7 // indirect - cosmossdk.io/x/tx v0.2.2 // indirect + cosmossdk.io/x/tx v0.2.3-0.20230309163709-87da587416ba // indirect filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect @@ -189,13 +189,11 @@ require ( // Replace here are pending PRs, or version to be tagged replace ( // TODO tag all extracted modules after SDK refactor - cosmossdk.io/core => ../core cosmossdk.io/tools/confix => ../tools/confix cosmossdk.io/tools/rosetta => ../tools/rosetta cosmossdk.io/x/evidence => ../x/evidence cosmossdk.io/x/feegrant => ../x/feegrant cosmossdk.io/x/nft => ../x/nft - cosmossdk.io/x/tx => ../x/tx cosmossdk.io/x/upgrade => ../x/upgrade ) diff --git a/simapp/go.sum b/simapp/go.sum index 0f10988510ee..f6a637dad438 100644 --- a/simapp/go.sum +++ b/simapp/go.sum @@ -190,10 +190,12 @@ cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1V cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= cosmossdk.io/api v0.3.1 h1:NNiOclKRR0AOlO4KIqeaG6PS6kswOMhHD0ir0SscNXE= cosmossdk.io/api v0.3.1/go.mod h1:DfHfMkiNA2Uhy8fj0JJlOCYOBp4eWUUJ1te5zBGNyIw= -cosmossdk.io/client/v2 v2.0.0-20230220152935-67f04e629623 h1:QzZA1P+twvj10ylCVXzHodLge+RvrwoNIlWpU+MrRa0= -cosmossdk.io/client/v2 v2.0.0-20230220152935-67f04e629623/go.mod h1:Yo6R3XSXKxi+G642kK7+ZOh2czNTwTO1b8ywOvwaFQo= -cosmossdk.io/collections v0.0.0-20230306161821-d6240a43e6e8 h1:TmhLZxHM/TlyiF1bS7ObHBzMdXW0nEJC3i+nQ/nt4Zs= -cosmossdk.io/collections v0.0.0-20230306161821-d6240a43e6e8/go.mod h1:RoEzMOLLsorYvlNTm1wzYzlI5yQ0QSWeJqkMdfDVgHE= +cosmossdk.io/client/v2 v2.0.0-20230309163709-87da587416ba h1:LuPHCncU2KLMNPItFECs709uo46I9wSu2fAWYVCx+/U= +cosmossdk.io/client/v2 v2.0.0-20230309163709-87da587416ba/go.mod h1:SXdwqO7cN5htalh/lhXWP8V4zKtBrhhcSTU+ytuEtmM= +cosmossdk.io/collections v0.0.0-20230309163709-87da587416ba h1:S4PYij/tX3Op/hwenVEN9D+M27JRcwSwVqE3UA0BnwM= +cosmossdk.io/collections v0.0.0-20230309163709-87da587416ba/go.mod h1:lpS+G8bGC2anqzWdndTzjnQnuMO/qAcgZUkGJp4i3rc= +cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba h1:kSnaDzbwMInpQYwz8ESgvi6ceUQWcXAJdEVZW454dX0= +cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba/go.mod h1:WiFk9ZQbFVBHk9AqQIkLFqyj30NPQB6C45CIeAZxDcw= cosmossdk.io/depinject v1.0.0-alpha.3 h1:6evFIgj//Y3w09bqOUOzEpFj5tsxBqdc5CfkO7z+zfw= cosmossdk.io/depinject v1.0.0-alpha.3/go.mod h1:eRbcdQ7MRpIPEM5YUJh8k97nxHpYbc3sMUnEtt8HPWU= cosmossdk.io/errors v1.0.0-beta.7 h1:gypHW76pTQGVnHKo6QBkb4yFOJjC+sUGRc5Al3Odj1w= @@ -202,8 +204,10 @@ cosmossdk.io/log v0.0.0-20230306220716-5e55f56d39d5 h1:r2R2nHYi6BIE0C5ZV4b/r3Rho cosmossdk.io/log v0.0.0-20230306220716-5e55f56d39d5/go.mod h1:ilL9YXutMQo36MS9CD1cFNUqqHadAtyf8+A2b2EqO5A= cosmossdk.io/math v1.0.0-beta.6.0.20230216172121-959ce49135e4 h1:/jnzJ9zFsL7qkV8LCQ1JH3dYHh2EsKZ3k8Mr6AqqiOA= cosmossdk.io/math v1.0.0-beta.6.0.20230216172121-959ce49135e4/go.mod h1:gUVtWwIzfSXqcOT+lBVz2jyjfua8DoBdzRsIyaUAT/8= -cosmossdk.io/store v0.0.0-20230227103508-bbe7f8a11b44 h1:/pKsj/ApzO4+zMwpgLiPG5iakoHxziGpMiJcz4S+r4w= -cosmossdk.io/store v0.0.0-20230227103508-bbe7f8a11b44/go.mod h1:flrxUykloEW1asE9p+Q+d8LSuNI3fBRdzISg9HTpYlQ= +cosmossdk.io/store v0.0.0-20230309163709-87da587416ba h1:63dnRBywQLvo/Ke0zljksFlWg5tAMTwOiuv6yZ3X0sM= +cosmossdk.io/store v0.0.0-20230309163709-87da587416ba/go.mod h1:sf0uPZvsgXqXy2ydRXJmsM+sNHSZLZN6xZZkh7c3+t0= +cosmossdk.io/x/tx v0.2.3-0.20230309163709-87da587416ba h1:NmWXkl0voj3dN96Qmk4rfrze6dLLLxB4qTCxXZTXBpM= +cosmossdk.io/x/tx v0.2.3-0.20230309163709-87da587416ba/go.mod h1:dhIxZhZF2glIA9hkkildy/JmSqVH3FIU/OhSU8is7PM= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek= filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= diff --git a/simapp/sim_test.go b/simapp/sim_test.go index 0cd6cdc26ca5..9411b2c0192a 100644 --- a/simapp/sim_test.go +++ b/simapp/sim_test.go @@ -27,7 +27,6 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" @@ -209,7 +208,6 @@ func TestAppImportExport(t *testing.T) { {app.GetKey(paramtypes.StoreKey), newApp.GetKey(paramtypes.StoreKey), [][]byte{}}, {app.GetKey(govtypes.StoreKey), newApp.GetKey(govtypes.StoreKey), [][]byte{}}, {app.GetKey(evidencetypes.StoreKey), newApp.GetKey(evidencetypes.StoreKey), [][]byte{}}, - {app.GetKey(capabilitytypes.StoreKey), newApp.GetKey(capabilitytypes.StoreKey), [][]byte{}}, {app.GetKey(authzkeeper.StoreKey), newApp.GetKey(authzkeeper.StoreKey), [][]byte{authzkeeper.GrantKey, authzkeeper.GrantQueuePrefix}}, } diff --git a/simapp/simd/main.go b/simapp/simd/main.go index e23ac2c75e00..4913650885c5 100644 --- a/simapp/simd/main.go +++ b/simapp/simd/main.go @@ -1,23 +1,14 @@ package main import ( - "os" - "cosmossdk.io/simapp" "cosmossdk.io/simapp/simd/cmd" - "github.com/cosmos/cosmos-sdk/server" svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" ) func main() { rootCmd := cmd.NewRootCmd() if err := svrcmd.Execute(rootCmd, "", simapp.DefaultNodeHome); err != nil { - switch e := err.(type) { - case server.ErrorCode: - os.Exit(e.Code) - - default: - os.Exit(1) - } + panic(err) } } diff --git a/tests/fixtures/adr-024-coin-metadata_genesis.json b/tests/fixtures/adr-024-coin-metadata_genesis.json index ecedfd67cb7c..ac0fac7dacdc 100644 --- a/tests/fixtures/adr-024-coin-metadata_genesis.json +++ b/tests/fixtures/adr-024-coin-metadata_genesis.json @@ -85,10 +85,6 @@ "genutil": { "gentxs": [] }, - "capability": { - "index": "1", - "owners": [] - }, "mint": { "minter": { "inflation": "0.130000000000000000", diff --git a/tests/go.mod b/tests/go.mod index b28883a42b28..a0b1943ef7c5 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -8,12 +8,12 @@ require ( cosmossdk.io/errors v1.0.0-beta.7 cosmossdk.io/log v0.0.0-20230306220716-5e55f56d39d5 cosmossdk.io/math v1.0.0-beta.6.0.20230216172121-959ce49135e4 - cosmossdk.io/simapp v0.0.0-00010101000000-000000000000 - cosmossdk.io/store v0.0.0-20230227103508-bbe7f8a11b44 + cosmossdk.io/simapp v0.0.0-20230309163709-87da587416ba + cosmossdk.io/store v0.0.0-20230309163709-87da587416ba cosmossdk.io/x/evidence v0.1.0 cosmossdk.io/x/feegrant v0.0.0-20230117113717-50e7c4a4ceff cosmossdk.io/x/nft v0.0.0-20230113085233-fae3332d62fc - cosmossdk.io/x/tx v0.2.2 + cosmossdk.io/x/tx v0.2.3-0.20230309163709-87da587416ba cosmossdk.io/x/upgrade v0.0.0-20230127052425-54c8e1568335 github.com/cometbft/cometbft v0.37.0 github.com/cosmos/cosmos-db v1.0.0-rc.1 @@ -36,9 +36,9 @@ require ( cloud.google.com/go/compute/metadata v0.2.3 // indirect cloud.google.com/go/iam v0.11.0 // indirect cloud.google.com/go/storage v1.29.0 // indirect - cosmossdk.io/client/v2 v2.0.0-20230220152935-67f04e629623 // indirect - cosmossdk.io/collections v0.0.0-20230306161821-d6240a43e6e8 // indirect - cosmossdk.io/core v0.6.0 // indirect + cosmossdk.io/client/v2 v2.0.0-20230309163709-87da587416ba // indirect + cosmossdk.io/collections v0.0.0-20230309163709-87da587416ba // indirect + cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba // indirect filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect @@ -185,13 +185,10 @@ require ( // Replace here are pending PRs, or version to be tagged. // It must be in sync with SimApp temporary replaces replace ( - cosmossdk.io/client/v2 => ../client/v2 // TODO tag all extracted modules after SDK refactor - cosmossdk.io/core => ../core cosmossdk.io/x/evidence => ../x/evidence cosmossdk.io/x/feegrant => ../x/feegrant cosmossdk.io/x/nft => ../x/nft - cosmossdk.io/x/tx => ../x/tx cosmossdk.io/x/upgrade => ../x/upgrade ) diff --git a/tests/go.sum b/tests/go.sum index ff6e8bda00c9..ec377b1f17ea 100644 --- a/tests/go.sum +++ b/tests/go.sum @@ -190,8 +190,12 @@ cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1V cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= cosmossdk.io/api v0.3.1 h1:NNiOclKRR0AOlO4KIqeaG6PS6kswOMhHD0ir0SscNXE= cosmossdk.io/api v0.3.1/go.mod h1:DfHfMkiNA2Uhy8fj0JJlOCYOBp4eWUUJ1te5zBGNyIw= -cosmossdk.io/collections v0.0.0-20230306161821-d6240a43e6e8 h1:TmhLZxHM/TlyiF1bS7ObHBzMdXW0nEJC3i+nQ/nt4Zs= -cosmossdk.io/collections v0.0.0-20230306161821-d6240a43e6e8/go.mod h1:RoEzMOLLsorYvlNTm1wzYzlI5yQ0QSWeJqkMdfDVgHE= +cosmossdk.io/client/v2 v2.0.0-20230309163709-87da587416ba h1:LuPHCncU2KLMNPItFECs709uo46I9wSu2fAWYVCx+/U= +cosmossdk.io/client/v2 v2.0.0-20230309163709-87da587416ba/go.mod h1:SXdwqO7cN5htalh/lhXWP8V4zKtBrhhcSTU+ytuEtmM= +cosmossdk.io/collections v0.0.0-20230309163709-87da587416ba h1:S4PYij/tX3Op/hwenVEN9D+M27JRcwSwVqE3UA0BnwM= +cosmossdk.io/collections v0.0.0-20230309163709-87da587416ba/go.mod h1:lpS+G8bGC2anqzWdndTzjnQnuMO/qAcgZUkGJp4i3rc= +cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba h1:kSnaDzbwMInpQYwz8ESgvi6ceUQWcXAJdEVZW454dX0= +cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba/go.mod h1:WiFk9ZQbFVBHk9AqQIkLFqyj30NPQB6C45CIeAZxDcw= cosmossdk.io/depinject v1.0.0-alpha.3 h1:6evFIgj//Y3w09bqOUOzEpFj5tsxBqdc5CfkO7z+zfw= cosmossdk.io/depinject v1.0.0-alpha.3/go.mod h1:eRbcdQ7MRpIPEM5YUJh8k97nxHpYbc3sMUnEtt8HPWU= cosmossdk.io/errors v1.0.0-beta.7 h1:gypHW76pTQGVnHKo6QBkb4yFOJjC+sUGRc5Al3Odj1w= @@ -200,8 +204,10 @@ cosmossdk.io/log v0.0.0-20230306220716-5e55f56d39d5 h1:r2R2nHYi6BIE0C5ZV4b/r3Rho cosmossdk.io/log v0.0.0-20230306220716-5e55f56d39d5/go.mod h1:ilL9YXutMQo36MS9CD1cFNUqqHadAtyf8+A2b2EqO5A= cosmossdk.io/math v1.0.0-beta.6.0.20230216172121-959ce49135e4 h1:/jnzJ9zFsL7qkV8LCQ1JH3dYHh2EsKZ3k8Mr6AqqiOA= cosmossdk.io/math v1.0.0-beta.6.0.20230216172121-959ce49135e4/go.mod h1:gUVtWwIzfSXqcOT+lBVz2jyjfua8DoBdzRsIyaUAT/8= -cosmossdk.io/store v0.0.0-20230227103508-bbe7f8a11b44 h1:/pKsj/ApzO4+zMwpgLiPG5iakoHxziGpMiJcz4S+r4w= -cosmossdk.io/store v0.0.0-20230227103508-bbe7f8a11b44/go.mod h1:flrxUykloEW1asE9p+Q+d8LSuNI3fBRdzISg9HTpYlQ= +cosmossdk.io/store v0.0.0-20230309163709-87da587416ba h1:63dnRBywQLvo/Ke0zljksFlWg5tAMTwOiuv6yZ3X0sM= +cosmossdk.io/store v0.0.0-20230309163709-87da587416ba/go.mod h1:sf0uPZvsgXqXy2ydRXJmsM+sNHSZLZN6xZZkh7c3+t0= +cosmossdk.io/x/tx v0.2.3-0.20230309163709-87da587416ba h1:NmWXkl0voj3dN96Qmk4rfrze6dLLLxB4qTCxXZTXBpM= +cosmossdk.io/x/tx v0.2.3-0.20230309163709-87da587416ba/go.mod h1:dhIxZhZF2glIA9hkkildy/JmSqVH3FIU/OhSU8is7PM= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek= filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= diff --git a/testutil/configurator/configurator.go b/testutil/configurator/configurator.go index 90b04e7c16a3..174097ba46ef 100644 --- a/testutil/configurator/configurator.go +++ b/testutil/configurator/configurator.go @@ -22,7 +22,6 @@ import ( var beginBlockOrder = []string{ "upgrade", - "capability", "mint", "distribution", "slashing", @@ -46,7 +45,6 @@ var endBlockersOrder = []string{ "crisis", "gov", "staking", - "capability", "auth", "bank", "distribution", @@ -65,7 +63,6 @@ var endBlockersOrder = []string{ } var initGenesisOrder = []string{ - "capability", "auth", "bank", "distribution", diff --git a/tools/confix/go.mod b/tools/confix/go.mod index 869c2c97de09..c26ca9b76e3c 100644 --- a/tools/confix/go.mod +++ b/tools/confix/go.mod @@ -15,13 +15,13 @@ require ( require ( cosmossdk.io/api v0.3.1 // indirect cosmossdk.io/collections v0.0.0-20230214153846-b6c6e4e99177 // indirect - cosmossdk.io/core v0.6.0 // indirect + cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba // indirect cosmossdk.io/depinject v1.0.0-alpha.3 // indirect cosmossdk.io/errors v1.0.0-beta.7 // indirect cosmossdk.io/log v0.0.0-20230306220716-5e55f56d39d5 // indirect cosmossdk.io/math v1.0.0-beta.6.0.20230216172121-959ce49135e4 // indirect cosmossdk.io/store v0.0.0-20230227103508-bbe7f8a11b44 // indirect - cosmossdk.io/x/tx v0.2.2 // indirect + cosmossdk.io/x/tx v0.2.3-0.20230309163709-87da587416ba // indirect filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect @@ -43,7 +43,7 @@ require ( github.com/confio/ics23/go v0.9.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect github.com/cosmos/cosmos-db v1.0.0-rc.1 // indirect - github.com/cosmos/cosmos-proto v1.0.0-beta.2 // indirect + github.com/cosmos/cosmos-proto v1.0.0-beta.3 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/gogoproto v1.4.6 // indirect diff --git a/tools/confix/go.sum b/tools/confix/go.sum index e3fb880ae889..085d2e0d2932 100644 --- a/tools/confix/go.sum +++ b/tools/confix/go.sum @@ -39,8 +39,8 @@ cosmossdk.io/api v0.3.1 h1:NNiOclKRR0AOlO4KIqeaG6PS6kswOMhHD0ir0SscNXE= cosmossdk.io/api v0.3.1/go.mod h1:DfHfMkiNA2Uhy8fj0JJlOCYOBp4eWUUJ1te5zBGNyIw= cosmossdk.io/collections v0.0.0-20230214153846-b6c6e4e99177 h1:At2M0aYQKEAWqr6JtZrJPOlfhdvENiGwJg2NCNHwIdc= cosmossdk.io/collections v0.0.0-20230214153846-b6c6e4e99177/go.mod h1:uqCi8FG+Bh2vv/qf5xZ8iab0E0c/DMA/cwafbp8dkcU= -cosmossdk.io/core v0.6.0 h1:V2zyaMVFN6hJSVENYx2XE9CMhzqwJPMjzSQpj0MyXAU= -cosmossdk.io/core v0.6.0/go.mod h1:YSFzBcKOf/U24e/sa6WFaYSrlZl5zgNvnWwjfFyPniw= +cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba h1:kSnaDzbwMInpQYwz8ESgvi6ceUQWcXAJdEVZW454dX0= +cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba/go.mod h1:WiFk9ZQbFVBHk9AqQIkLFqyj30NPQB6C45CIeAZxDcw= cosmossdk.io/depinject v1.0.0-alpha.3 h1:6evFIgj//Y3w09bqOUOzEpFj5tsxBqdc5CfkO7z+zfw= cosmossdk.io/depinject v1.0.0-alpha.3/go.mod h1:eRbcdQ7MRpIPEM5YUJh8k97nxHpYbc3sMUnEtt8HPWU= cosmossdk.io/errors v1.0.0-beta.7 h1:gypHW76pTQGVnHKo6QBkb4yFOJjC+sUGRc5Al3Odj1w= @@ -51,8 +51,8 @@ cosmossdk.io/math v1.0.0-beta.6.0.20230216172121-959ce49135e4 h1:/jnzJ9zFsL7qkV8 cosmossdk.io/math v1.0.0-beta.6.0.20230216172121-959ce49135e4/go.mod h1:gUVtWwIzfSXqcOT+lBVz2jyjfua8DoBdzRsIyaUAT/8= cosmossdk.io/store v0.0.0-20230227103508-bbe7f8a11b44 h1:/pKsj/ApzO4+zMwpgLiPG5iakoHxziGpMiJcz4S+r4w= cosmossdk.io/store v0.0.0-20230227103508-bbe7f8a11b44/go.mod h1:flrxUykloEW1asE9p+Q+d8LSuNI3fBRdzISg9HTpYlQ= -cosmossdk.io/x/tx v0.2.2 h1:pD4TEbzOOerVQNI+M9anQIncl+4wFELpGds3N7RzPiQ= -cosmossdk.io/x/tx v0.2.2/go.mod h1:cur19OSg8P6ifrZ00yJOyY6HT75FEhLBX2Ir3Sl0ubY= +cosmossdk.io/x/tx v0.2.3-0.20230309163709-87da587416ba h1:NmWXkl0voj3dN96Qmk4rfrze6dLLLxB4qTCxXZTXBpM= +cosmossdk.io/x/tx v0.2.3-0.20230309163709-87da587416ba/go.mod h1:dhIxZhZF2glIA9hkkildy/JmSqVH3FIU/OhSU8is7PM= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek= filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= @@ -178,8 +178,8 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= github.com/cosmos/cosmos-db v1.0.0-rc.1 h1:SjnT8B6WKMW9WEIX32qMhnEEKcI7ZP0+G1Sa9HD3nmY= github.com/cosmos/cosmos-db v1.0.0-rc.1/go.mod h1:Dnmk3flSf5lkwCqvvjNpoxjpXzhxnCAFzKHlbaForso= -github.com/cosmos/cosmos-proto v1.0.0-beta.2 h1:X3OKvWgK9Gsejo0F1qs5l8Qn6xJV/AzgIWR2wZ8Nua8= -github.com/cosmos/cosmos-proto v1.0.0-beta.2/go.mod h1:+XRCLJ14pr5HFEHIUcn51IKXD1Fy3rkEQqt4WqmN4V0= +github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= +github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= github.com/cosmos/cosmos-sdk v0.46.0-beta2.0.20230306220716-5e55f56d39d5 h1:/6AWQpNJO7Kt8KcWlNOeR6RxHWz9jKE3xXaSJ1ijqDU= github.com/cosmos/cosmos-sdk v0.46.0-beta2.0.20230306220716-5e55f56d39d5/go.mod h1:yEwevSvOObLNzTLXERD1tdyoHoowNyeKB4GmPej6DO4= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= diff --git a/tools/cosmovisor/CHANGELOG.md b/tools/cosmovisor/CHANGELOG.md index 67bc51a14888..9b66d909a465 100644 --- a/tools/cosmovisor/CHANGELOG.md +++ b/tools/cosmovisor/CHANGELOG.md @@ -36,6 +36,10 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] +## Features + +* [#15361](https://github.com/cosmos/cosmos-sdk/pull/15361) Add `cosmovisor config` command to display the configuration used by cosmovisor. + ## Client Breaking Changes * [#14881](https://github.com/cosmos/cosmos-sdk/pull/14881) Cosmovisor supports only upgrade plan with a checksum. This is enforced by the `x/upgrade` module for better security. @@ -44,6 +48,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [#14881](https://github.com/cosmos/cosmos-sdk/pull/14881) Refactor Cosmovisor to use `x/upgrade` validation logic. * [#14881](https://github.com/cosmos/cosmos-sdk/pull/14881) Refactor Cosmovisor to depend only on the `x/upgrade` module. +* [#15362](https://github.com/cosmos/cosmos-sdk/pull/15362) Allow disabling Cosmovisor logs ## v1.4.0 2022-10-23 diff --git a/tools/cosmovisor/README.md b/tools/cosmovisor/README.md index 19f1706375be..f8d23b00a3a3 100644 --- a/tools/cosmovisor/README.md +++ b/tools/cosmovisor/README.md @@ -6,20 +6,21 @@ sidebar_position: 1 `cosmovisor` is a small process manager for Cosmos SDK application binaries that monitors the governance module for incoming chain upgrade proposals. If it sees a proposal that gets approved, `cosmovisor` can automatically download the new binary, stop the current binary, switch from the old binary to the new one, and finally restart the node with the new binary. -* [Design](#design) -* [Contributing](#contributing) -* [Setup](#setup) - * [Installation](#installation) - * [Command Line Arguments And Environment Variables](#command-line-arguments-and-environment-variables) - * [Folder Layout](#folder-layout) -* [Usage](#usage) - * [Initialization](#initialization) - * [Detecting Upgrades](#detecting-upgrades) - * [Auto-Download](#auto-download) -* [Example: SimApp Upgrade](#example-simapp-upgrade) - * [Chain Setup](#chain-setup) - * [Prepare Cosmovisor and Start the Chain](#prepare-cosmovisor-and-start-the-chain) - * [Update App](#update-app) +* [Cosmovisor](#cosmovisor) + * [Design](#design) + * [Contributing](#contributing) + * [Setup](#setup) + * [Installation](#installation) + * [Command Line Arguments And Environment Variables](#command-line-arguments-and-environment-variables) + * [Folder Layout](#folder-layout) + * [Usage](#usage) + * [Initialization](#initialization) + * [Detecting Upgrades](#detecting-upgrades) + * [Auto-Download](#auto-download) + * [Example: SimApp Upgrade](#example-simapp-upgrade) + * [Chain Setup](#chain-setup) + * [Prepare Cosmovisor and Start the Chain](#prepare-cosmovisor-and-start-the-chain) + * [Update App](#update-app) ## Design @@ -60,22 +61,11 @@ go install github.com/cosmos/cosmos-sdk/cosmovisor/cmd/cosmovisor@v0.1.0 Run `cosmovisor version` to check the cosmovisor version. -You can also install from source by pulling the cosmos-sdk repository and switching to the correct version and building as follows: +Alternatively, for building from source, simply run `make cosmovisor`. The binary will be located in `tools/cosmovisor`. -```shell -git clone git@github.com:cosmos/cosmos-sdk -cd cosmos-sdk -git checkout cosmovisor/vx.x.x -make cosmovisor -``` - -This will build cosmovisor in `/cosmovisor` directory. Afterwards you may want to put it into your machine's PATH like as follows: - -```shell -cp cosmovisor/cosmovisor ~/go/bin/cosmovisor -``` - -*Note: If you are using go `v1.15` or earlier, you will need to use `go get`, and you may want to run the command outside a project directory.* +:::warning +Building from source using `make cosmovisor` won't display the correct `cosmovisor` version. +::: ### Command Line Arguments And Environment Variables @@ -99,7 +89,8 @@ All arguments passed to `cosmovisor run` will be passed to the application binar * `DAEMON_POLL_INTERVAL` (*optional*, default 300 milliseconds), is the interval length for polling the upgrade plan file. The value must be a duration (e.g. `1s`). * `DAEMON_DATA_BACKUP_DIR` option to set a custom backup directory. If not set, `DAEMON_HOME` is used. * `UNSAFE_SKIP_BACKUP` (defaults to `false`), if set to `true`, upgrades directly without performing a backup. Otherwise (`false`, default) backs up the data before trying the upgrade. The default value of false is useful and recommended in case of failures and when a backup needed to rollback. We recommend using the default backup option `UNSAFE_SKIP_BACKUP=false`. -* `DAEMON_PREUPGRADE_MAX_RETRIES` (defaults to `0`). The maximum number of times to call `pre-upgrade` in the application after exit status of `31`. After the maximum number of retries, cosmovisor fails the upgrade. +* `DAEMON_PREUPGRADE_MAX_RETRIES` (defaults to `0`). The maximum number of times to call `pre-upgrade` in the application after exit status of `31`. After the maximum number of retries, Cosmovisor fails the upgrade. +* `COSMOVISOR_DISABLE_LOGS` (defaults to `false`). If set to true, this will disable Cosmovisor logs (but not the underlying process) completely. This may be useful, for example, when a Cosmovisor subcommand you are executing returns a valid JSON you are then parsing, as logs added by Cosmovisor make this output not a valid JSON. ### Folder Layout diff --git a/tools/cosmovisor/args.go b/tools/cosmovisor/args.go index 45358412b314..8c61c1f1c1fb 100644 --- a/tools/cosmovisor/args.go +++ b/tools/cosmovisor/args.go @@ -28,6 +28,7 @@ const ( EnvDataBackupPath = "DAEMON_DATA_BACKUP_DIR" EnvInterval = "DAEMON_POLL_INTERVAL" EnvPreupgradeMaxRetries = "DAEMON_PREUPGRADE_MAX_RETRIES" + EnvDisableLogs = "COSMOVISOR_DISABLE_LOGS" ) const ( @@ -51,6 +52,7 @@ type Config struct { UnsafeSkipBackup bool DataBackupPath string PreupgradeMaxRetries int + DisableLogs bool // currently running upgrade currentUpgrade upgradetypes.Plan @@ -158,6 +160,9 @@ func GetConfigFromEnv() (*Config, error) { if cfg.UnsafeSkipBackup, err = booleanOption(EnvSkipBackup, false); err != nil { errs = append(errs, err) } + if cfg.DisableLogs, err = booleanOption(EnvDisableLogs, false); err != nil { + errs = append(errs, err) + } interval := os.Getenv(EnvInterval) if interval != "" { @@ -369,6 +374,7 @@ func (cfg Config) DetailString() string { {EnvSkipBackup, fmt.Sprintf("%t", cfg.UnsafeSkipBackup)}, {EnvDataBackupPath, cfg.DataBackupPath}, {EnvPreupgradeMaxRetries, fmt.Sprintf("%d", cfg.PreupgradeMaxRetries)}, + {EnvDisableLogs, fmt.Sprintf("%t", cfg.DisableLogs)}, } derivedEntries := []struct{ name, value string }{ diff --git a/tools/cosmovisor/args_test.go b/tools/cosmovisor/args_test.go index ffb932294546..b84e537c69d8 100644 --- a/tools/cosmovisor/args_test.go +++ b/tools/cosmovisor/args_test.go @@ -38,6 +38,7 @@ type cosmovisorEnv struct { DataBackupPath string Interval string PreupgradeMaxRetries string + DisableLogs string } // ToMap creates a map of the cosmovisorEnv where the keys are the env var names. @@ -52,6 +53,7 @@ func (c cosmovisorEnv) ToMap() map[string]string { EnvDataBackupPath: c.DataBackupPath, EnvInterval: c.Interval, EnvPreupgradeMaxRetries: c.PreupgradeMaxRetries, + EnvDisableLogs: c.DisableLogs, } } @@ -76,6 +78,8 @@ func (c *cosmovisorEnv) Set(envVar, envVal string) { c.Interval = envVal case EnvPreupgradeMaxRetries: c.PreupgradeMaxRetries = envVal + case EnvDisableLogs: + c.DisableLogs = envVal default: panic(fmt.Errorf("Unknown environment variable [%s]. Ccannot set field to [%s]. ", envVar, envVal)) } @@ -367,7 +371,7 @@ func (s *argsTestSuite) TestGetConfigFromEnv() { absPath, perr := filepath.Abs(relPath) s.Require().NoError(perr) - newConfig := func(home, name string, downloadBin, restartUpgrade bool, restartDelay int, skipBackup bool, dataBackupPath string, interval int, preupgradeMaxRetries int) *Config { + newConfig := func(home, name string, downloadBin, restartUpgrade bool, restartDelay int, skipBackup bool, dataBackupPath string, interval int, preupgradeMaxRetries int, disableLogs bool) *Config { return &Config{ Home: home, Name: name, @@ -378,6 +382,7 @@ func (s *argsTestSuite) TestGetConfigFromEnv() { UnsafeSkipBackup: skipBackup, DataBackupPath: dataBackupPath, PreupgradeMaxRetries: preupgradeMaxRetries, + DisableLogs: disableLogs, } } @@ -405,183 +410,195 @@ func (s *argsTestSuite) TestGetConfigFromEnv() { }, { name: "all good", - envVals: cosmovisorEnv{absPath, "testname", "true", "false", "600ms", "true", "", "303ms", "1"}, - expectedCfg: newConfig(absPath, "testname", true, false, 600, true, absPath, 303, 1), + envVals: cosmovisorEnv{absPath, "testname", "true", "false", "600ms", "true", "", "303ms", "1", "false"}, + expectedCfg: newConfig(absPath, "testname", true, false, 600, true, absPath, 303, 1, false), expectedErrCount: 0, }, { name: "nothing set", - envVals: cosmovisorEnv{"", "", "", "", "", "", "", "", ""}, + envVals: cosmovisorEnv{"", "", "", "", "", "", "", "", "", "false"}, expectedCfg: nil, expectedErrCount: 3, }, // Note: Home and Name tests are done in TestValidate { name: "download bin bad", - envVals: cosmovisorEnv{absPath, "testname", "bad", "false", "600ms", "true", "", "303ms", "1"}, + envVals: cosmovisorEnv{absPath, "testname", "bad", "false", "600ms", "true", "", "303ms", "1", "false"}, expectedCfg: nil, expectedErrCount: 1, }, { name: "download bin not set", - envVals: cosmovisorEnv{absPath, "testname", "", "false", "600ms", "true", "", "303ms", "1"}, - expectedCfg: newConfig(absPath, "testname", false, false, 600, true, absPath, 303, 1), + envVals: cosmovisorEnv{absPath, "testname", "", "false", "600ms", "true", "", "303ms", "1", "false"}, + expectedCfg: newConfig(absPath, "testname", false, false, 600, true, absPath, 303, 1, false), expectedErrCount: 0, }, { name: "download bin true", - envVals: cosmovisorEnv{absPath, "testname", "true", "false", "600ms", "true", "", "303ms", "1"}, - expectedCfg: newConfig(absPath, "testname", true, false, 600, true, absPath, 303, 1), + envVals: cosmovisorEnv{absPath, "testname", "true", "false", "600ms", "true", "", "303ms", "1", "false"}, + expectedCfg: newConfig(absPath, "testname", true, false, 600, true, absPath, 303, 1, false), expectedErrCount: 0, }, { name: "download bin false", - envVals: cosmovisorEnv{absPath, "testname", "false", "false", "600ms", "true", "", "303ms", "1"}, - expectedCfg: newConfig(absPath, "testname", false, false, 600, true, absPath, 303, 1), + envVals: cosmovisorEnv{absPath, "testname", "false", "false", "600ms", "true", "", "303ms", "1", "false"}, + expectedCfg: newConfig(absPath, "testname", false, false, 600, true, absPath, 303, 1, false), expectedErrCount: 0, }, { name: "restart upgrade bad", - envVals: cosmovisorEnv{absPath, "testname", "true", "bad", "600ms", "true", "", "303ms", "1"}, + envVals: cosmovisorEnv{absPath, "testname", "true", "bad", "600ms", "true", "", "303ms", "1", "false"}, expectedCfg: nil, expectedErrCount: 1, }, { name: "restart upgrade not set", - envVals: cosmovisorEnv{absPath, "testname", "true", "", "600ms", "true", "", "303ms", "1"}, - expectedCfg: newConfig(absPath, "testname", true, true, 600, true, absPath, 303, 1), + envVals: cosmovisorEnv{absPath, "testname", "true", "", "600ms", "true", "", "303ms", "1", "false"}, + expectedCfg: newConfig(absPath, "testname", true, true, 600, true, absPath, 303, 1, false), expectedErrCount: 0, }, { name: "restart upgrade true", - envVals: cosmovisorEnv{absPath, "testname", "true", "true", "600ms", "true", "", "303ms", "1"}, - expectedCfg: newConfig(absPath, "testname", true, true, 600, true, absPath, 303, 1), + envVals: cosmovisorEnv{absPath, "testname", "true", "true", "600ms", "true", "", "303ms", "1", "false"}, + expectedCfg: newConfig(absPath, "testname", true, true, 600, true, absPath, 303, 1, false), expectedErrCount: 0, }, { name: "restart upgrade true", - envVals: cosmovisorEnv{absPath, "testname", "true", "false", "600ms", "true", "", "303ms", "1"}, - expectedCfg: newConfig(absPath, "testname", true, false, 600, true, absPath, 303, 1), + envVals: cosmovisorEnv{absPath, "testname", "true", "false", "600ms", "true", "", "303ms", "1", "false"}, + expectedCfg: newConfig(absPath, "testname", true, false, 600, true, absPath, 303, 1, false), expectedErrCount: 0, }, { name: "skip unsafe backups bad", - envVals: cosmovisorEnv{absPath, "testname", "true", "false", "600ms", "bad", "", "303ms", "1"}, + envVals: cosmovisorEnv{absPath, "testname", "true", "false", "600ms", "bad", "", "303ms", "1", "false"}, expectedCfg: nil, expectedErrCount: 1, }, { name: "skip unsafe backups not set", - envVals: cosmovisorEnv{absPath, "testname", "true", "false", "600ms", "", "", "303ms", "1"}, - expectedCfg: newConfig(absPath, "testname", true, false, 600, false, absPath, 303, 1), + envVals: cosmovisorEnv{absPath, "testname", "true", "false", "600ms", "", "", "303ms", "1", "false"}, + expectedCfg: newConfig(absPath, "testname", true, false, 600, false, absPath, 303, 1, false), expectedErrCount: 0, }, { name: "skip unsafe backups true", - envVals: cosmovisorEnv{absPath, "testname", "true", "false", "600ms", "true", "", "303ms", "1"}, - expectedCfg: newConfig(absPath, "testname", true, false, 600, true, absPath, 303, 1), + envVals: cosmovisorEnv{absPath, "testname", "true", "false", "600ms", "true", "", "303ms", "1", "false"}, + expectedCfg: newConfig(absPath, "testname", true, false, 600, true, absPath, 303, 1, false), expectedErrCount: 0, }, { name: "skip unsafe backups false", - envVals: cosmovisorEnv{absPath, "testname", "true", "false", "600ms", "false", "", "303ms", "1"}, - expectedCfg: newConfig(absPath, "testname", true, false, 600, false, absPath, 303, 1), + envVals: cosmovisorEnv{absPath, "testname", "true", "false", "600ms", "false", "", "303ms", "1", "false"}, + expectedCfg: newConfig(absPath, "testname", true, false, 600, false, absPath, 303, 1, false), expectedErrCount: 0, }, { name: "poll interval bad", - envVals: cosmovisorEnv{absPath, "testname", "false", "false", "600ms", "false", "", "bad", "1"}, + envVals: cosmovisorEnv{absPath, "testname", "false", "false", "600ms", "false", "", "bad", "1", "false"}, expectedCfg: nil, expectedErrCount: 1, }, { name: "poll interval 0", - envVals: cosmovisorEnv{absPath, "testname", "false", "false", "600ms", "false", "", "0", "1"}, + envVals: cosmovisorEnv{absPath, "testname", "false", "false", "600ms", "false", "", "0", "1", "false"}, expectedCfg: nil, expectedErrCount: 1, }, { name: "poll interval not set", - envVals: cosmovisorEnv{absPath, "testname", "false", "false", "600ms", "false", "", "", "1"}, - expectedCfg: newConfig(absPath, "testname", false, false, 600, false, absPath, 300, 1), + envVals: cosmovisorEnv{absPath, "testname", "false", "false", "600ms", "false", "", "", "1", "false"}, + expectedCfg: newConfig(absPath, "testname", false, false, 600, false, absPath, 300, 1, false), expectedErrCount: 0, }, { name: "poll interval 600", - envVals: cosmovisorEnv{absPath, "testname", "false", "false", "600ms", "false", "", "600", "1"}, + envVals: cosmovisorEnv{absPath, "testname", "false", "false", "600ms", "false", "", "600", "1", "false"}, expectedCfg: nil, expectedErrCount: 1, }, { name: "poll interval 1s", - envVals: cosmovisorEnv{absPath, "testname", "false", "false", "600ms", "false", "", "1s", "1"}, - expectedCfg: newConfig(absPath, "testname", false, false, 600, false, absPath, 1000, 1), + envVals: cosmovisorEnv{absPath, "testname", "false", "false", "600ms", "false", "", "1s", "1", "false"}, + expectedCfg: newConfig(absPath, "testname", false, false, 600, false, absPath, 1000, 1, false), expectedErrCount: 0, }, { name: "poll interval -3m", - envVals: cosmovisorEnv{absPath, "testname", "false", "false", "600ms", "false", "", "-3m", "1"}, + envVals: cosmovisorEnv{absPath, "testname", "false", "false", "600ms", "false", "", "-3m", "1", "false"}, expectedCfg: nil, expectedErrCount: 1, }, { name: "restart delay bad", - envVals: cosmovisorEnv{absPath, "testname", "false", "false", "bad", "false", "", "303ms", "1"}, + envVals: cosmovisorEnv{absPath, "testname", "false", "false", "bad", "false", "", "303ms", "1", "false"}, expectedCfg: nil, expectedErrCount: 1, }, { name: "restart delay 0", - envVals: cosmovisorEnv{absPath, "testname", "false", "false", "0", "false", "", "303ms", "1"}, + envVals: cosmovisorEnv{absPath, "testname", "false", "false", "0", "false", "", "303ms", "1", "false"}, expectedCfg: nil, expectedErrCount: 1, }, { name: "restart delay not set", - envVals: cosmovisorEnv{absPath, "testname", "false", "false", "", "false", "", "303ms", "1"}, - expectedCfg: newConfig(absPath, "testname", false, false, 0, false, absPath, 303, 1), + envVals: cosmovisorEnv{absPath, "testname", "false", "false", "", "false", "", "303ms", "1", "false"}, + expectedCfg: newConfig(absPath, "testname", false, false, 0, false, absPath, 303, 1, false), expectedErrCount: 0, }, { name: "restart delay 600", - envVals: cosmovisorEnv{absPath, "testname", "false", "false", "600", "false", "", "300ms", "1"}, + envVals: cosmovisorEnv{absPath, "testname", "false", "false", "600", "false", "", "300ms", "1", "false"}, expectedCfg: nil, expectedErrCount: 1, }, { name: "restart delay 1s", - envVals: cosmovisorEnv{absPath, "testname", "false", "false", "1s", "false", "", "303ms", "1"}, - expectedCfg: newConfig(absPath, "testname", false, false, 1000, false, absPath, 303, 1), + envVals: cosmovisorEnv{absPath, "testname", "false", "false", "1s", "false", "", "303ms", "1", "false"}, + expectedCfg: newConfig(absPath, "testname", false, false, 1000, false, absPath, 303, 1, false), expectedErrCount: 0, }, { name: "restart delay -3m", - envVals: cosmovisorEnv{absPath, "testname", "false", "false", "-3m", "false", "", "303ms", "1"}, + envVals: cosmovisorEnv{absPath, "testname", "false", "false", "-3m", "false", "", "303ms", "1", "false"}, expectedCfg: nil, expectedErrCount: 1, }, { name: "prepupgrade max retries bad", - envVals: cosmovisorEnv{absPath, "testname", "false", "false", "600ms", "false", "", "406ms", "bad"}, + envVals: cosmovisorEnv{absPath, "testname", "false", "false", "600ms", "false", "", "406ms", "bad", "false"}, expectedCfg: nil, expectedErrCount: 1, }, { name: "prepupgrade max retries 0", - envVals: cosmovisorEnv{absPath, "testname", "false", "false", "600ms", "false", "", "406ms", "0"}, - expectedCfg: newConfig(absPath, "testname", false, false, 600, false, absPath, 406, 0), + envVals: cosmovisorEnv{absPath, "testname", "false", "false", "600ms", "false", "", "406ms", "0", "false"}, + expectedCfg: newConfig(absPath, "testname", false, false, 600, false, absPath, 406, 0, false), expectedErrCount: 0, }, { name: "prepupgrade max retries not set", - envVals: cosmovisorEnv{absPath, "testname", "false", "false", "600ms", "false", "", "406ms", ""}, - expectedCfg: newConfig(absPath, "testname", false, false, 600, false, absPath, 406, 0), + envVals: cosmovisorEnv{absPath, "testname", "false", "false", "600ms", "false", "", "406ms", "", "false"}, + expectedCfg: newConfig(absPath, "testname", false, false, 600, false, absPath, 406, 0, false), expectedErrCount: 0, }, { name: "prepupgrade max retries 5", - envVals: cosmovisorEnv{absPath, "testname", "false", "false", "600ms", "false", "", "406ms", "5"}, - expectedCfg: newConfig(absPath, "testname", false, false, 600, false, absPath, 406, 5), + envVals: cosmovisorEnv{absPath, "testname", "false", "false", "600ms", "false", "", "406ms", "5", "false"}, + expectedCfg: newConfig(absPath, "testname", false, false, 600, false, absPath, 406, 5, false), + expectedErrCount: 0, + }, + { + name: "disable logs bad", + envVals: cosmovisorEnv{absPath, "testname", "false", "false", "600ms", "false", "", "406ms", "5", "bad"}, + expectedCfg: nil, + expectedErrCount: 1, + }, + { + name: "disable logs good", + envVals: cosmovisorEnv{absPath, "testname", "false", "false", "600ms", "false", "", "406ms", "", "true"}, + expectedCfg: newConfig(absPath, "testname", false, false, 600, false, absPath, 406, 0, true), expectedErrCount: 0, }, } diff --git a/tools/cosmovisor/cmd/cosmovisor/config.go b/tools/cosmovisor/cmd/cosmovisor/config.go new file mode 100644 index 000000000000..1a4aa22783a9 --- /dev/null +++ b/tools/cosmovisor/cmd/cosmovisor/config.go @@ -0,0 +1,23 @@ +package main + +import ( + "fmt" + + "cosmossdk.io/tools/cosmovisor" + "github.com/spf13/cobra" +) + +var configCmd = &cobra.Command{ + Use: "config", + Short: "Display cosmovisor config (prints environment variables used by cosmovisor).", + SilenceUsage: true, + RunE: func(cmd *cobra.Command, args []string) error { + cfg, err := cosmovisor.GetConfigFromEnv() + if err != nil { + return err + } + + fmt.Fprint(cmd.OutOrStdout(), cfg.DetailString()) + return nil + }, +} diff --git a/tools/cosmovisor/cmd/cosmovisor/init.go b/tools/cosmovisor/cmd/cosmovisor/init.go index c77342a31285..dd49cce19752 100644 --- a/tools/cosmovisor/cmd/cosmovisor/init.go +++ b/tools/cosmovisor/cmd/cosmovisor/init.go @@ -16,13 +16,9 @@ import ( "cosmossdk.io/x/upgrade/plan" ) -func init() { - rootCmd.AddCommand(initCmd) -} - var initCmd = &cobra.Command{ Use: "init ", - Short: "Initializes a cosmovisor daemon home directory.", + Short: "Initialize a cosmovisor daemon home directory.", Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { logger := cmd.Context().Value(log.ContextKey).(*zerolog.Logger) diff --git a/tools/cosmovisor/cmd/cosmovisor/main.go b/tools/cosmovisor/cmd/cosmovisor/main.go index 26d696552e41..44bd80fc6235 100644 --- a/tools/cosmovisor/cmd/cosmovisor/main.go +++ b/tools/cosmovisor/cmd/cosmovisor/main.go @@ -12,7 +12,7 @@ func main() { logger := log.NewLoggerWithKV(os.Stdout, log.ModuleKey, "cosmovisor") ctx := context.WithValue(context.Background(), log.ContextKey, logger) - if err := rootCmd.ExecuteContext(ctx); err != nil { + if err := NewRootCmd().ExecuteContext(ctx); err != nil { cverrors.LogErrors(logger, "", err) os.Exit(1) } diff --git a/tools/cosmovisor/cmd/cosmovisor/root.go b/tools/cosmovisor/cmd/cosmovisor/root.go index 69f6cfe075ed..e4ac242ddc6e 100644 --- a/tools/cosmovisor/cmd/cosmovisor/root.go +++ b/tools/cosmovisor/cmd/cosmovisor/root.go @@ -4,8 +4,19 @@ import ( "github.com/spf13/cobra" ) -var rootCmd = &cobra.Command{ - Use: "cosmovisor", - Short: "A process manager for Cosmos SDK application binaries.", - Long: GetHelpText(), +func NewRootCmd() *cobra.Command { + rootCmd := &cobra.Command{ + Use: "cosmovisor", + Short: "A process manager for Cosmos SDK application binaries.", + Long: GetHelpText(), + } + + rootCmd.AddCommand( + initCmd, + runCmd, + configCmd, + NewVersionCmd(), + ) + + return rootCmd } diff --git a/tools/cosmovisor/cmd/cosmovisor/run.go b/tools/cosmovisor/cmd/cosmovisor/run.go index 5c91c77c1108..fe300d58fa62 100644 --- a/tools/cosmovisor/cmd/cosmovisor/run.go +++ b/tools/cosmovisor/cmd/cosmovisor/run.go @@ -3,32 +3,33 @@ package main import ( "cosmossdk.io/log" "cosmossdk.io/tools/cosmovisor" + "github.com/rs/zerolog" "github.com/spf13/cobra" ) -func init() { - rootCmd.AddCommand(runCmd) -} - var runCmd = &cobra.Command{ Use: "run", Short: "Run an APP command.", SilenceUsage: true, DisableFlagParsing: true, RunE: func(cmd *cobra.Command, args []string) error { - logger := cmd.Context().Value(log.ContextKey).(log.Logger) - - return Run(logger, args) + return Run(cmd, args) }, } // Run runs the configured program with the given args and monitors it for upgrades. -func Run(logger log.Logger, args []string, options ...RunOption) error { +func Run(cmd *cobra.Command, args []string, options ...RunOption) error { cfg, err := cosmovisor.GetConfigFromEnv() if err != nil { return err } + logger := cmd.Context().Value(log.ContextKey).(log.Logger) + + if cfg.DisableLogs { + logger = log.NewCustomLogger(zerolog.Nop()) + } + runCfg := DefaultRunConfig for _, opt := range options { opt(&runCfg) diff --git a/tools/cosmovisor/cmd/cosmovisor/run_test.go b/tools/cosmovisor/cmd/cosmovisor/run_test.go deleted file mode 100644 index 7c585d9b6461..000000000000 --- a/tools/cosmovisor/cmd/cosmovisor/run_test.go +++ /dev/null @@ -1,4 +0,0 @@ -package main - -// TODO: Write tests for func Run(args []string) error -// https://github.com/cosmos/cosmos-sdk/issues/11852 diff --git a/tools/cosmovisor/cmd/cosmovisor/version.go b/tools/cosmovisor/cmd/cosmovisor/version.go index 722ccc5e9388..3cbbf72cada5 100644 --- a/tools/cosmovisor/cmd/cosmovisor/version.go +++ b/tools/cosmovisor/cmd/cosmovisor/version.go @@ -6,32 +6,29 @@ import ( "runtime/debug" "strings" - "cosmossdk.io/log" - "github.com/rs/zerolog" "github.com/spf13/cobra" ) -func init() { - versionCmd.Flags().StringP(OutputFlag, "o", "text", "Output format (text|json)") - rootCmd.AddCommand(versionCmd) -} - // OutputFlag defines the output format flag var OutputFlag = "output" -var versionCmd = &cobra.Command{ - Use: "version", - Short: "Prints the version of Cosmovisor.", - SilenceUsage: true, - RunE: func(cmd *cobra.Command, args []string) error { - logger := cmd.Context().Value(log.ContextKey).(log.Logger) +func NewVersionCmd() *cobra.Command { + versionCmd := &cobra.Command{ + Use: "version", + Short: "Display cosmovisor and APP version.", + SilenceUsage: true, + RunE: func(cmd *cobra.Command, args []string) error { + if val, err := cmd.Flags().GetString(OutputFlag); val == "json" && err == nil { + return printVersionJSON(cmd, args) + } + + return printVersion(cmd, args) + }, + } - if val, err := cmd.Flags().GetString(OutputFlag); val == "json" && err == nil { - return printVersionJSON(logger, args) - } + versionCmd.Flags().StringP(OutputFlag, "o", "text", "Output format (text|json)") - return printVersion(logger, args) - }, + return versionCmd } func getVersion() string { @@ -43,25 +40,21 @@ func getVersion() string { return strings.TrimSpace(version.Main.Version) } -func printVersion(logger log.Logger, args []string) error { +func printVersion(cmd *cobra.Command, args []string) error { fmt.Printf("cosmovisor version: %s\n", getVersion()) - if err := Run(logger, append([]string{"version"}, args...)); err != nil { + if err := Run(cmd, append([]string{"version"}, args...)); err != nil { return fmt.Errorf("failed to run version command: %w", err) } return nil } -func printVersionJSON(logger log.Logger, args []string) error { +func printVersionJSON(cmd *cobra.Command, args []string) error { buf := new(strings.Builder) - // disable logger - zl := logger.Impl().(*zerolog.Logger) - logger = log.NewCustomLogger(zl.Level(zerolog.Disabled)) - if err := Run( - logger, + cmd, []string{"version", "--long", "--output", "json"}, StdOutRunOption(buf), ); err != nil { diff --git a/tools/cosmovisor/cmd/cosmovisor/version_test.go b/tools/cosmovisor/cmd/cosmovisor/version_test.go index d42e3d6bb6fe..0a7d9e586846 100644 --- a/tools/cosmovisor/cmd/cosmovisor/version_test.go +++ b/tools/cosmovisor/cmd/cosmovisor/version_test.go @@ -12,6 +12,7 @@ import ( func TestVersionCommand_Error(t *testing.T) { logger := log.NewTestLogger(t).With(log.ModuleKey, "cosmovisor") + rootCmd := NewRootCmd() rootCmd.SetArgs([]string{"version"}) out := bytes.NewBufferString("") diff --git a/tools/cosmovisor/go.mod b/tools/cosmovisor/go.mod index 0350b2a176ab..abb32739d386 100644 --- a/tools/cosmovisor/go.mod +++ b/tools/cosmovisor/go.mod @@ -19,12 +19,12 @@ require ( cloud.google.com/go/storage v1.29.0 // indirect cosmossdk.io/api v0.3.1 // indirect cosmossdk.io/collections v0.0.0-20230214153846-b6c6e4e99177 // indirect - cosmossdk.io/core v0.6.0 // indirect + cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba // indirect cosmossdk.io/depinject v1.0.0-alpha.3 // indirect cosmossdk.io/errors v1.0.0-beta.7 // indirect cosmossdk.io/math v1.0.0-beta.6.0.20230216172121-959ce49135e4 // indirect cosmossdk.io/store v0.0.0-20230227103508-bbe7f8a11b44 // indirect - cosmossdk.io/x/tx v0.2.2 // indirect + cosmossdk.io/x/tx v0.2.3-0.20230309163709-87da587416ba // indirect filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect @@ -46,7 +46,7 @@ require ( github.com/confio/ics23/go v0.9.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect github.com/cosmos/cosmos-db v1.0.0-rc.1 // indirect - github.com/cosmos/cosmos-proto v1.0.0-beta.2 // indirect + github.com/cosmos/cosmos-proto v1.0.0-beta.3 // indirect github.com/cosmos/cosmos-sdk v0.46.0-beta2.0.20230306220716-5e55f56d39d5 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect diff --git a/tools/cosmovisor/go.sum b/tools/cosmovisor/go.sum index 37118a67a430..67849ca7bfe4 100644 --- a/tools/cosmovisor/go.sum +++ b/tools/cosmovisor/go.sum @@ -192,8 +192,8 @@ cosmossdk.io/api v0.3.1 h1:NNiOclKRR0AOlO4KIqeaG6PS6kswOMhHD0ir0SscNXE= cosmossdk.io/api v0.3.1/go.mod h1:DfHfMkiNA2Uhy8fj0JJlOCYOBp4eWUUJ1te5zBGNyIw= cosmossdk.io/collections v0.0.0-20230214153846-b6c6e4e99177 h1:At2M0aYQKEAWqr6JtZrJPOlfhdvENiGwJg2NCNHwIdc= cosmossdk.io/collections v0.0.0-20230214153846-b6c6e4e99177/go.mod h1:uqCi8FG+Bh2vv/qf5xZ8iab0E0c/DMA/cwafbp8dkcU= -cosmossdk.io/core v0.6.0 h1:V2zyaMVFN6hJSVENYx2XE9CMhzqwJPMjzSQpj0MyXAU= -cosmossdk.io/core v0.6.0/go.mod h1:YSFzBcKOf/U24e/sa6WFaYSrlZl5zgNvnWwjfFyPniw= +cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba h1:kSnaDzbwMInpQYwz8ESgvi6ceUQWcXAJdEVZW454dX0= +cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba/go.mod h1:WiFk9ZQbFVBHk9AqQIkLFqyj30NPQB6C45CIeAZxDcw= cosmossdk.io/depinject v1.0.0-alpha.3 h1:6evFIgj//Y3w09bqOUOzEpFj5tsxBqdc5CfkO7z+zfw= cosmossdk.io/depinject v1.0.0-alpha.3/go.mod h1:eRbcdQ7MRpIPEM5YUJh8k97nxHpYbc3sMUnEtt8HPWU= cosmossdk.io/errors v1.0.0-beta.7 h1:gypHW76pTQGVnHKo6QBkb4yFOJjC+sUGRc5Al3Odj1w= @@ -204,8 +204,8 @@ cosmossdk.io/math v1.0.0-beta.6.0.20230216172121-959ce49135e4 h1:/jnzJ9zFsL7qkV8 cosmossdk.io/math v1.0.0-beta.6.0.20230216172121-959ce49135e4/go.mod h1:gUVtWwIzfSXqcOT+lBVz2jyjfua8DoBdzRsIyaUAT/8= cosmossdk.io/store v0.0.0-20230227103508-bbe7f8a11b44 h1:/pKsj/ApzO4+zMwpgLiPG5iakoHxziGpMiJcz4S+r4w= cosmossdk.io/store v0.0.0-20230227103508-bbe7f8a11b44/go.mod h1:flrxUykloEW1asE9p+Q+d8LSuNI3fBRdzISg9HTpYlQ= -cosmossdk.io/x/tx v0.2.2 h1:pD4TEbzOOerVQNI+M9anQIncl+4wFELpGds3N7RzPiQ= -cosmossdk.io/x/tx v0.2.2/go.mod h1:cur19OSg8P6ifrZ00yJOyY6HT75FEhLBX2Ir3Sl0ubY= +cosmossdk.io/x/tx v0.2.3-0.20230309163709-87da587416ba h1:NmWXkl0voj3dN96Qmk4rfrze6dLLLxB4qTCxXZTXBpM= +cosmossdk.io/x/tx v0.2.3-0.20230309163709-87da587416ba/go.mod h1:dhIxZhZF2glIA9hkkildy/JmSqVH3FIU/OhSU8is7PM= cosmossdk.io/x/upgrade v0.0.0-20230227110325-294ef34f396f h1:K9arlZkok6I5X5+FEqQBj3vtTXSccWTfOsU9WPhsif0= cosmossdk.io/x/upgrade v0.0.0-20230227110325-294ef34f396f/go.mod h1:DgT89ckyz+u8XVfYdIoAhkFXV+o3ieva3zE+qoYu89g= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= @@ -330,8 +330,8 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= github.com/cosmos/cosmos-db v1.0.0-rc.1 h1:SjnT8B6WKMW9WEIX32qMhnEEKcI7ZP0+G1Sa9HD3nmY= github.com/cosmos/cosmos-db v1.0.0-rc.1/go.mod h1:Dnmk3flSf5lkwCqvvjNpoxjpXzhxnCAFzKHlbaForso= -github.com/cosmos/cosmos-proto v1.0.0-beta.2 h1:X3OKvWgK9Gsejo0F1qs5l8Qn6xJV/AzgIWR2wZ8Nua8= -github.com/cosmos/cosmos-proto v1.0.0-beta.2/go.mod h1:+XRCLJ14pr5HFEHIUcn51IKXD1Fy3rkEQqt4WqmN4V0= +github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= +github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= github.com/cosmos/cosmos-sdk v0.46.0-beta2.0.20230306220716-5e55f56d39d5 h1:/6AWQpNJO7Kt8KcWlNOeR6RxHWz9jKE3xXaSJ1ijqDU= github.com/cosmos/cosmos-sdk v0.46.0-beta2.0.20230306220716-5e55f56d39d5/go.mod h1:yEwevSvOObLNzTLXERD1tdyoHoowNyeKB4GmPej6DO4= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= diff --git a/tools/hubl/go.mod b/tools/hubl/go.mod index 92387203d21b..abd9374d0572 100644 --- a/tools/hubl/go.mod +++ b/tools/hubl/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( cosmossdk.io/api v0.3.1 - cosmossdk.io/client/v2 v2.0.0-20230221205652-bc53611b4c2c + cosmossdk.io/client/v2 v2.0.0-20230309163709-87da587416ba cosmossdk.io/errors v1.0.0-beta.7 github.com/cockroachdb/errors v1.9.1 github.com/hashicorp/go-multierror v1.1.1 @@ -17,12 +17,12 @@ require ( require ( cosmossdk.io/collections v0.0.0-20230214153846-b6c6e4e99177 // indirect - cosmossdk.io/core v0.6.0 // indirect + cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba // indirect cosmossdk.io/depinject v1.0.0-alpha.3 // indirect cosmossdk.io/log v0.0.0-20230306220716-5e55f56d39d5 // indirect cosmossdk.io/math v1.0.0-beta.6.0.20230216172121-959ce49135e4 // indirect cosmossdk.io/store v0.0.0-20230227103508-bbe7f8a11b44 // indirect - cosmossdk.io/x/tx v0.2.2 // indirect + cosmossdk.io/x/tx v0.2.3-0.20230309163709-87da587416ba // indirect filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect @@ -41,7 +41,7 @@ require ( github.com/confio/ics23/go v0.9.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect github.com/cosmos/cosmos-db v1.0.0-rc.1 // indirect - github.com/cosmos/cosmos-proto v1.0.0-beta.2 // indirect + github.com/cosmos/cosmos-proto v1.0.0-beta.3 // indirect github.com/cosmos/cosmos-sdk v0.46.0-beta2.0.20230306220716-5e55f56d39d5 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogoproto v1.4.6 // indirect diff --git a/tools/hubl/go.sum b/tools/hubl/go.sum index 28aae53ec7fa..eddd69a1b6bb 100644 --- a/tools/hubl/go.sum +++ b/tools/hubl/go.sum @@ -37,12 +37,12 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9 cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= cosmossdk.io/api v0.3.1 h1:NNiOclKRR0AOlO4KIqeaG6PS6kswOMhHD0ir0SscNXE= cosmossdk.io/api v0.3.1/go.mod h1:DfHfMkiNA2Uhy8fj0JJlOCYOBp4eWUUJ1te5zBGNyIw= -cosmossdk.io/client/v2 v2.0.0-20230221205652-bc53611b4c2c h1:C9v7K9rrn4abRjUZhg8DJe4YaI69I5c6vXyHAd662zo= -cosmossdk.io/client/v2 v2.0.0-20230221205652-bc53611b4c2c/go.mod h1:39SEMRM+9bS+FsRr3bgUAKGUU6mLdBPRdr1PmFzp0j8= +cosmossdk.io/client/v2 v2.0.0-20230309163709-87da587416ba h1:LuPHCncU2KLMNPItFECs709uo46I9wSu2fAWYVCx+/U= +cosmossdk.io/client/v2 v2.0.0-20230309163709-87da587416ba/go.mod h1:SXdwqO7cN5htalh/lhXWP8V4zKtBrhhcSTU+ytuEtmM= cosmossdk.io/collections v0.0.0-20230214153846-b6c6e4e99177 h1:At2M0aYQKEAWqr6JtZrJPOlfhdvENiGwJg2NCNHwIdc= cosmossdk.io/collections v0.0.0-20230214153846-b6c6e4e99177/go.mod h1:uqCi8FG+Bh2vv/qf5xZ8iab0E0c/DMA/cwafbp8dkcU= -cosmossdk.io/core v0.6.0 h1:V2zyaMVFN6hJSVENYx2XE9CMhzqwJPMjzSQpj0MyXAU= -cosmossdk.io/core v0.6.0/go.mod h1:YSFzBcKOf/U24e/sa6WFaYSrlZl5zgNvnWwjfFyPniw= +cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba h1:kSnaDzbwMInpQYwz8ESgvi6ceUQWcXAJdEVZW454dX0= +cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba/go.mod h1:WiFk9ZQbFVBHk9AqQIkLFqyj30NPQB6C45CIeAZxDcw= cosmossdk.io/depinject v1.0.0-alpha.3 h1:6evFIgj//Y3w09bqOUOzEpFj5tsxBqdc5CfkO7z+zfw= cosmossdk.io/depinject v1.0.0-alpha.3/go.mod h1:eRbcdQ7MRpIPEM5YUJh8k97nxHpYbc3sMUnEtt8HPWU= cosmossdk.io/errors v1.0.0-beta.7 h1:gypHW76pTQGVnHKo6QBkb4yFOJjC+sUGRc5Al3Odj1w= @@ -53,8 +53,8 @@ cosmossdk.io/math v1.0.0-beta.6.0.20230216172121-959ce49135e4 h1:/jnzJ9zFsL7qkV8 cosmossdk.io/math v1.0.0-beta.6.0.20230216172121-959ce49135e4/go.mod h1:gUVtWwIzfSXqcOT+lBVz2jyjfua8DoBdzRsIyaUAT/8= cosmossdk.io/store v0.0.0-20230227103508-bbe7f8a11b44 h1:/pKsj/ApzO4+zMwpgLiPG5iakoHxziGpMiJcz4S+r4w= cosmossdk.io/store v0.0.0-20230227103508-bbe7f8a11b44/go.mod h1:flrxUykloEW1asE9p+Q+d8LSuNI3fBRdzISg9HTpYlQ= -cosmossdk.io/x/tx v0.2.2 h1:pD4TEbzOOerVQNI+M9anQIncl+4wFELpGds3N7RzPiQ= -cosmossdk.io/x/tx v0.2.2/go.mod h1:cur19OSg8P6ifrZ00yJOyY6HT75FEhLBX2Ir3Sl0ubY= +cosmossdk.io/x/tx v0.2.3-0.20230309163709-87da587416ba h1:NmWXkl0voj3dN96Qmk4rfrze6dLLLxB4qTCxXZTXBpM= +cosmossdk.io/x/tx v0.2.3-0.20230309163709-87da587416ba/go.mod h1:dhIxZhZF2glIA9hkkildy/JmSqVH3FIU/OhSU8is7PM= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek= filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= @@ -144,8 +144,8 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= github.com/cosmos/cosmos-db v1.0.0-rc.1 h1:SjnT8B6WKMW9WEIX32qMhnEEKcI7ZP0+G1Sa9HD3nmY= github.com/cosmos/cosmos-db v1.0.0-rc.1/go.mod h1:Dnmk3flSf5lkwCqvvjNpoxjpXzhxnCAFzKHlbaForso= -github.com/cosmos/cosmos-proto v1.0.0-beta.2 h1:X3OKvWgK9Gsejo0F1qs5l8Qn6xJV/AzgIWR2wZ8Nua8= -github.com/cosmos/cosmos-proto v1.0.0-beta.2/go.mod h1:+XRCLJ14pr5HFEHIUcn51IKXD1Fy3rkEQqt4WqmN4V0= +github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= +github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= github.com/cosmos/cosmos-sdk v0.46.0-beta2.0.20230306220716-5e55f56d39d5 h1:/6AWQpNJO7Kt8KcWlNOeR6RxHWz9jKE3xXaSJ1ijqDU= github.com/cosmos/cosmos-sdk v0.46.0-beta2.0.20230306220716-5e55f56d39d5/go.mod h1:yEwevSvOObLNzTLXERD1tdyoHoowNyeKB4GmPej6DO4= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= diff --git a/tools/rosetta/go.mod b/tools/rosetta/go.mod index 26ee4fa4a426..ebfecf7deadf 100644 --- a/tools/rosetta/go.mod +++ b/tools/rosetta/go.mod @@ -19,11 +19,11 @@ require ( require ( cosmossdk.io/api v0.3.1 // indirect cosmossdk.io/collections v0.0.0-20230214153846-b6c6e4e99177 // indirect - cosmossdk.io/core v0.6.0 // indirect + cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba // indirect cosmossdk.io/depinject v1.0.0-alpha.3 // indirect cosmossdk.io/errors v1.0.0-beta.7 // indirect cosmossdk.io/store v0.0.0-20230227103508-bbe7f8a11b44 // indirect - cosmossdk.io/x/tx v0.2.2 // indirect + cosmossdk.io/x/tx v0.2.3-0.20230309163709-87da587416ba // indirect filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect @@ -42,7 +42,7 @@ require ( github.com/confio/ics23/go v0.9.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect github.com/cosmos/cosmos-db v1.0.0-rc.1 // indirect - github.com/cosmos/cosmos-proto v1.0.0-beta.2 // indirect + github.com/cosmos/cosmos-proto v1.0.0-beta.3 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/gogoproto v1.4.6 // indirect diff --git a/tools/rosetta/go.sum b/tools/rosetta/go.sum index d86af8bfe2b9..543d4e1448b7 100644 --- a/tools/rosetta/go.sum +++ b/tools/rosetta/go.sum @@ -39,8 +39,8 @@ cosmossdk.io/api v0.3.1 h1:NNiOclKRR0AOlO4KIqeaG6PS6kswOMhHD0ir0SscNXE= cosmossdk.io/api v0.3.1/go.mod h1:DfHfMkiNA2Uhy8fj0JJlOCYOBp4eWUUJ1te5zBGNyIw= cosmossdk.io/collections v0.0.0-20230214153846-b6c6e4e99177 h1:At2M0aYQKEAWqr6JtZrJPOlfhdvENiGwJg2NCNHwIdc= cosmossdk.io/collections v0.0.0-20230214153846-b6c6e4e99177/go.mod h1:uqCi8FG+Bh2vv/qf5xZ8iab0E0c/DMA/cwafbp8dkcU= -cosmossdk.io/core v0.6.0 h1:V2zyaMVFN6hJSVENYx2XE9CMhzqwJPMjzSQpj0MyXAU= -cosmossdk.io/core v0.6.0/go.mod h1:YSFzBcKOf/U24e/sa6WFaYSrlZl5zgNvnWwjfFyPniw= +cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba h1:kSnaDzbwMInpQYwz8ESgvi6ceUQWcXAJdEVZW454dX0= +cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba/go.mod h1:WiFk9ZQbFVBHk9AqQIkLFqyj30NPQB6C45CIeAZxDcw= cosmossdk.io/depinject v1.0.0-alpha.3 h1:6evFIgj//Y3w09bqOUOzEpFj5tsxBqdc5CfkO7z+zfw= cosmossdk.io/depinject v1.0.0-alpha.3/go.mod h1:eRbcdQ7MRpIPEM5YUJh8k97nxHpYbc3sMUnEtt8HPWU= cosmossdk.io/errors v1.0.0-beta.7 h1:gypHW76pTQGVnHKo6QBkb4yFOJjC+sUGRc5Al3Odj1w= @@ -51,8 +51,8 @@ cosmossdk.io/math v1.0.0-beta.6.0.20230216172121-959ce49135e4 h1:/jnzJ9zFsL7qkV8 cosmossdk.io/math v1.0.0-beta.6.0.20230216172121-959ce49135e4/go.mod h1:gUVtWwIzfSXqcOT+lBVz2jyjfua8DoBdzRsIyaUAT/8= cosmossdk.io/store v0.0.0-20230227103508-bbe7f8a11b44 h1:/pKsj/ApzO4+zMwpgLiPG5iakoHxziGpMiJcz4S+r4w= cosmossdk.io/store v0.0.0-20230227103508-bbe7f8a11b44/go.mod h1:flrxUykloEW1asE9p+Q+d8LSuNI3fBRdzISg9HTpYlQ= -cosmossdk.io/x/tx v0.2.2 h1:pD4TEbzOOerVQNI+M9anQIncl+4wFELpGds3N7RzPiQ= -cosmossdk.io/x/tx v0.2.2/go.mod h1:cur19OSg8P6ifrZ00yJOyY6HT75FEhLBX2Ir3Sl0ubY= +cosmossdk.io/x/tx v0.2.3-0.20230309163709-87da587416ba h1:NmWXkl0voj3dN96Qmk4rfrze6dLLLxB4qTCxXZTXBpM= +cosmossdk.io/x/tx v0.2.3-0.20230309163709-87da587416ba/go.mod h1:dhIxZhZF2glIA9hkkildy/JmSqVH3FIU/OhSU8is7PM= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek= filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= @@ -168,8 +168,8 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= github.com/cosmos/cosmos-db v1.0.0-rc.1 h1:SjnT8B6WKMW9WEIX32qMhnEEKcI7ZP0+G1Sa9HD3nmY= github.com/cosmos/cosmos-db v1.0.0-rc.1/go.mod h1:Dnmk3flSf5lkwCqvvjNpoxjpXzhxnCAFzKHlbaForso= -github.com/cosmos/cosmos-proto v1.0.0-beta.2 h1:X3OKvWgK9Gsejo0F1qs5l8Qn6xJV/AzgIWR2wZ8Nua8= -github.com/cosmos/cosmos-proto v1.0.0-beta.2/go.mod h1:+XRCLJ14pr5HFEHIUcn51IKXD1Fy3rkEQqt4WqmN4V0= +github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= +github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= github.com/cosmos/cosmos-sdk v0.46.0-beta2.0.20230306220716-5e55f56d39d5 h1:/6AWQpNJO7Kt8KcWlNOeR6RxHWz9jKE3xXaSJ1ijqDU= github.com/cosmos/cosmos-sdk v0.46.0-beta2.0.20230306220716-5e55f56d39d5/go.mod h1:yEwevSvOObLNzTLXERD1tdyoHoowNyeKB4GmPej6DO4= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= diff --git a/x/README.md b/x/README.md index 7d930b1c3693..4b168c5397c8 100644 --- a/x/README.md +++ b/x/README.md @@ -10,7 +10,6 @@ Here are some production-grade modules that can be used in Cosmos SDK applicatio * [Auth](./auth/README.md) - Authentication of accounts and transactions for Cosmos SDK applications. * [Authz](./authz/README.md) - Authorization for accounts to perform actions on behalf of other accounts. * [Bank](./bank/README.md) - Token transfer functionalities. -* [Capability](./capability/README.md) - Object capability implementation. * [Crisis](./crisis/README.md) - Halting the blockchain under certain circumstances (e.g. if an invariant is broken). * [Distribution](./distribution/README.md) - Fee distribution, and staking token provision distribution. * [Evidence](./evidence/README.md) - Evidence handling for double signing, misbehaviour, etc. diff --git a/x/auth/keeper/bech32_codec.go b/x/auth/keeper/bech32_codec.go index 298a5813f292..2a28dcc426b1 100644 --- a/x/auth/keeper/bech32_codec.go +++ b/x/auth/keeper/bech32_codec.go @@ -15,7 +15,7 @@ type bech32Codec struct { var _ address.Codec = &bech32Codec{} -func newBech32Codec(prefix string) bech32Codec { +func NewBech32Codec(prefix string) address.Codec { return bech32Codec{prefix} } diff --git a/x/auth/keeper/keeper.go b/x/auth/keeper/keeper.go index d59a40521f81..2d3a65c9e337 100644 --- a/x/auth/keeper/keeper.go +++ b/x/auth/keeper/keeper.go @@ -86,7 +86,7 @@ func NewAccountKeeper( permAddrs[name] = types.NewPermissionsForAddress(name, perms) } - bech32Codec := newBech32Codec(bech32Prefix) + bech32Codec := NewBech32Codec(bech32Prefix) return AccountKeeper{ storeKey: storeKey, diff --git a/x/auth/module.go b/x/auth/module.go index 16b8703b2387..e302de831810 100644 --- a/x/auth/module.go +++ b/x/auth/module.go @@ -12,6 +12,7 @@ import ( "cosmossdk.io/depinject" "cosmossdk.io/core/appmodule" + "github.com/cosmos/cosmos-sdk/types/address" modulev1 "cosmossdk.io/api/cosmos/auth/module/v1" @@ -200,10 +201,17 @@ func (AppModule) WeightedOperations(_ module.SimulationState) []simtypes.Weighte func init() { appmodule.Register(&modulev1.Module{}, + appmodule.Provide(ProvideAddressCodec), appmodule.Provide(ProvideModule), ) } +// ProvideAddressCodec provides an address.Codec to the container for any +// modules that want to do address string <> bytes conversion. +func ProvideAddressCodec(config *modulev1.Module) address.Codec { + return keeper.NewBech32Codec(config.Bech32Prefix) +} + //nolint:revive type AuthInputs struct { depinject.In diff --git a/x/capability/README.md b/x/capability/README.md deleted file mode 100644 index cdd1c0e70d69..000000000000 --- a/x/capability/README.md +++ /dev/null @@ -1,134 +0,0 @@ ---- -sidebar_position: 1 ---- - -# `x/capability` - -## Overview - -`x/capability` is an implementation of a Cosmos SDK module, per [ADR 003](https://github.com/cosmos/cosmos-sdk/blob/main/docs/architecture/adr-003-dynamic-capability-store.md), -that allows for provisioning, tracking, and authenticating multi-owner capabilities -at runtime. - -The keeper maintains two states: persistent and ephemeral in-memory. The persistent -store maintains a globally unique auto-incrementing index and a mapping from -capability index to a set of capability owners that are defined as a module and -capability name tuple. The in-memory ephemeral state keeps track of the actual -capabilities, represented as addresses in local memory, with both forward and reverse indexes. -The forward index maps module name and capability tuples to the capability name. The -reverse index maps between the module and capability name and the capability itself. - -The keeper allows the creation of "scoped" sub-keepers which are tied to a particular -module by name. Scoped keepers must be created at application initialization and -passed to modules, which can then use them to claim capabilities they receive and -retrieve capabilities which they own by name, in addition to creating new capabilities -& authenticating capabilities passed by other modules. A scoped keeper cannot escape its scope, -so a module cannot interfere with or inspect capabilities owned by other modules. - -The keeper provides no other core functionality that can be found in other modules -like queriers, REST and CLI handlers, and genesis state. - -## Initialization - -During application initialization, the keeper must be instantiated with a persistent -store key and an in-memory store key. - -```go -type App struct { - // ... - - capabilityKeeper *capability.Keeper -} - -func NewApp(...) *App { - // ... - - app.capabilityKeeper = capability.NewKeeper(codec, persistentStoreKey, memStoreKey) -} -``` - -After the keeper is created, it can be used to create scoped sub-keepers which -are passed to other modules that can create, authenticate, and claim capabilities. -After all the necessary scoped keepers are created and the state is loaded, the -main capability keeper must be sealed to prevent further scoped keepers from -being created. - -```go -func NewApp(...) *App { - // ... - - // Creating a scoped keeper - scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibchost.ModuleName) - - // Seal the capability keeper to prevent any further modules from creating scoped - // sub-keepers. - app.capabilityKeeper.Seal() - - return app -} -``` - -## Contents - -* [Concepts](#concepts) - * [Capabilities](#capabilities) - * [Stores](#stores) -* [State](#state) - * [In persisted KV store](#in-persisted-kv-store) - * [In-memory KV store](#in-memory-kv-store) - -## Concepts - -### Capabilities - -Capabilities are multi-owner. A scoped keeper can create a capability via `NewCapability` -which creates a new unique, unforgeable object-capability reference. The newly -created capability is automatically persisted; the calling module need not call -`ClaimCapability`. Calling `NewCapability` will create the capability with the -calling module and name as a tuple to be treated the capabilities first owner. - -Capabilities can be claimed by other modules which add them as owners. `ClaimCapability` -allows a module to claim a capability key which it has received from another -module so that future `GetCapability` calls will succeed. `ClaimCapability` MUST -be called if a module which receives a capability wishes to access it by name in -the future. Again, capabilities are multi-owner, so if multiple modules have a -single Capability reference, they will all own it. If a module receives a capability -from another module but does not call `ClaimCapability`, it may use it in the executing -transaction but will not be able to access it afterwards. - -`AuthenticateCapability` can be called by any module to check that a capability -does in fact correspond to a particular name (the name can be un-trusted user input) -with which the calling module previously associated it. - -`GetCapability` allows a module to fetch a capability which it has previously -claimed by name. The module is not allowed to retrieve capabilities which it does -not own. - -### Stores - -* MemStore -* KeyStore - -## State - -### In persisted KV store - -1. Global unique capability index -2. Capability owners - -Indexes: - -* Unique index: `[]byte("index") -> []byte(currentGlobalIndex)` -* Capability Index: `[]byte("capability_index") | []byte(index) -> ProtocolBuffer(CapabilityOwners)` - -### In-memory KV store - -1. Initialized flag -2. Mapping between the module and capability tuple and the capability name -3. Mapping between the module and capability name and its index - -Indexes: - -* Initialized flag: `[]byte("mem_initialized")` -* RevCapabilityKey: `[]byte(moduleName + "/rev/" + capabilityName) -> []byte(index)` -* FwdCapabilityKey: `[]byte(moduleName + "/fwd/" + capabilityPointerAddress) -> []byte(capabilityName)` diff --git a/x/capability/capability_test.go b/x/capability/capability_test.go deleted file mode 100644 index a907b3989221..000000000000 --- a/x/capability/capability_test.go +++ /dev/null @@ -1,108 +0,0 @@ -package capability_test - -import ( - "testing" - - abci "github.com/cometbft/cometbft/abci/types" - cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" - "github.com/stretchr/testify/suite" - - storetypes "cosmossdk.io/store/types" - - "github.com/cosmos/cosmos-sdk/baseapp" - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/runtime" - simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" - sdk "github.com/cosmos/cosmos-sdk/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/cosmos/cosmos-sdk/x/capability" - "github.com/cosmos/cosmos-sdk/x/capability/keeper" - "github.com/cosmos/cosmos-sdk/x/capability/testutil" - "github.com/cosmos/cosmos-sdk/x/capability/types" -) - -type CapabilityTestSuite struct { - suite.Suite - - app *runtime.App - cdc codec.Codec - ctx sdk.Context - keeper *keeper.Keeper - memKey *storetypes.MemoryStoreKey -} - -func (suite *CapabilityTestSuite) SetupTest() { - suite.memKey = storetypes.NewMemoryStoreKey("testingkey") - - startupCfg := simtestutil.DefaultStartUpConfig() - startupCfg.BaseAppOption = func(ba *baseapp.BaseApp) { - ba.MountStores(suite.memKey) - } - - app, err := simtestutil.SetupWithConfiguration(testutil.AppConfig, - startupCfg, - &suite.cdc, - &suite.keeper, - ) - suite.Require().NoError(err) - - suite.app = app - suite.ctx = app.BaseApp.NewContext(false, cmtproto.Header{Height: 1}) -} - -// The following test case mocks a specific bug discovered in https://github.com/cosmos/cosmos-sdk/issues/9800 -// and ensures that the current code successfully fixes the issue. -func (suite *CapabilityTestSuite) TestInitializeMemStore() { - sk1 := suite.keeper.ScopeToModule(banktypes.ModuleName) - - cap1, err := sk1.NewCapability(suite.ctx, "transfer") - suite.Require().NoError(err) - suite.Require().NotNil(cap1) - - // mock statesync by creating new keeper that shares persistent state but loses in-memory map - newKeeper := keeper.NewKeeper(suite.cdc, suite.app.UnsafeFindStoreKey(types.StoreKey).(*storetypes.KVStoreKey), suite.memKey) - newSk1 := newKeeper.ScopeToModule(banktypes.ModuleName) - - // Mock App startup - ctx := suite.app.BaseApp.NewUncachedContext(false, cmtproto.Header{}) - newKeeper.Seal() - suite.Require().False(newKeeper.IsInitialized(ctx), "memstore initialized flag set before BeginBlock") - - // Mock app beginblock and ensure that no gas has been consumed and memstore is initialized - ctx = suite.app.BaseApp.NewContext(false, cmtproto.Header{}).WithBlockGasMeter(storetypes.NewGasMeter(50)) - prevBlockGas := ctx.BlockGasMeter().GasConsumed() - prevGas := ctx.GasMeter().GasConsumed() - restartedModule := capability.NewAppModule(suite.cdc, *newKeeper, true) - restartedModule.BeginBlock(ctx, abci.RequestBeginBlock{}) - gasUsed := ctx.GasMeter().GasConsumed() - suite.Require().True(newKeeper.IsInitialized(ctx), "memstore initialized flag not set") - blockGasUsed := ctx.BlockGasMeter().GasConsumed() - - suite.Require().Equal(prevBlockGas, blockGasUsed, "ensure beginblocker consumed no block gas during execution") - suite.Require().Equal(prevGas, gasUsed, "ensure beginblocker consumed no gas during execution") - - // Mock the first transaction getting capability and subsequently failing - // by using a cached context and discarding all cached writes. - cacheCtx, _ := ctx.CacheContext() - _, ok := newSk1.GetCapability(cacheCtx, "transfer") - suite.Require().True(ok) - - // Ensure that the second transaction can still receive capability even if first tx fails. - ctx = suite.app.BaseApp.NewContext(false, cmtproto.Header{}) - - cap1, ok = newSk1.GetCapability(ctx, "transfer") - suite.Require().True(ok) - - // Ensure the capabilities don't get reinitialized on next BeginBlock - // by testing to see if capability returns same pointer - // also check that initialized flag is still set - restartedModule.BeginBlock(ctx, abci.RequestBeginBlock{}) - recap, ok := newSk1.GetCapability(ctx, "transfer") - suite.Require().True(ok) - suite.Require().Equal(cap1, recap, "capabilities got reinitialized after second BeginBlock") - suite.Require().True(newKeeper.IsInitialized(ctx), "memstore initialized flag not set") -} - -func TestCapabilityTestSuite(t *testing.T) { - suite.Run(t, new(CapabilityTestSuite)) -} diff --git a/x/capability/genesis.go b/x/capability/genesis.go deleted file mode 100644 index 2e9a11b994be..000000000000 --- a/x/capability/genesis.go +++ /dev/null @@ -1,46 +0,0 @@ -package capability - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/capability/keeper" - "github.com/cosmos/cosmos-sdk/x/capability/types" -) - -// InitGenesis initializes the capability module's state from a provided genesis -// state. -func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { - if err := k.InitializeIndex(ctx, genState.Index); err != nil { - panic(err) - } - - // set owners for each index - for _, genOwner := range genState.Owners { - k.SetOwners(ctx, genOwner.Index, genOwner.IndexOwners) - } - // initialize in-memory capabilities - k.InitMemStore(ctx) -} - -// ExportGenesis returns the capability module's exported genesis. -func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { - index := k.GetLatestIndex(ctx) - owners := []types.GenesisOwners{} - - for i := uint64(1); i < index; i++ { - capabilityOwners, ok := k.GetOwners(ctx, i) - if !ok || len(capabilityOwners.Owners) == 0 { - continue - } - - genOwner := types.GenesisOwners{ - Index: i, - IndexOwners: capabilityOwners, - } - owners = append(owners, genOwner) - } - - return &types.GenesisState{ - Index: index, - Owners: owners, - } -} diff --git a/x/capability/genesis_test.go b/x/capability/genesis_test.go deleted file mode 100644 index 9dc9798fae97..000000000000 --- a/x/capability/genesis_test.go +++ /dev/null @@ -1,56 +0,0 @@ -package capability_test - -import ( - storetypes "cosmossdk.io/store/types" - cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" - - simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/cosmos/cosmos-sdk/x/capability" - "github.com/cosmos/cosmos-sdk/x/capability/keeper" - "github.com/cosmos/cosmos-sdk/x/capability/testutil" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" -) - -func (suite *CapabilityTestSuite) TestGenesis() { - sk1 := suite.keeper.ScopeToModule(banktypes.ModuleName) - sk2 := suite.keeper.ScopeToModule(stakingtypes.ModuleName) - - cap1, err := sk1.NewCapability(suite.ctx, "transfer") - suite.Require().NoError(err) - suite.Require().NotNil(cap1) - - err = sk2.ClaimCapability(suite.ctx, cap1, "transfer") - suite.Require().NoError(err) - - cap2, err := sk2.NewCapability(suite.ctx, "ica") - suite.Require().NoError(err) - suite.Require().NotNil(cap2) - - genState := capability.ExportGenesis(suite.ctx, *suite.keeper) - - // create new app that does not share persistent or in-memory state - // and initialize app from exported genesis state above. - var newKeeper *keeper.Keeper - newApp, err := simtestutil.SetupAtGenesis(testutil.AppConfig, &newKeeper) - suite.Require().NoError(err) - - newSk1 := newKeeper.ScopeToModule(banktypes.ModuleName) - newSk2 := newKeeper.ScopeToModule(stakingtypes.ModuleName) - deliverCtx, _ := newApp.BaseApp.NewUncachedContext(false, cmtproto.Header{}).WithBlockGasMeter(storetypes.NewInfiniteGasMeter()).CacheContext() - - capability.InitGenesis(deliverCtx, *newKeeper, *genState) - - // check that all previous capabilities exist in new app after InitGenesis - sk1Cap1, ok := newSk1.GetCapability(deliverCtx, "transfer") - suite.Require().True(ok, "could not get first capability after genesis on first ScopedKeeper") - suite.Require().Equal(*cap1, *sk1Cap1, "capability values not equal on first ScopedKeeper") - - sk2Cap1, ok := newSk2.GetCapability(deliverCtx, "transfer") - suite.Require().True(ok, "could not get first capability after genesis on first ScopedKeeper") - suite.Require().Equal(*cap1, *sk2Cap1, "capability values not equal on first ScopedKeeper") - - sk2Cap2, ok := newSk2.GetCapability(deliverCtx, "ica") - suite.Require().True(ok, "could not get second capability after genesis on second ScopedKeeper") - suite.Require().Equal(*cap2, *sk2Cap2, "capability values not equal on second ScopedKeeper") -} diff --git a/x/capability/keeper/keeper.go b/x/capability/keeper/keeper.go deleted file mode 100644 index cb2294e9c88d..000000000000 --- a/x/capability/keeper/keeper.go +++ /dev/null @@ -1,497 +0,0 @@ -package keeper - -import ( - "fmt" - "strings" - - "cosmossdk.io/log" - - "cosmossdk.io/store/prefix" - storetypes "cosmossdk.io/store/types" - - "cosmossdk.io/errors" - - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/capability/types" -) - -type ( - // Keeper defines the capability module's keeper. It is responsible for provisioning, - // tracking, and authenticating capabilities at runtime. During application - // initialization, the keeper can be hooked up to modules through unique function - // references so that it can identify the calling module when later invoked. - // - // When the initial state is loaded from disk, the keeper allows the ability to - // create new capability keys for all previously allocated capability identifiers - // (allocated during execution of past transactions and assigned to particular modes), - // and keep them in a memory-only store while the chain is running. - // - // The keeper allows the ability to create scoped sub-keepers which are tied to - // a single specific module. - Keeper struct { - cdc codec.BinaryCodec - storeKey storetypes.StoreKey - memKey storetypes.StoreKey - capMap map[uint64]*types.Capability - scopedModules map[string]struct{} - sealed bool - } - - // ScopedKeeper defines a scoped sub-keeper which is tied to a single specific - // module provisioned by the capability keeper. Scoped keepers must be created - // at application initialization and passed to modules, which can then use them - // to claim capabilities they receive and retrieve capabilities which they own - // by name, in addition to creating new capabilities & authenticating capabilities - // passed by other modules. - ScopedKeeper struct { - cdc codec.BinaryCodec - storeKey storetypes.StoreKey - memKey storetypes.StoreKey - capMap map[uint64]*types.Capability - module string - } -) - -// NewKeeper constructs a new CapabilityKeeper instance and initializes maps -// for capability map and scopedModules map. -func NewKeeper(cdc codec.BinaryCodec, storeKey, memKey storetypes.StoreKey) *Keeper { - return &Keeper{ - cdc: cdc, - storeKey: storeKey, - memKey: memKey, - capMap: make(map[uint64]*types.Capability), - scopedModules: make(map[string]struct{}), - sealed: false, - } -} - -// ScopeToModule attempts to create and return a ScopedKeeper for a given module -// by name. It will panic if the keeper is already sealed or if the module name -// already has a ScopedKeeper. -func (k *Keeper) ScopeToModule(moduleName string) ScopedKeeper { - if k.sealed { - panic("cannot scope to module via a sealed capability keeper") - } - if strings.TrimSpace(moduleName) == "" { - panic("cannot scope to an empty module name") - } - - if _, ok := k.scopedModules[moduleName]; ok { - panic(fmt.Sprintf("cannot create multiple scoped keepers for the same module name: %s", moduleName)) - } - - k.scopedModules[moduleName] = struct{}{} - - return ScopedKeeper{ - cdc: k.cdc, - storeKey: k.storeKey, - memKey: k.memKey, - capMap: k.capMap, - module: moduleName, - } -} - -// Seal seals the keeper to prevent further modules from creating a scoped keeper. -// Seal may be called during app initialization for applications that do not wish to create scoped keepers dynamically. -func (k *Keeper) Seal() { - if k.sealed { - panic("cannot initialize and seal an already sealed capability keeper") - } - - k.sealed = true -} - -// IsSealed returns if the keeper is sealed. -func (k *Keeper) IsSealed() bool { - return k.sealed -} - -// InitMemStore will assure that the module store is a memory store (it will panic if it's not) -// and willl initialize it. The function is safe to be called multiple times. -// InitMemStore must be called every time the app starts before the keeper is used (so -// `BeginBlock` or `InitChain` - whichever is first). We need access to the store so we -// can't initialize it in a constructor. -func (k *Keeper) InitMemStore(ctx sdk.Context) { - memStore := ctx.KVStore(k.memKey) - memStoreType := memStore.GetStoreType() - - if memStoreType != storetypes.StoreTypeMemory { - panic(fmt.Sprintf("invalid memory store type; got %s, expected: %s", memStoreType, storetypes.StoreTypeMemory)) - } - - // Create a context with no `BlockGasMeter`, and no `GasMeter`. This ensures we do not consume gas during local - // initialization logic. - noGasCtx := ctx.WithBlockGasMeter(storetypes.NewInfiniteGasMeter()).WithGasMeter(storetypes.NewInfiniteGasMeter()) - - // check if memory store has not been initialized yet by checking if initialized flag is nil. - if !k.IsInitialized(noGasCtx) { - prefixStore := prefix.NewStore(noGasCtx.KVStore(k.storeKey), types.KeyPrefixIndexCapability) - iterator := storetypes.KVStorePrefixIterator(prefixStore, nil) - - // initialize the in-memory store for all persisted capabilities - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - index := types.IndexFromKey(iterator.Key()) - - var capOwners types.CapabilityOwners - - k.cdc.MustUnmarshal(iterator.Value(), &capOwners) - k.InitializeCapability(noGasCtx, index, capOwners) - } - - // set the initialized flag so we don't rerun initialization logic - memStore := noGasCtx.KVStore(k.memKey) - memStore.Set(types.KeyMemInitialized, []byte{1}) - } -} - -// IsInitialized returns true if the keeper is properly initialized, and false otherwise. -func (k *Keeper) IsInitialized(ctx sdk.Context) bool { - memStore := ctx.KVStore(k.memKey) - return memStore.Get(types.KeyMemInitialized) != nil -} - -// InitializeIndex sets the index to one (or greater) in InitChain according -// to the GenesisState. It must only be called once. -// It will panic if the provided index is 0, or if the index is already set. -func (k Keeper) InitializeIndex(ctx sdk.Context, index uint64) error { - if index == 0 { - panic("SetIndex requires index > 0") - } - latest := k.GetLatestIndex(ctx) - if latest > 0 { - panic("SetIndex requires index to not be set") - } - - // set the global index to the passed index - store := ctx.KVStore(k.storeKey) - store.Set(types.KeyIndex, types.IndexToKey(index)) - return nil -} - -// GetLatestIndex returns the latest index of the CapabilityKeeper -func (k Keeper) GetLatestIndex(ctx sdk.Context) uint64 { - store := ctx.KVStore(k.storeKey) - return types.IndexFromKey(store.Get(types.KeyIndex)) -} - -// SetOwners set the capability owners to the store -func (k Keeper) SetOwners(ctx sdk.Context, index uint64, owners types.CapabilityOwners) { - prefixStore := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixIndexCapability) - indexKey := types.IndexToKey(index) - - // set owners in persistent store - prefixStore.Set(indexKey, k.cdc.MustMarshal(&owners)) -} - -// GetOwners returns the capability owners with a given index. -func (k Keeper) GetOwners(ctx sdk.Context, index uint64) (types.CapabilityOwners, bool) { - prefixStore := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixIndexCapability) - indexKey := types.IndexToKey(index) - - // get owners for index from persistent store - ownerBytes := prefixStore.Get(indexKey) - if ownerBytes == nil { - return types.CapabilityOwners{}, false - } - var owners types.CapabilityOwners - k.cdc.MustUnmarshal(ownerBytes, &owners) - return owners, true -} - -// InitializeCapability takes in an index and an owners array. It creates the capability in memory -// and sets the fwd and reverse keys for each owner in the memstore. -// It is used during initialization from genesis. -func (k Keeper) InitializeCapability(ctx sdk.Context, index uint64, owners types.CapabilityOwners) { - memStore := ctx.KVStore(k.memKey) - - cap := types.NewCapability(index) - for _, owner := range owners.Owners { - // Set the forward mapping between the module and capability tuple and the - // capability name in the memKVStore - memStore.Set(types.FwdCapabilityKey(owner.Module, cap), []byte(owner.Name)) - - // Set the reverse mapping between the module and capability name and the - // index in the in-memory store. Since marshalling and unmarshalling into a store - // will change memory address of capability, we simply store index as value here - // and retrieve the in-memory pointer to the capability from our map - memStore.Set(types.RevCapabilityKey(owner.Module, owner.Name), sdk.Uint64ToBigEndian(index)) - - // Set the mapping from index from index to in-memory capability in the go map - k.capMap[index] = cap - } -} - -// NewCapability attempts to create a new capability with a given name. If the -// capability already exists in the in-memory store, an error will be returned. -// Otherwise, a new capability is created with the current global unique index. -// The newly created capability has the scoped module name and capability name -// tuple set as the initial owner. Finally, the global index is incremented along -// with forward and reverse indexes set in the in-memory store. -// -// Note, namespacing is completely local, which is safe since records are prefixed -// with the module name and no two ScopedKeeper can have the same module name. -func (sk ScopedKeeper) NewCapability(ctx sdk.Context, name string) (*types.Capability, error) { - if strings.TrimSpace(name) == "" { - return nil, errors.Wrap(types.ErrInvalidCapabilityName, "capability name cannot be empty") - } - store := ctx.KVStore(sk.storeKey) - - if _, ok := sk.GetCapability(ctx, name); ok { - return nil, errors.Wrapf(types.ErrCapabilityTaken, fmt.Sprintf("module: %s, name: %s", sk.module, name)) - } - - // create new capability with the current global index - index := types.IndexFromKey(store.Get(types.KeyIndex)) - cap := types.NewCapability(index) - - // update capability owner set - if err := sk.addOwner(ctx, cap, name); err != nil { - return nil, err - } - - // increment global index - store.Set(types.KeyIndex, types.IndexToKey(index+1)) - - memStore := ctx.KVStore(sk.memKey) - - // Set the forward mapping between the module and capability tuple and the - // capability name in the memKVStore - memStore.Set(types.FwdCapabilityKey(sk.module, cap), []byte(name)) - - // Set the reverse mapping between the module and capability name and the - // index in the in-memory store. Since marshalling and unmarshalling into a store - // will change memory address of capability, we simply store index as value here - // and retrieve the in-memory pointer to the capability from our map - memStore.Set(types.RevCapabilityKey(sk.module, name), sdk.Uint64ToBigEndian(index)) - - // Set the mapping from index from index to in-memory capability in the go map - sk.capMap[index] = cap - - logger(ctx).Info("created new capability", "module", sk.module, "name", name) - - return cap, nil -} - -// AuthenticateCapability attempts to authenticate a given capability and name -// from a caller. It allows for a caller to check that a capability does in fact -// correspond to a particular name. The scoped keeper will lookup the capability -// from the internal in-memory store and check against the provided name. It returns -// true upon success and false upon failure. -// -// Note, the capability's forward mapping is indexed by a string which should -// contain its unique memory reference. -func (sk ScopedKeeper) AuthenticateCapability(ctx sdk.Context, cap *types.Capability, name string) bool { - if strings.TrimSpace(name) == "" || cap == nil { - return false - } - return sk.GetCapabilityName(ctx, cap) == name -} - -// ClaimCapability attempts to claim a given Capability. The provided name and -// the scoped module's name tuple are treated as the owner. It will attempt -// to add the owner to the persistent set of capability owners for the capability -// index. If the owner already exists, it will return an error. Otherwise, it will -// also set a forward and reverse index for the capability and capability name. -func (sk ScopedKeeper) ClaimCapability(ctx sdk.Context, cap *types.Capability, name string) error { - if cap == nil { - return errors.Wrap(types.ErrNilCapability, "cannot claim nil capability") - } - if strings.TrimSpace(name) == "" { - return errors.Wrap(types.ErrInvalidCapabilityName, "capability name cannot be empty") - } - // update capability owner set - if err := sk.addOwner(ctx, cap, name); err != nil { - return err - } - - memStore := ctx.KVStore(sk.memKey) - - // Set the forward mapping between the module and capability tuple and the - // capability name in the memKVStore - memStore.Set(types.FwdCapabilityKey(sk.module, cap), []byte(name)) - - // Set the reverse mapping between the module and capability name and the - // index in the in-memory store. Since marshalling and unmarshalling into a store - // will change memory address of capability, we simply store index as value here - // and retrieve the in-memory pointer to the capability from our map - memStore.Set(types.RevCapabilityKey(sk.module, name), sdk.Uint64ToBigEndian(cap.GetIndex())) - - logger(ctx).Info("claimed capability", "module", sk.module, "name", name, "capability", cap.GetIndex()) - - return nil -} - -// ReleaseCapability allows a scoped module to release a capability which it had -// previously claimed or created. After releasing the capability, if no more -// owners exist, the capability will be globally removed. -func (sk ScopedKeeper) ReleaseCapability(ctx sdk.Context, cap *types.Capability) error { - if cap == nil { - return errors.Wrap(types.ErrNilCapability, "cannot release nil capability") - } - name := sk.GetCapabilityName(ctx, cap) - if len(name) == 0 { - return errors.Wrap(types.ErrCapabilityNotOwned, sk.module) - } - - memStore := ctx.KVStore(sk.memKey) - - // Delete the forward mapping between the module and capability tuple and the - // capability name in the memKVStore - memStore.Delete(types.FwdCapabilityKey(sk.module, cap)) - - // Delete the reverse mapping between the module and capability name and the - // index in the in-memory store. - memStore.Delete(types.RevCapabilityKey(sk.module, name)) - - // remove owner - capOwners := sk.getOwners(ctx, cap) - capOwners.Remove(types.NewOwner(sk.module, name)) - - prefixStore := prefix.NewStore(ctx.KVStore(sk.storeKey), types.KeyPrefixIndexCapability) - indexKey := types.IndexToKey(cap.GetIndex()) - - if len(capOwners.Owners) == 0 { - // remove capability owner set - prefixStore.Delete(indexKey) - // since no one owns capability, we can delete capability from map - delete(sk.capMap, cap.GetIndex()) - } else { - // update capability owner set - prefixStore.Set(indexKey, sk.cdc.MustMarshal(capOwners)) - } - - return nil -} - -// GetCapability allows a module to fetch a capability which it previously claimed -// by name. The module is not allowed to retrieve capabilities which it does not -// own. -func (sk ScopedKeeper) GetCapability(ctx sdk.Context, name string) (*types.Capability, bool) { - if strings.TrimSpace(name) == "" { - return nil, false - } - memStore := ctx.KVStore(sk.memKey) - - key := types.RevCapabilityKey(sk.module, name) - indexBytes := memStore.Get(key) - index := sdk.BigEndianToUint64(indexBytes) - - if len(indexBytes) == 0 { - // If a tx failed and NewCapability got reverted, it is possible - // to still have the capability in the go map since changes to - // go map do not automatically get reverted on tx failure, - // so we delete here to remove unnecessary values in map - // TODO: Delete index correctly from capMap by storing some reverse lookup - // in-memory map. Issue: https://github.com/cosmos/cosmos-sdk/issues/7805 - - return nil, false - } - - cap := sk.capMap[index] - if cap == nil { - panic("capability found in memstore is missing from map") - } - - return cap, true -} - -// GetCapabilityName allows a module to retrieve the name under which it stored a given -// capability given the capability -func (sk ScopedKeeper) GetCapabilityName(ctx sdk.Context, cap *types.Capability) string { - if cap == nil { - return "" - } - memStore := ctx.KVStore(sk.memKey) - - return string(memStore.Get(types.FwdCapabilityKey(sk.module, cap))) -} - -// GetOwners all the Owners that own the capability associated with the name this ScopedKeeper uses -// to refer to the capability -func (sk ScopedKeeper) GetOwners(ctx sdk.Context, name string) (*types.CapabilityOwners, bool) { - if strings.TrimSpace(name) == "" { - return nil, false - } - cap, ok := sk.GetCapability(ctx, name) - if !ok { - return nil, false - } - - prefixStore := prefix.NewStore(ctx.KVStore(sk.storeKey), types.KeyPrefixIndexCapability) - indexKey := types.IndexToKey(cap.GetIndex()) - - var capOwners types.CapabilityOwners - - bz := prefixStore.Get(indexKey) - if len(bz) == 0 { - return nil, false - } - - sk.cdc.MustUnmarshal(bz, &capOwners) - - return &capOwners, true -} - -// LookupModules returns all the module owners for a given capability -// as a string array and the capability itself. -// The method returns an error if either the capability or the owners cannot be -// retreived from the memstore. -func (sk ScopedKeeper) LookupModules(ctx sdk.Context, name string) ([]string, *types.Capability, error) { - if strings.TrimSpace(name) == "" { - return nil, nil, errors.Wrap(types.ErrInvalidCapabilityName, "cannot lookup modules with empty capability name") - } - cap, ok := sk.GetCapability(ctx, name) - if !ok { - return nil, nil, errors.Wrap(types.ErrCapabilityNotFound, name) - } - - capOwners, ok := sk.GetOwners(ctx, name) - if !ok { - return nil, nil, errors.Wrap(types.ErrCapabilityOwnersNotFound, name) - } - - mods := make([]string, len(capOwners.Owners)) - for i, co := range capOwners.Owners { - mods[i] = co.Module - } - - return mods, cap, nil -} - -func (sk ScopedKeeper) addOwner(ctx sdk.Context, cap *types.Capability, name string) error { - prefixStore := prefix.NewStore(ctx.KVStore(sk.storeKey), types.KeyPrefixIndexCapability) - indexKey := types.IndexToKey(cap.GetIndex()) - - capOwners := sk.getOwners(ctx, cap) - - if err := capOwners.Set(types.NewOwner(sk.module, name)); err != nil { - return err - } - - // update capability owner set - prefixStore.Set(indexKey, sk.cdc.MustMarshal(capOwners)) - - return nil -} - -func (sk ScopedKeeper) getOwners(ctx sdk.Context, cap *types.Capability) *types.CapabilityOwners { - prefixStore := prefix.NewStore(ctx.KVStore(sk.storeKey), types.KeyPrefixIndexCapability) - indexKey := types.IndexToKey(cap.GetIndex()) - - bz := prefixStore.Get(indexKey) - - if len(bz) == 0 { - return types.NewCapabilityOwners() - } - - var capOwners types.CapabilityOwners - sk.cdc.MustUnmarshal(bz, &capOwners) - return &capOwners -} - -func logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) -} diff --git a/x/capability/keeper/keeper_test.go b/x/capability/keeper/keeper_test.go deleted file mode 100644 index 61d5ddf6b932..000000000000 --- a/x/capability/keeper/keeper_test.go +++ /dev/null @@ -1,310 +0,0 @@ -package keeper_test - -import ( - "fmt" - "testing" - - "github.com/stretchr/testify/suite" - - storetypes "cosmossdk.io/store/types" - - "github.com/cosmos/cosmos-sdk/testutil" - sdk "github.com/cosmos/cosmos-sdk/types" - moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" - "github.com/cosmos/cosmos-sdk/x/capability" - "github.com/cosmos/cosmos-sdk/x/capability/keeper" - "github.com/cosmos/cosmos-sdk/x/capability/types" -) - -var ( - stakingModuleName = "staking" - bankModuleName = "bank" -) - -type KeeperTestSuite struct { - suite.Suite - - ctx sdk.Context - keeper *keeper.Keeper -} - -func (suite *KeeperTestSuite) SetupTest() { - key := storetypes.NewKVStoreKey(types.StoreKey) - testCtx := testutil.DefaultContextWithDB(suite.T(), key, storetypes.NewTransientStoreKey("transient_test")) - suite.ctx = testCtx.Ctx - encCfg := moduletestutil.MakeTestEncodingConfig(capability.AppModuleBasic{}) - suite.keeper = keeper.NewKeeper(encCfg.Codec, key, key) -} - -func (suite *KeeperTestSuite) TestSeal() { - sk := suite.keeper.ScopeToModule(bankModuleName) - suite.Require().Panics(func() { - suite.keeper.ScopeToModule(" ") - }) - - caps := make([]*types.Capability, 5) - // Get Latest Index before creating new ones to sychronize indices correctly - prevIndex := suite.keeper.GetLatestIndex(suite.ctx) - - for i := range caps { - cap, err := sk.NewCapability(suite.ctx, fmt.Sprintf("transfer-%d", i)) - suite.Require().NoError(err) - suite.Require().NotNil(cap) - suite.Require().Equal(uint64(i)+prevIndex, cap.GetIndex()) - - caps[i] = cap - } - - suite.Require().NotPanics(func() { - suite.keeper.Seal() - }) - - for i, cap := range caps { - got, ok := sk.GetCapability(suite.ctx, fmt.Sprintf("transfer-%d", i)) - suite.Require().True(ok) - suite.Require().Equal(cap, got) - suite.Require().Equal(uint64(i)+prevIndex, got.GetIndex()) - } - - suite.Require().Panics(func() { - suite.keeper.Seal() - }) - - suite.Require().Panics(func() { - _ = suite.keeper.ScopeToModule(stakingModuleName) - }) -} - -func (suite *KeeperTestSuite) TestNewCapability() { - sk := suite.keeper.ScopeToModule(bankModuleName) - - got, ok := sk.GetCapability(suite.ctx, "transfer") - suite.Require().False(ok) - suite.Require().Nil(got) - - cap, err := sk.NewCapability(suite.ctx, "transfer") - suite.Require().NoError(err) - suite.Require().NotNil(cap) - - got, ok = sk.GetCapability(suite.ctx, "transfer") - suite.Require().True(ok) - suite.Require().Equal(cap, got) - suite.Require().True(cap == got, "expected memory addresses to be equal") - - got, ok = sk.GetCapability(suite.ctx, "invalid") - suite.Require().False(ok) - suite.Require().Nil(got) - - got, ok = sk.GetCapability(suite.ctx, "transfer") - suite.Require().True(ok) - suite.Require().Equal(cap, got) - suite.Require().True(cap == got, "expected memory addresses to be equal") - - cap2, err := sk.NewCapability(suite.ctx, "transfer") - suite.Require().Error(err) - suite.Require().Nil(cap2) - - got, ok = sk.GetCapability(suite.ctx, "transfer") - suite.Require().True(ok) - suite.Require().Equal(cap, got) - suite.Require().True(cap == got, "expected memory addresses to be equal") - - cap, err = sk.NewCapability(suite.ctx, " ") - suite.Require().Error(err) - suite.Require().Nil(cap) -} - -func (suite *KeeperTestSuite) TestAuthenticateCapability() { - sk1 := suite.keeper.ScopeToModule(bankModuleName) - sk2 := suite.keeper.ScopeToModule(stakingModuleName) - - cap1, err := sk1.NewCapability(suite.ctx, "transfer") - suite.Require().NoError(err) - suite.Require().NotNil(cap1) - - forgedCap := types.NewCapability(cap1.Index) // index should be the same index as the first capability - suite.Require().False(sk1.AuthenticateCapability(suite.ctx, forgedCap, "transfer")) - suite.Require().False(sk2.AuthenticateCapability(suite.ctx, forgedCap, "transfer")) - - cap2, err := sk2.NewCapability(suite.ctx, "bond") - suite.Require().NoError(err) - suite.Require().NotNil(cap2) - - got, ok := sk1.GetCapability(suite.ctx, "transfer") - suite.Require().True(ok) - - suite.Require().True(sk1.AuthenticateCapability(suite.ctx, cap1, "transfer")) - suite.Require().True(sk1.AuthenticateCapability(suite.ctx, got, "transfer")) - suite.Require().False(sk1.AuthenticateCapability(suite.ctx, cap1, "invalid")) - suite.Require().False(sk1.AuthenticateCapability(suite.ctx, cap2, "transfer")) - - suite.Require().True(sk2.AuthenticateCapability(suite.ctx, cap2, "bond")) - suite.Require().False(sk2.AuthenticateCapability(suite.ctx, cap2, "invalid")) - suite.Require().False(sk2.AuthenticateCapability(suite.ctx, cap1, "bond")) - - sk2.ReleaseCapability(suite.ctx, cap2) - suite.Require().False(sk2.AuthenticateCapability(suite.ctx, cap2, "bond")) - - badCap := types.NewCapability(100) - suite.Require().False(sk1.AuthenticateCapability(suite.ctx, badCap, "transfer")) - suite.Require().False(sk2.AuthenticateCapability(suite.ctx, badCap, "bond")) - - suite.Require().False(sk1.AuthenticateCapability(suite.ctx, cap1, " ")) - suite.Require().False(sk1.AuthenticateCapability(suite.ctx, nil, "transfer")) -} - -func (suite *KeeperTestSuite) TestClaimCapability() { - sk1 := suite.keeper.ScopeToModule(bankModuleName) - sk2 := suite.keeper.ScopeToModule(stakingModuleName) - sk3 := suite.keeper.ScopeToModule("foo") - - cap, err := sk1.NewCapability(suite.ctx, "transfer") - suite.Require().NoError(err) - suite.Require().NotNil(cap) - - suite.Require().Error(sk1.ClaimCapability(suite.ctx, cap, "transfer")) - suite.Require().NoError(sk2.ClaimCapability(suite.ctx, cap, "transfer")) - - got, ok := sk1.GetCapability(suite.ctx, "transfer") - suite.Require().True(ok) - suite.Require().Equal(cap, got) - - got, ok = sk2.GetCapability(suite.ctx, "transfer") - suite.Require().True(ok) - suite.Require().Equal(cap, got) - - suite.Require().Error(sk3.ClaimCapability(suite.ctx, cap, " ")) - suite.Require().Error(sk3.ClaimCapability(suite.ctx, nil, "transfer")) -} - -func (suite *KeeperTestSuite) TestGetOwners() { - sk1 := suite.keeper.ScopeToModule(bankModuleName) - sk2 := suite.keeper.ScopeToModule(stakingModuleName) - sk3 := suite.keeper.ScopeToModule("foo") - - sks := []keeper.ScopedKeeper{sk1, sk2, sk3} - - cap, err := sk1.NewCapability(suite.ctx, "transfer") - suite.Require().NoError(err) - suite.Require().NotNil(cap) - - suite.Require().NoError(sk2.ClaimCapability(suite.ctx, cap, "transfer")) - suite.Require().NoError(sk3.ClaimCapability(suite.ctx, cap, "transfer")) - - expectedOrder := []string{bankModuleName, "foo", stakingModuleName} - // Ensure all scoped keepers can get owners - for _, sk := range sks { - owners, ok := sk.GetOwners(suite.ctx, "transfer") - mods, gotCap, err := sk.LookupModules(suite.ctx, "transfer") - - suite.Require().True(ok, "could not retrieve owners") - suite.Require().NotNil(owners, "owners is nil") - - suite.Require().NoError(err, "could not retrieve modules") - suite.Require().NotNil(gotCap, "capability is nil") - suite.Require().NotNil(mods, "modules is nil") - suite.Require().Equal(cap, gotCap, "caps not equal") - - suite.Require().Equal(len(expectedOrder), len(owners.Owners), "length of owners is unexpected") - for i, o := range owners.Owners { - // Require owner is in expected position - suite.Require().Equal(expectedOrder[i], o.Module, "module is unexpected") - suite.Require().Equal(expectedOrder[i], mods[i], "module in lookup is unexpected") - } - } - - // foo module releases capability - err = sk3.ReleaseCapability(suite.ctx, cap) - suite.Require().Nil(err, "could not release capability") - - // new expected order and scoped capabilities - expectedOrder = []string{bankModuleName, stakingModuleName} - sks = []keeper.ScopedKeeper{sk1, sk2} - - // Ensure all scoped keepers can get owners - for _, sk := range sks { - owners, ok := sk.GetOwners(suite.ctx, "transfer") - mods, cap, err := sk.LookupModules(suite.ctx, "transfer") - - suite.Require().True(ok, "could not retrieve owners") - suite.Require().NotNil(owners, "owners is nil") - - suite.Require().NoError(err, "could not retrieve modules") - suite.Require().NotNil(cap, "capability is nil") - suite.Require().NotNil(mods, "modules is nil") - - suite.Require().Equal(len(expectedOrder), len(owners.Owners), "length of owners is unexpected") - for i, o := range owners.Owners { - // Require owner is in expected position - suite.Require().Equal(expectedOrder[i], o.Module, "module is unexpected") - suite.Require().Equal(expectedOrder[i], mods[i], "module in lookup is unexpected") - } - } - - _, ok := sk1.GetOwners(suite.ctx, " ") - suite.Require().False(ok, "got owners from empty capability name") -} - -func (suite *KeeperTestSuite) TestReleaseCapability() { - sk1 := suite.keeper.ScopeToModule(bankModuleName) - sk2 := suite.keeper.ScopeToModule(stakingModuleName) - - cap1, err := sk1.NewCapability(suite.ctx, "transfer") - suite.Require().NoError(err) - suite.Require().NotNil(cap1) - - suite.Require().NoError(sk2.ClaimCapability(suite.ctx, cap1, "transfer")) - - cap2, err := sk2.NewCapability(suite.ctx, "bond") - suite.Require().NoError(err) - suite.Require().NotNil(cap2) - - suite.Require().Error(sk1.ReleaseCapability(suite.ctx, cap2)) - - suite.Require().NoError(sk2.ReleaseCapability(suite.ctx, cap1)) - got, ok := sk2.GetCapability(suite.ctx, "transfer") - suite.Require().False(ok) - suite.Require().Nil(got) - - suite.Require().NoError(sk1.ReleaseCapability(suite.ctx, cap1)) - got, ok = sk1.GetCapability(suite.ctx, "transfer") - suite.Require().False(ok) - suite.Require().Nil(got) - - suite.Require().Error(sk1.ReleaseCapability(suite.ctx, nil)) -} - -func (suite *KeeperTestSuite) TestRevertCapability() { - sk := suite.keeper.ScopeToModule(bankModuleName) - - ms := suite.ctx.MultiStore() - - msCache := ms.CacheMultiStore() - cacheCtx := suite.ctx.WithMultiStore(msCache) - - capName := "revert" - // Create capability on cached context - cap, err := sk.NewCapability(cacheCtx, capName) - suite.Require().NoError(err, "could not create capability") - - // Check that capability written in cached context - gotCache, ok := sk.GetCapability(cacheCtx, capName) - suite.Require().True(ok, "could not retrieve capability from cached context") - suite.Require().Equal(cap, gotCache, "did not get correct capability from cached context") - - // Check that capability is NOT written to original context - got, ok := sk.GetCapability(suite.ctx, capName) - suite.Require().False(ok, "retrieved capability from original context before write") - suite.Require().Nil(got, "capability not nil in original store") - - // Write to underlying memKVStore - msCache.Write() - - got, ok = sk.GetCapability(suite.ctx, capName) - suite.Require().True(ok, "could not retrieve capability from context") - suite.Require().Equal(cap, got, "did not get correct capability from context") -} - -func TestKeeperTestSuite(t *testing.T) { - suite.Run(t, new(KeeperTestSuite)) -} diff --git a/x/capability/module.go b/x/capability/module.go deleted file mode 100644 index 914b86e542fd..000000000000 --- a/x/capability/module.go +++ /dev/null @@ -1,213 +0,0 @@ -package capability - -import ( - "encoding/json" - "fmt" - "time" - - gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" - - "cosmossdk.io/core/appmodule" - - abci "github.com/cometbft/cometbft/abci/types" - - modulev1 "cosmossdk.io/api/cosmos/capability/module/v1" - "cosmossdk.io/depinject" - - store "cosmossdk.io/store/types" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - "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" - "github.com/cosmos/cosmos-sdk/x/capability/keeper" - "github.com/cosmos/cosmos-sdk/x/capability/simulation" - "github.com/cosmos/cosmos-sdk/x/capability/types" -) - -var ( - _ module.BeginBlockAppModule = AppModule{} - _ module.AppModuleBasic = AppModuleBasic{} - _ module.AppModuleSimulation = AppModule{} -) - -// ---------------------------------------------------------------------------- -// AppModuleBasic -// ---------------------------------------------------------------------------- - -// AppModuleBasic implements the AppModuleBasic interface for the capability module. -type AppModuleBasic struct { - cdc codec.Codec -} - -func NewAppModuleBasic(cdc codec.Codec) AppModuleBasic { - return AppModuleBasic{cdc: cdc} -} - -// Name returns the capability module's name. -func (AppModuleBasic) Name() string { - return types.ModuleName -} - -// RegisterLegacyAminoCodec does nothing. Capability does not support amino. -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {} - -// RegisterInterfaces registers the module's interface types -func (a AppModuleBasic) RegisterInterfaces(_ cdctypes.InterfaceRegistry) {} - -// DefaultGenesis returns the capability module's default genesis state. -func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(types.DefaultGenesis()) -} - -// ValidateGenesis performs genesis state validation for the capability module. -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { - var genState types.GenesisState - if err := cdc.UnmarshalJSON(bz, &genState); err != nil { - return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) - } - return genState.Validate() -} - -// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the capability module. -func (a AppModuleBasic) RegisterGRPCGatewayRoutes(_ client.Context, _ *gwruntime.ServeMux) { -} - -// GetTxCmd returns the capability module's root tx command. -func (a AppModuleBasic) GetTxCmd() *cobra.Command { return nil } - -// GetQueryCmd returns the capability module's root query command. -func (AppModuleBasic) GetQueryCmd() *cobra.Command { return nil } - -// ---------------------------------------------------------------------------- -// AppModule -// ---------------------------------------------------------------------------- - -// AppModule implements the AppModule interface for the capability module. -type AppModule struct { - AppModuleBasic - - keeper keeper.Keeper - - sealKeeper bool -} - -func NewAppModule(cdc codec.Codec, keeper keeper.Keeper, sealKeeper bool) AppModule { - return AppModule{ - AppModuleBasic: NewAppModuleBasic(cdc), - keeper: keeper, - sealKeeper: sealKeeper, - } -} - -var _ appmodule.AppModule = AppModule{} - -// IsOnePerModuleType implements the depinject.OnePerModuleType interface. -func (am AppModule) IsOnePerModuleType() {} - -// IsAppModule implements the appmodule.AppModule interface. -func (am AppModule) IsAppModule() {} - -// Name returns the capability module's name. -func (am AppModule) Name() string { - return am.AppModuleBasic.Name() -} - -// RegisterServices registers a GRPC query service to respond to the -// module-specific GRPC queries. -func (am AppModule) RegisterServices(module.Configurator) {} - -// RegisterInvariants registers the capability module's invariants. -func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} - -// InitGenesis performs the capability module's genesis initialization It returns -// no validator updates. -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate { - var genState types.GenesisState - // Initialize global index to index in genesis state - cdc.MustUnmarshalJSON(gs, &genState) - - InitGenesis(ctx, am.keeper, genState) - - return []abci.ValidatorUpdate{} -} - -// ExportGenesis returns the capability module's exported genesis state as raw JSON bytes. -func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { - genState := ExportGenesis(ctx, am.keeper) - return cdc.MustMarshalJSON(genState) -} - -// ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 1 } - -// BeginBlock executes all ABCI BeginBlock logic respective to the capability module. -// BeginBlocker calls InitMemStore to assert that the memory store is initialized. -// It's safe to run multiple times. -func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { - defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyBeginBlocker) - - am.keeper.InitMemStore(ctx) - - if am.sealKeeper && !am.keeper.IsSealed() { - am.keeper.Seal() - } -} - -// GenerateGenesisState creates a randomized GenState of the capability module. -func (AppModule) GenerateGenesisState(simState *module.SimulationState) { - simulation.RandomizedGenState(simState) -} - -// RegisterStoreDecoder registers a decoder for capability module's types -func (am AppModule) RegisterStoreDecoder(sdr simtypes.StoreDecoderRegistry) { - sdr[types.StoreKey] = simulation.NewDecodeStore(am.cdc) -} - -// WeightedOperations returns the all the gov module operations with their respective weights. -func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { - return nil -} - -// -// App Wiring Setup -// - -func init() { - appmodule.Register(&modulev1.Module{}, - appmodule.Provide(ProvideModule), - ) -} - -//nolint:revive -type CapabilityInputs struct { - depinject.In - - Config *modulev1.Module - - KvStoreKey *store.KVStoreKey - MemStoreKey *store.MemoryStoreKey - Cdc codec.Codec -} - -//nolint:revive -type CapabilityOutputs struct { - depinject.Out - - CapabilityKeeper *keeper.Keeper - Module appmodule.AppModule -} - -func ProvideModule(in CapabilityInputs) CapabilityOutputs { - k := keeper.NewKeeper(in.Cdc, in.KvStoreKey, in.MemStoreKey) - m := NewAppModule(in.Cdc, *k, in.Config.SealKeeper) - - return CapabilityOutputs{ - CapabilityKeeper: k, - Module: m, - } -} diff --git a/x/capability/simulation/decoder.go b/x/capability/simulation/decoder.go deleted file mode 100644 index 3cea7bb8893b..000000000000 --- a/x/capability/simulation/decoder.go +++ /dev/null @@ -1,33 +0,0 @@ -package simulation - -import ( - "bytes" - "fmt" - - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/kv" - "github.com/cosmos/cosmos-sdk/x/capability/types" -) - -// NewDecodeStore returns a decoder function closure that unmarshals the KVPair's -// Value to the corresponding capability type. -func NewDecodeStore(cdc codec.Codec) func(kvA, kvB kv.Pair) string { - return func(kvA, kvB kv.Pair) string { - switch { - case bytes.Equal(kvA.Key, types.KeyIndex): - idxA := sdk.BigEndianToUint64(kvA.Value) - idxB := sdk.BigEndianToUint64(kvB.Value) - return fmt.Sprintf("Index A: %d\nIndex B: %d\n", idxA, idxB) - - case bytes.HasPrefix(kvA.Key, types.KeyPrefixIndexCapability): - var capOwnersA, capOwnersB types.CapabilityOwners - cdc.MustUnmarshal(kvA.Value, &capOwnersA) - cdc.MustUnmarshal(kvB.Value, &capOwnersB) - return fmt.Sprintf("CapabilityOwners A: %v\nCapabilityOwners B: %v\n", capOwnersA, capOwnersB) - - default: - panic(fmt.Sprintf("invalid %s key prefix %X (%s)", types.ModuleName, kvA.Key, kvA.Key)) - } - } -} diff --git a/x/capability/simulation/decoder_test.go b/x/capability/simulation/decoder_test.go deleted file mode 100644 index 1c3c7e6d0dd5..000000000000 --- a/x/capability/simulation/decoder_test.go +++ /dev/null @@ -1,65 +0,0 @@ -package simulation_test - -import ( - "fmt" - "testing" - - "github.com/stretchr/testify/require" - - "cosmossdk.io/depinject" - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/kv" - "github.com/cosmos/cosmos-sdk/x/capability/simulation" - "github.com/cosmos/cosmos-sdk/x/capability/testutil" - "github.com/cosmos/cosmos-sdk/x/capability/types" -) - -func TestDecodeStore(t *testing.T) { - var cdc codec.Codec - err := depinject.Inject(testutil.AppConfig, &cdc) - require.NoError(t, err) - - dec := simulation.NewDecodeStore(cdc) - - capOwners := types.CapabilityOwners{ - Owners: []types.Owner{{Module: "transfer", Name: "ports/transfer"}}, - } - - kvPairs := kv.Pairs{ - Pairs: []kv.Pair{ - { - Key: types.KeyIndex, - Value: sdk.Uint64ToBigEndian(10), - }, - { - Key: types.KeyPrefixIndexCapability, - Value: cdc.MustMarshal(&capOwners), - }, - { - Key: []byte{0x99}, - Value: []byte{0x99}, - }, - }, - } - tests := []struct { - name string - expectedLog string - }{ - {"Index", "Index A: 10\nIndex B: 10\n"}, - {"CapabilityOwners", fmt.Sprintf("CapabilityOwners A: %v\nCapabilityOwners B: %v\n", capOwners, capOwners)}, - {"other", ""}, - } - - for i, tt := range tests { - i, tt := i, tt - t.Run(tt.name, func(t *testing.T) { - switch i { - case len(tests) - 1: - require.Panics(t, func() { dec(kvPairs.Pairs[i], kvPairs.Pairs[i]) }, tt.name) - default: - require.Equal(t, tt.expectedLog, dec(kvPairs.Pairs[i], kvPairs.Pairs[i]), tt.name) - } - }) - } -} diff --git a/x/capability/simulation/genesis.go b/x/capability/simulation/genesis.go deleted file mode 100644 index 8cb45fc034f3..000000000000 --- a/x/capability/simulation/genesis.go +++ /dev/null @@ -1,37 +0,0 @@ -package simulation - -import ( - "encoding/json" - "fmt" - "math/rand" - - "github.com/cosmos/cosmos-sdk/types/module" - "github.com/cosmos/cosmos-sdk/x/capability/types" -) - -// Simulation parameter constants -const index = "index" - -// GenIndex returns a random global index between 1-1000 -func GenIndex(r *rand.Rand) uint64 { - return uint64(r.Int63n(1000)) + 1 -} - -// RandomizedGenState generates a random GenesisState for capability -func RandomizedGenState(simState *module.SimulationState) { - var idx uint64 - - simState.AppParams.GetOrGenerate( - simState.Cdc, index, &idx, simState.Rand, - func(r *rand.Rand) { idx = GenIndex(r) }, - ) - - capabilityGenesis := types.GenesisState{Index: idx} - - bz, err := json.MarshalIndent(&capabilityGenesis, "", " ") - if err != nil { - panic(err) - } - fmt.Printf("Selected randomly generated %s parameters:\n%s\n", types.ModuleName, bz) - simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&capabilityGenesis) -} diff --git a/x/capability/simulation/genesis_test.go b/x/capability/simulation/genesis_test.go deleted file mode 100644 index 14eb344cc093..000000000000 --- a/x/capability/simulation/genesis_test.go +++ /dev/null @@ -1,72 +0,0 @@ -package simulation_test - -import ( - "encoding/json" - "math/rand" - "testing" - - "github.com/stretchr/testify/require" - - sdkmath "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/types/module" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - "github.com/cosmos/cosmos-sdk/x/capability/simulation" - "github.com/cosmos/cosmos-sdk/x/capability/types" -) - -// TestRandomizedGenState tests the normal scenario of applying RandomizedGenState. -// Abonormal scenarios are not tested here. -func TestRandomizedGenState(t *testing.T) { - interfaceRegistry := codectypes.NewInterfaceRegistry() - cdc := codec.NewProtoCodec(interfaceRegistry) - s := rand.NewSource(1) - r := rand.New(s) - - simState := module.SimulationState{ - AppParams: make(simtypes.AppParams), - Cdc: cdc, - Rand: r, - NumBonded: 3, - Accounts: simtypes.RandomAccounts(r, 3), - InitialStake: sdkmath.NewInt(1000), - GenState: make(map[string]json.RawMessage), - } - - simulation.RandomizedGenState(&simState) - - var capGenesis types.GenesisState - simState.Cdc.MustUnmarshalJSON(simState.GenState[types.ModuleName], &capGenesis) - - require.Equal(t, uint64(149), capGenesis.Index) - require.Len(t, capGenesis.Owners, 0) -} - -// TestRandomizedGenState tests abnormal scenarios of applying RandomizedGenState. -func TestRandomizedGenState1(t *testing.T) { - interfaceRegistry := codectypes.NewInterfaceRegistry() - cdc := codec.NewProtoCodec(interfaceRegistry) - - s := rand.NewSource(1) - r := rand.New(s) - - // all these tests will panic - tests := []struct { - simState module.SimulationState - panicMsg string - }{ - { // panic => reason: incomplete initialization of the simState - module.SimulationState{}, "invalid memory address or nil pointer dereference"}, - { // panic => reason: incomplete initialization of the simState - module.SimulationState{ - AppParams: make(simtypes.AppParams), - Cdc: cdc, - Rand: r, - }, "assignment to entry in nil map"}, - } - - for _, tt := range tests { - require.Panicsf(t, func() { simulation.RandomizedGenState(&tt.simState) }, tt.panicMsg) - } -} diff --git a/x/capability/testutil/app_config.go b/x/capability/testutil/app_config.go deleted file mode 100644 index c94037b9d17c..000000000000 --- a/x/capability/testutil/app_config.go +++ /dev/null @@ -1,102 +0,0 @@ -package testutil - -import ( - _ "github.com/cosmos/cosmos-sdk/x/auth" // import as blank for app wiring - _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import as blank for app wiring - _ "github.com/cosmos/cosmos-sdk/x/bank" // import as blank for app wiring - _ "github.com/cosmos/cosmos-sdk/x/capability" // import as blank for app wiring - _ "github.com/cosmos/cosmos-sdk/x/consensus" // import as blank for app wiring - _ "github.com/cosmos/cosmos-sdk/x/genutil" // import as blank for app wiring - _ "github.com/cosmos/cosmos-sdk/x/params" // import as blank for app wiring - _ "github.com/cosmos/cosmos-sdk/x/staking" // import as blank for app wiring - - "cosmossdk.io/core/appconfig" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - consensustypes "github.com/cosmos/cosmos-sdk/x/consensus/types" - genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" - paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - - runtimev1alpha1 "cosmossdk.io/api/cosmos/app/runtime/v1alpha1" - appv1alpha1 "cosmossdk.io/api/cosmos/app/v1alpha1" - authmodulev1 "cosmossdk.io/api/cosmos/auth/module/v1" - bankmodulev1 "cosmossdk.io/api/cosmos/bank/module/v1" - capabilitymodulev1 "cosmossdk.io/api/cosmos/capability/module/v1" - consensusmodulev1 "cosmossdk.io/api/cosmos/consensus/module/v1" - genutilmodulev1 "cosmossdk.io/api/cosmos/genutil/module/v1" - paramsmodulev1 "cosmossdk.io/api/cosmos/params/module/v1" - stakingmodulev1 "cosmossdk.io/api/cosmos/staking/module/v1" - txconfigv1 "cosmossdk.io/api/cosmos/tx/config/v1" -) - -var AppConfig = appconfig.Compose(&appv1alpha1.Config{ - Modules: []*appv1alpha1.ModuleConfig{ - { - Name: "runtime", - Config: appconfig.WrapAny(&runtimev1alpha1.Module{ - AppName: "CapabilityApp", - BeginBlockers: []string{ - capabilitytypes.ModuleName, - stakingtypes.ModuleName, - genutiltypes.ModuleName, - }, - EndBlockers: []string{ - stakingtypes.ModuleName, - genutiltypes.ModuleName, - }, - InitGenesis: []string{ - capabilitytypes.ModuleName, - authtypes.ModuleName, - banktypes.ModuleName, - stakingtypes.ModuleName, - genutiltypes.ModuleName, - paramstypes.ModuleName, - consensustypes.ModuleName, - }, - }), - }, - { - Name: authtypes.ModuleName, - Config: appconfig.WrapAny(&authmodulev1.Module{ - Bech32Prefix: "cosmos", - ModuleAccountPermissions: []*authmodulev1.ModuleAccountPermission{ - {Account: authtypes.FeeCollectorName}, - {Account: stakingtypes.BondedPoolName, Permissions: []string{authtypes.Burner, stakingtypes.ModuleName}}, - {Account: stakingtypes.NotBondedPoolName, Permissions: []string{authtypes.Burner, stakingtypes.ModuleName}}, - }, - }), - }, - { - Name: banktypes.ModuleName, - Config: appconfig.WrapAny(&bankmodulev1.Module{}), - }, - { - Name: stakingtypes.ModuleName, - Config: appconfig.WrapAny(&stakingmodulev1.Module{}), - }, - { - Name: paramstypes.ModuleName, - Config: appconfig.WrapAny(¶msmodulev1.Module{}), - }, - { - Name: "tx", - Config: appconfig.WrapAny(&txconfigv1.Config{}), - }, - { - Name: genutiltypes.ModuleName, - Config: appconfig.WrapAny(&genutilmodulev1.Module{}), - }, - { - Name: consensustypes.ModuleName, - Config: appconfig.WrapAny(&consensusmodulev1.Module{}), - }, - { - Name: capabilitytypes.ModuleName, - Config: appconfig.WrapAny(&capabilitymodulev1.Module{ - SealKeeper: true, - }), - }, - }, -}) diff --git a/x/capability/types/capability.pb.go b/x/capability/types/capability.pb.go deleted file mode 100644 index 072e36c8caa7..000000000000 --- a/x/capability/types/capability.pb.go +++ /dev/null @@ -1,703 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/capability/v1beta1/capability.proto - -package types - -import ( - fmt "fmt" - _ "github.com/cosmos/cosmos-sdk/types/tx/amino" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// Capability defines an implementation of an object capability. The index -// provided to a Capability must be globally unique. -type Capability struct { - Index uint64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"` -} - -func (m *Capability) Reset() { *m = Capability{} } -func (m *Capability) String() string { return proto.CompactTextString(m) } -func (*Capability) ProtoMessage() {} -func (*Capability) Descriptor() ([]byte, []int) { - return fileDescriptor_6308261edd8470a9, []int{0} -} -func (m *Capability) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Capability) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Capability.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Capability) XXX_Merge(src proto.Message) { - xxx_messageInfo_Capability.Merge(m, src) -} -func (m *Capability) XXX_Size() int { - return m.Size() -} -func (m *Capability) XXX_DiscardUnknown() { - xxx_messageInfo_Capability.DiscardUnknown(m) -} - -var xxx_messageInfo_Capability proto.InternalMessageInfo - -func (m *Capability) GetIndex() uint64 { - if m != nil { - return m.Index - } - return 0 -} - -// Owner defines a single capability owner. An owner is defined by the name of -// capability and the module name. -type Owner struct { - Module string `protobuf:"bytes,1,opt,name=module,proto3" json:"module,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` -} - -func (m *Owner) Reset() { *m = Owner{} } -func (m *Owner) String() string { return proto.CompactTextString(m) } -func (*Owner) ProtoMessage() {} -func (*Owner) Descriptor() ([]byte, []int) { - return fileDescriptor_6308261edd8470a9, []int{1} -} -func (m *Owner) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Owner) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Owner.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Owner) XXX_Merge(src proto.Message) { - xxx_messageInfo_Owner.Merge(m, src) -} -func (m *Owner) XXX_Size() int { - return m.Size() -} -func (m *Owner) XXX_DiscardUnknown() { - xxx_messageInfo_Owner.DiscardUnknown(m) -} - -var xxx_messageInfo_Owner proto.InternalMessageInfo - -// CapabilityOwners defines a set of owners of a single Capability. The set of -// owners must be unique. -type CapabilityOwners struct { - Owners []Owner `protobuf:"bytes,1,rep,name=owners,proto3" json:"owners"` -} - -func (m *CapabilityOwners) Reset() { *m = CapabilityOwners{} } -func (m *CapabilityOwners) String() string { return proto.CompactTextString(m) } -func (*CapabilityOwners) ProtoMessage() {} -func (*CapabilityOwners) Descriptor() ([]byte, []int) { - return fileDescriptor_6308261edd8470a9, []int{2} -} -func (m *CapabilityOwners) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CapabilityOwners) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_CapabilityOwners.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *CapabilityOwners) XXX_Merge(src proto.Message) { - xxx_messageInfo_CapabilityOwners.Merge(m, src) -} -func (m *CapabilityOwners) XXX_Size() int { - return m.Size() -} -func (m *CapabilityOwners) XXX_DiscardUnknown() { - xxx_messageInfo_CapabilityOwners.DiscardUnknown(m) -} - -var xxx_messageInfo_CapabilityOwners proto.InternalMessageInfo - -func (m *CapabilityOwners) GetOwners() []Owner { - if m != nil { - return m.Owners - } - return nil -} - -func init() { - proto.RegisterType((*Capability)(nil), "cosmos.capability.v1beta1.Capability") - proto.RegisterType((*Owner)(nil), "cosmos.capability.v1beta1.Owner") - proto.RegisterType((*CapabilityOwners)(nil), "cosmos.capability.v1beta1.CapabilityOwners") -} - -func init() { - proto.RegisterFile("cosmos/capability/v1beta1/capability.proto", fileDescriptor_6308261edd8470a9) -} - -var fileDescriptor_6308261edd8470a9 = []byte{ - // 270 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x4a, 0xce, 0x2f, 0xce, - 0xcd, 0x2f, 0xd6, 0x4f, 0x4e, 0x2c, 0x48, 0x4c, 0xca, 0xcc, 0xc9, 0x2c, 0xa9, 0xd4, 0x2f, 0x33, - 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0x44, 0x12, 0xd2, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x84, - 0xa8, 0xd5, 0x43, 0x92, 0x80, 0xaa, 0x95, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0xab, 0xd2, 0x07, - 0xb1, 0x20, 0x1a, 0xa4, 0x04, 0x13, 0x73, 0x33, 0xf3, 0xf2, 0xf5, 0xc1, 0x24, 0x44, 0x48, 0x49, - 0x89, 0x8b, 0xcb, 0x19, 0xae, 0x5d, 0x48, 0x84, 0x8b, 0x35, 0x33, 0x2f, 0x25, 0xb5, 0x42, 0x82, - 0x51, 0x81, 0x51, 0x83, 0x25, 0x08, 0xc2, 0x51, 0xb2, 0xe4, 0x62, 0xf5, 0x2f, 0xcf, 0x4b, 0x2d, - 0x12, 0x12, 0xe3, 0x62, 0xcb, 0xcd, 0x4f, 0x29, 0xcd, 0x49, 0x05, 0xcb, 0x73, 0x06, 0x41, 0x79, - 0x42, 0x42, 0x5c, 0x2c, 0x79, 0x89, 0xb9, 0xa9, 0x12, 0x4c, 0x60, 0x51, 0x30, 0xdb, 0x8a, 0xa5, - 0x63, 0x81, 0x3c, 0x83, 0x52, 0x38, 0x97, 0x00, 0xc2, 0x78, 0xb0, 0x21, 0xc5, 0x42, 0xce, 0x5c, - 0x6c, 0xf9, 0x60, 0x96, 0x04, 0xa3, 0x02, 0xb3, 0x06, 0xb7, 0x91, 0x82, 0x1e, 0x4e, 0x7f, 0xe8, - 0x81, 0xb5, 0x38, 0x71, 0x9e, 0xb8, 0x27, 0xcf, 0xb0, 0xe2, 0xf9, 0x06, 0x2d, 0xc6, 0x20, 0xa8, - 0x56, 0x27, 0xcf, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, - 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0xd2, 0x4f, 0xcf, - 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x87, 0x05, 0x26, 0x98, 0xd2, 0x2d, 0x4e, - 0xc9, 0xd6, 0xaf, 0x40, 0x0e, 0xd9, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0x70, 0x48, 0x18, - 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x07, 0x8a, 0x4b, 0x8d, 0x7b, 0x01, 0x00, 0x00, -} - -func (m *Capability) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Capability) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Capability) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Index != 0 { - i = encodeVarintCapability(dAtA, i, uint64(m.Index)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *Owner) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Owner) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Owner) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintCapability(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x12 - } - if len(m.Module) > 0 { - i -= len(m.Module) - copy(dAtA[i:], m.Module) - i = encodeVarintCapability(dAtA, i, uint64(len(m.Module))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *CapabilityOwners) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CapabilityOwners) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CapabilityOwners) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Owners) > 0 { - for iNdEx := len(m.Owners) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Owners[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCapability(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func encodeVarintCapability(dAtA []byte, offset int, v uint64) int { - offset -= sovCapability(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Capability) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Index != 0 { - n += 1 + sovCapability(uint64(m.Index)) - } - return n -} - -func (m *Owner) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Module) - if l > 0 { - n += 1 + l + sovCapability(uint64(l)) - } - l = len(m.Name) - if l > 0 { - n += 1 + l + sovCapability(uint64(l)) - } - return n -} - -func (m *CapabilityOwners) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Owners) > 0 { - for _, e := range m.Owners { - l = e.Size() - n += 1 + l + sovCapability(uint64(l)) - } - } - return n -} - -func sovCapability(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozCapability(x uint64) (n int) { - return sovCapability(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Capability) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCapability - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Capability: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Capability: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) - } - m.Index = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCapability - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Index |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipCapability(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCapability - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Owner) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCapability - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Owner: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Owner: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Module", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCapability - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCapability - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCapability - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Module = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCapability - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCapability - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCapability - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCapability(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCapability - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CapabilityOwners) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCapability - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CapabilityOwners: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CapabilityOwners: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owners", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCapability - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCapability - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCapability - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Owners = append(m.Owners, Owner{}) - if err := m.Owners[len(m.Owners)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCapability(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCapability - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipCapability(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowCapability - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowCapability - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowCapability - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthCapability - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupCapability - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthCapability - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthCapability = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowCapability = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupCapability = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/capability/types/errors.go b/x/capability/types/errors.go deleted file mode 100644 index edd46a3de37f..000000000000 --- a/x/capability/types/errors.go +++ /dev/null @@ -1,14 +0,0 @@ -package types - -import "cosmossdk.io/errors" - -// x/capability module sentinel errors -var ( - ErrInvalidCapabilityName = errors.Register(ModuleName, 2, "capability name not valid") - ErrNilCapability = errors.Register(ModuleName, 3, "provided capability is nil") - ErrCapabilityTaken = errors.Register(ModuleName, 4, "capability name already taken") - ErrOwnerClaimed = errors.Register(ModuleName, 5, "given owner already claimed capability") - ErrCapabilityNotOwned = errors.Register(ModuleName, 6, "capability not owned by module") - ErrCapabilityNotFound = errors.Register(ModuleName, 7, "capability not found") - ErrCapabilityOwnersNotFound = errors.Register(ModuleName, 8, "owners not found for capability") -) diff --git a/x/capability/types/genesis.go b/x/capability/types/genesis.go deleted file mode 100644 index afab1d0c7d31..000000000000 --- a/x/capability/types/genesis.go +++ /dev/null @@ -1,49 +0,0 @@ -package types - -import ( - "fmt" - "strings" -) - -// DefaultIndex is the default capability global index -const DefaultIndex uint64 = 1 - -// DefaultGenesis returns the default Capability genesis state -func DefaultGenesis() *GenesisState { - return &GenesisState{ - Index: DefaultIndex, - Owners: []GenesisOwners{}, - } -} - -// Validate performs basic genesis state validation returning an error upon any -// failure. -func (gs GenesisState) Validate() error { - // NOTE: index must be greater than 0 - if gs.Index == 0 { - return fmt.Errorf("capability index must be non-zero") - } - - for _, genOwner := range gs.Owners { - if len(genOwner.IndexOwners.Owners) == 0 { - return fmt.Errorf("empty owners in genesis") - } - - // all exported existing indices must be between [1, gs.Index) - if genOwner.Index == 0 || genOwner.Index >= gs.Index { - return fmt.Errorf("owners exist for index %d outside of valid range: %d-%d", genOwner.Index, 1, gs.Index-1) - } - - for _, owner := range genOwner.IndexOwners.Owners { - if strings.TrimSpace(owner.Module) == "" { - return fmt.Errorf("owner's module cannot be blank: %s", owner) - } - - if strings.TrimSpace(owner.Name) == "" { - return fmt.Errorf("owner's name cannot be blank: %s", owner) - } - } - } - - return nil -} diff --git a/x/capability/types/genesis.pb.go b/x/capability/types/genesis.pb.go deleted file mode 100644 index 785d99b51b94..000000000000 --- a/x/capability/types/genesis.pb.go +++ /dev/null @@ -1,586 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/capability/v1beta1/genesis.proto - -package types - -import ( - fmt "fmt" - _ "github.com/cosmos/cosmos-sdk/types/tx/amino" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// GenesisOwners defines the capability owners with their corresponding index. -type GenesisOwners struct { - // index is the index of the capability owner. - Index uint64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"` - // index_owners are the owners at the given index. - IndexOwners CapabilityOwners `protobuf:"bytes,2,opt,name=index_owners,json=indexOwners,proto3" json:"index_owners"` -} - -func (m *GenesisOwners) Reset() { *m = GenesisOwners{} } -func (m *GenesisOwners) String() string { return proto.CompactTextString(m) } -func (*GenesisOwners) ProtoMessage() {} -func (*GenesisOwners) Descriptor() ([]byte, []int) { - return fileDescriptor_94922dd16a11c23e, []int{0} -} -func (m *GenesisOwners) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GenesisOwners) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GenesisOwners.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *GenesisOwners) XXX_Merge(src proto.Message) { - xxx_messageInfo_GenesisOwners.Merge(m, src) -} -func (m *GenesisOwners) XXX_Size() int { - return m.Size() -} -func (m *GenesisOwners) XXX_DiscardUnknown() { - xxx_messageInfo_GenesisOwners.DiscardUnknown(m) -} - -var xxx_messageInfo_GenesisOwners proto.InternalMessageInfo - -func (m *GenesisOwners) GetIndex() uint64 { - if m != nil { - return m.Index - } - return 0 -} - -func (m *GenesisOwners) GetIndexOwners() CapabilityOwners { - if m != nil { - return m.IndexOwners - } - return CapabilityOwners{} -} - -// GenesisState defines the capability module's genesis state. -type GenesisState struct { - // index is the capability global index. - Index uint64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"` - // owners represents a map from index to owners of the capability index - // index key is string to allow amino marshalling. - Owners []GenesisOwners `protobuf:"bytes,2,rep,name=owners,proto3" json:"owners"` -} - -func (m *GenesisState) Reset() { *m = GenesisState{} } -func (m *GenesisState) String() string { return proto.CompactTextString(m) } -func (*GenesisState) ProtoMessage() {} -func (*GenesisState) Descriptor() ([]byte, []int) { - return fileDescriptor_94922dd16a11c23e, []int{1} -} -func (m *GenesisState) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *GenesisState) XXX_Merge(src proto.Message) { - xxx_messageInfo_GenesisState.Merge(m, src) -} -func (m *GenesisState) XXX_Size() int { - return m.Size() -} -func (m *GenesisState) XXX_DiscardUnknown() { - xxx_messageInfo_GenesisState.DiscardUnknown(m) -} - -var xxx_messageInfo_GenesisState proto.InternalMessageInfo - -func (m *GenesisState) GetIndex() uint64 { - if m != nil { - return m.Index - } - return 0 -} - -func (m *GenesisState) GetOwners() []GenesisOwners { - if m != nil { - return m.Owners - } - return nil -} - -func init() { - proto.RegisterType((*GenesisOwners)(nil), "cosmos.capability.v1beta1.GenesisOwners") - proto.RegisterType((*GenesisState)(nil), "cosmos.capability.v1beta1.GenesisState") -} - -func init() { - proto.RegisterFile("cosmos/capability/v1beta1/genesis.proto", fileDescriptor_94922dd16a11c23e) -} - -var fileDescriptor_94922dd16a11c23e = []byte{ - // 280 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4f, 0xce, 0x2f, 0xce, - 0xcd, 0x2f, 0xd6, 0x4f, 0x4e, 0x2c, 0x48, 0x4c, 0xca, 0xcc, 0xc9, 0x2c, 0xa9, 0xd4, 0x2f, 0x33, - 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, - 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x84, 0x28, 0xd4, 0x43, 0x28, 0xd4, 0x83, 0x2a, 0x94, 0x12, 0x49, - 0xcf, 0x4f, 0xcf, 0x07, 0xab, 0xd2, 0x07, 0xb1, 0x20, 0x1a, 0xa4, 0xb4, 0x70, 0x9b, 0x8c, 0x64, - 0x06, 0x44, 0xad, 0x60, 0x62, 0x6e, 0x66, 0x5e, 0xbe, 0x3e, 0x98, 0x84, 0x08, 0x29, 0x35, 0x30, - 0x72, 0xf1, 0xba, 0x43, 0x5c, 0xe0, 0x5f, 0x9e, 0x97, 0x5a, 0x54, 0x2c, 0x24, 0xc2, 0xc5, 0x9a, - 0x99, 0x97, 0x92, 0x5a, 0x21, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x12, 0x04, 0xe1, 0x08, 0x45, 0x72, - 0xf1, 0x80, 0x19, 0xf1, 0xf9, 0x60, 0x55, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0xdc, 0x46, 0xda, 0x7a, - 0x38, 0x9d, 0xab, 0xe7, 0x0c, 0x17, 0x82, 0x18, 0xec, 0xc4, 0x79, 0xe2, 0x9e, 0x3c, 0xc3, 0x8a, - 0xe7, 0x1b, 0xb4, 0x18, 0x83, 0xb8, 0xc1, 0x66, 0x41, 0xc4, 0x95, 0x0a, 0xb9, 0x78, 0xa0, 0x2e, - 0x08, 0x2e, 0x49, 0x2c, 0x49, 0xc5, 0xe1, 0x00, 0x6f, 0x2e, 0x36, 0xb8, 0xd5, 0xcc, 0x1a, 0xdc, - 0x46, 0x1a, 0x78, 0xac, 0x46, 0xf1, 0x10, 0xb2, 0xbd, 0x50, 0x23, 0x9c, 0x3c, 0x4f, 0x3c, 0x92, - 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, - 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0x3f, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, - 0x39, 0x3f, 0x57, 0x1f, 0x16, 0xb2, 0x60, 0x4a, 0xb7, 0x38, 0x25, 0x5b, 0xbf, 0x02, 0x39, 0x98, - 0x4b, 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0xe1, 0x68, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, - 0xa2, 0x39, 0xc7, 0xe6, 0xe2, 0x01, 0x00, 0x00, -} - -func (m *GenesisOwners) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GenesisOwners) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GenesisOwners) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.IndexOwners.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if m.Index != 0 { - i = encodeVarintGenesis(dAtA, i, uint64(m.Index)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *GenesisState) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Owners) > 0 { - for iNdEx := len(m.Owners) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Owners[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if m.Index != 0 { - i = encodeVarintGenesis(dAtA, i, uint64(m.Index)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { - offset -= sovGenesis(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *GenesisOwners) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Index != 0 { - n += 1 + sovGenesis(uint64(m.Index)) - } - l = m.IndexOwners.Size() - n += 1 + l + sovGenesis(uint64(l)) - return n -} - -func (m *GenesisState) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Index != 0 { - n += 1 + sovGenesis(uint64(m.Index)) - } - if len(m.Owners) > 0 { - for _, e := range m.Owners { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - return n -} - -func sovGenesis(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenesis(x uint64) (n int) { - return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *GenesisOwners) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GenesisOwners: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GenesisOwners: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) - } - m.Index = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Index |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IndexOwners", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.IndexOwners.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GenesisState) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) - } - m.Index = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Index |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owners", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Owners = append(m.Owners, GenesisOwners{}) - if err := m.Owners[len(m.Owners)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGenesis(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthGenesis - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenesis - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenesis - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/capability/types/genesis_test.go b/x/capability/types/genesis_test.go deleted file mode 100644 index 5208a2b59043..000000000000 --- a/x/capability/types/genesis_test.go +++ /dev/null @@ -1,125 +0,0 @@ -package types - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func TestValidateGenesis(t *testing.T) { - testCases := []struct { - name string - malleate func(*GenesisState) - expPass bool - }{ - { - name: "default", - malleate: func(_ *GenesisState) {}, - expPass: true, - }, - { - name: "valid genesis state", - malleate: func(genState *GenesisState) { - genState.Index = 10 - genOwner := GenesisOwners{ - Index: 1, - IndexOwners: CapabilityOwners{[]Owner{{Module: "ibc", Name: "port/transfer"}}}, - } - - genState.Owners = append(genState.Owners, genOwner) - }, - expPass: true, - }, - { - name: "initial index is 0", - malleate: func(genState *GenesisState) { - genState.Index = 0 - genOwner := GenesisOwners{ - Index: 0, - IndexOwners: CapabilityOwners{[]Owner{{Module: "ibc", Name: "port/transfer"}}}, - } - - genState.Owners = append(genState.Owners, genOwner) - }, - expPass: false, - }, - - { - name: "blank owner module", - malleate: func(genState *GenesisState) { - genState.Index = 1 - genOwner := GenesisOwners{ - Index: 1, - IndexOwners: CapabilityOwners{[]Owner{{Module: "", Name: "port/transfer"}}}, - } - - genState.Owners = append(genState.Owners, genOwner) - }, - expPass: false, - }, - { - name: "blank owner name", - malleate: func(genState *GenesisState) { - genState.Index = 1 - genOwner := GenesisOwners{ - Index: 1, - IndexOwners: CapabilityOwners{[]Owner{{Module: "ibc", Name: ""}}}, - } - - genState.Owners = append(genState.Owners, genOwner) - }, - expPass: false, - }, - { - name: "index above range", - malleate: func(genState *GenesisState) { - genState.Index = 10 - genOwner := GenesisOwners{ - Index: 12, - IndexOwners: CapabilityOwners{[]Owner{{Module: "ibc", Name: "port/transfer"}}}, - } - - genState.Owners = append(genState.Owners, genOwner) - }, - expPass: false, - }, - { - name: "index below range", - malleate: func(genState *GenesisState) { - genState.Index = 10 - genOwner := GenesisOwners{ - Index: 0, - IndexOwners: CapabilityOwners{[]Owner{{Module: "ibc", Name: "port/transfer"}}}, - } - - genState.Owners = append(genState.Owners, genOwner) - }, - expPass: false, - }, - { - name: "owners are empty", - malleate: func(genState *GenesisState) { - genState.Index = 10 - genOwner := GenesisOwners{ - Index: 0, - IndexOwners: CapabilityOwners{[]Owner{}}, - } - - genState.Owners = append(genState.Owners, genOwner) - }, - expPass: false, - }, - } - - for _, tc := range testCases { - tc := tc - genState := DefaultGenesis() - tc.malleate(genState) - err := genState.Validate() - if tc.expPass { - require.NoError(t, err, tc.name) - } else { - require.Error(t, err, tc.name) - } - } -} diff --git a/x/capability/types/keys.go b/x/capability/types/keys.go deleted file mode 100644 index fe6ae41aacf8..000000000000 --- a/x/capability/types/keys.go +++ /dev/null @@ -1,54 +0,0 @@ -package types - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -const ( - // ModuleName defines the module name - ModuleName = "capability" - - // StoreKey defines the primary module store key - StoreKey = ModuleName - - // MemStoreKey defines the in-memory store key - MemStoreKey = "memory:capability" -) - -var ( - // KeyIndex defines the key that stores the current globally unique capability - // index. - KeyIndex = []byte("index") - - // KeyPrefixIndexCapability defines a key prefix that stores index to capability - // owners mappings. - KeyPrefixIndexCapability = []byte("capability_index") - - // KeyMemInitialized defines the key that stores the initialized flag in the memory store - KeyMemInitialized = []byte("mem_initialized") -) - -// RevCapabilityKey returns a reverse lookup key for a given module and capability -// name. -func RevCapabilityKey(module, name string) []byte { - return []byte(fmt.Sprintf("%s/rev/%s", module, name)) -} - -// FwdCapabilityKey returns a forward lookup key for a given module and capability -// reference. -func FwdCapabilityKey(module string, cap *Capability) []byte { - return []byte(fmt.Sprintf("%s/fwd/%#016p", module, cap)) -} - -// IndexToKey returns bytes to be used as a key for a given capability index. -func IndexToKey(index uint64) []byte { - return sdk.Uint64ToBigEndian(index) -} - -// IndexFromKey returns an index from a call to IndexToKey for a given capability -// index. -func IndexFromKey(key []byte) uint64 { - return sdk.BigEndianToUint64(key) -} diff --git a/x/capability/types/keys_test.go b/x/capability/types/keys_test.go deleted file mode 100644 index 1ac4702ba581..000000000000 --- a/x/capability/types/keys_test.go +++ /dev/null @@ -1,29 +0,0 @@ -package types_test - -import ( - "fmt" - "testing" - - "github.com/stretchr/testify/require" - - "github.com/cosmos/cosmos-sdk/x/capability/types" -) - -func TestRevCapabilityKey(t *testing.T) { - expected := []byte("bank/rev/send") - require.Equal(t, expected, types.RevCapabilityKey("bank", "send")) -} - -func TestFwdCapabilityKey(t *testing.T) { - cap := types.NewCapability(23) - expected := []byte(fmt.Sprintf("bank/fwd/%#016p", cap)) - require.Equal(t, expected, types.FwdCapabilityKey("bank", cap)) -} - -func TestIndexToKey(t *testing.T) { - require.Equal(t, []byte{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc, 0x5a}, types.IndexToKey(3162)) -} - -func TestIndexFromKey(t *testing.T) { - require.Equal(t, uint64(3162), types.IndexFromKey([]byte{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc, 0x5a})) -} diff --git a/x/capability/types/types.go b/x/capability/types/types.go deleted file mode 100644 index 5771992555d4..000000000000 --- a/x/capability/types/types.go +++ /dev/null @@ -1,73 +0,0 @@ -package types - -import ( - "fmt" - "sort" - - "cosmossdk.io/errors" -) - -// NewCapability returns a reference to a new Capability to be used as an -// actual capability. -func NewCapability(index uint64) *Capability { - return &Capability{Index: index} -} - -func NewOwner(module, name string) Owner { - return Owner{Module: module, Name: name} -} - -// Key returns a composite key for an Owner. -func (o Owner) Key() string { - return fmt.Sprintf("%s/%s", o.Module, o.Name) -} - -func NewCapabilityOwners() *CapabilityOwners { - return &CapabilityOwners{Owners: make([]Owner, 0)} -} - -// Set attempts to add a given owner to the CapabilityOwners. If the owner -// already exists, an error will be returned. Set runs in O(log n) average time -// and O(n) in the worst case. -func (co *CapabilityOwners) Set(owner Owner) error { - i, ok := co.Get(owner) - if ok { - // owner already exists at co.Owners[i] - return errors.Wrapf(ErrOwnerClaimed, owner.String()) - } - - // owner does not exist in the set of owners, so we insert at position i - co.Owners = append(co.Owners, Owner{}) // expand by 1 in amortized O(1) / O(n) worst case - copy(co.Owners[i+1:], co.Owners[i:]) - co.Owners[i] = owner - - return nil -} - -// Remove removes a provided owner from the CapabilityOwners if it exists. If the -// owner does not exist, Remove is considered a no-op. -func (co *CapabilityOwners) Remove(owner Owner) { - if len(co.Owners) == 0 { - return - } - - i, ok := co.Get(owner) - if ok { - // owner exists at co.Owners[i] - co.Owners = append(co.Owners[:i], co.Owners[i+1:]...) - } -} - -// Get returns (i, true) of the provided owner in the CapabilityOwners if the -// owner exists, where i indicates the owner's index in the set. Otherwise -// (i, false) where i indicates where in the set the owner should be added. -func (co *CapabilityOwners) Get(owner Owner) (int, bool) { - // find smallest index s.t. co.Owners[i] >= owner in O(log n) time - i := sort.Search(len(co.Owners), func(i int) bool { return co.Owners[i].Key() >= owner.Key() }) - if i < len(co.Owners) && co.Owners[i].Key() == owner.Key() { - // owner exists at co.Owners[i] - return i, true - } - - return i, false -} diff --git a/x/capability/types/types_test.go b/x/capability/types/types_test.go deleted file mode 100644 index 5cdd5cf0892c..000000000000 --- a/x/capability/types/types_test.go +++ /dev/null @@ -1,70 +0,0 @@ -package types_test - -import ( - "fmt" - "sort" - "strings" - "testing" - - "github.com/stretchr/testify/require" - - "github.com/cosmos/cosmos-sdk/x/capability/types" -) - -func TestCapabilityKey(t *testing.T) { - idx := uint64(3162) - cap := types.NewCapability(idx) - require.Equal(t, idx, cap.GetIndex()) - require.Equal(t, fmt.Sprintf("index:%d", idx), strings.TrimSpace(cap.String())) -} - -func TestOwner(t *testing.T) { - o := types.NewOwner("bank", "send") - require.Equal(t, "bank/send", o.Key()) - require.Equal(t, "module:\"bank\" name:\"send\" ", o.String()) -} - -func TestCapabilityOwners_Set(t *testing.T) { - co := types.NewCapabilityOwners() - - owners := make([]types.Owner, 1024) - for i := range owners { - var owner types.Owner - - if i%2 == 0 { - owner = types.NewOwner("bank", fmt.Sprintf("send-%d", i)) - } else { - owner = types.NewOwner("slashing", fmt.Sprintf("slash-%d", i)) - } - - owners[i] = owner - require.NoError(t, co.Set(owner)) - } - - sort.Slice(owners, func(i, j int) bool { return owners[i].Key() < owners[j].Key() }) - require.Equal(t, owners, co.Owners) - - for _, owner := range owners { - require.Error(t, co.Set(owner)) - } -} - -func TestCapabilityOwners_Remove(t *testing.T) { - co := types.NewCapabilityOwners() - - co.Remove(types.NewOwner("bank", "send-0")) - require.Len(t, co.Owners, 0) - - for i := 0; i < 5; i++ { - require.NoError(t, co.Set(types.NewOwner("bank", fmt.Sprintf("send-%d", i)))) - } - - require.Len(t, co.Owners, 5) - - for i := 0; i < 5; i++ { - co.Remove(types.NewOwner("bank", fmt.Sprintf("send-%d", i))) - require.Len(t, co.Owners, 5-(i+1)) - } - - require.Len(t, co.Owners, 0) -} diff --git a/x/circuit/go.mod b/x/circuit/go.mod index 009175b5c993..b525f65e71f1 100644 --- a/x/circuit/go.mod +++ b/x/circuit/go.mod @@ -14,12 +14,12 @@ require ( require ( cosmossdk.io/api v0.3.1 // indirect cosmossdk.io/collections v0.0.0-20230214153846-b6c6e4e99177 // indirect - cosmossdk.io/core v0.6.0 // indirect + cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba // indirect cosmossdk.io/depinject v1.0.0-alpha.3 // indirect cosmossdk.io/errors v1.0.0-beta.7 // indirect cosmossdk.io/log v0.0.0-20230306220716-5e55f56d39d5 // indirect cosmossdk.io/math v1.0.0-beta.6.0.20230216172121-959ce49135e4 // indirect - cosmossdk.io/x/tx v0.2.2 // indirect + cosmossdk.io/x/tx v0.2.3-0.20230309163709-87da587416ba // indirect github.com/DataDog/zstd v1.5.2 // indirect github.com/alecthomas/participle/v2 v2.0.0-alpha7 // indirect github.com/armon/go-metrics v0.4.1 // indirect @@ -35,7 +35,7 @@ require ( github.com/confio/ics23/go v0.9.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect github.com/cosmos/cosmos-db v1.0.0-rc.1 // indirect - github.com/cosmos/cosmos-proto v1.0.0-beta.2 // indirect + github.com/cosmos/cosmos-proto v1.0.0-beta.3 // indirect github.com/cucumber/common/gherkin/go/v22 v22.0.0 // indirect github.com/cucumber/common/messages/go/v17 v17.1.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect diff --git a/x/circuit/go.sum b/x/circuit/go.sum index 80db3057640b..577afe2dbb7d 100644 --- a/x/circuit/go.sum +++ b/x/circuit/go.sum @@ -39,8 +39,8 @@ cosmossdk.io/api v0.3.1 h1:NNiOclKRR0AOlO4KIqeaG6PS6kswOMhHD0ir0SscNXE= cosmossdk.io/api v0.3.1/go.mod h1:DfHfMkiNA2Uhy8fj0JJlOCYOBp4eWUUJ1te5zBGNyIw= cosmossdk.io/collections v0.0.0-20230214153846-b6c6e4e99177 h1:At2M0aYQKEAWqr6JtZrJPOlfhdvENiGwJg2NCNHwIdc= cosmossdk.io/collections v0.0.0-20230214153846-b6c6e4e99177/go.mod h1:uqCi8FG+Bh2vv/qf5xZ8iab0E0c/DMA/cwafbp8dkcU= -cosmossdk.io/core v0.6.0 h1:V2zyaMVFN6hJSVENYx2XE9CMhzqwJPMjzSQpj0MyXAU= -cosmossdk.io/core v0.6.0/go.mod h1:YSFzBcKOf/U24e/sa6WFaYSrlZl5zgNvnWwjfFyPniw= +cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba h1:kSnaDzbwMInpQYwz8ESgvi6ceUQWcXAJdEVZW454dX0= +cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba/go.mod h1:WiFk9ZQbFVBHk9AqQIkLFqyj30NPQB6C45CIeAZxDcw= cosmossdk.io/depinject v1.0.0-alpha.3 h1:6evFIgj//Y3w09bqOUOzEpFj5tsxBqdc5CfkO7z+zfw= cosmossdk.io/depinject v1.0.0-alpha.3/go.mod h1:eRbcdQ7MRpIPEM5YUJh8k97nxHpYbc3sMUnEtt8HPWU= cosmossdk.io/errors v1.0.0-beta.7 h1:gypHW76pTQGVnHKo6QBkb4yFOJjC+sUGRc5Al3Odj1w= @@ -51,8 +51,8 @@ cosmossdk.io/math v1.0.0-beta.6.0.20230216172121-959ce49135e4 h1:/jnzJ9zFsL7qkV8 cosmossdk.io/math v1.0.0-beta.6.0.20230216172121-959ce49135e4/go.mod h1:gUVtWwIzfSXqcOT+lBVz2jyjfua8DoBdzRsIyaUAT/8= cosmossdk.io/store v0.0.0-20230302163046-da238c555585 h1:kTCveRw3C9qjZ/OXjol1q3r/SM6Qa7N/51rlGfTxqbY= cosmossdk.io/store v0.0.0-20230302163046-da238c555585/go.mod h1:gWCnPGa1lkOscgyrrC2S5rXyKa29Z1wpXvpczZpJef4= -cosmossdk.io/x/tx v0.2.2 h1:pD4TEbzOOerVQNI+M9anQIncl+4wFELpGds3N7RzPiQ= -cosmossdk.io/x/tx v0.2.2/go.mod h1:cur19OSg8P6ifrZ00yJOyY6HT75FEhLBX2Ir3Sl0ubY= +cosmossdk.io/x/tx v0.2.3-0.20230309163709-87da587416ba h1:NmWXkl0voj3dN96Qmk4rfrze6dLLLxB4qTCxXZTXBpM= +cosmossdk.io/x/tx v0.2.3-0.20230309163709-87da587416ba/go.mod h1:dhIxZhZF2glIA9hkkildy/JmSqVH3FIU/OhSU8is7PM= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= @@ -133,8 +133,8 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= github.com/cosmos/cosmos-db v1.0.0-rc.1 h1:SjnT8B6WKMW9WEIX32qMhnEEKcI7ZP0+G1Sa9HD3nmY= github.com/cosmos/cosmos-db v1.0.0-rc.1/go.mod h1:Dnmk3flSf5lkwCqvvjNpoxjpXzhxnCAFzKHlbaForso= -github.com/cosmos/cosmos-proto v1.0.0-beta.2 h1:X3OKvWgK9Gsejo0F1qs5l8Qn6xJV/AzgIWR2wZ8Nua8= -github.com/cosmos/cosmos-proto v1.0.0-beta.2/go.mod h1:+XRCLJ14pr5HFEHIUcn51IKXD1Fy3rkEQqt4WqmN4V0= +github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= +github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= github.com/cosmos/cosmos-sdk v0.46.0-beta2.0.20230306220716-5e55f56d39d5 h1:/6AWQpNJO7Kt8KcWlNOeR6RxHWz9jKE3xXaSJ1ijqDU= github.com/cosmos/cosmos-sdk v0.46.0-beta2.0.20230306220716-5e55f56d39d5/go.mod h1:yEwevSvOObLNzTLXERD1tdyoHoowNyeKB4GmPej6DO4= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= diff --git a/x/crisis/module.go b/x/crisis/module.go index e84e88eb316b..bc85df429b1b 100644 --- a/x/crisis/module.go +++ b/x/crisis/module.go @@ -74,7 +74,7 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod return types.ValidateGenesis(&data) } -// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the capability module. +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the crisis module. func (AppModuleBasic) RegisterGRPCGatewayRoutes(_ client.Context, _ *gwruntime.ServeMux) {} // GetTxCmd returns the root tx command for the crisis module. diff --git a/x/evidence/go.mod b/x/evidence/go.mod index 85a31bce39ed..b73569db0ae9 100644 --- a/x/evidence/go.mod +++ b/x/evidence/go.mod @@ -4,14 +4,14 @@ go 1.20 require ( cosmossdk.io/api v0.3.1 - cosmossdk.io/core v0.6.0 + cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba cosmossdk.io/depinject v1.0.0-alpha.3 cosmossdk.io/errors v1.0.0-beta.7 cosmossdk.io/log v0.0.0-20230306220716-5e55f56d39d5 cosmossdk.io/math v1.0.0-beta.6.0.20230216172121-959ce49135e4 cosmossdk.io/store v0.0.0-20230227103508-bbe7f8a11b44 github.com/cometbft/cometbft v0.37.0 - github.com/cosmos/cosmos-proto v1.0.0-beta.2 + github.com/cosmos/cosmos-proto v1.0.0-beta.3 github.com/cosmos/cosmos-sdk v0.46.0-beta2.0.20230306220716-5e55f56d39d5 github.com/cosmos/gogoproto v1.4.6 github.com/golang/mock v1.6.0 @@ -26,7 +26,7 @@ require ( require ( cosmossdk.io/collections v0.0.0-20230214153846-b6c6e4e99177 // indirect - cosmossdk.io/x/tx v0.2.2 // indirect + cosmossdk.io/x/tx v0.2.3-0.20230309163709-87da587416ba // indirect filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect diff --git a/x/evidence/go.sum b/x/evidence/go.sum index ee5b610c4bc7..448f19d356a4 100644 --- a/x/evidence/go.sum +++ b/x/evidence/go.sum @@ -39,8 +39,8 @@ cosmossdk.io/api v0.3.1 h1:NNiOclKRR0AOlO4KIqeaG6PS6kswOMhHD0ir0SscNXE= cosmossdk.io/api v0.3.1/go.mod h1:DfHfMkiNA2Uhy8fj0JJlOCYOBp4eWUUJ1te5zBGNyIw= cosmossdk.io/collections v0.0.0-20230214153846-b6c6e4e99177 h1:At2M0aYQKEAWqr6JtZrJPOlfhdvENiGwJg2NCNHwIdc= cosmossdk.io/collections v0.0.0-20230214153846-b6c6e4e99177/go.mod h1:uqCi8FG+Bh2vv/qf5xZ8iab0E0c/DMA/cwafbp8dkcU= -cosmossdk.io/core v0.6.0 h1:V2zyaMVFN6hJSVENYx2XE9CMhzqwJPMjzSQpj0MyXAU= -cosmossdk.io/core v0.6.0/go.mod h1:YSFzBcKOf/U24e/sa6WFaYSrlZl5zgNvnWwjfFyPniw= +cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba h1:kSnaDzbwMInpQYwz8ESgvi6ceUQWcXAJdEVZW454dX0= +cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba/go.mod h1:WiFk9ZQbFVBHk9AqQIkLFqyj30NPQB6C45CIeAZxDcw= cosmossdk.io/depinject v1.0.0-alpha.3 h1:6evFIgj//Y3w09bqOUOzEpFj5tsxBqdc5CfkO7z+zfw= cosmossdk.io/depinject v1.0.0-alpha.3/go.mod h1:eRbcdQ7MRpIPEM5YUJh8k97nxHpYbc3sMUnEtt8HPWU= cosmossdk.io/errors v1.0.0-beta.7 h1:gypHW76pTQGVnHKo6QBkb4yFOJjC+sUGRc5Al3Odj1w= @@ -51,8 +51,8 @@ cosmossdk.io/math v1.0.0-beta.6.0.20230216172121-959ce49135e4 h1:/jnzJ9zFsL7qkV8 cosmossdk.io/math v1.0.0-beta.6.0.20230216172121-959ce49135e4/go.mod h1:gUVtWwIzfSXqcOT+lBVz2jyjfua8DoBdzRsIyaUAT/8= cosmossdk.io/store v0.0.0-20230227103508-bbe7f8a11b44 h1:/pKsj/ApzO4+zMwpgLiPG5iakoHxziGpMiJcz4S+r4w= cosmossdk.io/store v0.0.0-20230227103508-bbe7f8a11b44/go.mod h1:flrxUykloEW1asE9p+Q+d8LSuNI3fBRdzISg9HTpYlQ= -cosmossdk.io/x/tx v0.2.2 h1:pD4TEbzOOerVQNI+M9anQIncl+4wFELpGds3N7RzPiQ= -cosmossdk.io/x/tx v0.2.2/go.mod h1:cur19OSg8P6ifrZ00yJOyY6HT75FEhLBX2Ir3Sl0ubY= +cosmossdk.io/x/tx v0.2.3-0.20230309163709-87da587416ba h1:NmWXkl0voj3dN96Qmk4rfrze6dLLLxB4qTCxXZTXBpM= +cosmossdk.io/x/tx v0.2.3-0.20230309163709-87da587416ba/go.mod h1:dhIxZhZF2glIA9hkkildy/JmSqVH3FIU/OhSU8is7PM= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek= filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= @@ -178,8 +178,8 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= github.com/cosmos/cosmos-db v1.0.0-rc.1 h1:SjnT8B6WKMW9WEIX32qMhnEEKcI7ZP0+G1Sa9HD3nmY= github.com/cosmos/cosmos-db v1.0.0-rc.1/go.mod h1:Dnmk3flSf5lkwCqvvjNpoxjpXzhxnCAFzKHlbaForso= -github.com/cosmos/cosmos-proto v1.0.0-beta.2 h1:X3OKvWgK9Gsejo0F1qs5l8Qn6xJV/AzgIWR2wZ8Nua8= -github.com/cosmos/cosmos-proto v1.0.0-beta.2/go.mod h1:+XRCLJ14pr5HFEHIUcn51IKXD1Fy3rkEQqt4WqmN4V0= +github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= +github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= github.com/cosmos/cosmos-sdk v0.46.0-beta2.0.20230306220716-5e55f56d39d5 h1:/6AWQpNJO7Kt8KcWlNOeR6RxHWz9jKE3xXaSJ1ijqDU= github.com/cosmos/cosmos-sdk v0.46.0-beta2.0.20230306220716-5e55f56d39d5/go.mod h1:yEwevSvOObLNzTLXERD1tdyoHoowNyeKB4GmPej6DO4= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= diff --git a/x/feegrant/go.mod b/x/feegrant/go.mod index a77d2e839c31..e1287e15a768 100644 --- a/x/feegrant/go.mod +++ b/x/feegrant/go.mod @@ -4,14 +4,14 @@ go 1.20 require ( cosmossdk.io/api v0.3.1 - cosmossdk.io/core v0.6.0 + cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba cosmossdk.io/depinject v1.0.0-alpha.3 cosmossdk.io/errors v1.0.0-beta.7 cosmossdk.io/log v0.0.0-20230306220716-5e55f56d39d5 cosmossdk.io/math v1.0.0-beta.6.0.20230216172121-959ce49135e4 cosmossdk.io/store v0.0.0-20230227103508-bbe7f8a11b44 github.com/cometbft/cometbft v0.37.0 - github.com/cosmos/cosmos-proto v1.0.0-beta.2 + github.com/cosmos/cosmos-proto v1.0.0-beta.3 github.com/cosmos/cosmos-sdk v0.46.0-beta2.0.20230306220716-5e55f56d39d5 github.com/cosmos/gogoproto v1.4.6 github.com/golang/mock v1.6.0 @@ -26,7 +26,7 @@ require ( require ( cosmossdk.io/collections v0.0.0-20230214153846-b6c6e4e99177 // indirect - cosmossdk.io/x/tx v0.2.2 // indirect + cosmossdk.io/x/tx v0.2.3-0.20230309163709-87da587416ba // indirect filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect diff --git a/x/feegrant/go.sum b/x/feegrant/go.sum index 7132179ae047..f60db818db9e 100644 --- a/x/feegrant/go.sum +++ b/x/feegrant/go.sum @@ -39,8 +39,8 @@ cosmossdk.io/api v0.3.1 h1:NNiOclKRR0AOlO4KIqeaG6PS6kswOMhHD0ir0SscNXE= cosmossdk.io/api v0.3.1/go.mod h1:DfHfMkiNA2Uhy8fj0JJlOCYOBp4eWUUJ1te5zBGNyIw= cosmossdk.io/collections v0.0.0-20230214153846-b6c6e4e99177 h1:At2M0aYQKEAWqr6JtZrJPOlfhdvENiGwJg2NCNHwIdc= cosmossdk.io/collections v0.0.0-20230214153846-b6c6e4e99177/go.mod h1:uqCi8FG+Bh2vv/qf5xZ8iab0E0c/DMA/cwafbp8dkcU= -cosmossdk.io/core v0.6.0 h1:V2zyaMVFN6hJSVENYx2XE9CMhzqwJPMjzSQpj0MyXAU= -cosmossdk.io/core v0.6.0/go.mod h1:YSFzBcKOf/U24e/sa6WFaYSrlZl5zgNvnWwjfFyPniw= +cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba h1:kSnaDzbwMInpQYwz8ESgvi6ceUQWcXAJdEVZW454dX0= +cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba/go.mod h1:WiFk9ZQbFVBHk9AqQIkLFqyj30NPQB6C45CIeAZxDcw= cosmossdk.io/depinject v1.0.0-alpha.3 h1:6evFIgj//Y3w09bqOUOzEpFj5tsxBqdc5CfkO7z+zfw= cosmossdk.io/depinject v1.0.0-alpha.3/go.mod h1:eRbcdQ7MRpIPEM5YUJh8k97nxHpYbc3sMUnEtt8HPWU= cosmossdk.io/errors v1.0.0-beta.7 h1:gypHW76pTQGVnHKo6QBkb4yFOJjC+sUGRc5Al3Odj1w= @@ -51,8 +51,8 @@ cosmossdk.io/math v1.0.0-beta.6.0.20230216172121-959ce49135e4 h1:/jnzJ9zFsL7qkV8 cosmossdk.io/math v1.0.0-beta.6.0.20230216172121-959ce49135e4/go.mod h1:gUVtWwIzfSXqcOT+lBVz2jyjfua8DoBdzRsIyaUAT/8= cosmossdk.io/store v0.0.0-20230227103508-bbe7f8a11b44 h1:/pKsj/ApzO4+zMwpgLiPG5iakoHxziGpMiJcz4S+r4w= cosmossdk.io/store v0.0.0-20230227103508-bbe7f8a11b44/go.mod h1:flrxUykloEW1asE9p+Q+d8LSuNI3fBRdzISg9HTpYlQ= -cosmossdk.io/x/tx v0.2.2 h1:pD4TEbzOOerVQNI+M9anQIncl+4wFELpGds3N7RzPiQ= -cosmossdk.io/x/tx v0.2.2/go.mod h1:cur19OSg8P6ifrZ00yJOyY6HT75FEhLBX2Ir3Sl0ubY= +cosmossdk.io/x/tx v0.2.3-0.20230309163709-87da587416ba h1:NmWXkl0voj3dN96Qmk4rfrze6dLLLxB4qTCxXZTXBpM= +cosmossdk.io/x/tx v0.2.3-0.20230309163709-87da587416ba/go.mod h1:dhIxZhZF2glIA9hkkildy/JmSqVH3FIU/OhSU8is7PM= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek= filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= @@ -183,8 +183,8 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= github.com/cosmos/cosmos-db v1.0.0-rc.1 h1:SjnT8B6WKMW9WEIX32qMhnEEKcI7ZP0+G1Sa9HD3nmY= github.com/cosmos/cosmos-db v1.0.0-rc.1/go.mod h1:Dnmk3flSf5lkwCqvvjNpoxjpXzhxnCAFzKHlbaForso= -github.com/cosmos/cosmos-proto v1.0.0-beta.2 h1:X3OKvWgK9Gsejo0F1qs5l8Qn6xJV/AzgIWR2wZ8Nua8= -github.com/cosmos/cosmos-proto v1.0.0-beta.2/go.mod h1:+XRCLJ14pr5HFEHIUcn51IKXD1Fy3rkEQqt4WqmN4V0= +github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= +github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= github.com/cosmos/cosmos-sdk v0.46.0-beta2.0.20230306220716-5e55f56d39d5 h1:/6AWQpNJO7Kt8KcWlNOeR6RxHWz9jKE3xXaSJ1ijqDU= github.com/cosmos/cosmos-sdk v0.46.0-beta2.0.20230306220716-5e55f56d39d5/go.mod h1:yEwevSvOObLNzTLXERD1tdyoHoowNyeKB4GmPej6DO4= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= diff --git a/x/genutil/types/testdata/app_genesis.json b/x/genutil/types/testdata/app_genesis.json index 450a8f278174..ebff50f77af3 100644 --- a/x/genutil/types/testdata/app_genesis.json +++ b/x/genutil/types/testdata/app_genesis.json @@ -1 +1 @@ -{"app_name":"","app_version":"","genesis_time":"2023-02-20T11:08:30.588307671Z","chain_id":"demo","initial_height":48,"app_hash":"","app_state":{"auth":{"accounts":[{"@type":"/cosmos.auth.v1beta1.BaseAccount","account_number":"1","address":"cosmos1qmkksxlxqdslq6kkca25m4jn344nx29lytq8f9","pub_key":null,"sequence":"0"},{"@type":"/cosmos.auth.v1beta1.BaseAccount","account_number":"8","address":"cosmos1pnt5523etwtzv6mj7haryfw6w8h5tkcuhd99m8","pub_key":null,"sequence":"0"},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"4","address":"cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh","pub_key":null,"sequence":"0"},"name":"bonded_tokens_pool","permissions":["burner","staking"]},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"5","address":"cosmos1tygms3xhhs3yv487phx3dw4a95jn7t7lpm470r","pub_key":null,"sequence":"0"},"name":"not_bonded_tokens_pool","permissions":["burner","staking"]},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"6","address":"cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn","pub_key":null,"sequence":"0"},"name":"gov","permissions":["burner"]},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"3","address":"cosmos1jv65s3grqf6v6jl3dp4t6c9t9rk99cd88lyufl","pub_key":null,"sequence":"0"},"name":"distribution","permissions":[]},{"@type":"/cosmos.auth.v1beta1.BaseAccount","account_number":"0","address":"cosmos15jenkldw6348lpgdev3vjzw90zzknxa9a3vg0j","pub_key":{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A3uyZdXedyvYx9VCL6xRjkxtcFpgxjhXFIz9b2mWz+aV"},"sequence":"4"},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"7","address":"cosmos1m3h30wlvsf8llruxtpukdvsy0km2kum8g38c8q","pub_key":null,"sequence":"0"},"name":"mint","permissions":["minter"]},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"2","address":"cosmos17xpfvakm2amg962yls6f84z3kell8c5lserqta","pub_key":null,"sequence":"0"},"name":"fee_collector","permissions":[]}],"params":{"max_memo_characters":"256","sig_verify_cost_ed25519":"590","sig_verify_cost_secp256k1":"1000","tx_sig_limit":"7","tx_size_cost_per_byte":"10"}},"authz":{"authorization":[]},"bank":{"balances":[{"address":"cosmos1qmkksxlxqdslq6kkca25m4jn344nx29lytq8f9","coins":[{"amount":"5000000000","denom":"stake"}]},{"address":"cosmos1pnt5523etwtzv6mj7haryfw6w8h5tkcuhd99m8","coins":[{"amount":"1000","denom":"stake"}]},{"address":"cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh","coins":[{"amount":"1000000","denom":"stake"}]},{"address":"cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn","coins":[{"amount":"10010000","denom":"stake"}]},{"address":"cosmos1jv65s3grqf6v6jl3dp4t6c9t9rk99cd88lyufl","coins":[{"amount":"9635","denom":"stake"}]},{"address":"cosmos15jenkldw6348lpgdev3vjzw90zzknxa9a3vg0j","coins":[{"amount":"4988989000","denom":"stake"}]}],"denom_metadata":[],"params":{"default_send_enabled":true,"send_enabled":[]},"send_enabled":[],"supply":[{"amount":"10000009635","denom":"stake"}]},"capability":{"index":"1","owners":[]},"consensus":null,"crisis":{"constant_fee":{"amount":"1000","denom":"stake"}},"distribution":{"delegator_starting_infos":[{"delegator_address":"cosmos15jenkldw6348lpgdev3vjzw90zzknxa9a3vg0j","starting_info":{"height":"0","previous_period":"1","stake":"1000000.000000000000000000"},"validator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp"}],"delegator_withdraw_infos":[],"fee_pool":{"community_pool":[{"amount":"192.700000000000000000","denom":"stake"}]},"outstanding_rewards":[{"outstanding_rewards":[{"amount":"9442.300000000000000000","denom":"stake"}],"validator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp"}],"params":{"base_proposer_reward":"0.000000000000000000","bonus_proposer_reward":"0.000000000000000000","community_tax":"0.020000000000000000","withdraw_addr_enabled":true},"previous_proposer":"cosmosvalcons16vm0nx49eam4q0xasdnwdzsdl6ymgyjt757sgr","validator_accumulated_commissions":[{"accumulated":{"commission":[{"amount":"944.230000000000000000","denom":"stake"}]},"validator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp"}],"validator_current_rewards":[{"rewards":{"period":"2","rewards":[{"amount":"8498.070000000000000000","denom":"stake"}]},"validator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp"}],"validator_historical_rewards":[{"period":"1","rewards":{"cumulative_reward_ratio":[],"reference_count":2},"validator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp"}],"validator_slash_events":[]},"evidence":{"evidence":[]},"feegrant":{"allowances":[]},"genutil":{"gen_txs":[]},"gov":{"deposit_params":null,"deposits":[{"amount":[{"amount":"10010000","denom":"stake"}],"depositor":"cosmos15jenkldw6348lpgdev3vjzw90zzknxa9a3vg0j","proposal_id":"1"}],"params":{"expedited_min_deposit":[{"amount":"50000000","denom":"stake"}],"expedited_threshold":"0.667000000000000000","expedited_voting_period":"86400s","max_deposit_period":"172800s","min_deposit":[{"amount":"10000000","denom":"stake"}],"min_initial_deposit_ratio":"0.000000000000000000","proposal_cancel_dest":"","proposal_cancel_ratio":"0.500000000000000000","quorum":"0.334000000000000000","threshold":"0.500000000000000000","veto_threshold":"0.334000000000000000","voting_period":"172800s"},"proposals":[{"deposit_end_time":"2023-02-22T11:11:52.776167376Z","expedited":false,"final_tally_result":{"abstain_count":"0","no_count":"0","no_with_veto_count":"0","yes_count":"0"},"id":"1","messages":[{"@type":"/cosmos.distribution.v1beta1.MsgCommunityPoolSpend","amount":[],"authority":"cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn","recipient":"cosmos1pnt5523etwtzv6mj7haryfw6w8h5tkcuhd99m8"}],"metadata":"ipfs://CID","proposer":"cosmos15jenkldw6348lpgdev3vjzw90zzknxa9a3vg0j","status":"PROPOSAL_STATUS_VOTING_PERIOD","submit_time":"2023-02-20T11:11:52.776167376Z","summary":"test proposal","title":"test proposal","total_deposit":[{"amount":"10010000","denom":"stake"}],"voting_end_time":"2023-02-22T11:12:07.801161984Z","voting_start_time":"2023-02-20T11:12:07.801161984Z"}],"starting_proposal_id":"2","tally_params":null,"votes":[],"voting_params":null},"group":{"group_members":[],"group_policies":[],"group_policy_seq":"0","group_seq":"0","groups":[],"proposal_seq":"0","proposals":[],"votes":[]},"mint":{"minter":{"annual_provisions":"1300010905.175073197786747950","inflation":"0.130000967926594565"},"params":{"blocks_per_year":"6311520","goal_bonded":"0.670000000000000000","inflation_max":"0.200000000000000000","inflation_min":"0.070000000000000000","inflation_rate_change":"0.130000000000000000","mint_denom":"stake"}},"nft":{"classes":[],"entries":[]},"params":null,"slashing":{"missed_blocks":[{"address":"cosmosvalcons16vm0nx49eam4q0xasdnwdzsdl6ymgyjt757sgr","missed_blocks":[]}],"params":{"downtime_jail_duration":"600s","min_signed_per_window":"0.500000000000000000","signed_blocks_window":"100","slash_fraction_double_sign":"0.050000000000000000","slash_fraction_downtime":"0.010000000000000000"},"signing_infos":[{"address":"cosmosvalcons16vm0nx49eam4q0xasdnwdzsdl6ymgyjt757sgr","validator_signing_info":{"address":"cosmosvalcons16vm0nx49eam4q0xasdnwdzsdl6ymgyjt757sgr","index_offset":"46","jailed_until":"1970-01-01T00:00:00Z","missed_blocks_counter":"0","start_height":"0","tombstoned":false}}]},"staking":{"delegations":[{"delegator_address":"cosmos15jenkldw6348lpgdev3vjzw90zzknxa9a3vg0j","shares":"1000000.000000000000000000","validator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp"}],"exported":true,"last_total_power":"1","last_validator_powers":[{"address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp","power":"1"}],"params":{"bond_denom":"stake","historical_entries":10000,"max_entries":7,"max_validators":100,"min_commission_rate":"0.000000000000000000","unbonding_time":"1814400s"},"redelegations":[],"unbonding_delegations":[],"validators":[{"commission":{"commission_rates":{"max_change_rate":"0.010000000000000000","max_rate":"0.200000000000000000","rate":"0.100000000000000000"},"update_time":"2023-02-20T11:08:30.588307671Z"},"consensus_pubkey":{"@type":"/cosmos.crypto.ed25519.PubKey","key":"tMZonPQYoooG/xbFVhHg95pTLxx7aO43/qgHFxDagWM="},"delegator_shares":"1000000.000000000000000000","description":{"details":"","identity":"","moniker":"test","security_contact":"","website":""},"jailed":false,"min_self_delegation":"1","operator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp","status":"BOND_STATUS_BONDED","tokens":"1000000","unbonding_height":"0","unbonding_ids":[],"unbonding_on_hold_ref_count":"0","unbonding_time":"1970-01-01T00:00:00Z"}]},"upgrade":{},"vesting":{}},"consensus":{"validators":[{"address":"D336F99AA5CF77503CDD8366E68A0DFE89B4124B","pub_key":{"type":"tendermint/PubKeyEd25519","value":"tMZonPQYoooG/xbFVhHg95pTLxx7aO43/qgHFxDagWM="},"power":"1","name":"test"}],"params":{"block":{"max_bytes":"22020096","max_gas":"-1"},"evidence":{"max_age_num_blocks":"100000","max_age_duration":"172800000000000","max_bytes":"1048576"},"validator":{"pub_key_types":["ed25519"]},"version":{"app":"0"}}}} \ No newline at end of file +{"app_name":"","app_version":"","genesis_time":"2023-02-20T11:08:30.588307671Z","chain_id":"demo","initial_height":48,"app_hash":"","app_state":{"auth":{"accounts":[{"@type":"/cosmos.auth.v1beta1.BaseAccount","account_number":"1","address":"cosmos1qmkksxlxqdslq6kkca25m4jn344nx29lytq8f9","pub_key":null,"sequence":"0"},{"@type":"/cosmos.auth.v1beta1.BaseAccount","account_number":"8","address":"cosmos1pnt5523etwtzv6mj7haryfw6w8h5tkcuhd99m8","pub_key":null,"sequence":"0"},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"4","address":"cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh","pub_key":null,"sequence":"0"},"name":"bonded_tokens_pool","permissions":["burner","staking"]},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"5","address":"cosmos1tygms3xhhs3yv487phx3dw4a95jn7t7lpm470r","pub_key":null,"sequence":"0"},"name":"not_bonded_tokens_pool","permissions":["burner","staking"]},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"6","address":"cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn","pub_key":null,"sequence":"0"},"name":"gov","permissions":["burner"]},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"3","address":"cosmos1jv65s3grqf6v6jl3dp4t6c9t9rk99cd88lyufl","pub_key":null,"sequence":"0"},"name":"distribution","permissions":[]},{"@type":"/cosmos.auth.v1beta1.BaseAccount","account_number":"0","address":"cosmos15jenkldw6348lpgdev3vjzw90zzknxa9a3vg0j","pub_key":{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A3uyZdXedyvYx9VCL6xRjkxtcFpgxjhXFIz9b2mWz+aV"},"sequence":"4"},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"7","address":"cosmos1m3h30wlvsf8llruxtpukdvsy0km2kum8g38c8q","pub_key":null,"sequence":"0"},"name":"mint","permissions":["minter"]},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"2","address":"cosmos17xpfvakm2amg962yls6f84z3kell8c5lserqta","pub_key":null,"sequence":"0"},"name":"fee_collector","permissions":[]}],"params":{"max_memo_characters":"256","sig_verify_cost_ed25519":"590","sig_verify_cost_secp256k1":"1000","tx_sig_limit":"7","tx_size_cost_per_byte":"10"}},"authz":{"authorization":[]},"bank":{"balances":[{"address":"cosmos1qmkksxlxqdslq6kkca25m4jn344nx29lytq8f9","coins":[{"amount":"5000000000","denom":"stake"}]},{"address":"cosmos1pnt5523etwtzv6mj7haryfw6w8h5tkcuhd99m8","coins":[{"amount":"1000","denom":"stake"}]},{"address":"cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh","coins":[{"amount":"1000000","denom":"stake"}]},{"address":"cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn","coins":[{"amount":"10010000","denom":"stake"}]},{"address":"cosmos1jv65s3grqf6v6jl3dp4t6c9t9rk99cd88lyufl","coins":[{"amount":"9635","denom":"stake"}]},{"address":"cosmos15jenkldw6348lpgdev3vjzw90zzknxa9a3vg0j","coins":[{"amount":"4988989000","denom":"stake"}]}],"denom_metadata":[],"params":{"default_send_enabled":true,"send_enabled":[]},"send_enabled":[],"supply":[{"amount":"10000009635","denom":"stake"}]},"consensus":null,"crisis":{"constant_fee":{"amount":"1000","denom":"stake"}},"distribution":{"delegator_starting_infos":[{"delegator_address":"cosmos15jenkldw6348lpgdev3vjzw90zzknxa9a3vg0j","starting_info":{"height":"0","previous_period":"1","stake":"1000000.000000000000000000"},"validator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp"}],"delegator_withdraw_infos":[],"fee_pool":{"community_pool":[{"amount":"192.700000000000000000","denom":"stake"}]},"outstanding_rewards":[{"outstanding_rewards":[{"amount":"9442.300000000000000000","denom":"stake"}],"validator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp"}],"params":{"base_proposer_reward":"0.000000000000000000","bonus_proposer_reward":"0.000000000000000000","community_tax":"0.020000000000000000","withdraw_addr_enabled":true},"previous_proposer":"cosmosvalcons16vm0nx49eam4q0xasdnwdzsdl6ymgyjt757sgr","validator_accumulated_commissions":[{"accumulated":{"commission":[{"amount":"944.230000000000000000","denom":"stake"}]},"validator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp"}],"validator_current_rewards":[{"rewards":{"period":"2","rewards":[{"amount":"8498.070000000000000000","denom":"stake"}]},"validator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp"}],"validator_historical_rewards":[{"period":"1","rewards":{"cumulative_reward_ratio":[],"reference_count":2},"validator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp"}],"validator_slash_events":[]},"evidence":{"evidence":[]},"feegrant":{"allowances":[]},"genutil":{"gen_txs":[]},"gov":{"deposit_params":null,"deposits":[{"amount":[{"amount":"10010000","denom":"stake"}],"depositor":"cosmos15jenkldw6348lpgdev3vjzw90zzknxa9a3vg0j","proposal_id":"1"}],"params":{"expedited_min_deposit":[{"amount":"50000000","denom":"stake"}],"expedited_threshold":"0.667000000000000000","expedited_voting_period":"86400s","max_deposit_period":"172800s","min_deposit":[{"amount":"10000000","denom":"stake"}],"min_initial_deposit_ratio":"0.000000000000000000","proposal_cancel_dest":"","proposal_cancel_ratio":"0.500000000000000000","quorum":"0.334000000000000000","threshold":"0.500000000000000000","veto_threshold":"0.334000000000000000","voting_period":"172800s"},"proposals":[{"deposit_end_time":"2023-02-22T11:11:52.776167376Z","expedited":false,"final_tally_result":{"abstain_count":"0","no_count":"0","no_with_veto_count":"0","yes_count":"0"},"id":"1","messages":[{"@type":"/cosmos.distribution.v1beta1.MsgCommunityPoolSpend","amount":[],"authority":"cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn","recipient":"cosmos1pnt5523etwtzv6mj7haryfw6w8h5tkcuhd99m8"}],"metadata":"ipfs://CID","proposer":"cosmos15jenkldw6348lpgdev3vjzw90zzknxa9a3vg0j","status":"PROPOSAL_STATUS_VOTING_PERIOD","submit_time":"2023-02-20T11:11:52.776167376Z","summary":"test proposal","title":"test proposal","total_deposit":[{"amount":"10010000","denom":"stake"}],"voting_end_time":"2023-02-22T11:12:07.801161984Z","voting_start_time":"2023-02-20T11:12:07.801161984Z"}],"starting_proposal_id":"2","tally_params":null,"votes":[],"voting_params":null},"group":{"group_members":[],"group_policies":[],"group_policy_seq":"0","group_seq":"0","groups":[],"proposal_seq":"0","proposals":[],"votes":[]},"mint":{"minter":{"annual_provisions":"1300010905.175073197786747950","inflation":"0.130000967926594565"},"params":{"blocks_per_year":"6311520","goal_bonded":"0.670000000000000000","inflation_max":"0.200000000000000000","inflation_min":"0.070000000000000000","inflation_rate_change":"0.130000000000000000","mint_denom":"stake"}},"nft":{"classes":[],"entries":[]},"params":null,"slashing":{"missed_blocks":[{"address":"cosmosvalcons16vm0nx49eam4q0xasdnwdzsdl6ymgyjt757sgr","missed_blocks":[]}],"params":{"downtime_jail_duration":"600s","min_signed_per_window":"0.500000000000000000","signed_blocks_window":"100","slash_fraction_double_sign":"0.050000000000000000","slash_fraction_downtime":"0.010000000000000000"},"signing_infos":[{"address":"cosmosvalcons16vm0nx49eam4q0xasdnwdzsdl6ymgyjt757sgr","validator_signing_info":{"address":"cosmosvalcons16vm0nx49eam4q0xasdnwdzsdl6ymgyjt757sgr","index_offset":"46","jailed_until":"1970-01-01T00:00:00Z","missed_blocks_counter":"0","start_height":"0","tombstoned":false}}]},"staking":{"delegations":[{"delegator_address":"cosmos15jenkldw6348lpgdev3vjzw90zzknxa9a3vg0j","shares":"1000000.000000000000000000","validator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp"}],"exported":true,"last_total_power":"1","last_validator_powers":[{"address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp","power":"1"}],"params":{"bond_denom":"stake","historical_entries":10000,"max_entries":7,"max_validators":100,"min_commission_rate":"0.000000000000000000","unbonding_time":"1814400s"},"redelegations":[],"unbonding_delegations":[],"validators":[{"commission":{"commission_rates":{"max_change_rate":"0.010000000000000000","max_rate":"0.200000000000000000","rate":"0.100000000000000000"},"update_time":"2023-02-20T11:08:30.588307671Z"},"consensus_pubkey":{"@type":"/cosmos.crypto.ed25519.PubKey","key":"tMZonPQYoooG/xbFVhHg95pTLxx7aO43/qgHFxDagWM="},"delegator_shares":"1000000.000000000000000000","description":{"details":"","identity":"","moniker":"test","security_contact":"","website":""},"jailed":false,"min_self_delegation":"1","operator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp","status":"BOND_STATUS_BONDED","tokens":"1000000","unbonding_height":"0","unbonding_ids":[],"unbonding_on_hold_ref_count":"0","unbonding_time":"1970-01-01T00:00:00Z"}]},"upgrade":{},"vesting":{}},"consensus":{"validators":[{"address":"D336F99AA5CF77503CDD8366E68A0DFE89B4124B","pub_key":{"type":"tendermint/PubKeyEd25519","value":"tMZonPQYoooG/xbFVhHg95pTLxx7aO43/qgHFxDagWM="},"power":"1","name":"test"}],"params":{"block":{"max_bytes":"22020096","max_gas":"-1"},"evidence":{"max_age_num_blocks":"100000","max_age_duration":"172800000000000","max_bytes":"1048576"},"validator":{"pub_key_types":["ed25519"]},"version":{"app":"0"}}}} \ No newline at end of file diff --git a/x/genutil/types/testdata/cmt_genesis.json b/x/genutil/types/testdata/cmt_genesis.json index 96275f71806f..aae3d84d0698 100644 --- a/x/genutil/types/testdata/cmt_genesis.json +++ b/x/genutil/types/testdata/cmt_genesis.json @@ -1 +1 @@ -{"app_hash":"","app_state":{"auth":{"accounts":[{"@type":"/cosmos.auth.v1beta1.BaseAccount","account_number":"1","address":"cosmos1qmkksxlxqdslq6kkca25m4jn344nx29lytq8f9","pub_key":null,"sequence":"0"},{"@type":"/cosmos.auth.v1beta1.BaseAccount","account_number":"8","address":"cosmos1pnt5523etwtzv6mj7haryfw6w8h5tkcuhd99m8","pub_key":null,"sequence":"0"},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"4","address":"cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh","pub_key":null,"sequence":"0"},"name":"bonded_tokens_pool","permissions":["burner","staking"]},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"5","address":"cosmos1tygms3xhhs3yv487phx3dw4a95jn7t7lpm470r","pub_key":null,"sequence":"0"},"name":"not_bonded_tokens_pool","permissions":["burner","staking"]},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"6","address":"cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn","pub_key":null,"sequence":"0"},"name":"gov","permissions":["burner"]},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"3","address":"cosmos1jv65s3grqf6v6jl3dp4t6c9t9rk99cd88lyufl","pub_key":null,"sequence":"0"},"name":"distribution","permissions":[]},{"@type":"/cosmos.auth.v1beta1.BaseAccount","account_number":"0","address":"cosmos15jenkldw6348lpgdev3vjzw90zzknxa9a3vg0j","pub_key":{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A3uyZdXedyvYx9VCL6xRjkxtcFpgxjhXFIz9b2mWz+aV"},"sequence":"4"},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"7","address":"cosmos1m3h30wlvsf8llruxtpukdvsy0km2kum8g38c8q","pub_key":null,"sequence":"0"},"name":"mint","permissions":["minter"]},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"2","address":"cosmos17xpfvakm2amg962yls6f84z3kell8c5lserqta","pub_key":null,"sequence":"0"},"name":"fee_collector","permissions":[]}],"params":{"max_memo_characters":"256","sig_verify_cost_ed25519":"590","sig_verify_cost_secp256k1":"1000","tx_sig_limit":"7","tx_size_cost_per_byte":"10"}},"authz":{"authorization":[]},"bank":{"balances":[{"address":"cosmos1qmkksxlxqdslq6kkca25m4jn344nx29lytq8f9","coins":[{"amount":"5000000000","denom":"stake"}]},{"address":"cosmos1pnt5523etwtzv6mj7haryfw6w8h5tkcuhd99m8","coins":[{"amount":"1000","denom":"stake"}]},{"address":"cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh","coins":[{"amount":"1000000","denom":"stake"}]},{"address":"cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn","coins":[{"amount":"10010000","denom":"stake"}]},{"address":"cosmos1jv65s3grqf6v6jl3dp4t6c9t9rk99cd88lyufl","coins":[{"amount":"9635","denom":"stake"}]},{"address":"cosmos15jenkldw6348lpgdev3vjzw90zzknxa9a3vg0j","coins":[{"amount":"4988989000","denom":"stake"}]}],"denom_metadata":[],"params":{"default_send_enabled":true,"send_enabled":[]},"send_enabled":[],"supply":[{"amount":"10000009635","denom":"stake"}]},"capability":{"index":"1","owners":[]},"consensus":null,"crisis":{"constant_fee":{"amount":"1000","denom":"stake"}},"distribution":{"delegator_starting_infos":[{"delegator_address":"cosmos15jenkldw6348lpgdev3vjzw90zzknxa9a3vg0j","starting_info":{"height":"0","previous_period":"1","stake":"1000000.000000000000000000"},"validator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp"}],"delegator_withdraw_infos":[],"fee_pool":{"community_pool":[{"amount":"192.700000000000000000","denom":"stake"}]},"outstanding_rewards":[{"outstanding_rewards":[{"amount":"9442.300000000000000000","denom":"stake"}],"validator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp"}],"params":{"base_proposer_reward":"0.000000000000000000","bonus_proposer_reward":"0.000000000000000000","community_tax":"0.020000000000000000","withdraw_addr_enabled":true},"previous_proposer":"cosmosvalcons16vm0nx49eam4q0xasdnwdzsdl6ymgyjt757sgr","validator_accumulated_commissions":[{"accumulated":{"commission":[{"amount":"944.230000000000000000","denom":"stake"}]},"validator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp"}],"validator_current_rewards":[{"rewards":{"period":"2","rewards":[{"amount":"8498.070000000000000000","denom":"stake"}]},"validator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp"}],"validator_historical_rewards":[{"period":"1","rewards":{"cumulative_reward_ratio":[],"reference_count":2},"validator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp"}],"validator_slash_events":[]},"evidence":{"evidence":[]},"feegrant":{"allowances":[]},"genutil":{"gen_txs":[]},"gov":{"deposit_params":null,"deposits":[{"amount":[{"amount":"10010000","denom":"stake"}],"depositor":"cosmos15jenkldw6348lpgdev3vjzw90zzknxa9a3vg0j","proposal_id":"1"}],"params":{"expedited_min_deposit":[{"amount":"50000000","denom":"stake"}],"expedited_threshold":"0.667000000000000000","expedited_voting_period":"86400s","max_deposit_period":"172800s","min_deposit":[{"amount":"10000000","denom":"stake"}],"min_initial_deposit_ratio":"0.000000000000000000","proposal_cancel_dest":"","proposal_cancel_ratio":"0.500000000000000000","quorum":"0.334000000000000000","threshold":"0.500000000000000000","veto_threshold":"0.334000000000000000","voting_period":"172800s"},"proposals":[{"deposit_end_time":"2023-02-22T11:11:52.776167376Z","expedited":false,"final_tally_result":{"abstain_count":"0","no_count":"0","no_with_veto_count":"0","yes_count":"0"},"id":"1","messages":[{"@type":"/cosmos.distribution.v1beta1.MsgCommunityPoolSpend","amount":[],"authority":"cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn","recipient":"cosmos1pnt5523etwtzv6mj7haryfw6w8h5tkcuhd99m8"}],"metadata":"ipfs://CID","proposer":"cosmos15jenkldw6348lpgdev3vjzw90zzknxa9a3vg0j","status":"PROPOSAL_STATUS_VOTING_PERIOD","submit_time":"2023-02-20T11:11:52.776167376Z","summary":"test proposal","title":"test proposal","total_deposit":[{"amount":"10010000","denom":"stake"}],"voting_end_time":"2023-02-22T11:12:07.801161984Z","voting_start_time":"2023-02-20T11:12:07.801161984Z"}],"starting_proposal_id":"2","tally_params":null,"votes":[],"voting_params":null},"group":{"group_members":[],"group_policies":[],"group_policy_seq":"0","group_seq":"0","groups":[],"proposal_seq":"0","proposals":[],"votes":[]},"mint":{"minter":{"annual_provisions":"1300010905.175073197786747950","inflation":"0.130000967926594565"},"params":{"blocks_per_year":"6311520","goal_bonded":"0.670000000000000000","inflation_max":"0.200000000000000000","inflation_min":"0.070000000000000000","inflation_rate_change":"0.130000000000000000","mint_denom":"stake"}},"nft":{"classes":[],"entries":[]},"params":null,"slashing":{"missed_blocks":[{"address":"cosmosvalcons16vm0nx49eam4q0xasdnwdzsdl6ymgyjt757sgr","missed_blocks":[]}],"params":{"downtime_jail_duration":"600s","min_signed_per_window":"0.500000000000000000","signed_blocks_window":"100","slash_fraction_double_sign":"0.050000000000000000","slash_fraction_downtime":"0.010000000000000000"},"signing_infos":[{"address":"cosmosvalcons16vm0nx49eam4q0xasdnwdzsdl6ymgyjt757sgr","validator_signing_info":{"address":"cosmosvalcons16vm0nx49eam4q0xasdnwdzsdl6ymgyjt757sgr","index_offset":"46","jailed_until":"1970-01-01T00:00:00Z","missed_blocks_counter":"0","start_height":"0","tombstoned":false}}]},"staking":{"delegations":[{"delegator_address":"cosmos15jenkldw6348lpgdev3vjzw90zzknxa9a3vg0j","shares":"1000000.000000000000000000","validator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp"}],"exported":true,"last_total_power":"1","last_validator_powers":[{"address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp","power":"1"}],"params":{"bond_denom":"stake","historical_entries":10000,"max_entries":7,"max_validators":100,"min_commission_rate":"0.000000000000000000","unbonding_time":"1814400s"},"redelegations":[],"unbonding_delegations":[],"validators":[{"commission":{"commission_rates":{"max_change_rate":"0.010000000000000000","max_rate":"0.200000000000000000","rate":"0.100000000000000000"},"update_time":"2023-02-20T11:08:30.588307671Z"},"consensus_pubkey":{"@type":"/cosmos.crypto.ed25519.PubKey","key":"tMZonPQYoooG/xbFVhHg95pTLxx7aO43/qgHFxDagWM="},"delegator_shares":"1000000.000000000000000000","description":{"details":"","identity":"","moniker":"test","security_contact":"","website":""},"jailed":false,"min_self_delegation":"1","operator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp","status":"BOND_STATUS_BONDED","tokens":"1000000","unbonding_height":"0","unbonding_ids":[],"unbonding_on_hold_ref_count":"0","unbonding_time":"1970-01-01T00:00:00Z"}]},"upgrade":{},"vesting":{}},"chain_id":"demo","consensus_params":{"block":{"max_bytes":"22020096","max_gas":"-1"},"evidence":{"max_age_duration":"172800000000000","max_age_num_blocks":"100000","max_bytes":"1048576"},"validator":{"pub_key_types":["ed25519"]},"version":{"app":"0"}},"genesis_time":"2023-02-20T11:08:30.588307671Z","initial_height":"48","validators":[{"address":"D336F99AA5CF77503CDD8366E68A0DFE89B4124B","name":"test","power":"1","pub_key":{"type":"tendermint/PubKeyEd25519","value":"tMZonPQYoooG/xbFVhHg95pTLxx7aO43/qgHFxDagWM="}}]} \ No newline at end of file +{"app_hash":"","app_state":{"auth":{"accounts":[{"@type":"/cosmos.auth.v1beta1.BaseAccount","account_number":"1","address":"cosmos1qmkksxlxqdslq6kkca25m4jn344nx29lytq8f9","pub_key":null,"sequence":"0"},{"@type":"/cosmos.auth.v1beta1.BaseAccount","account_number":"8","address":"cosmos1pnt5523etwtzv6mj7haryfw6w8h5tkcuhd99m8","pub_key":null,"sequence":"0"},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"4","address":"cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh","pub_key":null,"sequence":"0"},"name":"bonded_tokens_pool","permissions":["burner","staking"]},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"5","address":"cosmos1tygms3xhhs3yv487phx3dw4a95jn7t7lpm470r","pub_key":null,"sequence":"0"},"name":"not_bonded_tokens_pool","permissions":["burner","staking"]},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"6","address":"cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn","pub_key":null,"sequence":"0"},"name":"gov","permissions":["burner"]},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"3","address":"cosmos1jv65s3grqf6v6jl3dp4t6c9t9rk99cd88lyufl","pub_key":null,"sequence":"0"},"name":"distribution","permissions":[]},{"@type":"/cosmos.auth.v1beta1.BaseAccount","account_number":"0","address":"cosmos15jenkldw6348lpgdev3vjzw90zzknxa9a3vg0j","pub_key":{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A3uyZdXedyvYx9VCL6xRjkxtcFpgxjhXFIz9b2mWz+aV"},"sequence":"4"},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"7","address":"cosmos1m3h30wlvsf8llruxtpukdvsy0km2kum8g38c8q","pub_key":null,"sequence":"0"},"name":"mint","permissions":["minter"]},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"2","address":"cosmos17xpfvakm2amg962yls6f84z3kell8c5lserqta","pub_key":null,"sequence":"0"},"name":"fee_collector","permissions":[]}],"params":{"max_memo_characters":"256","sig_verify_cost_ed25519":"590","sig_verify_cost_secp256k1":"1000","tx_sig_limit":"7","tx_size_cost_per_byte":"10"}},"authz":{"authorization":[]},"bank":{"balances":[{"address":"cosmos1qmkksxlxqdslq6kkca25m4jn344nx29lytq8f9","coins":[{"amount":"5000000000","denom":"stake"}]},{"address":"cosmos1pnt5523etwtzv6mj7haryfw6w8h5tkcuhd99m8","coins":[{"amount":"1000","denom":"stake"}]},{"address":"cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh","coins":[{"amount":"1000000","denom":"stake"}]},{"address":"cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn","coins":[{"amount":"10010000","denom":"stake"}]},{"address":"cosmos1jv65s3grqf6v6jl3dp4t6c9t9rk99cd88lyufl","coins":[{"amount":"9635","denom":"stake"}]},{"address":"cosmos15jenkldw6348lpgdev3vjzw90zzknxa9a3vg0j","coins":[{"amount":"4988989000","denom":"stake"}]}],"denom_metadata":[],"params":{"default_send_enabled":true,"send_enabled":[]},"send_enabled":[],"supply":[{"amount":"10000009635","denom":"stake"}]},"consensus":null,"crisis":{"constant_fee":{"amount":"1000","denom":"stake"}},"distribution":{"delegator_starting_infos":[{"delegator_address":"cosmos15jenkldw6348lpgdev3vjzw90zzknxa9a3vg0j","starting_info":{"height":"0","previous_period":"1","stake":"1000000.000000000000000000"},"validator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp"}],"delegator_withdraw_infos":[],"fee_pool":{"community_pool":[{"amount":"192.700000000000000000","denom":"stake"}]},"outstanding_rewards":[{"outstanding_rewards":[{"amount":"9442.300000000000000000","denom":"stake"}],"validator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp"}],"params":{"base_proposer_reward":"0.000000000000000000","bonus_proposer_reward":"0.000000000000000000","community_tax":"0.020000000000000000","withdraw_addr_enabled":true},"previous_proposer":"cosmosvalcons16vm0nx49eam4q0xasdnwdzsdl6ymgyjt757sgr","validator_accumulated_commissions":[{"accumulated":{"commission":[{"amount":"944.230000000000000000","denom":"stake"}]},"validator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp"}],"validator_current_rewards":[{"rewards":{"period":"2","rewards":[{"amount":"8498.070000000000000000","denom":"stake"}]},"validator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp"}],"validator_historical_rewards":[{"period":"1","rewards":{"cumulative_reward_ratio":[],"reference_count":2},"validator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp"}],"validator_slash_events":[]},"evidence":{"evidence":[]},"feegrant":{"allowances":[]},"genutil":{"gen_txs":[]},"gov":{"deposit_params":null,"deposits":[{"amount":[{"amount":"10010000","denom":"stake"}],"depositor":"cosmos15jenkldw6348lpgdev3vjzw90zzknxa9a3vg0j","proposal_id":"1"}],"params":{"expedited_min_deposit":[{"amount":"50000000","denom":"stake"}],"expedited_threshold":"0.667000000000000000","expedited_voting_period":"86400s","max_deposit_period":"172800s","min_deposit":[{"amount":"10000000","denom":"stake"}],"min_initial_deposit_ratio":"0.000000000000000000","proposal_cancel_dest":"","proposal_cancel_ratio":"0.500000000000000000","quorum":"0.334000000000000000","threshold":"0.500000000000000000","veto_threshold":"0.334000000000000000","voting_period":"172800s"},"proposals":[{"deposit_end_time":"2023-02-22T11:11:52.776167376Z","expedited":false,"final_tally_result":{"abstain_count":"0","no_count":"0","no_with_veto_count":"0","yes_count":"0"},"id":"1","messages":[{"@type":"/cosmos.distribution.v1beta1.MsgCommunityPoolSpend","amount":[],"authority":"cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn","recipient":"cosmos1pnt5523etwtzv6mj7haryfw6w8h5tkcuhd99m8"}],"metadata":"ipfs://CID","proposer":"cosmos15jenkldw6348lpgdev3vjzw90zzknxa9a3vg0j","status":"PROPOSAL_STATUS_VOTING_PERIOD","submit_time":"2023-02-20T11:11:52.776167376Z","summary":"test proposal","title":"test proposal","total_deposit":[{"amount":"10010000","denom":"stake"}],"voting_end_time":"2023-02-22T11:12:07.801161984Z","voting_start_time":"2023-02-20T11:12:07.801161984Z"}],"starting_proposal_id":"2","tally_params":null,"votes":[],"voting_params":null},"group":{"group_members":[],"group_policies":[],"group_policy_seq":"0","group_seq":"0","groups":[],"proposal_seq":"0","proposals":[],"votes":[]},"mint":{"minter":{"annual_provisions":"1300010905.175073197786747950","inflation":"0.130000967926594565"},"params":{"blocks_per_year":"6311520","goal_bonded":"0.670000000000000000","inflation_max":"0.200000000000000000","inflation_min":"0.070000000000000000","inflation_rate_change":"0.130000000000000000","mint_denom":"stake"}},"nft":{"classes":[],"entries":[]},"params":null,"slashing":{"missed_blocks":[{"address":"cosmosvalcons16vm0nx49eam4q0xasdnwdzsdl6ymgyjt757sgr","missed_blocks":[]}],"params":{"downtime_jail_duration":"600s","min_signed_per_window":"0.500000000000000000","signed_blocks_window":"100","slash_fraction_double_sign":"0.050000000000000000","slash_fraction_downtime":"0.010000000000000000"},"signing_infos":[{"address":"cosmosvalcons16vm0nx49eam4q0xasdnwdzsdl6ymgyjt757sgr","validator_signing_info":{"address":"cosmosvalcons16vm0nx49eam4q0xasdnwdzsdl6ymgyjt757sgr","index_offset":"46","jailed_until":"1970-01-01T00:00:00Z","missed_blocks_counter":"0","start_height":"0","tombstoned":false}}]},"staking":{"delegations":[{"delegator_address":"cosmos15jenkldw6348lpgdev3vjzw90zzknxa9a3vg0j","shares":"1000000.000000000000000000","validator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp"}],"exported":true,"last_total_power":"1","last_validator_powers":[{"address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp","power":"1"}],"params":{"bond_denom":"stake","historical_entries":10000,"max_entries":7,"max_validators":100,"min_commission_rate":"0.000000000000000000","unbonding_time":"1814400s"},"redelegations":[],"unbonding_delegations":[],"validators":[{"commission":{"commission_rates":{"max_change_rate":"0.010000000000000000","max_rate":"0.200000000000000000","rate":"0.100000000000000000"},"update_time":"2023-02-20T11:08:30.588307671Z"},"consensus_pubkey":{"@type":"/cosmos.crypto.ed25519.PubKey","key":"tMZonPQYoooG/xbFVhHg95pTLxx7aO43/qgHFxDagWM="},"delegator_shares":"1000000.000000000000000000","description":{"details":"","identity":"","moniker":"test","security_contact":"","website":""},"jailed":false,"min_self_delegation":"1","operator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp","status":"BOND_STATUS_BONDED","tokens":"1000000","unbonding_height":"0","unbonding_ids":[],"unbonding_on_hold_ref_count":"0","unbonding_time":"1970-01-01T00:00:00Z"}]},"upgrade":{},"vesting":{}},"chain_id":"demo","consensus_params":{"block":{"max_bytes":"22020096","max_gas":"-1"},"evidence":{"max_age_duration":"172800000000000","max_age_num_blocks":"100000","max_bytes":"1048576"},"validator":{"pub_key_types":["ed25519"]},"version":{"app":"0"}},"genesis_time":"2023-02-20T11:08:30.588307671Z","initial_height":"48","validators":[{"address":"D336F99AA5CF77503CDD8366E68A0DFE89B4124B","name":"test","power":"1","pub_key":{"type":"tendermint/PubKeyEd25519","value":"tMZonPQYoooG/xbFVhHg95pTLxx7aO43/qgHFxDagWM="}}]} \ No newline at end of file diff --git a/x/gov/keeper/proposal.go b/x/gov/keeper/proposal.go index adf5c227ad9e..3777ab12bb46 100644 --- a/x/gov/keeper/proposal.go +++ b/x/gov/keeper/proposal.go @@ -212,6 +212,7 @@ func (keeper Keeper) DeleteProposal(ctx sdk.Context, proposalID uint64) { } if proposal.VotingEndTime != nil { keeper.RemoveFromActiveProposalQueue(ctx, proposalID, *proposal.VotingEndTime) + store.Delete(types.VotingPeriodProposalKey(proposalID)) } store.Delete(types.ProposalKey(proposalID)) diff --git a/x/gov/simulation/decoder.go b/x/gov/simulation/decoder.go index 3bd1df5d3b03..6e0f99a292da 100644 --- a/x/gov/simulation/decoder.go +++ b/x/gov/simulation/decoder.go @@ -58,6 +58,9 @@ func NewDecodeStore(cdc codec.Codec) func(kvA, kvB kv.Pair) string { cdc.MustUnmarshal(kvB.Value, &voteB) return fmt.Sprintf("%v\n%v", voteA, voteB) + case bytes.Equal(kvA.Key[:1], types.VotingPeriodProposalKeyPrefix): + return fmt.Sprintf("%v\n%v", kvA.Value, kvB.Value) + default: panic(fmt.Sprintf("invalid governance key prefix %X", kvA.Key[:1])) } diff --git a/x/gov/types/keys.go b/x/gov/types/keys.go index 95bf4d194191..4725685fbf1c 100644 --- a/x/gov/types/keys.go +++ b/x/gov/types/keys.go @@ -31,6 +31,8 @@ const ( // // - 0x03: nextProposalID // +// - 0x04: []byte{0x01} if proposalID is in the voting period +// // - 0x10: Deposit // // - 0x20: Voter diff --git a/x/nft/go.mod b/x/nft/go.mod index 930a36cb3421..a38f415ac634 100644 --- a/x/nft/go.mod +++ b/x/nft/go.mod @@ -4,13 +4,13 @@ go 1.20 require ( cosmossdk.io/api v0.3.1 - cosmossdk.io/core v0.6.0 + cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba cosmossdk.io/depinject v1.0.0-alpha.3 cosmossdk.io/errors v1.0.0-beta.7 cosmossdk.io/math v1.0.0-beta.6.0.20230216172121-959ce49135e4 cosmossdk.io/store v0.0.0-20230227103508-bbe7f8a11b44 github.com/cometbft/cometbft v0.37.0 - github.com/cosmos/cosmos-proto v1.0.0-beta.2 + github.com/cosmos/cosmos-proto v1.0.0-beta.3 github.com/cosmos/cosmos-sdk v0.46.0-beta2.0.20230306220716-5e55f56d39d5 github.com/cosmos/gogoproto v1.4.6 github.com/golang/mock v1.6.0 @@ -25,7 +25,7 @@ require ( require ( cosmossdk.io/collections v0.0.0-20230214153846-b6c6e4e99177 // indirect cosmossdk.io/log v0.0.0-20230306220716-5e55f56d39d5 // indirect - cosmossdk.io/x/tx v0.2.2 // indirect + cosmossdk.io/x/tx v0.2.3-0.20230309163709-87da587416ba // indirect filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect diff --git a/x/nft/go.sum b/x/nft/go.sum index ee5b610c4bc7..448f19d356a4 100644 --- a/x/nft/go.sum +++ b/x/nft/go.sum @@ -39,8 +39,8 @@ cosmossdk.io/api v0.3.1 h1:NNiOclKRR0AOlO4KIqeaG6PS6kswOMhHD0ir0SscNXE= cosmossdk.io/api v0.3.1/go.mod h1:DfHfMkiNA2Uhy8fj0JJlOCYOBp4eWUUJ1te5zBGNyIw= cosmossdk.io/collections v0.0.0-20230214153846-b6c6e4e99177 h1:At2M0aYQKEAWqr6JtZrJPOlfhdvENiGwJg2NCNHwIdc= cosmossdk.io/collections v0.0.0-20230214153846-b6c6e4e99177/go.mod h1:uqCi8FG+Bh2vv/qf5xZ8iab0E0c/DMA/cwafbp8dkcU= -cosmossdk.io/core v0.6.0 h1:V2zyaMVFN6hJSVENYx2XE9CMhzqwJPMjzSQpj0MyXAU= -cosmossdk.io/core v0.6.0/go.mod h1:YSFzBcKOf/U24e/sa6WFaYSrlZl5zgNvnWwjfFyPniw= +cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba h1:kSnaDzbwMInpQYwz8ESgvi6ceUQWcXAJdEVZW454dX0= +cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba/go.mod h1:WiFk9ZQbFVBHk9AqQIkLFqyj30NPQB6C45CIeAZxDcw= cosmossdk.io/depinject v1.0.0-alpha.3 h1:6evFIgj//Y3w09bqOUOzEpFj5tsxBqdc5CfkO7z+zfw= cosmossdk.io/depinject v1.0.0-alpha.3/go.mod h1:eRbcdQ7MRpIPEM5YUJh8k97nxHpYbc3sMUnEtt8HPWU= cosmossdk.io/errors v1.0.0-beta.7 h1:gypHW76pTQGVnHKo6QBkb4yFOJjC+sUGRc5Al3Odj1w= @@ -51,8 +51,8 @@ cosmossdk.io/math v1.0.0-beta.6.0.20230216172121-959ce49135e4 h1:/jnzJ9zFsL7qkV8 cosmossdk.io/math v1.0.0-beta.6.0.20230216172121-959ce49135e4/go.mod h1:gUVtWwIzfSXqcOT+lBVz2jyjfua8DoBdzRsIyaUAT/8= cosmossdk.io/store v0.0.0-20230227103508-bbe7f8a11b44 h1:/pKsj/ApzO4+zMwpgLiPG5iakoHxziGpMiJcz4S+r4w= cosmossdk.io/store v0.0.0-20230227103508-bbe7f8a11b44/go.mod h1:flrxUykloEW1asE9p+Q+d8LSuNI3fBRdzISg9HTpYlQ= -cosmossdk.io/x/tx v0.2.2 h1:pD4TEbzOOerVQNI+M9anQIncl+4wFELpGds3N7RzPiQ= -cosmossdk.io/x/tx v0.2.2/go.mod h1:cur19OSg8P6ifrZ00yJOyY6HT75FEhLBX2Ir3Sl0ubY= +cosmossdk.io/x/tx v0.2.3-0.20230309163709-87da587416ba h1:NmWXkl0voj3dN96Qmk4rfrze6dLLLxB4qTCxXZTXBpM= +cosmossdk.io/x/tx v0.2.3-0.20230309163709-87da587416ba/go.mod h1:dhIxZhZF2glIA9hkkildy/JmSqVH3FIU/OhSU8is7PM= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek= filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= @@ -178,8 +178,8 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= github.com/cosmos/cosmos-db v1.0.0-rc.1 h1:SjnT8B6WKMW9WEIX32qMhnEEKcI7ZP0+G1Sa9HD3nmY= github.com/cosmos/cosmos-db v1.0.0-rc.1/go.mod h1:Dnmk3flSf5lkwCqvvjNpoxjpXzhxnCAFzKHlbaForso= -github.com/cosmos/cosmos-proto v1.0.0-beta.2 h1:X3OKvWgK9Gsejo0F1qs5l8Qn6xJV/AzgIWR2wZ8Nua8= -github.com/cosmos/cosmos-proto v1.0.0-beta.2/go.mod h1:+XRCLJ14pr5HFEHIUcn51IKXD1Fy3rkEQqt4WqmN4V0= +github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= +github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= github.com/cosmos/cosmos-sdk v0.46.0-beta2.0.20230306220716-5e55f56d39d5 h1:/6AWQpNJO7Kt8KcWlNOeR6RxHWz9jKE3xXaSJ1ijqDU= github.com/cosmos/cosmos-sdk v0.46.0-beta2.0.20230306220716-5e55f56d39d5/go.mod h1:yEwevSvOObLNzTLXERD1tdyoHoowNyeKB4GmPej6DO4= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= diff --git a/x/tx/go.mod b/x/tx/go.mod index fad4ca661c20..96f87f615ba8 100644 --- a/x/tx/go.mod +++ b/x/tx/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( cosmossdk.io/api v0.3.1 - cosmossdk.io/core v0.6.0 + cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba cosmossdk.io/math v1.0.0-beta.6 github.com/cosmos/cosmos-proto v1.0.0-beta.3 github.com/google/go-cmp v0.5.9 diff --git a/x/tx/go.sum b/x/tx/go.sum index 760e3d2fb616..e636261d26ce 100644 --- a/x/tx/go.sum +++ b/x/tx/go.sum @@ -1,7 +1,7 @@ cosmossdk.io/api v0.3.1 h1:NNiOclKRR0AOlO4KIqeaG6PS6kswOMhHD0ir0SscNXE= cosmossdk.io/api v0.3.1/go.mod h1:DfHfMkiNA2Uhy8fj0JJlOCYOBp4eWUUJ1te5zBGNyIw= -cosmossdk.io/core v0.6.0 h1:V2zyaMVFN6hJSVENYx2XE9CMhzqwJPMjzSQpj0MyXAU= -cosmossdk.io/core v0.6.0/go.mod h1:YSFzBcKOf/U24e/sa6WFaYSrlZl5zgNvnWwjfFyPniw= +cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba h1:kSnaDzbwMInpQYwz8ESgvi6ceUQWcXAJdEVZW454dX0= +cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba/go.mod h1:WiFk9ZQbFVBHk9AqQIkLFqyj30NPQB6C45CIeAZxDcw= cosmossdk.io/math v1.0.0-beta.6 h1:WF29SiFYNde5eYvqO2kdOM9nYbDb44j3YW5B8M1m9KE= cosmossdk.io/math v1.0.0-beta.6/go.mod h1:gUVtWwIzfSXqcOT+lBVz2jyjfua8DoBdzRsIyaUAT/8= github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= diff --git a/x/upgrade/README.md b/x/upgrade/README.md index 03ebfa7c8cdb..d1be1b2c8c2a 100644 --- a/x/upgrade/README.md +++ b/x/upgrade/README.md @@ -246,8 +246,6 @@ module_versions: version: "1" - name: bank version: "2" -- name: capability - version: "1" - name: crisis version: "1" - name: distribution @@ -412,10 +410,6 @@ Example Output: "name": "bank", "version": "2" }, - { - "name": "capability", - "version": "1" - }, { "name": "crisis", "version": "1" @@ -558,10 +552,6 @@ Example Output: "name": "bank", "version": "2" }, - { - "name": "capability", - "version": "1" - }, { "name": "crisis", "version": "1" diff --git a/x/upgrade/go.mod b/x/upgrade/go.mod index e551529c462b..11bf0e4dcd17 100644 --- a/x/upgrade/go.mod +++ b/x/upgrade/go.mod @@ -4,14 +4,14 @@ go 1.20 require ( cosmossdk.io/api v0.3.1 - cosmossdk.io/core v0.6.0 + cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba cosmossdk.io/depinject v1.0.0-alpha.3 cosmossdk.io/errors v1.0.0-beta.7 cosmossdk.io/log v0.0.0-20230306220716-5e55f56d39d5 cosmossdk.io/store v0.0.0-20230227103508-bbe7f8a11b44 github.com/cometbft/cometbft v0.37.0 github.com/cosmos/cosmos-db v1.0.0-rc.1 - github.com/cosmos/cosmos-proto v1.0.0-beta.2 + github.com/cosmos/cosmos-proto v1.0.0-beta.3 github.com/cosmos/cosmos-sdk v0.46.0-beta2.0.20230306220716-5e55f56d39d5 github.com/cosmos/gogoproto v1.4.6 github.com/golang/protobuf v1.5.3 @@ -34,7 +34,7 @@ require ( cloud.google.com/go/storage v1.29.0 // indirect cosmossdk.io/collections v0.0.0-20230214153846-b6c6e4e99177 // indirect cosmossdk.io/math v1.0.0-beta.6.0.20230216172121-959ce49135e4 // indirect - cosmossdk.io/x/tx v0.2.2 // indirect + cosmossdk.io/x/tx v0.2.3-0.20230309163709-87da587416ba // indirect filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect diff --git a/x/upgrade/go.sum b/x/upgrade/go.sum index 91d479779b1b..c17922bac2b5 100644 --- a/x/upgrade/go.sum +++ b/x/upgrade/go.sum @@ -192,8 +192,8 @@ cosmossdk.io/api v0.3.1 h1:NNiOclKRR0AOlO4KIqeaG6PS6kswOMhHD0ir0SscNXE= cosmossdk.io/api v0.3.1/go.mod h1:DfHfMkiNA2Uhy8fj0JJlOCYOBp4eWUUJ1te5zBGNyIw= cosmossdk.io/collections v0.0.0-20230214153846-b6c6e4e99177 h1:At2M0aYQKEAWqr6JtZrJPOlfhdvENiGwJg2NCNHwIdc= cosmossdk.io/collections v0.0.0-20230214153846-b6c6e4e99177/go.mod h1:uqCi8FG+Bh2vv/qf5xZ8iab0E0c/DMA/cwafbp8dkcU= -cosmossdk.io/core v0.6.0 h1:V2zyaMVFN6hJSVENYx2XE9CMhzqwJPMjzSQpj0MyXAU= -cosmossdk.io/core v0.6.0/go.mod h1:YSFzBcKOf/U24e/sa6WFaYSrlZl5zgNvnWwjfFyPniw= +cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba h1:kSnaDzbwMInpQYwz8ESgvi6ceUQWcXAJdEVZW454dX0= +cosmossdk.io/core v0.6.1-0.20230309163709-87da587416ba/go.mod h1:WiFk9ZQbFVBHk9AqQIkLFqyj30NPQB6C45CIeAZxDcw= cosmossdk.io/depinject v1.0.0-alpha.3 h1:6evFIgj//Y3w09bqOUOzEpFj5tsxBqdc5CfkO7z+zfw= cosmossdk.io/depinject v1.0.0-alpha.3/go.mod h1:eRbcdQ7MRpIPEM5YUJh8k97nxHpYbc3sMUnEtt8HPWU= cosmossdk.io/errors v1.0.0-beta.7 h1:gypHW76pTQGVnHKo6QBkb4yFOJjC+sUGRc5Al3Odj1w= @@ -204,8 +204,8 @@ cosmossdk.io/math v1.0.0-beta.6.0.20230216172121-959ce49135e4 h1:/jnzJ9zFsL7qkV8 cosmossdk.io/math v1.0.0-beta.6.0.20230216172121-959ce49135e4/go.mod h1:gUVtWwIzfSXqcOT+lBVz2jyjfua8DoBdzRsIyaUAT/8= cosmossdk.io/store v0.0.0-20230227103508-bbe7f8a11b44 h1:/pKsj/ApzO4+zMwpgLiPG5iakoHxziGpMiJcz4S+r4w= cosmossdk.io/store v0.0.0-20230227103508-bbe7f8a11b44/go.mod h1:flrxUykloEW1asE9p+Q+d8LSuNI3fBRdzISg9HTpYlQ= -cosmossdk.io/x/tx v0.2.2 h1:pD4TEbzOOerVQNI+M9anQIncl+4wFELpGds3N7RzPiQ= -cosmossdk.io/x/tx v0.2.2/go.mod h1:cur19OSg8P6ifrZ00yJOyY6HT75FEhLBX2Ir3Sl0ubY= +cosmossdk.io/x/tx v0.2.3-0.20230309163709-87da587416ba h1:NmWXkl0voj3dN96Qmk4rfrze6dLLLxB4qTCxXZTXBpM= +cosmossdk.io/x/tx v0.2.3-0.20230309163709-87da587416ba/go.mod h1:dhIxZhZF2glIA9hkkildy/JmSqVH3FIU/OhSU8is7PM= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek= filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= @@ -343,8 +343,8 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= github.com/cosmos/cosmos-db v1.0.0-rc.1 h1:SjnT8B6WKMW9WEIX32qMhnEEKcI7ZP0+G1Sa9HD3nmY= github.com/cosmos/cosmos-db v1.0.0-rc.1/go.mod h1:Dnmk3flSf5lkwCqvvjNpoxjpXzhxnCAFzKHlbaForso= -github.com/cosmos/cosmos-proto v1.0.0-beta.2 h1:X3OKvWgK9Gsejo0F1qs5l8Qn6xJV/AzgIWR2wZ8Nua8= -github.com/cosmos/cosmos-proto v1.0.0-beta.2/go.mod h1:+XRCLJ14pr5HFEHIUcn51IKXD1Fy3rkEQqt4WqmN4V0= +github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= +github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= github.com/cosmos/cosmos-sdk v0.46.0-beta2.0.20230306220716-5e55f56d39d5 h1:/6AWQpNJO7Kt8KcWlNOeR6RxHWz9jKE3xXaSJ1ijqDU= github.com/cosmos/cosmos-sdk v0.46.0-beta2.0.20230306220716-5e55f56d39d5/go.mod h1:yEwevSvOObLNzTLXERD1tdyoHoowNyeKB4GmPej6DO4= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y=