From 19c735e3475f49bf734beca425e47903465eb9ce Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Fri, 19 Aug 2022 14:50:27 +0200 Subject: [PATCH 01/23] docs: add core API ADR --- docs/architecture/README.md | 1 + docs/architecture/adr-061-core-module-api.md | 367 +++++++++++++++++++ 2 files changed, 368 insertions(+) create mode 100644 docs/architecture/adr-061-core-module-api.md diff --git a/docs/architecture/README.md b/docs/architecture/README.md index a3446ce1a2fd..875c7e493799 100644 --- a/docs/architecture/README.md +++ b/docs/architecture/README.md @@ -81,6 +81,7 @@ When writing ADRs, follow the same best practices for writing RFCs. When writing * [ADR 046: Module Params](./adr-046-module-params.md) * [ADR 057: App Wiring Part I](./adr-057-app-wiring-1.md) * [ADR 059: Test Scopes](./adr-059-test-scopes.md) +* [ADR 061: Core Module API](./adr-61-core-module-api.md) ### Draft diff --git a/docs/architecture/adr-061-core-module-api.md b/docs/architecture/adr-061-core-module-api.md new file mode 100644 index 000000000000..f1f40f276f47 --- /dev/null +++ b/docs/architecture/adr-061-core-module-api.md @@ -0,0 +1,367 @@ +# ADR 061: Core Module API + +## Changelog + +* 2022-08-18 First Draft + +## Status + +PROPOSED Not Implemented + +## Abstract + +> "If you can't explain it simply, you don't understand it well enough." Provide a simplified and layman-accessible explanation of the ADR. +> A short (~200 word) description of the issue being addressed. + +## Context + +Historically modules have exposed their functionality to the state machine via the `AppModule` and `AppModuleBasic` +interfaces which have the following shortcomings: +* both `AppModule` and `AppModuleBasic` need to be defined which is counter-intuitive +* apps need to implement the full interfaces, even parts they don't need +* interface methods depend heavily on unstable third party dependencies, in particular Tendermint +* legacy required methods have littered these interfaces for far too long + +In order to interact with the state machine, modules have needed to do a combination of these things: +* get store keys from the app +* call methods on `sdk.Context` which contains more or less the full set of capability available to modules. + +By isolating all the state machine functionality into `sdk.Context`, the set of functionalities available to +modules are tightly coupled to this type. If there are changes to upstream dependencies (such as Tendermint) +or new functionalities are desired (such as alternate store types), the changes need impact `sdk.Context` and all +consumers of it (basically all modules). Also, all modules now receive `context.Context` and need to convert these +to `sdk.Context`'s with a non-ergonomic unwrapping function. + +## Decision + +The `core` API proposes a set of core APIs that modules can rely on to interact with the state machine and expose their +functionalities to it that are designed in a principled way such that: +* tight coupling of dependencies and unrelated functionalities is minimized or eliminated +* APIs can have long-term stability guarantees +* the SDK framework is extensible in a safe a straightforward way + +The design principles of the core API are as follows: +* everything that a module wants to interact with in the state machine is a service +* all services coordinate state via `context.Context` and don't try to recreate the "bag of variables" approach of `sdk.Context` +* all independent services are isolated in independent packages with minimal APIs and minimal dependencies +* the core API should be minimalistic and designed for long-term support (LTS) +* a "runtime" module will implement all the "core services" defined by the core API and can handle all module + functionalities exposed by the core `Handler` type +* other non-core and/or non-LTS services can be exposed by specific versions of runtime modules or other modules +following the same design principles, this includes functionality that interacts with specific non-stable versions of +third party dependencies such as Tendermint +* go stable API management principles are followed (TODO: link) + +### Core Services + +The following "core services" are defined by the core API. All valid runtime module implementations should provide +implementations of these services to modules via both [dependency injection](./adr-057-app-wiring-1.md) and +manual wiring. + +#### Store Services + +The generic store interface is defined as the current SDK `KVStore` interface. The `StoreService` type is a refactoring +of the existing store key types which inverts the relationship with the context. Instead of expecting a +"bag of variables" context type to explicitly know about stores, `StoreService` uses the general-purpose +`context.Context` just to coordinate state: + +```go +type StoreService interface { + // Open retrieves the KVStore from the context. + Open(context.Context) KVStore +} +``` + +Modules can use these services like this: +```go +func (k msgServer) Send(ctx context.Context, msg *types.MsgSend) (*types.MsgSendResponse, error) { + store := k.storeService.Open(ctx) +} +``` + +Three specific types of store services (kv-store, memory and transient) are defined by the core API that modules can +get a reference to via dependency injection or manually: + +```go +type KVStoreService interface { + StoreService + IsKVStoreService() +} + +type MemoryStoreService interface { + StoreService + IsMemoryStoreService() +} + +type TransientStoreService interface { + StoreService + IsTransientStoreService() +} +``` + +Just as with the current runtime module implementation, modules will not need to explicitly name these store keys, +but rather the runtime module will choose an appropriate name for them and modules just need to request the +type of store they need in their dependency injection (or manual) constructors. + +#### Event Service + +The event service gives modules access to an event manager which allows modules to emit typed and legacy, +untyped events: + +```go +type EventService interface { + GetManager(context.Context) EventManager +} + +type EventManager interface { + Emit(proto.Message) error + EmitLegacy(eventType string, attrs ...LegacyEventAttribute) error +} +``` + +By definition, typed events emitted with `Emit` are part of consensus and can be observed by other modules while +legacy events emitted by `EmitLegacy` are not considered to be part of consensus and cannot be observed by other +modules. + +Design questions: +* should we allow overriding event managers (like `sdk.Context.WithEventManager`)? +* should there be a way to "silently" emit typed events that aren't part of consensus? + +#### Block Info Service + +The `BlockInfo` service allows modules to get a limited set of information about the currently executing block +that does not depend on any specific version of Tendermint: +```go +type BlockInfoService interface { + GetBlockInfo(ctx context.Context) BlockInfo +} + +type BlockInfo interface { + ChainID() string + Height() int64 + Time() *timestamppb.Timestamp + Hash() []byte +} +``` + +Only a limited set of modules need any other information from the Tendermint block header and specific versions +of runtime modules tied to specific Tendermint versions can expose this functionality to modules that need it. +The basic `BlockInfo` service is left fairly generic to insulate the vast majority of other modules from unneeded +exposure to changes in the Tendermint protocol. + +#### Gas Service + +The `GasService` handles tracking of gas consumptions at the block and transaction level and also allows +for overriding the gas meter passed to child calls: +```go +type Service interface { + GetMeter(context.Context) Meter + GetBlockMeter(context.Context) Meter + WithMeter(ctx context.Context, meter Meter) context.Context + WithBlockMeter(ctx context.Context, meter Meter) context.Context +} +``` + +#### `grpc.ClientConnInterface` + +Runtime module implementations should provide an instance of `grpc.ClientConnInterface` as core service. This service +will allow modules to send messages to and make queries against other modules as described in [ADR 033](./adr-033-protobuf-inter-module-comm.md). + +A single `grpc.ClientConnInterface` will be used for both MsgClient's and QueryClient's and the state machine will +make the presence or absence of the protobuf option `cosmos.msg.v1.service` which will be required for all +valid `Msg` service types. + +It will likely be necessary to define which queries and `Msg`'s are available for inter-module communication, possibly +with an `internal` protobuf option. + +The router used by the `grpc.ClientConnInterface` will provide a unified interface for sending `Msg`'s and queries +which ensures all required pre-processing steps are uniformly executed by all modules which need such functionality. + +### Core `Handler` Struct + +Modules will provide their core services to runtime module via the `Handler` struct instead of the existing +`AppModule` interface: +```go +type Handler struct { + // Services are the Msg and Query services for the module. Msg services + // must be annotated with the option cosmos.msg.v1.service = true. + Services []ServiceImpl + + DefaultGenesis(GenesisTarget) + ValidateGenesis(GenesisSource) error + InitGenesis(context.Context, GenesisSource) error + ExportGenesis(context.Context, GenesisTarget) + + BeginBlocker func(context.Context) error + EndBlocker func(context.Context) error + + EventListeners []EventListener + + UpgradeHandlers []UpgradeHandler +} +``` + +A struct as opposed to an interface has been chosen for the following reasons: +* it is always possible to add new fields to a struct without breaking backwards compatibility +* it is not necessary to populate all fields in a struct, whereas interface methods must always be implemented +* compared to extension interfaces, struct fields are more explicit + +Helper methods will be added to the `Handler` struct to simplify construction of more complex fields. + +#### `MsgServer` and `QueryServer` registration + +The `Handler` struct type will implement `grpc.ServiceRegistrar` interface which will allow for registering +`MsgServer` and `QueryServer` implementations directly with the `Handler` struct like this: +```go + h := &appmodule.Handler{} + types.RegisterMsgServer(h, keeper.NewMsgServerImpl(am.keeper)) + types.RegisterQueryServer(h, am.keeper) +``` + +Because of the `cosmos.msg.v1.service` protobuf option, required for `Msg` services, the same handler struct can be +used to register both `Msg` and query services. + +#### Genesis + +The genesis `Handler` functions - `DefaultGenesis`, `ValidateGenesis`, `InitGenesis` and `ExportGenesis` - are specified +against the `GenesisSource` and `GenesisTarget` interfaces which will abstract over genesis sources which may be single +JSON files or collections of JSON objects that can be efficiently streamed. They will also include helper functions for +interacting with genesis data represented by single `proto.Message` types. + +```go +type GenesisSource interface { + ReadMessage(proto.Message) error + OpenReader(field string) (io.ReadCloser, error) + ReadRawJSON() (json.RawMessage, error) +} + +type GenesisTarget interface { + WriteMessage(proto.Message) error + OpenWriter(field string) (io.WriteCloser, error) + WriteRawJSON(json.RawMessage) error +} +``` + +All genesis objects for a given module are expected to conform to the semantics of a JSON object. That object may +represent a single genesis state `proto.Message` which is the case for most current modules, or it may represent a set +of nested JSON structures which may optionally be streamed as arrays from individual files which is the way the +[ORM](./adr-055-orm.md) is designed. This streaming genesis support may be beneficial for chains with extremely large +amounts of state that can't fit into memory. + +Modules which use a single `proto.Message` can use the `GenesisSource.ReadMessage` and `GenesisTarget.ReadMessage` +methods without needing to deal with raw JSON or codecs. + +Modules which use streaming genesis can use the +`GenesisSource.OpenReader` and `GenesisTarget.OpenWriter` methods. In the case of modules using the ORM, all JSON +handling is done automatically by the ORM and a single line will be sufficient for registering all of that functionality +(ex. `ormDb.RegisterGenesis(handler)`). + +Low-level `ReadRawJSON` and `WriteRawJSON` are provided in case modules use some other sort of legacy genesis logic +we haven't anticipated. + +#### Begin and End Blockers + +The `BeginBlock` and `EndBlock` methods will simply take a `context.Context`, because: +* most modules don't need Tendermint information other than `BlockInfo` so we can eliminate dependencies on specific +Tendermint versions +* for the few modules that need Tendermint block headers and/or return validator updates, specific versions of the +runtime module will provide specific functionality for interacting with the specific version(s) of Tendermint +supported + +In order for `BeginBlock`, `EndBlock` and `InitGenesis` to send back validator updates and retrieve full Tendermint +block headers, the runtime module for a specific version of Tendermint could provide services like this: +```go +type ValidatorUpdateService interface { + SetValidatorUpdates(context.Context, []abci.ValidatorUpdate) +} + +type BeginBlockService interface { + GetBeginBlockRequest(context.Context) abci.RequestBeginBlock +} +``` + +We know these types will change at the Tendermint level and that also a very limited set of modules actually need this +functionality, so they are intentionally kept out of core to keep core limited to the necessary, minimal set of stable +APIs. + +#### Event Listeners + +Handlers allow event listeners for typed events to be registered that will be called deterministically whenever those +events are called in the state machine. Event listeners are functions that take a context, the protobuf message type of +the event and optionally return an error. If an event listener returns a non-nil error, this error will fail the process +that emitted the event and revert any state transitions that this process would have caused. + +Event listeners for typed events can be added to the handler struct either by populating the `EventListeners` field +or using the `Handler.AddEventListener` builder method: +```go +handler.AddEventListener(func (ctx context.Context, e *EventReceive) error) { ... }) +``` + +#### Upgrade Handlers + +Upgrade handlers can be specified using the `UpgradeHandlers` field that takes an array of `UpgradeHandler` structs: +```go +type UpgradeHandler struct { + FromModule protoreflect.FullName + Handler func(context.Context) error +} +``` + +In the [ADR 057: App Wiring](./adr-057-app-wiring-1.md) it is specified that each version of each module should be +identified by a unique protobuf message type called the module config object. For example for the consensus version 3 +of the bank module, we would actually have a unique type `cosmos.bank.module.v3.Module` to identify this module. +In the [ModuleDescriptor](../proto/cosmos/app/v1alpha1/module.proto) for the module config object, `MigrateFromInfo` +objects should be provided which specify the full-qualified names of the modules that this module can migrate from. +For example, `cosmos.bank.module.v3.Module` might specify that it can migrate from `cosmos.bank.module.v2.Module`. +The app wiring framework will ensure that if the `ModuleDescriptor` specifies that a module can upgrade from another +module, an `UpgradeHandler` specifying that `FromModule` must be provided. + +A helper method on handler will be provided to simplify upgrade handler registration, ex: +```go +func (h *Handler) RegisterUpgradeHandler(fromModule protoreflect.FullName, handler func(context.Context) error) +``` + +TODO: +* interfaces and legacy amino registration +* commands +* grpc gateway +* invariants +* inter-module hooks +* simulations + +### Runtime Compatibility Version + +### Legacy `AppModule` Runtime Compatibility + +## Consequences + +> This section describes the resulting context, after applying the decision. All consequences should be listed here, not just the "positive" ones. A particular decision may have positive, negative, and neutral consequences, but all of them affect the team and project in the future. + +### Backwards Compatibility + +> All ADRs that introduce backwards incompatibilities must include a section describing these incompatibilities and their severity. The ADR must explain how the author proposes to deal with these incompatibilities. ADR submissions without a sufficient backwards compatibility treatise may be rejected outright. + +### Positive + +{positive consequences} + +### Negative + +{negative consequences} + +### Neutral + +{neutral consequences} + +## Further Discussions + +While an ADR is in the DRAFT or PROPOSED stage, this section should contain a summary of issues to be solved in future iterations (usually referencing comments from a pull-request discussion). +Later, this section can optionally list ideas or improvements the author or reviewers found during the analysis of this ADR. + +## Test Cases [optional] + +Test cases for an implementation are mandatory for ADRs that are affecting consensus changes. Other ADRs can choose to include links to test cases if applicable. + +## References + +* {reference link} From 95e52813904fb8afc09097e52fe05c628663cf30 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Fri, 19 Aug 2022 15:37:31 +0200 Subject: [PATCH 02/23] updates --- docs/architecture/adr-061-core-module-api.md | 36 +++++++++++++++++--- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/docs/architecture/adr-061-core-module-api.md b/docs/architecture/adr-061-core-module-api.md index f1f40f276f47..3d26b99becfa 100644 --- a/docs/architecture/adr-061-core-module-api.md +++ b/docs/architecture/adr-061-core-module-api.md @@ -109,11 +109,12 @@ The event service gives modules access to an event manager which allows modules untyped events: ```go -type EventService interface { - GetManager(context.Context) EventManager +package event +type Service interface { + GetManager(context.Context) Manager } -type EventManager interface { +type Manager interface { Emit(proto.Message) error EmitLegacy(eventType string, attrs ...LegacyEventAttribute) error } @@ -132,7 +133,9 @@ Design questions: The `BlockInfo` service allows modules to get a limited set of information about the currently executing block that does not depend on any specific version of Tendermint: ```go -type BlockInfoService interface { +package blockinfo + +type Service interface { GetBlockInfo(ctx context.Context) BlockInfo } @@ -151,9 +154,11 @@ exposure to changes in the Tendermint protocol. #### Gas Service -The `GasService` handles tracking of gas consumptions at the block and transaction level and also allows +The gas service handles tracking of gas consumptions at the block and transaction level and also allows for overriding the gas meter passed to child calls: ```go +package gas + type Service interface { GetMeter(context.Context) Meter GetBlockMeter(context.Context) Meter @@ -321,6 +326,27 @@ A helper method on handler will be provided to simplify upgrade handler registra func (h *Handler) RegisterUpgradeHandler(fromModule protoreflect.FullName, handler func(context.Context) error) ``` +#### Remaining Parts of AppModule + + +#### Example Usage + +Here is an example of setting up a hypothetical `foo` v2 module which uses the [ORM](./adr-055-orm.md) for its state +management and genesis. + +```go +func ProvideApp(config *foomodulev2.Module, evtSvc event.EventService, db orm.ModuleDB) (Keeper, *Handler){ + k := &Keeper{db: db, evtSvc: evtSvc} + h := &Handler{} + foov1.RegisterMsgServer(h, k) + foov1.RegisterQueryServer(h, k) + h.RegisterBeginBlocker(k.BeginBlock) + db.RegisterGenesis(h) + h.RegisterUpgradeHandler("foo.module.v1.Module", k.MigrateFromV1) + return k, h +} +``` + TODO: * interfaces and legacy amino registration * commands From 77d6ea15a1e918650ca10c9b23ca709cd514530e Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Fri, 19 Aug 2022 17:24:09 +0200 Subject: [PATCH 03/23] updates --- docs/architecture/adr-057-app-wiring-1.md | 84 +++++++++-- docs/architecture/adr-061-core-module-api.md | 147 ++++++++++++++----- 2 files changed, 184 insertions(+), 47 deletions(-) diff --git a/docs/architecture/adr-057-app-wiring-1.md b/docs/architecture/adr-057-app-wiring-1.md index 5287613d0045..31ad00e7a06f 100644 --- a/docs/architecture/adr-057-app-wiring-1.md +++ b/docs/architecture/adr-057-app-wiring-1.md @@ -1,12 +1,13 @@ -# ADR 057: App Wiring Part I +# ADR 057: App Wiring ## Changelog * 2022-05-04: Initial Draft +* 2022-08-19: Updates to align with [ADR 061](./adr-061-core-module-api.md) ## Status -PROPOSED Partially Implemented +PROPOSED Implemented ## Abstract @@ -54,7 +55,7 @@ features: * dependency resolution and provision through functional constructors, ex: `func(need SomeDep) (AnotherDep, error)` * dependency injection `In` and `Out` structs which support `optional` dependencies -* grouped-dependencies (many-per-container) through the `AutoGroupType` tag interface +* grouped-dependencies (many-per-container) through the `ManyPerContainerType` tag interface * module-scoped dependencies via `ModuleKey`s (where each module gets a unique dependency) * one-per-module dependencies through the `OnePerModuleType` tag interface * sophisticated debugging information and container visualization via GraphViz @@ -63,7 +64,7 @@ Here are some examples of how these would be used in an SDK module: * `StoreKey` could be a module-scoped dependency which is unique per module * a module's `AppModule` instance (or the equivalent) could be a `OnePerModuleType` -* CLI commands could be provided with `AutoGroupType`s +* CLI commands could be provided with `ManyPerContainerType`s Note that even though dependency resolution is dynamic and based on reflection, which could be considered a pitfall of this approach, the entire dependency graph should be resolved immediately on app startup and only gets resolved @@ -94,7 +95,9 @@ message ModuleConfig { The configuration for every module is itself a protobuf message and modules will be identified and loaded based on the protobuf type URL of their config object (ex. `cosmos.bank.module.v1.Module`). Modules are given a unique short `name` to share resources across different versions of the same module which might have a different protobuf package -versions (ex. `cosmos.bank.module.v2.Module`). +versions (ex. `cosmos.bank.module.v2.Module`). All module config objects should define the `cosmos.app.v1alpha1.module` +descriptor option which will provide additional useful metadata for the framework and which can also be indexed +in module registries. An example app config in YAML might look like this: @@ -178,39 +181,43 @@ Ex: ```go func init() { - module.Register("cosmos.bank.module.v1.Module", - module.Types( + appmodule.Register("cosmos.bank.module.v1.Module", + appmodule.Types( types.Types_tx_proto, types.Types_query_proto, types.Types_types_proto, ), - module.Provide( + appmodule.Provide( provideBankModule, ) ) } -type inputs struct { +type Inputs struct { container.In AuthKeeper auth.Keeper DB ormdb.ModuleDB } -type outputs struct { +type Outputs struct { Keeper bank.Keeper - Handler app.Handler // app.Handler is a hypothetical type which replaces the current AppModule + Handler *appmodule.Handler } -func provideBankModule(config types.Module, inputs) (outputs, error) { ... } +func ProvideBankModule(config *bankmodulev1.Module, Inputs) (Outputs, error) { ... } ``` -Note that in this module, a module configuration object *cannot* register different dependency providers based on the -configuration. This is intentional because it allows us to know globally which modules provide which dependencies. This +Note that in this module, a module configuration object *cannot* register different dependency providers at runtime +based on the configuration. This is intentional because it allows us to know globally which modules provide which +dependencies, and it will also allow us to do code generation of the whole app initialization. This can help us figure out issues with missing dependencies in an app config if the needed modules are loaded at runtime. In cases where required modules are not loaded at runtime, it may be possible to guide users to the correct module if through a global Cosmos SDK module registry. +The `*appmodule.Handler` type referenced above is a replacement for the legacy `AppModule` framework, and +described in [ADR 061: Core Module API](./adr-061-core-module-api.md). + ### New `app.go` With this setup, `app.go` might now look something like this: @@ -244,6 +251,55 @@ be applied to the existing SDK in a way that: 1. is as easy to apply to existing modules as possible, 2. while also making it possible to improve existing APIs and minimize long-term technical debt +### Registration of Inter-Module Hooks + +Some modules define a hooks interface (ex. `StakingHooks`) which allows one module to call back into another module +when certain events happen. + +With the app wiring framework, these hooks interfaces can be defined as a `OnePerModuleType`s and then the module +which consumes these hooks can collect these hooks as a map of module name to hook type (ex. `map[string]FooHooks`). Ex: +```go +func init() { + appmodule.Register( + &foomodulev1.Module{}, + appmodule.Invoke(InvokeSetFooHooks), + ... + ) +} +func InvokeSetFooHooks( + keeper *keeper.Keeper, + fooHooks map[string]FooHooks, +) error { + for k in sort.Strings(maps.Keys(fooHooks)) { + keeper.AddFooHooks(fooHooks[k]) + } +} +``` + +Optionally, the module consuming hooks can allow app's to define an order for calling these hooks based on module name +in its config object. + +An alternative way for registering hooks via reflection was considered where all keeper types are inspected to see if +they implement the hook interface by the modules exposing hooks. This has the downsides of: +* needing to expose all the keepers of all modules to the module providing hooks, +* not allowing for encapsulating hooks on a different type which doesn't expose all keeper methods, +* harder to know statically which module expose hooks or are checking for them. + +With the approach proposed here, hooks registration will be obviously observable in `app.go` if `depinject` codegen +(described below) is used. + +Note that event listeners, described in [ADR 061: Core Module API](./adr-061-core-module-api.md), are a more +standardized alternative to hooks with both a simpler declaration and registration system. + +### Code Generation + +The `depinject` framework will optionally allow the app configuration and dependency injection wiring to be code +generated. This will allow: +* dependency injection wiring to be inspected as regular go code just like the existing `app.go`, +* dependency injection to be opt-in with manual wiring 100% still possible. + +Code generation requires that all providers and invokers and their parameters are exported and in non-internal packages. + ## Consequences ### Backwards Compatibility diff --git a/docs/architecture/adr-061-core-module-api.md b/docs/architecture/adr-061-core-module-api.md index 3d26b99becfa..23cacb056d18 100644 --- a/docs/architecture/adr-061-core-module-api.md +++ b/docs/architecture/adr-061-core-module-api.md @@ -10,8 +10,15 @@ PROPOSED Not Implemented ## Abstract -> "If you can't explain it simply, you don't understand it well enough." Provide a simplified and layman-accessible explanation of the ADR. -> A short (~200 word) description of the issue being addressed. +A new core API is proposed to replace the existing `AppModule` and `sdk.Context` frameworks a set of core services +and a new `Handler` struct. This core API aims to: +- be simpler, +- more extensible +- and more stable than the current framework +while also +- enabling deterministic events and queries, and +- supporting event listeners +- and [ADR 033: Protobuf-based Inter-Module Communication](./adr-033-protobuf-inter-module-comm.md) clients. ## Context @@ -60,13 +67,15 @@ manual wiring. #### Store Services -The generic store interface is defined as the current SDK `KVStore` interface. The `StoreService` type is a refactoring -of the existing store key types which inverts the relationship with the context. Instead of expecting a +Store services will be defined in the `cosmossdk.io/core/store` package. + +The generic `store.KVStore` interface is the same as current SDK `KVStore` interface. The `store.Service` type is a +refactoring of the existing store key types which inverts the relationship with the context. Instead of expecting a "bag of variables" context type to explicitly know about stores, `StoreService` uses the general-purpose `context.Context` just to coordinate state: ```go -type StoreService interface { +type Service interface { // Open retrieves the KVStore from the context. Open(context.Context) KVStore } @@ -84,17 +93,17 @@ get a reference to via dependency injection or manually: ```go type KVStoreService interface { - StoreService + Service IsKVStoreService() } type MemoryStoreService interface { - StoreService + Service IsMemoryStoreService() } type TransientStoreService interface { - StoreService + Service IsTransientStoreService() } ``` @@ -105,7 +114,9 @@ type of store they need in their dependency injection (or manual) constructors. #### Event Service -The event service gives modules access to an event manager which allows modules to emit typed and legacy, +The event `Service` and `Manager` will be defined in the `cosmossdk.io/core/event` package. + +The event `Service` gives modules access to an event `Manager` which allows modules to emit typed and legacy, untyped events: ```go @@ -130,6 +141,8 @@ Design questions: #### Block Info Service +The block info `Service` will be defined in the `cosmossdk.io/core/blockinfo` package. + The `BlockInfo` service allows modules to get a limited set of information about the currently executing block that does not depend on any specific version of Tendermint: ```go @@ -154,6 +167,8 @@ exposure to changes in the Tendermint protocol. #### Gas Service +The gas `Service` and `Meter` types will be defined in the `cosmossdk.io/core/gas` package. + The gas service handles tracking of gas consumptions at the block and transaction level and also allows for overriding the gas meter passed to child calls: ```go @@ -184,9 +199,13 @@ which ensures all required pre-processing steps are uniformly executed by all mo ### Core `Handler` Struct -Modules will provide their core services to runtime module via the `Handler` struct instead of the existing + +Modules will provide their core services to runtime module via the `Handler` struct, defined in the `cosmossdk.io/core/appmodule` +package, instead of the existing `AppModule` interface: ```go +package appmodule + type Handler struct { // Services are the Msg and Query services for the module. Msg services // must be annotated with the option cosmos.msg.v1.service = true. @@ -223,6 +242,14 @@ The `Handler` struct type will implement `grpc.ServiceRegistrar` interface which types.RegisterQueryServer(h, am.keeper) ``` +Service registrations will be stored in the `Handler.Services` field using the `ServiceImpl` struct: +```go +type ServiceImpl struct { + Desc *grpc.ServiceDesc + Impl interface{} +} +``` + Because of the `cosmos.msg.v1.service` protobuf option, required for `Msg` services, the same handler struct can be used to register both `Msg` and query services. @@ -302,6 +329,13 @@ or using the `Handler.AddEventListener` builder method: handler.AddEventListener(func (ctx context.Context, e *EventReceive) error) { ... }) ``` +Event listeners provide a standardized alternative to module hooks, such as `StakingHooks`, even though these hooks +are still supported and described in [ADR 057: App Wiring](./adr-057-app-wiring-1.md) + +Only one event listener per event type can be defined per module. Event listeners will be called in a deterministic +order based on alphabetically sorting module names. If a more customizable order is desired, additional parameters +to the runtime module config object can be added to support optional custom ordering. + #### Upgrade Handlers Upgrade handlers can be specified using the `UpgradeHandlers` field that takes an array of `UpgradeHandler` structs: @@ -328,6 +362,46 @@ func (h *Handler) RegisterUpgradeHandler(fromModule protoreflect.FullName, handl #### Remaining Parts of AppModule +The current `AppModule` framework handles a number of additional concerns which aren't addressed by this core API. +These include the registration of: +* gogo proto and amino interface types +* cobra query and tx commands +* gRPC gateway +* crisis module invariants +* simulations + +The design proposed here relegates the registration of these things to other structures besides the `Handler` struct +defined here. In the case of gogo proto and amino interfaces, the registration of these generally should happen as early +as possible during initialization and in [ADR 057: App Wiring](./adr-057-app-wiring-1.md), protobuf type registration +happens before dependency injection (although this could alternatively be done dedicated DI providers). + +Commands should likely be handled at a different level of the framework as they are purely a client concern. Currently, +we use the cobra framework, but there have been discussions of potentially using other frameworks, automatically +generating CLI commands, and even letting libraries outside the SDK totally manage this. + +gRPC gateway registration should probably be handled by the runtime module, but the core API shouldn't depend on gRPC +gateway types as 1) we are already using an older version and 2) it's possible the framework can do this registration +automatically in the future. So for now, the runtime module should probably provide some sort of specific type for doing +this registration ex: +```go +type GrpcGatewayInfo struct { + Handlers []GrpcGatewayHandler +} + +type GrpcGatewayHandler func(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error +``` + +which modules can return in a provider: +```go +func ProvideGrpcGateway() GrpcGatewayInfo { + return GrpcGatewayinfo { + Handlers: []Handler {types.RegisterQueryHandlerClient} + } +} +``` + +Crisis module invariants and simulations are subject to potential redesign and should be managed with types +defined in the crisis and simulation modules respectively. #### Example Usage @@ -347,47 +421,54 @@ func ProvideApp(config *foomodulev2.Module, evtSvc event.EventService, db orm.Mo } ``` -TODO: -* interfaces and legacy amino registration -* commands -* grpc gateway -* invariants -* inter-module hooks -* simulations - ### Runtime Compatibility Version -### Legacy `AppModule` Runtime Compatibility +The `core` module will define a static integer var, `cosmossdk.io/core/RuntimeCompatibilityVersion`, which is +a minor version indicator of the core module that is accessible at runtime. Correct runtime module implementations +should check this compatibility version and return an error if the current `RuntimeCompatibilityVersion` is higher +than the version of the core API that this runtime version can support. When new features are adding to the `core` +module API that runtime modules are required to support, this version should be incremented. ## Consequences -> This section describes the resulting context, after applying the decision. All consequences should be listed here, not just the "positive" ones. A particular decision may have positive, negative, and neutral consequences, but all of them affect the team and project in the future. - ### Backwards Compatibility -> All ADRs that introduce backwards incompatibilities must include a section describing these incompatibilities and their severity. The ADR must explain how the author proposes to deal with these incompatibilities. ADR submissions without a sufficient backwards compatibility treatise may be rejected outright. +Early versions of runtime modules should aim to support as much as possible modules built with the existing +`AppModule`/`sdk.Context` framework. As the core API is more widely adopted, later runtime versions may choose to +drop support and only support the core API plus any runtime module specific APIs (like specific versions of Tendermint). + +The core module itself should strive to remain at the go semantic version `v1` as long as possible and follow design +principles that allow for strong long-term support (LTS). ### Positive -{positive consequences} +* better API encapsulation and separation of concerns +* more stable APIs +* more framework extensibility +* deterministic events and queries +* event listeners +* inter-module msg and query execution support ### Negative -{negative consequences} - ### Neutral -{neutral consequences} +* modules will need to be refactored to use this API +* some replacements for `AppModule` functionality still need to be defined in follow-ups + (type registration, commands, invariants, simulations) and this will take additional design work +* the upgrade module may need upgrades to support the new upgrade handler system described here ## Further Discussions -While an ADR is in the DRAFT or PROPOSED stage, this section should contain a summary of issues to be solved in future iterations (usually referencing comments from a pull-request discussion). -Later, this section can optionally list ideas or improvements the author or reviewers found during the analysis of this ADR. - -## Test Cases [optional] - -Test cases for an implementation are mandatory for ADRs that are affecting consensus changes. Other ADRs can choose to include links to test cases if applicable. +* how to register: + * gogo proto and amino interface types + * cobra commands + * invariants + * simulations +* should event and gas services allow callers to replace the event manager and gas meter in the context? ## References -* {reference link} +* [ADR 033: Protobuf-based Inter-Module Communication](./adr-033-protobuf-inter-module-comm.md) +* [ADR 057: App Wiring](./adr-057-app-wiring-1.md) +* [ADR 055: ORM](./adr-055-orm.md) From b4040de81af62d6133b478f960656ebde966d58b Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Fri, 19 Aug 2022 17:55:55 +0200 Subject: [PATCH 04/23] updates --- docs/architecture/adr-057-app-wiring-1.md | 12 +++++------- docs/architecture/adr-061-core-module-api.md | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/docs/architecture/adr-057-app-wiring-1.md b/docs/architecture/adr-057-app-wiring-1.md index 31ad00e7a06f..13086a15b2e6 100644 --- a/docs/architecture/adr-057-app-wiring-1.md +++ b/docs/architecture/adr-057-app-wiring-1.md @@ -245,11 +245,8 @@ func main() { ### Application to existing SDK modules So far we have described a system which is largely agnostic to the specifics of the SDK such as store keys, `AppModule`, -`BaseApp`, etc. A second app wiring ADR will be created which outlines the details of how this app wiring system will -be applied to the existing SDK in a way that: - -1. is as easy to apply to existing modules as possible, -2. while also making it possible to improve existing APIs and minimize long-term technical debt +`BaseApp`, etc. Improvements to these parts of the framework that integrate with the general app wiring framework +defined here are described in [ADR 061: Core Module API](./adr-061-core-module-api.md). ### Registration of Inter-Module Hooks @@ -328,8 +325,8 @@ registration paradigms. These two methods can live side-by-side for as long as i ## Further Discussions -As mentioned above, a second app wiring ADR will be created to describe more specifics than there is space to go -into here. Further discussions will also happen within the Cosmos SDK Framework Working Group and in https://github.com/cosmos/cosmos-sdk/discussions/10582. +The protobuf type registration system described in this ADR has not been implemented and may need to be reconsidered in +light of code generation. It may be better to do this type registration with a DI provider. ## References @@ -339,3 +336,4 @@ into here. Further discussions will also happen within the Cosmos SDK Framework * https://github.com/google/wire * https://pkg.go.dev/github.com/cosmos/cosmos-sdk/container * https://github.com/cosmos/cosmos-sdk/pull/11802 +* [ADR 061](./adr-061-core-module-api.md) \ No newline at end of file diff --git a/docs/architecture/adr-061-core-module-api.md b/docs/architecture/adr-061-core-module-api.md index 23cacb056d18..7230c646894c 100644 --- a/docs/architecture/adr-061-core-module-api.md +++ b/docs/architecture/adr-061-core-module-api.md @@ -57,8 +57,17 @@ The design principles of the core API are as follows: * other non-core and/or non-LTS services can be exposed by specific versions of runtime modules or other modules following the same design principles, this includes functionality that interacts with specific non-stable versions of third party dependencies such as Tendermint +* the core API doesn't implement *any* functionality, it just defines types * go stable API management principles are followed (TODO: link) +Runtime modules which implement the core API are *intentionally* separate from the core API in order to enable more +forks of the runtime module than is possible with the SDK's current tightly coupled `BaseApp` design while still +allowing for a high degree of composability and compatibility. + +Modules which are built only against the core API don't need to know anything about which version of runtime, +`BaseApp` or Tendermint in order to be compatible. Modules from the core mainline SDK could be easily composed +with a forked version of runtime with this pattern. + ### Core Services The following "core services" are defined by the core API. All valid runtime module implementations should provide @@ -355,6 +364,11 @@ For example, `cosmos.bank.module.v3.Module` might specify that it can migrate fr The app wiring framework will ensure that if the `ModuleDescriptor` specifies that a module can upgrade from another module, an `UpgradeHandler` specifying that `FromModule` must be provided. +This pattern of identifying from module versions will allow a module to upgrade from a version it is not a direct +descendant of. For example, someone could fork staking and allow upgrading from the mainline SDK staking. The mainline +SDK staking could later merge some of the forked changes and allow upgrading from the fork back to mainline. This +is intended to allow smooth forking and merging patterns in the ecosystem for simpler and more diverse innovation. + A helper method on handler will be provided to simplify upgrade handler registration, ex: ```go func (h *Handler) RegisterUpgradeHandler(fromModule protoreflect.FullName, handler func(context.Context) error) @@ -448,6 +462,7 @@ principles that allow for strong long-term support (LTS). * deterministic events and queries * event listeners * inter-module msg and query execution support +* more explicit support for forking and merging of module versions (including runtime) ### Negative From 1b2a02af36dcb3881cde9af18752ab683574faad Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Fri, 19 Aug 2022 17:57:35 +0200 Subject: [PATCH 05/23] updates --- docs/architecture/adr-061-core-module-api.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/architecture/adr-061-core-module-api.md b/docs/architecture/adr-061-core-module-api.md index 7230c646894c..c31aaf7b381e 100644 --- a/docs/architecture/adr-061-core-module-api.md +++ b/docs/architecture/adr-061-core-module-api.md @@ -481,6 +481,7 @@ principles that allow for strong long-term support (LTS). * invariants * simulations * should event and gas services allow callers to replace the event manager and gas meter in the context? +* should we allow a way for emitting typed events which aren't part of consensus? ## References From 736f50a5ca5cc3371c2c09cb206bbde1eb73f049 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Fri, 19 Aug 2022 18:29:06 +0200 Subject: [PATCH 06/23] updates --- docs/architecture/adr-061-core-module-api.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/architecture/adr-061-core-module-api.md b/docs/architecture/adr-061-core-module-api.md index c31aaf7b381e..63fff4049894 100644 --- a/docs/architecture/adr-061-core-module-api.md +++ b/docs/architecture/adr-061-core-module-api.md @@ -220,10 +220,10 @@ type Handler struct { // must be annotated with the option cosmos.msg.v1.service = true. Services []ServiceImpl - DefaultGenesis(GenesisTarget) - ValidateGenesis(GenesisSource) error - InitGenesis(context.Context, GenesisSource) error - ExportGenesis(context.Context, GenesisTarget) + DefaultGenesis func(GenesisTarget) + ValidateGenesis func(GenesisSource) error + InitGenesis func(context.Context, GenesisSource) error + ExportGenesis func(context.Context, GenesisTarget) BeginBlocker func(context.Context) error EndBlocker func(context.Context) error @@ -333,9 +333,9 @@ the event and optionally return an error. If an event listener returns a non-nil that emitted the event and revert any state transitions that this process would have caused. Event listeners for typed events can be added to the handler struct either by populating the `EventListeners` field -or using the `Handler.AddEventListener` builder method: +or using generic helper methods: ```go -handler.AddEventListener(func (ctx context.Context, e *EventReceive) error) { ... }) +appmodule.AddEventListener(handler, func (ctx context.Context, e *EventReceive)) { ... }) ``` Event listeners provide a standardized alternative to module hooks, such as `StakingHooks`, even though these hooks From 45bcd8da7998c3b1f95b8f465fb748a89aba5832 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Thu, 25 Aug 2022 11:41:45 -0400 Subject: [PATCH 07/23] updates based on reviews --- docs/architecture/adr-061-core-module-api.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/architecture/adr-061-core-module-api.md b/docs/architecture/adr-061-core-module-api.md index 63fff4049894..406cbc63917d 100644 --- a/docs/architecture/adr-061-core-module-api.md +++ b/docs/architecture/adr-061-core-module-api.md @@ -13,12 +13,11 @@ PROPOSED Not Implemented A new core API is proposed to replace the existing `AppModule` and `sdk.Context` frameworks a set of core services and a new `Handler` struct. This core API aims to: - be simpler, -- more extensible -- and more stable than the current framework -while also -- enabling deterministic events and queries, and -- supporting event listeners -- and [ADR 033: Protobuf-based Inter-Module Communication](./adr-033-protobuf-inter-module-comm.md) clients. +- more extensible, +- more stable than the current framework, +- enable deterministic events and queries, +- support event listeners and +- [ADR 033: Protobuf-based Inter-Module Communication](./adr-033-protobuf-inter-module-comm.md) clients. ## Context @@ -60,9 +59,10 @@ third party dependencies such as Tendermint * the core API doesn't implement *any* functionality, it just defines types * go stable API management principles are followed (TODO: link) -Runtime modules which implement the core API are *intentionally* separate from the core API in order to enable more -forks of the runtime module than is possible with the SDK's current tightly coupled `BaseApp` design while still -allowing for a high degree of composability and compatibility. +A "runtime" module is any module which implements the core functionality of composing an ABCI app, which is currently +handled by `BaseApp` and the `ModuleManager`. Runtime modules which implement the core API are *intentionally* separate +from the core API in order to enable more forks of the runtime module than is possible with the SDK's current tightly +coupled `BaseApp` design while still allowing for a high degree of composability and compatibility. Modules which are built only against the core API don't need to know anything about which version of runtime, `BaseApp` or Tendermint in order to be compatible. Modules from the core mainline SDK could be easily composed From 30039fffce30b542589609b44d0f48f06c71a4ff Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Thu, 25 Aug 2022 11:48:45 -0400 Subject: [PATCH 08/23] updates based on reviews --- docs/architecture/adr-061-core-module-api.md | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/docs/architecture/adr-061-core-module-api.md b/docs/architecture/adr-061-core-module-api.md index 406cbc63917d..22b24c3244b8 100644 --- a/docs/architecture/adr-061-core-module-api.md +++ b/docs/architecture/adr-061-core-module-api.md @@ -21,11 +21,11 @@ and a new `Handler` struct. This core API aims to: ## Context -Historically modules have exposed their functionality to the state machine via the `AppModule` and `AppModuleBasic` +Historically modules have exposed their functionality to the framework via the `AppModule` and `AppModuleBasic` interfaces which have the following shortcomings: -* both `AppModule` and `AppModuleBasic` need to be defined which is counter-intuitive -* apps need to implement the full interfaces, even parts they don't need -* interface methods depend heavily on unstable third party dependencies, in particular Tendermint +* both `AppModule` and `AppModuleBasic` need to be defined and registered which is counter-intuitive +* apps need to implement the full interfaces, even parts they don't need (although there are workarounds for this), +* interface methods depend heavily on unstable third party dependencies, in particular Tendermint, * legacy required methods have littered these interfaces for far too long In order to interact with the state machine, modules have needed to do a combination of these things: @@ -38,6 +38,12 @@ or new functionalities are desired (such as alternate store types), the changes consumers of it (basically all modules). Also, all modules now receive `context.Context` and need to convert these to `sdk.Context`'s with a non-ergonomic unwrapping function. +Any breaking changes to these interfaces, such as ones imposed by third-party dependencies like Tendermint, have the +side effect of forcing all modules in the ecosystem to update in lock-step. This means it is almost impossible to have +a version of the module which can be run with 2 or 3 different versions of the SDK or 2 or 3 different versions of +another module. This lock-step coupling slows down overall development within the ecosystem and causes updates to +components to be delayed longer than they would if things were more stable and loosely coupled. + ## Decision The `core` API proposes a set of core APIs that modules can rely on to interact with the state machine and expose their @@ -196,9 +202,9 @@ type Service interface { Runtime module implementations should provide an instance of `grpc.ClientConnInterface` as core service. This service will allow modules to send messages to and make queries against other modules as described in [ADR 033](./adr-033-protobuf-inter-module-comm.md). -A single `grpc.ClientConnInterface` will be used for both MsgClient's and QueryClient's and the state machine will -make the presence or absence of the protobuf option `cosmos.msg.v1.service` which will be required for all -valid `Msg` service types. +A single `grpc.ClientConnInterface` will be used for both MsgClient's and QueryClient's. The protobuf option +`cosmos.msg.v1.service` will allow the router to detect whether a given service is a query or msg service and +route requests appropriately. It will likely be necessary to define which queries and `Msg`'s are available for inter-module communication, possibly with an `internal` protobuf option. From 28c80468d700bf499adf870990b28f9d38281472 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Thu, 25 Aug 2022 11:52:50 -0400 Subject: [PATCH 09/23] updates based on reviews --- docs/architecture/adr-061-core-module-api.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/architecture/adr-061-core-module-api.md b/docs/architecture/adr-061-core-module-api.md index 22b24c3244b8..5a4b09960c0d 100644 --- a/docs/architecture/adr-061-core-module-api.md +++ b/docs/architecture/adr-061-core-module-api.md @@ -67,13 +67,19 @@ third party dependencies such as Tendermint A "runtime" module is any module which implements the core functionality of composing an ABCI app, which is currently handled by `BaseApp` and the `ModuleManager`. Runtime modules which implement the core API are *intentionally* separate -from the core API in order to enable more forks of the runtime module than is possible with the SDK's current tightly -coupled `BaseApp` design while still allowing for a high degree of composability and compatibility. +from the core API in order to enable more parallel versions and forks of the runtime module than is possible with the +SDK's current tightly coupled `BaseApp` design while still allowing for a high degree of composability and +compatibility. Modules which are built only against the core API don't need to know anything about which version of runtime, `BaseApp` or Tendermint in order to be compatible. Modules from the core mainline SDK could be easily composed with a forked version of runtime with this pattern. +This design is intended to enable matrices of compatible dependency versions. Ideally a given version of any module +is compatible with multiple versions of the runtime module and other compatible modules. This will allow dependencies +to be selectively updated based on battle-testing. More conservative projects may want to update some dependencies +slower than more fast moving projects. + ### Core Services The following "core services" are defined by the core API. All valid runtime module implementations should provide From 7d1f682701b3f552548104fccd65ec5a48762c43 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Thu, 25 Aug 2022 13:02:30 -0400 Subject: [PATCH 10/23] typo --- docs/architecture/adr-061-core-module-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/architecture/adr-061-core-module-api.md b/docs/architecture/adr-061-core-module-api.md index 5a4b09960c0d..b58a9a1f0697 100644 --- a/docs/architecture/adr-061-core-module-api.md +++ b/docs/architecture/adr-061-core-module-api.md @@ -449,7 +449,7 @@ func ProvideApp(config *foomodulev2.Module, evtSvc event.EventService, db orm.Mo ### Runtime Compatibility Version -The `core` module will define a static integer var, `cosmossdk.io/core/RuntimeCompatibilityVersion`, which is +The `core` module will define a static integer var, `cosmossdk.io/core.RuntimeCompatibilityVersion`, which is a minor version indicator of the core module that is accessible at runtime. Correct runtime module implementations should check this compatibility version and return an error if the current `RuntimeCompatibilityVersion` is higher than the version of the core API that this runtime version can support. When new features are adding to the `core` From c11a992ce7bf9e409ac27ecd8228c6f39f564a0d Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Mon, 29 Aug 2022 11:47:07 -0400 Subject: [PATCH 11/23] API simplifications --- docs/architecture/adr-061-core-module-api.md | 93 ++++++++++++-------- 1 file changed, 57 insertions(+), 36 deletions(-) diff --git a/docs/architecture/adr-061-core-module-api.md b/docs/architecture/adr-061-core-module-api.md index b58a9a1f0697..cf5022966d0e 100644 --- a/docs/architecture/adr-061-core-module-api.md +++ b/docs/architecture/adr-061-core-module-api.md @@ -63,7 +63,7 @@ The design principles of the core API are as follows: following the same design principles, this includes functionality that interacts with specific non-stable versions of third party dependencies such as Tendermint * the core API doesn't implement *any* functionality, it just defines types -* go stable API management principles are followed (TODO: link) +* go stable API compatibility guidelines are followed: https://go.dev/blog/module-compatibility A "runtime" module is any module which implements the core functionality of composing an ABCI app, which is currently handled by `BaseApp` and the `ModuleManager`. Runtime modules which implement the core API are *intentionally* separate @@ -84,48 +84,35 @@ slower than more fast moving projects. The following "core services" are defined by the core API. All valid runtime module implementations should provide implementations of these services to modules via both [dependency injection](./adr-057-app-wiring-1.md) and -manual wiring. +manual wiring. The individual services described below are all bundled in a convenient `appmodule.Service` +"bundle service" so that for simplicity modules can declare a dependency on a single service. #### Store Services Store services will be defined in the `cosmossdk.io/core/store` package. -The generic `store.KVStore` interface is the same as current SDK `KVStore` interface. The `store.Service` type is a -refactoring of the existing store key types which inverts the relationship with the context. Instead of expecting a -"bag of variables" context type to explicitly know about stores, `StoreService` uses the general-purpose -`context.Context` just to coordinate state: - -```go -type Service interface { - // Open retrieves the KVStore from the context. - Open(context.Context) KVStore -} -``` - -Modules can use these services like this: -```go -func (k msgServer) Send(ctx context.Context, msg *types.MsgSend) (*types.MsgSendResponse, error) { - store := k.storeService.Open(ctx) -} -``` - -Three specific types of store services (kv-store, memory and transient) are defined by the core API that modules can -get a reference to via dependency injection or manually: +The generic `store.KVStore` interface is the same as current SDK `KVStore` interface. Store keys have been refactored +into store services which, instead of expecting the context to know about stores, invert the pattern and allow +retrieving a store from a generic context. There are three store services for the three types of currently supported +stores - regular kv-store, memory, and transient: ```go type KVStoreService interface { - Service - IsKVStoreService() + OpenKVStore(context.Context) KVStore } type MemoryStoreService interface { - Service - IsMemoryStoreService() + OpenMemoryStore(context.Context) KVStore } - type TransientStoreService interface { - Service - IsTransientStoreService() + OpenTransientStore(context.Context) KVStore +} +``` + +Modules can use these services like this: +```go +func (k msgServer) Send(ctx context.Context, msg *types.MsgSend) (*types.MsgSendResponse, error) { + store := k.kvStoreSvc.OpenKVStore(ctx) } ``` @@ -173,11 +160,11 @@ type Service interface { GetBlockInfo(ctx context.Context) BlockInfo } -type BlockInfo interface { - ChainID() string - Height() int64 - Time() *timestamppb.Timestamp - Hash() []byte +type BlockInfo struct { + ChainID string + Height int64 + Time time.Time + Hash []byte } ``` @@ -203,7 +190,7 @@ type Service interface { } ``` -#### `grpc.ClientConnInterface` +#### Inter-module Client Runtime module implementations should provide an instance of `grpc.ClientConnInterface` as core service. This service will allow modules to send messages to and make queries against other modules as described in [ADR 033](./adr-033-protobuf-inter-module-comm.md). @@ -218,6 +205,39 @@ with an `internal` protobuf option. The router used by the `grpc.ClientConnInterface` will provide a unified interface for sending `Msg`'s and queries which ensures all required pre-processing steps are uniformly executed by all modules which need such functionality. +#### `appmodule.Service` Bundle Service + +To allow modules to declare a dependency on a single "bundle" service, runtime modules should provide an implementation +of the `appmodule.Service` interface: + +```go +package appmodule + +type Service interface { + store.KVStoreService + store.MemoryStoreService + store.TransientStoreService + event.Service + blockinfo.Service + gas.Service + grpc.ClientConnInterface +} +``` +To maintain API compatibility, if new core services are added, a new `cosmossdk.io/coreappmodule/v2.Service` should +be added which extends this service and bundles the new core services, ex: + +```go +package v2 + +import "cosmossdk.io/core/appmodule" + +type Service interface { + appmodule.Service + SomeNewService + AnotherNewService +} +``` + ### Core `Handler` Struct @@ -500,3 +520,4 @@ principles that allow for strong long-term support (LTS). * [ADR 033: Protobuf-based Inter-Module Communication](./adr-033-protobuf-inter-module-comm.md) * [ADR 057: App Wiring](./adr-057-app-wiring-1.md) * [ADR 055: ORM](./adr-055-orm.md) +* [Keeping Your Modules Compatible](https://go.dev/blog/module-compatibility) From 1175337624750af4979f740d7afe227412c6a342 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Mon, 29 Aug 2022 11:58:20 -0400 Subject: [PATCH 12/23] ADR-033 updates --- docs/architecture/adr-061-core-module-api.md | 37 +++++++++++++++++--- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/docs/architecture/adr-061-core-module-api.md b/docs/architecture/adr-061-core-module-api.md index cf5022966d0e..4bddd42427dd 100644 --- a/docs/architecture/adr-061-core-module-api.md +++ b/docs/architecture/adr-061-core-module-api.md @@ -192,19 +192,45 @@ type Service interface { #### Inter-module Client -Runtime module implementations should provide an instance of `grpc.ClientConnInterface` as core service. This service +Runtime module implementations should provide an instance of the `appmodule.RootInterModuleClient` interface which will allow modules to send messages to and make queries against other modules as described in [ADR 033](./adr-033-protobuf-inter-module-comm.md). -A single `grpc.ClientConnInterface` will be used for both MsgClient's and QueryClient's. The protobuf option +```go +type InterModuleClient interface { + grpc.ClientConnInterface + + // Address is the ADR-028 address of this client against which messages will be authenticated. + Address() []byte +} + +type RootInterModuleClient interface { + InterModuleClient + + DerivedClient(key []byte) InterModuleClient +} +``` + +The `RootInterModuleClient` allows a module to make inter-module calls using its root [ADR 028](./adr-028-public-key-addresses.md) +address (as returned by the `Address` method). + +This client can be used with both `MsgClient`'s and `QueryClient`'s and the protobuf option `cosmos.msg.v1.service` will allow the router to detect whether a given service is a query or msg service and route requests appropriately. -It will likely be necessary to define which queries and `Msg`'s are available for inter-module communication, possibly -with an `internal` protobuf option. +Module clients that use [ADR 028](./adr-028-public-key-addresses.md) derived module addresses +can be created using the `DerivedClient` method. + +By default, all `Msg`'s registered using the core API will be available for inter-module routing. Queries will only +be exposed for inter-module routing if their `rpc` methods have the protobuf option `cosmos.query.v1.internal` +set to true. -The router used by the `grpc.ClientConnInterface` will provide a unified interface for sending `Msg`'s and queries +The inter-module router will provide a unified interface for sending `Msg`'s and queries which ensures all required pre-processing steps are uniformly executed by all modules which need such functionality. +Runtime modules may choose to allow different types of "admin" access to individual modules which may allow for +bypassing certain authentication checks. This could allow `x/authz` to allow sending messages on behalf of all +addresses, for example. + #### `appmodule.Service` Bundle Service To allow modules to declare a dependency on a single "bundle" service, runtime modules should provide an implementation @@ -520,4 +546,5 @@ principles that allow for strong long-term support (LTS). * [ADR 033: Protobuf-based Inter-Module Communication](./adr-033-protobuf-inter-module-comm.md) * [ADR 057: App Wiring](./adr-057-app-wiring-1.md) * [ADR 055: ORM](./adr-055-orm.md) +* [ADR 028: Public Key Addresses](./adr-028-public-key-addresses.md) * [Keeping Your Modules Compatible](https://go.dev/blog/module-compatibility) From e9b24e084649615de103b1da1fb45e4034ee2698 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Mon, 29 Aug 2022 13:23:58 -0400 Subject: [PATCH 13/23] update events spec --- docs/architecture/adr-061-core-module-api.md | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/docs/architecture/adr-061-core-module-api.md b/docs/architecture/adr-061-core-module-api.md index 4bddd42427dd..67b5f722827f 100644 --- a/docs/architecture/adr-061-core-module-api.md +++ b/docs/architecture/adr-061-core-module-api.md @@ -134,18 +134,28 @@ type Service interface { } type Manager interface { + // Emit emits events to both clients and state machine listeners. These events MUST be emitted deterministically + // and should be assumed to be part of blockchain consensus. Emit(proto.Message) error + + // EmitLegacy emits legacy untyped events to clients only. These events do not need to be emitted deterministically + // and are not part of blockchain consensus. EmitLegacy(eventType string, attrs ...LegacyEventAttribute) error + + // EmitClientOnly emits events only to clients. These events do not need to be emitted deterministically + // and are not part of blockchain consensus. + EmitClientOnly(proto.Message) error } ``` -By definition, typed events emitted with `Emit` are part of consensus and can be observed by other modules while -legacy events emitted by `EmitLegacy` are not considered to be part of consensus and cannot be observed by other -modules. +Typed events emitted with `Emit` can be observed by other modules and thus must be deterministic and should be assumed +to be part of blockchain consensus (whether they are part of the block or app hash is left to the runtime to specify). + +Events emitted by `EmitLegacy` and `EmitClientOnly` are not considered to be part of consensus and cannot be observed +by other modules. If there is a client-side need to add events in patch releases, these methods can be used. Design questions: * should we allow overriding event managers (like `sdk.Context.WithEventManager`)? -* should there be a way to "silently" emit typed events that aren't part of consensus? #### Block Info Service @@ -403,6 +413,8 @@ Only one event listener per event type can be defined per module. Event listener order based on alphabetically sorting module names. If a more customizable order is desired, additional parameters to the runtime module config object can be added to support optional custom ordering. +Only events emitted using `EventManager.Emit` are observable using event listeners. + #### Upgrade Handlers Upgrade handlers can be specified using the `UpgradeHandlers` field that takes an array of `UpgradeHandler` structs: From 8da33ef4d69f93187ca1a49041db0866a2256a6a Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Mon, 29 Aug 2022 13:43:08 -0400 Subject: [PATCH 14/23] update bundle service --- docs/architecture/adr-061-core-module-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/architecture/adr-061-core-module-api.md b/docs/architecture/adr-061-core-module-api.md index 67b5f722827f..0126e2c61286 100644 --- a/docs/architecture/adr-061-core-module-api.md +++ b/docs/architecture/adr-061-core-module-api.md @@ -256,7 +256,7 @@ type Service interface { event.Service blockinfo.Service gas.Service - grpc.ClientConnInterface + RootInterModuleClient } ``` To maintain API compatibility, if new core services are added, a new `cosmossdk.io/coreappmodule/v2.Service` should From f8212ca8bbc1ac82e0de55181f7a1f0b4265c789 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Tue, 30 Aug 2022 10:33:45 -0400 Subject: [PATCH 15/23] Update docs/architecture/adr-061-core-module-api.md Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com> --- docs/architecture/adr-061-core-module-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/architecture/adr-061-core-module-api.md b/docs/architecture/adr-061-core-module-api.md index 0126e2c61286..d8417c1b0e06 100644 --- a/docs/architecture/adr-061-core-module-api.md +++ b/docs/architecture/adr-061-core-module-api.md @@ -50,7 +50,7 @@ The `core` API proposes a set of core APIs that modules can rely on to interact functionalities to it that are designed in a principled way such that: * tight coupling of dependencies and unrelated functionalities is minimized or eliminated * APIs can have long-term stability guarantees -* the SDK framework is extensible in a safe a straightforward way +* the SDK framework is extensible in a safe and straightforward way The design principles of the core API are as follows: * everything that a module wants to interact with in the state machine is a service From b13cb981dedc72f284f41704400d950a65389943 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Tue, 30 Aug 2022 11:55:33 -0400 Subject: [PATCH 16/23] Update docs/architecture/adr-061-core-module-api.md Co-authored-by: Marko --- docs/architecture/adr-061-core-module-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/architecture/adr-061-core-module-api.md b/docs/architecture/adr-061-core-module-api.md index d8417c1b0e06..0f167e8c579d 100644 --- a/docs/architecture/adr-061-core-module-api.md +++ b/docs/architecture/adr-061-core-module-api.md @@ -10,7 +10,7 @@ PROPOSED Not Implemented ## Abstract -A new core API is proposed to replace the existing `AppModule` and `sdk.Context` frameworks a set of core services +A new core API is proposed to be added as a way to develop cosmos-sdk applications that will in the future replace the existing `AppModule` and `sdk.Context` frameworks a set of core services and a new `Handler` struct. This core API aims to: - be simpler, - more extensible, From 58128282dfcda796a05e8035a19eb7b17c5732c2 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Wed, 31 Aug 2022 10:12:30 -0400 Subject: [PATCH 17/23] fix indentation --- docs/architecture/adr-061-core-module-api.md | 100 +++++++++---------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/docs/architecture/adr-061-core-module-api.md b/docs/architecture/adr-061-core-module-api.md index 0126e2c61286..68ad538413e4 100644 --- a/docs/architecture/adr-061-core-module-api.md +++ b/docs/architecture/adr-061-core-module-api.md @@ -112,7 +112,7 @@ type TransientStoreService interface { Modules can use these services like this: ```go func (k msgServer) Send(ctx context.Context, msg *types.MsgSend) (*types.MsgSendResponse, error) { - store := k.kvStoreSvc.OpenKVStore(ctx) + store := k.kvStoreSvc.OpenKVStore(ctx) } ``` @@ -134,12 +134,12 @@ type Service interface { } type Manager interface { - // Emit emits events to both clients and state machine listeners. These events MUST be emitted deterministically - // and should be assumed to be part of blockchain consensus. + // Emit emits events to both clients and state machine listeners. These events MUST be emitted deterministically + // and should be assumed to be part of blockchain consensus. Emit(proto.Message) error - - // EmitLegacy emits legacy untyped events to clients only. These events do not need to be emitted deterministically - // and are not part of blockchain consensus. + + // EmitLegacy emits legacy untyped events to clients only. These events do not need to be emitted deterministically + // and are not part of blockchain consensus. EmitLegacy(eventType string, attrs ...LegacyEventAttribute) error // EmitClientOnly emits events only to clients. These events do not need to be emitted deterministically @@ -193,10 +193,10 @@ for overriding the gas meter passed to child calls: package gas type Service interface { - GetMeter(context.Context) Meter - GetBlockMeter(context.Context) Meter - WithMeter(ctx context.Context, meter Meter) context.Context - WithBlockMeter(ctx context.Context, meter Meter) context.Context + GetMeter(context.Context) Meter + GetBlockMeter(context.Context) Meter + WithMeter(ctx context.Context, meter Meter) context.Context + WithBlockMeter(ctx context.Context, meter Meter) context.Context } ``` @@ -208,14 +208,14 @@ will allow modules to send messages to and make queries against other modules as ```go type InterModuleClient interface { grpc.ClientConnInterface - - // Address is the ADR-028 address of this client against which messages will be authenticated. - Address() []byte + + // Address is the ADR-028 address of this client against which messages will be authenticated. + Address() []byte } type RootInterModuleClient interface { - InterModuleClient - + InterModuleClient + DerivedClient(key []byte) InterModuleClient } ``` @@ -250,12 +250,12 @@ of the `appmodule.Service` interface: package appmodule type Service interface { - store.KVStoreService - store.MemoryStoreService - store.TransientStoreService - event.Service - blockinfo.Service - gas.Service + store.KVStoreService + store.MemoryStoreService + store.TransientStoreService + event.Service + blockinfo.Service + gas.Service RootInterModuleClient } ``` @@ -268,9 +268,9 @@ package v2 import "cosmossdk.io/core/appmodule" type Service interface { - appmodule.Service - SomeNewService - AnotherNewService + appmodule.Service + SomeNewService + AnotherNewService } ``` @@ -287,18 +287,18 @@ type Handler struct { // Services are the Msg and Query services for the module. Msg services // must be annotated with the option cosmos.msg.v1.service = true. Services []ServiceImpl - - DefaultGenesis func(GenesisTarget) + + DefaultGenesis func(GenesisTarget) ValidateGenesis func(GenesisSource) error InitGenesis func(context.Context, GenesisSource) error ExportGenesis func(context.Context, GenesisTarget) BeginBlocker func(context.Context) error - EndBlocker func(context.Context) error - - EventListeners []EventListener - - UpgradeHandlers []UpgradeHandler + EndBlocker func(context.Context) error + + EventListeners []EventListener + + UpgradeHandlers []UpgradeHandler } ``` @@ -315,15 +315,15 @@ The `Handler` struct type will implement `grpc.ServiceRegistrar` interface which `MsgServer` and `QueryServer` implementations directly with the `Handler` struct like this: ```go h := &appmodule.Handler{} - types.RegisterMsgServer(h, keeper.NewMsgServerImpl(am.keeper)) - types.RegisterQueryServer(h, am.keeper) + types.RegisterMsgServer(h, keeper.NewMsgServerImpl(am.keeper)) + types.RegisterQueryServer(h, am.keeper) ``` Service registrations will be stored in the `Handler.Services` field using the `ServiceImpl` struct: ```go type ServiceImpl struct { - Desc *grpc.ServiceDesc - Impl interface{} + Desc *grpc.ServiceDesc + Impl interface{} } ``` @@ -339,9 +339,9 @@ interacting with genesis data represented by single `proto.Message` types. ```go type GenesisSource interface { - ReadMessage(proto.Message) error - OpenReader(field string) (io.ReadCloser, error) - ReadRawJSON() (json.RawMessage, error) + ReadMessage(proto.Message) error + OpenReader(field string) (io.ReadCloser, error) + ReadRawJSON() (json.RawMessage, error) } type GenesisTarget interface { @@ -381,11 +381,11 @@ In order for `BeginBlock`, `EndBlock` and `InitGenesis` to send back validator u block headers, the runtime module for a specific version of Tendermint could provide services like this: ```go type ValidatorUpdateService interface { - SetValidatorUpdates(context.Context, []abci.ValidatorUpdate) + SetValidatorUpdates(context.Context, []abci.ValidatorUpdate) } type BeginBlockService interface { - GetBeginBlockRequest(context.Context) abci.RequestBeginBlock + GetBeginBlockRequest(context.Context) abci.RequestBeginBlock } ``` @@ -420,8 +420,8 @@ Only events emitted using `EventManager.Emit` are observable using event listene Upgrade handlers can be specified using the `UpgradeHandlers` field that takes an array of `UpgradeHandler` structs: ```go type UpgradeHandler struct { - FromModule protoreflect.FullName - Handler func(context.Context) error + FromModule protoreflect.FullName + Handler func(context.Context) error } ``` @@ -469,7 +469,7 @@ automatically in the future. So for now, the runtime module should probably prov this registration ex: ```go type GrpcGatewayInfo struct { - Handlers []GrpcGatewayHandler + Handlers []GrpcGatewayHandler } type GrpcGatewayHandler func(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error @@ -478,9 +478,9 @@ type GrpcGatewayHandler func(ctx context.Context, mux *runtime.ServeMux, client which modules can return in a provider: ```go func ProvideGrpcGateway() GrpcGatewayInfo { - return GrpcGatewayinfo { + return GrpcGatewayinfo { Handlers: []Handler {types.RegisterQueryHandlerClient} - } + } } ``` @@ -494,14 +494,14 @@ management and genesis. ```go func ProvideApp(config *foomodulev2.Module, evtSvc event.EventService, db orm.ModuleDB) (Keeper, *Handler){ - k := &Keeper{db: db, evtSvc: evtSvc} - h := &Handler{} - foov1.RegisterMsgServer(h, k) + k := &Keeper{db: db, evtSvc: evtSvc} + h := &Handler{} + foov1.RegisterMsgServer(h, k) foov1.RegisterQueryServer(h, k) - h.RegisterBeginBlocker(k.BeginBlock) + h.RegisterBeginBlocker(k.BeginBlock) db.RegisterGenesis(h) h.RegisterUpgradeHandler("foo.module.v1.Module", k.MigrateFromV1) - return k, h + return k, h } ``` From 64f2d11c4a9864d4ab670e8c6431257f19ec7df2 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Wed, 31 Aug 2022 10:54:58 -0400 Subject: [PATCH 18/23] Update docs/architecture/adr-061-core-module-api.md Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com> --- docs/architecture/adr-061-core-module-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/architecture/adr-061-core-module-api.md b/docs/architecture/adr-061-core-module-api.md index 2924c9171ddb..7f0e44fbe9b6 100644 --- a/docs/architecture/adr-061-core-module-api.md +++ b/docs/architecture/adr-061-core-module-api.md @@ -259,7 +259,7 @@ type Service interface { RootInterModuleClient } ``` -To maintain API compatibility, if new core services are added, a new `cosmossdk.io/coreappmodule/v2.Service` should +To maintain API compatibility, if new core services are added, a new `cosmossdk.io/core/appmodule/v2.Service` should be added which extends this service and bundles the new core services, ex: ```go From 83a90601b6278890a96cce43283b5a9e8deab89a Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Thu, 8 Dec 2022 17:30:16 -0500 Subject: [PATCH 19/23] revert --- api/amino/amino.pulsar.go | 3 +-- api/cosmos/app/runtime/v1alpha1/module.pulsar.go | 9 ++++----- api/cosmos/app/v1alpha1/module.pulsar.go | 7 +++---- api/cosmos/auth/module/v1/module.pulsar.go | 9 ++++----- api/cosmos/auth/v1beta1/auth.pulsar.go | 9 ++++----- api/cosmos/auth/v1beta1/genesis.pulsar.go | 9 ++++----- api/cosmos/auth/v1beta1/query.pulsar.go | 9 ++++----- api/cosmos/auth/v1beta1/tx.pulsar.go | 9 ++++----- api/cosmos/authz/v1beta1/authz.pulsar.go | 9 ++++----- api/cosmos/authz/v1beta1/genesis.pulsar.go | 9 ++++----- api/cosmos/authz/v1beta1/tx.pulsar.go | 9 ++++----- api/cosmos/autocli/v1/options.pulsar.go | 9 ++++----- api/cosmos/autocli/v1/query.pulsar.go | 11 +++++------ api/cosmos/bank/module/v1/module.pulsar.go | 9 ++++----- api/cosmos/bank/v1beta1/authz.pulsar.go | 9 ++++----- api/cosmos/bank/v1beta1/bank.pulsar.go | 9 ++++----- api/cosmos/bank/v1beta1/genesis.pulsar.go | 9 ++++----- api/cosmos/bank/v1beta1/query.pulsar.go | 9 ++++----- api/cosmos/bank/v1beta1/tx.pulsar.go | 9 ++++----- api/cosmos/base/abci/v1beta1/abci.pulsar.go | 9 ++++----- api/cosmos/base/node/v1beta1/query.pulsar.go | 7 +++---- api/cosmos/base/query/v1beta1/pagination.pulsar.go | 7 +++---- .../base/store/internal/kv/v1beta1/kv.pulsar.go | 7 +++---- .../base/store/snapshots/v1beta1/snapshot.pulsar.go | 7 +++---- api/cosmos/base/store/v1beta1/commit_info.pulsar.go | 7 +++---- api/cosmos/base/store/v1beta1/listening.pulsar.go | 9 ++++----- api/cosmos/base/tendermint/v1beta1/query.pulsar.go | 9 ++++----- api/cosmos/base/tendermint/v1beta1/types.pulsar.go | 9 ++++----- api/cosmos/base/v1beta1/coin.pulsar.go | 9 ++++----- api/cosmos/capability/v1beta1/capability.pulsar.go | 9 ++++----- api/cosmos/capability/v1beta1/genesis.pulsar.go | 9 ++++----- api/cosmos/consensus/module/v1/module.pulsar.go | 9 ++++----- api/cosmos/consensus/v1/query.pulsar.go | 9 ++++----- api/cosmos/consensus/v1/tx.pulsar.go | 9 ++++----- api/cosmos/crisis/module/v1/module.pulsar.go | 9 ++++----- api/cosmos/crisis/v1beta1/genesis.pulsar.go | 9 ++++----- api/cosmos/crisis/v1beta1/tx.pulsar.go | 9 ++++----- api/cosmos/crypto/ed25519/keys.pulsar.go | 9 ++++----- api/cosmos/crypto/hd/v1/hd.pulsar.go | 9 ++++----- api/cosmos/crypto/keyring/v1/record.pulsar.go | 9 ++++----- api/cosmos/crypto/multisig/keys.pulsar.go | 9 ++++----- api/cosmos/crypto/multisig/v1beta1/multisig.pulsar.go | 7 +++---- api/cosmos/crypto/secp256k1/keys.pulsar.go | 9 ++++----- api/cosmos/crypto/secp256r1/keys.pulsar.go | 7 +++---- api/cosmos/distribution/module/v1/module.pulsar.go | 9 ++++----- .../distribution/v1beta1/distribution.pulsar.go | 9 ++++----- api/cosmos/distribution/v1beta1/genesis.pulsar.go | 9 ++++----- api/cosmos/distribution/v1beta1/query.pulsar.go | 9 ++++----- api/cosmos/distribution/v1beta1/tx.pulsar.go | 9 ++++----- api/cosmos/evidence/v1beta1/evidence.pulsar.go | 9 ++++----- api/cosmos/evidence/v1beta1/query.pulsar.go | 9 ++++----- api/cosmos/evidence/v1beta1/tx.pulsar.go | 9 ++++----- api/cosmos/feegrant/v1beta1/feegrant.pulsar.go | 9 ++++----- api/cosmos/feegrant/v1beta1/genesis.pulsar.go | 9 ++++----- api/cosmos/feegrant/v1beta1/tx.pulsar.go | 9 ++++----- api/cosmos/genutil/v1beta1/genesis.pulsar.go | 9 ++++----- api/cosmos/gov/module/v1/module.pulsar.go | 9 ++++----- api/cosmos/gov/v1/gov.pulsar.go | 9 ++++----- api/cosmos/gov/v1/query.pulsar.go | 11 +++++------ api/cosmos/gov/v1/tx.pulsar.go | 9 ++++----- api/cosmos/gov/v1beta1/genesis.pulsar.go | 9 ++++----- api/cosmos/gov/v1beta1/gov.pulsar.go | 9 ++++----- api/cosmos/gov/v1beta1/query.pulsar.go | 9 ++++----- api/cosmos/gov/v1beta1/tx.pulsar.go | 9 ++++----- api/cosmos/group/module/v1/module.pulsar.go | 9 ++++----- 65 files changed, 251 insertions(+), 316 deletions(-) diff --git a/api/amino/amino.pulsar.go b/api/amino/amino.pulsar.go index c891d16fcfe1..b6f4a39cd329 100644 --- a/api/amino/amino.pulsar.go +++ b/api/amino/amino.pulsar.go @@ -2,11 +2,10 @@ package amino import ( - reflect "reflect" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" descriptorpb "google.golang.org/protobuf/types/descriptorpb" + reflect "reflect" ) // Code generated by protoc-gen-go. DO NOT EDIT. diff --git a/api/cosmos/app/runtime/v1alpha1/module.pulsar.go b/api/cosmos/app/runtime/v1alpha1/module.pulsar.go index f2c2850c0d82..e8fe74d59cd5 100644 --- a/api/cosmos/app/runtime/v1alpha1/module.pulsar.go +++ b/api/cosmos/app/runtime/v1alpha1/module.pulsar.go @@ -2,16 +2,15 @@ package runtimev1alpha1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "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 _ protoreflect.List = (*_Module_2_list)(nil) diff --git a/api/cosmos/app/v1alpha1/module.pulsar.go b/api/cosmos/app/v1alpha1/module.pulsar.go index 07914932e449..914894677e5d 100644 --- a/api/cosmos/app/v1alpha1/module.pulsar.go +++ b/api/cosmos/app/v1alpha1/module.pulsar.go @@ -3,15 +3,14 @@ package appv1alpha1 import ( fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - 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" descriptorpb "google.golang.org/protobuf/types/descriptorpb" + io "io" + reflect "reflect" + sync "sync" ) var _ protoreflect.List = (*_ModuleDescriptor_2_list)(nil) diff --git a/api/cosmos/auth/module/v1/module.pulsar.go b/api/cosmos/auth/module/v1/module.pulsar.go index 02db65a2befa..2ba0bff52d41 100644 --- a/api/cosmos/auth/module/v1/module.pulsar.go +++ b/api/cosmos/auth/module/v1/module.pulsar.go @@ -2,16 +2,15 @@ package modulev1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "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 _ protoreflect.List = (*_Module_2_list)(nil) diff --git a/api/cosmos/auth/v1beta1/auth.pulsar.go b/api/cosmos/auth/v1beta1/auth.pulsar.go index 790a7a682b03..96c273492395 100644 --- a/api/cosmos/auth/v1beta1/auth.pulsar.go +++ b/api/cosmos/auth/v1beta1/auth.pulsar.go @@ -2,12 +2,8 @@ package authv1beta1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "cosmossdk.io/api/amino" + fmt "fmt" _ "github.com/cosmos/cosmos-proto" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" @@ -15,6 +11,9 @@ import ( protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" anypb "google.golang.org/protobuf/types/known/anypb" + io "io" + reflect "reflect" + sync "sync" ) var ( diff --git a/api/cosmos/auth/v1beta1/genesis.pulsar.go b/api/cosmos/auth/v1beta1/genesis.pulsar.go index bb6f0d67198e..427e80bd6c5e 100644 --- a/api/cosmos/auth/v1beta1/genesis.pulsar.go +++ b/api/cosmos/auth/v1beta1/genesis.pulsar.go @@ -2,18 +2,17 @@ package authv1beta1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "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" anypb "google.golang.org/protobuf/types/known/anypb" + io "io" + reflect "reflect" + sync "sync" ) var _ protoreflect.List = (*_GenesisState_2_list)(nil) diff --git a/api/cosmos/auth/v1beta1/query.pulsar.go b/api/cosmos/auth/v1beta1/query.pulsar.go index 77b8031e72f7..d8051b6828e8 100644 --- a/api/cosmos/auth/v1beta1/query.pulsar.go +++ b/api/cosmos/auth/v1beta1/query.pulsar.go @@ -2,13 +2,9 @@ package authv1beta1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - v1beta1 "cosmossdk.io/api/cosmos/base/query/v1beta1" _ "cosmossdk.io/api/cosmos/query/v1" + fmt "fmt" _ "github.com/cosmos/cosmos-proto" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" @@ -17,6 +13,9 @@ import ( protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" anypb "google.golang.org/protobuf/types/known/anypb" + io "io" + reflect "reflect" + sync "sync" ) var ( diff --git a/api/cosmos/auth/v1beta1/tx.pulsar.go b/api/cosmos/auth/v1beta1/tx.pulsar.go index f96b48af0c09..cff25a1f6244 100644 --- a/api/cosmos/auth/v1beta1/tx.pulsar.go +++ b/api/cosmos/auth/v1beta1/tx.pulsar.go @@ -2,19 +2,18 @@ package authv1beta1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "cosmossdk.io/api/amino" _ "cosmossdk.io/api/cosmos/msg/v1" + fmt "fmt" _ "github.com/cosmos/cosmos-proto" 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 ( diff --git a/api/cosmos/authz/v1beta1/authz.pulsar.go b/api/cosmos/authz/v1beta1/authz.pulsar.go index e1060e571a4d..938b2159fe75 100644 --- a/api/cosmos/authz/v1beta1/authz.pulsar.go +++ b/api/cosmos/authz/v1beta1/authz.pulsar.go @@ -2,12 +2,8 @@ package authzv1beta1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "cosmossdk.io/api/amino" + fmt "fmt" _ "github.com/cosmos/cosmos-proto" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" @@ -16,6 +12,9 @@ import ( protoimpl "google.golang.org/protobuf/runtime/protoimpl" anypb "google.golang.org/protobuf/types/known/anypb" timestamppb "google.golang.org/protobuf/types/known/timestamppb" + io "io" + reflect "reflect" + sync "sync" ) var ( diff --git a/api/cosmos/authz/v1beta1/genesis.pulsar.go b/api/cosmos/authz/v1beta1/genesis.pulsar.go index cdc14f007a2e..edcab7bbb446 100644 --- a/api/cosmos/authz/v1beta1/genesis.pulsar.go +++ b/api/cosmos/authz/v1beta1/genesis.pulsar.go @@ -2,17 +2,16 @@ package authzv1beta1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "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 _ protoreflect.List = (*_GenesisState_1_list)(nil) diff --git a/api/cosmos/authz/v1beta1/tx.pulsar.go b/api/cosmos/authz/v1beta1/tx.pulsar.go index aed964e5067a..777d11f73592 100644 --- a/api/cosmos/authz/v1beta1/tx.pulsar.go +++ b/api/cosmos/authz/v1beta1/tx.pulsar.go @@ -2,13 +2,9 @@ package authzv1beta1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "cosmossdk.io/api/amino" _ "cosmossdk.io/api/cosmos/msg/v1" + fmt "fmt" _ "github.com/cosmos/cosmos-proto" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" @@ -16,6 +12,9 @@ import ( protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" anypb "google.golang.org/protobuf/types/known/anypb" + io "io" + reflect "reflect" + sync "sync" ) var ( diff --git a/api/cosmos/autocli/v1/options.pulsar.go b/api/cosmos/autocli/v1/options.pulsar.go index 8cbfff77ca01..bc175f979e1d 100644 --- a/api/cosmos/autocli/v1/options.pulsar.go +++ b/api/cosmos/autocli/v1/options.pulsar.go @@ -3,15 +3,14 @@ package autocliv1 import ( fmt "fmt" - io "io" - reflect "reflect" - sort "sort" - sync "sync" - 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" + sort "sort" + sync "sync" ) var ( diff --git a/api/cosmos/autocli/v1/query.pulsar.go b/api/cosmos/autocli/v1/query.pulsar.go index 450f81784cfa..ce5f90ba7c69 100644 --- a/api/cosmos/autocli/v1/query.pulsar.go +++ b/api/cosmos/autocli/v1/query.pulsar.go @@ -2,17 +2,16 @@ package autocliv1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sort "sort" - sync "sync" - _ "cosmossdk.io/api/cosmos/query/v1" + 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" + sort "sort" + sync "sync" ) var ( diff --git a/api/cosmos/bank/module/v1/module.pulsar.go b/api/cosmos/bank/module/v1/module.pulsar.go index 9e7e3c189aef..64e252a4af23 100644 --- a/api/cosmos/bank/module/v1/module.pulsar.go +++ b/api/cosmos/bank/module/v1/module.pulsar.go @@ -2,16 +2,15 @@ package modulev1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "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 _ protoreflect.List = (*_Module_1_list)(nil) diff --git a/api/cosmos/bank/v1beta1/authz.pulsar.go b/api/cosmos/bank/v1beta1/authz.pulsar.go index 5435ef7ee940..bfcbfd3ba578 100644 --- a/api/cosmos/bank/v1beta1/authz.pulsar.go +++ b/api/cosmos/bank/v1beta1/authz.pulsar.go @@ -2,19 +2,18 @@ package bankv1beta1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "cosmossdk.io/api/amino" v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" + fmt "fmt" _ "github.com/cosmos/cosmos-proto" 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 _ protoreflect.List = (*_SendAuthorization_1_list)(nil) diff --git a/api/cosmos/bank/v1beta1/bank.pulsar.go b/api/cosmos/bank/v1beta1/bank.pulsar.go index 15fb79d62492..35640d670d2b 100644 --- a/api/cosmos/bank/v1beta1/bank.pulsar.go +++ b/api/cosmos/bank/v1beta1/bank.pulsar.go @@ -2,20 +2,19 @@ package bankv1beta1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "cosmossdk.io/api/amino" v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" _ "cosmossdk.io/api/cosmos/msg/v1" + fmt "fmt" _ "github.com/cosmos/cosmos-proto" 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 _ protoreflect.List = (*_Params_1_list)(nil) diff --git a/api/cosmos/bank/v1beta1/genesis.pulsar.go b/api/cosmos/bank/v1beta1/genesis.pulsar.go index 7f5c36f9a758..73a8226986d4 100644 --- a/api/cosmos/bank/v1beta1/genesis.pulsar.go +++ b/api/cosmos/bank/v1beta1/genesis.pulsar.go @@ -2,19 +2,18 @@ package bankv1beta1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "cosmossdk.io/api/amino" v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" + fmt "fmt" _ "github.com/cosmos/cosmos-proto" 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 _ protoreflect.List = (*_GenesisState_2_list)(nil) diff --git a/api/cosmos/bank/v1beta1/query.pulsar.go b/api/cosmos/bank/v1beta1/query.pulsar.go index f56c56f7c747..bfd36bd11895 100644 --- a/api/cosmos/bank/v1beta1/query.pulsar.go +++ b/api/cosmos/bank/v1beta1/query.pulsar.go @@ -2,15 +2,11 @@ package bankv1beta1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "cosmossdk.io/api/amino" v1beta11 "cosmossdk.io/api/cosmos/base/query/v1beta1" v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" _ "cosmossdk.io/api/cosmos/query/v1" + fmt "fmt" _ "github.com/cosmos/cosmos-proto" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" @@ -18,6 +14,9 @@ import ( 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 ( diff --git a/api/cosmos/bank/v1beta1/tx.pulsar.go b/api/cosmos/bank/v1beta1/tx.pulsar.go index 72d66ab35516..96bdddda3037 100644 --- a/api/cosmos/bank/v1beta1/tx.pulsar.go +++ b/api/cosmos/bank/v1beta1/tx.pulsar.go @@ -2,20 +2,19 @@ package bankv1beta1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "cosmossdk.io/api/amino" v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" _ "cosmossdk.io/api/cosmos/msg/v1" + fmt "fmt" _ "github.com/cosmos/cosmos-proto" 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 _ protoreflect.List = (*_MsgSend_3_list)(nil) diff --git a/api/cosmos/base/abci/v1beta1/abci.pulsar.go b/api/cosmos/base/abci/v1beta1/abci.pulsar.go index cf3623c96274..6d3253676da1 100644 --- a/api/cosmos/base/abci/v1beta1/abci.pulsar.go +++ b/api/cosmos/base/abci/v1beta1/abci.pulsar.go @@ -2,18 +2,17 @@ package abciv1beta1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - abci "cosmossdk.io/api/tendermint/abci" + 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" anypb "google.golang.org/protobuf/types/known/anypb" + io "io" + reflect "reflect" + sync "sync" ) var _ protoreflect.List = (*_TxResponse_7_list)(nil) diff --git a/api/cosmos/base/node/v1beta1/query.pulsar.go b/api/cosmos/base/node/v1beta1/query.pulsar.go index b5958abe9720..600b4d5d3668 100644 --- a/api/cosmos/base/node/v1beta1/query.pulsar.go +++ b/api/cosmos/base/node/v1beta1/query.pulsar.go @@ -3,15 +3,14 @@ package nodev1beta1 import ( fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - runtime "github.com/cosmos/cosmos-proto/runtime" _ "google.golang.org/genproto/googleapis/api/annotations" 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 ( diff --git a/api/cosmos/base/query/v1beta1/pagination.pulsar.go b/api/cosmos/base/query/v1beta1/pagination.pulsar.go index ca31557e015d..1d5fe3521990 100644 --- a/api/cosmos/base/query/v1beta1/pagination.pulsar.go +++ b/api/cosmos/base/query/v1beta1/pagination.pulsar.go @@ -3,14 +3,13 @@ package queryv1beta1 import ( fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - 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 ( diff --git a/api/cosmos/base/store/internal/kv/v1beta1/kv.pulsar.go b/api/cosmos/base/store/internal/kv/v1beta1/kv.pulsar.go index 7c0bef5f32d3..12aec7f526bd 100644 --- a/api/cosmos/base/store/internal/kv/v1beta1/kv.pulsar.go +++ b/api/cosmos/base/store/internal/kv/v1beta1/kv.pulsar.go @@ -3,15 +3,14 @@ package kvv1beta1 import ( fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - 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 _ protoreflect.List = (*_Pairs_1_list)(nil) diff --git a/api/cosmos/base/store/snapshots/v1beta1/snapshot.pulsar.go b/api/cosmos/base/store/snapshots/v1beta1/snapshot.pulsar.go index 4b20fe7fa701..69ee185930fa 100644 --- a/api/cosmos/base/store/snapshots/v1beta1/snapshot.pulsar.go +++ b/api/cosmos/base/store/snapshots/v1beta1/snapshot.pulsar.go @@ -3,15 +3,14 @@ package snapshotsv1beta1 import ( fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - 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 ( diff --git a/api/cosmos/base/store/v1beta1/commit_info.pulsar.go b/api/cosmos/base/store/v1beta1/commit_info.pulsar.go index a4db547919bf..4e259d858705 100644 --- a/api/cosmos/base/store/v1beta1/commit_info.pulsar.go +++ b/api/cosmos/base/store/v1beta1/commit_info.pulsar.go @@ -3,15 +3,14 @@ package storev1beta1 import ( fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - 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 _ protoreflect.List = (*_CommitInfo_2_list)(nil) diff --git a/api/cosmos/base/store/v1beta1/listening.pulsar.go b/api/cosmos/base/store/v1beta1/listening.pulsar.go index 0156294d01d6..47eaf7b0fc13 100644 --- a/api/cosmos/base/store/v1beta1/listening.pulsar.go +++ b/api/cosmos/base/store/v1beta1/listening.pulsar.go @@ -2,16 +2,15 @@ package storev1beta1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - abci "cosmossdk.io/api/tendermint/abci" + 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 ( diff --git a/api/cosmos/base/tendermint/v1beta1/query.pulsar.go b/api/cosmos/base/tendermint/v1beta1/query.pulsar.go index 1bcf5aeb7333..ace9ead07407 100644 --- a/api/cosmos/base/tendermint/v1beta1/query.pulsar.go +++ b/api/cosmos/base/tendermint/v1beta1/query.pulsar.go @@ -2,15 +2,11 @@ package tendermintv1beta1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "cosmossdk.io/api/amino" v1beta1 "cosmossdk.io/api/cosmos/base/query/v1beta1" p2p "cosmossdk.io/api/tendermint/p2p" types "cosmossdk.io/api/tendermint/types" + fmt "fmt" _ "github.com/cosmos/cosmos-proto" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" @@ -19,6 +15,9 @@ import ( protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" anypb "google.golang.org/protobuf/types/known/anypb" + io "io" + reflect "reflect" + sync "sync" ) var ( diff --git a/api/cosmos/base/tendermint/v1beta1/types.pulsar.go b/api/cosmos/base/tendermint/v1beta1/types.pulsar.go index 094fc2637d5f..3b813632fe64 100644 --- a/api/cosmos/base/tendermint/v1beta1/types.pulsar.go +++ b/api/cosmos/base/tendermint/v1beta1/types.pulsar.go @@ -2,20 +2,19 @@ package tendermintv1beta1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "cosmossdk.io/api/amino" types "cosmossdk.io/api/tendermint/types" version "cosmossdk.io/api/tendermint/version" + 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" timestamppb "google.golang.org/protobuf/types/known/timestamppb" + io "io" + reflect "reflect" + sync "sync" ) var ( diff --git a/api/cosmos/base/v1beta1/coin.pulsar.go b/api/cosmos/base/v1beta1/coin.pulsar.go index aa88b78bec21..26b79e11737d 100644 --- a/api/cosmos/base/v1beta1/coin.pulsar.go +++ b/api/cosmos/base/v1beta1/coin.pulsar.go @@ -2,18 +2,17 @@ package basev1beta1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "cosmossdk.io/api/amino" + fmt "fmt" _ "github.com/cosmos/cosmos-proto" 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 ( diff --git a/api/cosmos/capability/v1beta1/capability.pulsar.go b/api/cosmos/capability/v1beta1/capability.pulsar.go index b0ceaf8640b1..774b9bf8526d 100644 --- a/api/cosmos/capability/v1beta1/capability.pulsar.go +++ b/api/cosmos/capability/v1beta1/capability.pulsar.go @@ -2,17 +2,16 @@ package capabilityv1beta1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "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 ( diff --git a/api/cosmos/capability/v1beta1/genesis.pulsar.go b/api/cosmos/capability/v1beta1/genesis.pulsar.go index 49d2dc2c07e4..171eb7f67660 100644 --- a/api/cosmos/capability/v1beta1/genesis.pulsar.go +++ b/api/cosmos/capability/v1beta1/genesis.pulsar.go @@ -2,17 +2,16 @@ package capabilityv1beta1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "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 ( diff --git a/api/cosmos/consensus/module/v1/module.pulsar.go b/api/cosmos/consensus/module/v1/module.pulsar.go index 81a1ca1b8a93..1ec17c3a5e11 100644 --- a/api/cosmos/consensus/module/v1/module.pulsar.go +++ b/api/cosmos/consensus/module/v1/module.pulsar.go @@ -2,16 +2,15 @@ package modulev1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "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 ( diff --git a/api/cosmos/consensus/v1/query.pulsar.go b/api/cosmos/consensus/v1/query.pulsar.go index 304050e27e6a..2e60bb1777e1 100644 --- a/api/cosmos/consensus/v1/query.pulsar.go +++ b/api/cosmos/consensus/v1/query.pulsar.go @@ -2,17 +2,16 @@ package consensusv1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - types "cosmossdk.io/api/tendermint/types" + fmt "fmt" runtime "github.com/cosmos/cosmos-proto/runtime" _ "google.golang.org/genproto/googleapis/api/annotations" 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 ( diff --git a/api/cosmos/consensus/v1/tx.pulsar.go b/api/cosmos/consensus/v1/tx.pulsar.go index beee6d730e98..9fe12cdd84df 100644 --- a/api/cosmos/consensus/v1/tx.pulsar.go +++ b/api/cosmos/consensus/v1/tx.pulsar.go @@ -2,18 +2,17 @@ package consensusv1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "cosmossdk.io/api/cosmos/msg/v1" types "cosmossdk.io/api/tendermint/types" + fmt "fmt" _ "github.com/cosmos/cosmos-proto" 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 ( diff --git a/api/cosmos/crisis/module/v1/module.pulsar.go b/api/cosmos/crisis/module/v1/module.pulsar.go index 3786f2d401b3..2e0a34d7d354 100644 --- a/api/cosmos/crisis/module/v1/module.pulsar.go +++ b/api/cosmos/crisis/module/v1/module.pulsar.go @@ -2,16 +2,15 @@ package modulev1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "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 ( diff --git a/api/cosmos/crisis/v1beta1/genesis.pulsar.go b/api/cosmos/crisis/v1beta1/genesis.pulsar.go index fdb4ca547028..301a23ec5000 100644 --- a/api/cosmos/crisis/v1beta1/genesis.pulsar.go +++ b/api/cosmos/crisis/v1beta1/genesis.pulsar.go @@ -2,18 +2,17 @@ package crisisv1beta1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "cosmossdk.io/api/amino" v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" + 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 ( diff --git a/api/cosmos/crisis/v1beta1/tx.pulsar.go b/api/cosmos/crisis/v1beta1/tx.pulsar.go index 71d85e605fbe..78ff02fce005 100644 --- a/api/cosmos/crisis/v1beta1/tx.pulsar.go +++ b/api/cosmos/crisis/v1beta1/tx.pulsar.go @@ -2,20 +2,19 @@ package crisisv1beta1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "cosmossdk.io/api/amino" v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" _ "cosmossdk.io/api/cosmos/msg/v1" + fmt "fmt" _ "github.com/cosmos/cosmos-proto" 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 ( diff --git a/api/cosmos/crypto/ed25519/keys.pulsar.go b/api/cosmos/crypto/ed25519/keys.pulsar.go index fb7d77e94e2d..13e2cf837e49 100644 --- a/api/cosmos/crypto/ed25519/keys.pulsar.go +++ b/api/cosmos/crypto/ed25519/keys.pulsar.go @@ -2,17 +2,16 @@ package ed25519 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "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 ( diff --git a/api/cosmos/crypto/hd/v1/hd.pulsar.go b/api/cosmos/crypto/hd/v1/hd.pulsar.go index 8e9530a873d6..2ddd2b875dc0 100644 --- a/api/cosmos/crypto/hd/v1/hd.pulsar.go +++ b/api/cosmos/crypto/hd/v1/hd.pulsar.go @@ -2,17 +2,16 @@ package hdv1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "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 ( diff --git a/api/cosmos/crypto/keyring/v1/record.pulsar.go b/api/cosmos/crypto/keyring/v1/record.pulsar.go index ee9a43ae5d91..8c04e58545f4 100644 --- a/api/cosmos/crypto/keyring/v1/record.pulsar.go +++ b/api/cosmos/crypto/keyring/v1/record.pulsar.go @@ -2,18 +2,17 @@ package keyringv1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - v1 "cosmossdk.io/api/cosmos/crypto/hd/v1" + 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" anypb "google.golang.org/protobuf/types/known/anypb" + io "io" + reflect "reflect" + sync "sync" ) var ( diff --git a/api/cosmos/crypto/multisig/keys.pulsar.go b/api/cosmos/crypto/multisig/keys.pulsar.go index e9717f9f4872..e1f2f1c9c423 100644 --- a/api/cosmos/crypto/multisig/keys.pulsar.go +++ b/api/cosmos/crypto/multisig/keys.pulsar.go @@ -2,18 +2,17 @@ package multisig import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "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" anypb "google.golang.org/protobuf/types/known/anypb" + io "io" + reflect "reflect" + sync "sync" ) var _ protoreflect.List = (*_LegacyAminoPubKey_2_list)(nil) diff --git a/api/cosmos/crypto/multisig/v1beta1/multisig.pulsar.go b/api/cosmos/crypto/multisig/v1beta1/multisig.pulsar.go index 70daa48d0d76..2bf4fc7cd6cc 100644 --- a/api/cosmos/crypto/multisig/v1beta1/multisig.pulsar.go +++ b/api/cosmos/crypto/multisig/v1beta1/multisig.pulsar.go @@ -3,15 +3,14 @@ package multisigv1beta1 import ( fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - 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 _ protoreflect.List = (*_MultiSignature_1_list)(nil) diff --git a/api/cosmos/crypto/secp256k1/keys.pulsar.go b/api/cosmos/crypto/secp256k1/keys.pulsar.go index 71e44d9ff356..93e13424729b 100644 --- a/api/cosmos/crypto/secp256k1/keys.pulsar.go +++ b/api/cosmos/crypto/secp256k1/keys.pulsar.go @@ -2,17 +2,16 @@ package secp256k1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "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 ( diff --git a/api/cosmos/crypto/secp256r1/keys.pulsar.go b/api/cosmos/crypto/secp256r1/keys.pulsar.go index fad556f313ee..02f122b0a878 100644 --- a/api/cosmos/crypto/secp256r1/keys.pulsar.go +++ b/api/cosmos/crypto/secp256r1/keys.pulsar.go @@ -3,15 +3,14 @@ package secp256r1 import ( fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - 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 ( diff --git a/api/cosmos/distribution/module/v1/module.pulsar.go b/api/cosmos/distribution/module/v1/module.pulsar.go index 2068d8395215..1e35d5529417 100644 --- a/api/cosmos/distribution/module/v1/module.pulsar.go +++ b/api/cosmos/distribution/module/v1/module.pulsar.go @@ -2,16 +2,15 @@ package modulev1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "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 ( diff --git a/api/cosmos/distribution/v1beta1/distribution.pulsar.go b/api/cosmos/distribution/v1beta1/distribution.pulsar.go index 4deacd80cf7a..856240f07509 100644 --- a/api/cosmos/distribution/v1beta1/distribution.pulsar.go +++ b/api/cosmos/distribution/v1beta1/distribution.pulsar.go @@ -2,19 +2,18 @@ package distributionv1beta1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "cosmossdk.io/api/amino" v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" + fmt "fmt" _ "github.com/cosmos/cosmos-proto" 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 ( diff --git a/api/cosmos/distribution/v1beta1/genesis.pulsar.go b/api/cosmos/distribution/v1beta1/genesis.pulsar.go index a88643983d91..f8048c0a70e8 100644 --- a/api/cosmos/distribution/v1beta1/genesis.pulsar.go +++ b/api/cosmos/distribution/v1beta1/genesis.pulsar.go @@ -2,19 +2,18 @@ package distributionv1beta1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "cosmossdk.io/api/amino" v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" + fmt "fmt" _ "github.com/cosmos/cosmos-proto" 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 ( diff --git a/api/cosmos/distribution/v1beta1/query.pulsar.go b/api/cosmos/distribution/v1beta1/query.pulsar.go index 49ba08cf405b..da754901807f 100644 --- a/api/cosmos/distribution/v1beta1/query.pulsar.go +++ b/api/cosmos/distribution/v1beta1/query.pulsar.go @@ -2,14 +2,10 @@ package distributionv1beta1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "cosmossdk.io/api/amino" v1beta11 "cosmossdk.io/api/cosmos/base/query/v1beta1" v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" + fmt "fmt" _ "github.com/cosmos/cosmos-proto" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" @@ -17,6 +13,9 @@ import ( 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 ( diff --git a/api/cosmos/distribution/v1beta1/tx.pulsar.go b/api/cosmos/distribution/v1beta1/tx.pulsar.go index e194da0db206..4f1e1af51097 100644 --- a/api/cosmos/distribution/v1beta1/tx.pulsar.go +++ b/api/cosmos/distribution/v1beta1/tx.pulsar.go @@ -2,20 +2,19 @@ package distributionv1beta1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "cosmossdk.io/api/amino" v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" _ "cosmossdk.io/api/cosmos/msg/v1" + fmt "fmt" _ "github.com/cosmos/cosmos-proto" 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 ( diff --git a/api/cosmos/evidence/v1beta1/evidence.pulsar.go b/api/cosmos/evidence/v1beta1/evidence.pulsar.go index ec979fafa7b0..4f526190ba8c 100644 --- a/api/cosmos/evidence/v1beta1/evidence.pulsar.go +++ b/api/cosmos/evidence/v1beta1/evidence.pulsar.go @@ -2,12 +2,8 @@ package evidencev1beta1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "cosmossdk.io/api/amino" + fmt "fmt" _ "github.com/cosmos/cosmos-proto" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" @@ -15,6 +11,9 @@ import ( protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" timestamppb "google.golang.org/protobuf/types/known/timestamppb" + io "io" + reflect "reflect" + sync "sync" ) var ( diff --git a/api/cosmos/evidence/v1beta1/query.pulsar.go b/api/cosmos/evidence/v1beta1/query.pulsar.go index bbf725a2b7ad..caaf87ae77df 100644 --- a/api/cosmos/evidence/v1beta1/query.pulsar.go +++ b/api/cosmos/evidence/v1beta1/query.pulsar.go @@ -2,12 +2,8 @@ package evidencev1beta1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - v1beta1 "cosmossdk.io/api/cosmos/base/query/v1beta1" + fmt "fmt" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" _ "google.golang.org/genproto/googleapis/api/annotations" @@ -15,6 +11,9 @@ import ( protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" anypb "google.golang.org/protobuf/types/known/anypb" + io "io" + reflect "reflect" + sync "sync" ) var ( diff --git a/api/cosmos/evidence/v1beta1/tx.pulsar.go b/api/cosmos/evidence/v1beta1/tx.pulsar.go index 019e2ece39c0..ce6a457ab684 100644 --- a/api/cosmos/evidence/v1beta1/tx.pulsar.go +++ b/api/cosmos/evidence/v1beta1/tx.pulsar.go @@ -2,13 +2,9 @@ package evidencev1beta1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "cosmossdk.io/api/amino" _ "cosmossdk.io/api/cosmos/msg/v1" + fmt "fmt" _ "github.com/cosmos/cosmos-proto" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" @@ -16,6 +12,9 @@ import ( protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" anypb "google.golang.org/protobuf/types/known/anypb" + io "io" + reflect "reflect" + sync "sync" ) var ( diff --git a/api/cosmos/feegrant/v1beta1/feegrant.pulsar.go b/api/cosmos/feegrant/v1beta1/feegrant.pulsar.go index c3cab6d86fbd..71e521f5edf1 100644 --- a/api/cosmos/feegrant/v1beta1/feegrant.pulsar.go +++ b/api/cosmos/feegrant/v1beta1/feegrant.pulsar.go @@ -2,13 +2,9 @@ package feegrantv1beta1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "cosmossdk.io/api/amino" v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" + fmt "fmt" _ "github.com/cosmos/cosmos-proto" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" @@ -18,6 +14,9 @@ import ( anypb "google.golang.org/protobuf/types/known/anypb" durationpb "google.golang.org/protobuf/types/known/durationpb" timestamppb "google.golang.org/protobuf/types/known/timestamppb" + io "io" + reflect "reflect" + sync "sync" ) var _ protoreflect.List = (*_BasicAllowance_1_list)(nil) diff --git a/api/cosmos/feegrant/v1beta1/genesis.pulsar.go b/api/cosmos/feegrant/v1beta1/genesis.pulsar.go index 98ee45d6208a..459af1b1511d 100644 --- a/api/cosmos/feegrant/v1beta1/genesis.pulsar.go +++ b/api/cosmos/feegrant/v1beta1/genesis.pulsar.go @@ -2,17 +2,16 @@ package feegrantv1beta1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "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 _ protoreflect.List = (*_GenesisState_1_list)(nil) diff --git a/api/cosmos/feegrant/v1beta1/tx.pulsar.go b/api/cosmos/feegrant/v1beta1/tx.pulsar.go index 04a44adf7b37..05e2e20a34d0 100644 --- a/api/cosmos/feegrant/v1beta1/tx.pulsar.go +++ b/api/cosmos/feegrant/v1beta1/tx.pulsar.go @@ -2,19 +2,18 @@ package feegrantv1beta1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "cosmossdk.io/api/amino" _ "cosmossdk.io/api/cosmos/msg/v1" + fmt "fmt" _ "github.com/cosmos/cosmos-proto" 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" anypb "google.golang.org/protobuf/types/known/anypb" + io "io" + reflect "reflect" + sync "sync" ) var ( diff --git a/api/cosmos/genutil/v1beta1/genesis.pulsar.go b/api/cosmos/genutil/v1beta1/genesis.pulsar.go index 7de100fd0ee3..4382a8bc801d 100644 --- a/api/cosmos/genutil/v1beta1/genesis.pulsar.go +++ b/api/cosmos/genutil/v1beta1/genesis.pulsar.go @@ -2,17 +2,16 @@ package genutilv1beta1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "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 _ protoreflect.List = (*_GenesisState_1_list)(nil) diff --git a/api/cosmos/gov/module/v1/module.pulsar.go b/api/cosmos/gov/module/v1/module.pulsar.go index 0cd66047322c..43e32585116a 100644 --- a/api/cosmos/gov/module/v1/module.pulsar.go +++ b/api/cosmos/gov/module/v1/module.pulsar.go @@ -2,16 +2,15 @@ package modulev1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "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 ( diff --git a/api/cosmos/gov/v1/gov.pulsar.go b/api/cosmos/gov/v1/gov.pulsar.go index d71bcf7ea257..88a6743a117c 100644 --- a/api/cosmos/gov/v1/gov.pulsar.go +++ b/api/cosmos/gov/v1/gov.pulsar.go @@ -2,13 +2,9 @@ package govv1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "cosmossdk.io/api/amino" v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" + fmt "fmt" _ "github.com/cosmos/cosmos-proto" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" @@ -18,6 +14,9 @@ import ( anypb "google.golang.org/protobuf/types/known/anypb" durationpb "google.golang.org/protobuf/types/known/durationpb" timestamppb "google.golang.org/protobuf/types/known/timestamppb" + io "io" + reflect "reflect" + sync "sync" ) var ( diff --git a/api/cosmos/gov/v1/query.pulsar.go b/api/cosmos/gov/v1/query.pulsar.go index d0281ab41857..02dbcc9d2434 100644 --- a/api/cosmos/gov/v1/query.pulsar.go +++ b/api/cosmos/gov/v1/query.pulsar.go @@ -2,18 +2,17 @@ package govv1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - v1beta1 "cosmossdk.io/api/cosmos/base/query/v1beta1" + fmt "fmt" _ "github.com/cosmos/cosmos-proto" runtime "github.com/cosmos/cosmos-proto/runtime" _ "google.golang.org/genproto/googleapis/api/annotations" 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 ( @@ -8322,7 +8321,7 @@ type QueryParamsResponse struct { // // Deprecated: Do not use. TallyParams *TallyParams `protobuf:"bytes,3,opt,name=tally_params,json=tallyParams,proto3" json:"tally_params,omitempty"` - // params defines all the parameters of x/gov module. + // params defines all the paramaters of x/gov module. // // Since: cosmos-sdk 0.47 Params *Params `protobuf:"bytes,4,opt,name=params,proto3" json:"params,omitempty"` diff --git a/api/cosmos/gov/v1/tx.pulsar.go b/api/cosmos/gov/v1/tx.pulsar.go index 5481133efb88..50e083538d98 100644 --- a/api/cosmos/gov/v1/tx.pulsar.go +++ b/api/cosmos/gov/v1/tx.pulsar.go @@ -2,14 +2,10 @@ package govv1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "cosmossdk.io/api/amino" v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" _ "cosmossdk.io/api/cosmos/msg/v1" + fmt "fmt" _ "github.com/cosmos/cosmos-proto" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" @@ -17,6 +13,9 @@ import ( protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" anypb "google.golang.org/protobuf/types/known/anypb" + io "io" + reflect "reflect" + sync "sync" ) var _ protoreflect.List = (*_MsgSubmitProposal_1_list)(nil) diff --git a/api/cosmos/gov/v1beta1/genesis.pulsar.go b/api/cosmos/gov/v1beta1/genesis.pulsar.go index b94ea16a4ead..b66ffd18f9da 100644 --- a/api/cosmos/gov/v1beta1/genesis.pulsar.go +++ b/api/cosmos/gov/v1beta1/genesis.pulsar.go @@ -2,17 +2,16 @@ package govv1beta1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "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 _ protoreflect.List = (*_GenesisState_2_list)(nil) diff --git a/api/cosmos/gov/v1beta1/gov.pulsar.go b/api/cosmos/gov/v1beta1/gov.pulsar.go index a563b75540a3..7215424ab17a 100644 --- a/api/cosmos/gov/v1beta1/gov.pulsar.go +++ b/api/cosmos/gov/v1beta1/gov.pulsar.go @@ -2,13 +2,9 @@ package govv1beta1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "cosmossdk.io/api/amino" v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" + fmt "fmt" _ "github.com/cosmos/cosmos-proto" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" @@ -18,6 +14,9 @@ import ( anypb "google.golang.org/protobuf/types/known/anypb" durationpb "google.golang.org/protobuf/types/known/durationpb" timestamppb "google.golang.org/protobuf/types/known/timestamppb" + io "io" + reflect "reflect" + sync "sync" ) var ( diff --git a/api/cosmos/gov/v1beta1/query.pulsar.go b/api/cosmos/gov/v1beta1/query.pulsar.go index 3e6a32ececab..28e2b8b5fe73 100644 --- a/api/cosmos/gov/v1beta1/query.pulsar.go +++ b/api/cosmos/gov/v1beta1/query.pulsar.go @@ -2,13 +2,9 @@ package govv1beta1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "cosmossdk.io/api/amino" v1beta1 "cosmossdk.io/api/cosmos/base/query/v1beta1" + fmt "fmt" _ "github.com/cosmos/cosmos-proto" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" @@ -16,6 +12,9 @@ import ( 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 ( diff --git a/api/cosmos/gov/v1beta1/tx.pulsar.go b/api/cosmos/gov/v1beta1/tx.pulsar.go index 56972c1981aa..bbd21a701034 100644 --- a/api/cosmos/gov/v1beta1/tx.pulsar.go +++ b/api/cosmos/gov/v1beta1/tx.pulsar.go @@ -2,14 +2,10 @@ package govv1beta1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "cosmossdk.io/api/amino" v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" _ "cosmossdk.io/api/cosmos/msg/v1" + fmt "fmt" _ "github.com/cosmos/cosmos-proto" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" @@ -17,6 +13,9 @@ import ( protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" anypb "google.golang.org/protobuf/types/known/anypb" + io "io" + reflect "reflect" + sync "sync" ) var _ protoreflect.List = (*_MsgSubmitProposal_2_list)(nil) diff --git a/api/cosmos/group/module/v1/module.pulsar.go b/api/cosmos/group/module/v1/module.pulsar.go index b399315a1808..d79dc4f53698 100644 --- a/api/cosmos/group/module/v1/module.pulsar.go +++ b/api/cosmos/group/module/v1/module.pulsar.go @@ -2,19 +2,18 @@ package modulev1 import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "cosmossdk.io/api/amino" _ "cosmossdk.io/api/cosmos/app/v1alpha1" + 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" durationpb "google.golang.org/protobuf/types/known/durationpb" + io "io" + reflect "reflect" + sync "sync" ) var ( From 2cbd7935881f59541ddce0e7843c8a71d229e910 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Thu, 8 Dec 2022 17:31:47 -0500 Subject: [PATCH 20/23] update to 063 --- docs/architecture/README.md | 2 +- .../{adr-061-core-module-api.md => adr-063-core-module-api.md} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename docs/architecture/{adr-061-core-module-api.md => adr-063-core-module-api.md} (100%) diff --git a/docs/architecture/README.md b/docs/architecture/README.md index 84bbfec89906..6696af5874cb 100644 --- a/docs/architecture/README.md +++ b/docs/architecture/README.md @@ -82,8 +82,8 @@ When writing ADRs, follow the same best practices for writing RFCs. When writing * [ADR 046: Module Params](./adr-046-module-params.md) * [ADR 057: App Wiring](./adr-057-app-wiring.md) * [ADR 059: Test Scopes](./adr-059-test-scopes.md) -* [ADR 061: Core Module API](./adr-61-core-module-api.md) * [ADR 062: Collections State Layer](./adr-062-collections-state-layer.md) +* [ADR 063: Core Module API](./adr-063-core-module-api.md) ### Draft diff --git a/docs/architecture/adr-061-core-module-api.md b/docs/architecture/adr-063-core-module-api.md similarity index 100% rename from docs/architecture/adr-061-core-module-api.md rename to docs/architecture/adr-063-core-module-api.md From aaf397b32302c07b79156b1119da88de92d1596e Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Thu, 8 Dec 2022 17:36:39 -0500 Subject: [PATCH 21/23] updates --- docs/architecture/adr-063-core-module-api.md | 46 +++++++------------- 1 file changed, 15 insertions(+), 31 deletions(-) diff --git a/docs/architecture/adr-063-core-module-api.md b/docs/architecture/adr-063-core-module-api.md index 7f0e44fbe9b6..bfb41db18fb1 100644 --- a/docs/architecture/adr-063-core-module-api.md +++ b/docs/architecture/adr-063-core-module-api.md @@ -1,8 +1,9 @@ -# ADR 061: Core Module API +# ADR 063: Core Module API ## Changelog * 2022-08-18 First Draft +* 2022-12-08 First Draft ## Status @@ -10,8 +11,8 @@ PROPOSED Not Implemented ## Abstract -A new core API is proposed to be added as a way to develop cosmos-sdk applications that will in the future replace the existing `AppModule` and `sdk.Context` frameworks a set of core services -and a new `Handler` struct. This core API aims to: +A new core API is proposed as a way to develop cosmos-sdk applications that will eventually replace the existing +`AppModule` and `sdk.Context` frameworks a set of core services and extension interfaces. This core API aims to: - be simpler, - more extensible, - more stable than the current framework, @@ -58,7 +59,7 @@ The design principles of the core API are as follows: * all independent services are isolated in independent packages with minimal APIs and minimal dependencies * the core API should be minimalistic and designed for long-term support (LTS) * a "runtime" module will implement all the "core services" defined by the core API and can handle all module - functionalities exposed by the core `Handler` type + functionalities exposed by core extension interfaces * other non-core and/or non-LTS services can be exposed by specific versions of runtime modules or other modules following the same design principles, this includes functionality that interacts with specific non-stable versions of third party dependencies such as Tendermint @@ -274,40 +275,23 @@ type Service interface { } ``` -### Core `Handler` Struct +### Core `AppModule` extension interfaces -Modules will provide their core services to runtime module via the `Handler` struct, defined in the `cosmossdk.io/core/appmodule` -package, instead of the existing -`AppModule` interface: +Modules will provide their core services to the runtime module via extension interfaces built on top of the +`cosmossdk.io/core/appmodule.AppModule` tag interface. This tag interface requires only two empty methods which +allow `depinject` to identify implementors as `depinject.OnePerModule` types and as app module implementations: ```go -package appmodule - -type Handler struct { - // Services are the Msg and Query services for the module. Msg services - // must be annotated with the option cosmos.msg.v1.service = true. - Services []ServiceImpl - - DefaultGenesis func(GenesisTarget) - ValidateGenesis func(GenesisSource) error - InitGenesis func(context.Context, GenesisSource) error - ExportGenesis func(context.Context, GenesisTarget) +type AppModule interface { + depinject.OnePerModuleType - BeginBlocker func(context.Context) error - EndBlocker func(context.Context) error - - EventListeners []EventListener - - UpgradeHandlers []UpgradeHandler + // IsAppModule is a dummy method to tag a struct as implementing an AppModule. + IsAppModule() } ``` -A struct as opposed to an interface has been chosen for the following reasons: -* it is always possible to add new fields to a struct without breaking backwards compatibility -* it is not necessary to populate all fields in a struct, whereas interface methods must always be implemented -* compared to extension interfaces, struct fields are more explicit - -Helper methods will be added to the `Handler` struct to simplify construction of more complex fields. +Other core extension interfaces will be defined in `cosmossdk.io/core` should be supported by valid runtime +implementations. #### `MsgServer` and `QueryServer` registration From 3432806d687174275e483d3d1b190a7358b2729d Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Tue, 24 Jan 2023 12:09:01 -0500 Subject: [PATCH 22/23] updates --- docs/architecture/adr-063-core-module-api.md | 393 +++++++------------ 1 file changed, 137 insertions(+), 256 deletions(-) diff --git a/docs/architecture/adr-063-core-module-api.md b/docs/architecture/adr-063-core-module-api.md index bfb41db18fb1..660ade07d56c 100644 --- a/docs/architecture/adr-063-core-module-api.md +++ b/docs/architecture/adr-063-core-module-api.md @@ -123,157 +123,41 @@ type of store they need in their dependency injection (or manual) constructors. #### Event Service -The event `Service` and `Manager` will be defined in the `cosmossdk.io/core/event` package. +The event `Service` will be defined in the `cosmossdk.io/core/event` package. -The event `Service` gives modules access to an event `Manager` which allows modules to emit typed and legacy, -untyped events: +The event `Service` allows modules to emit typed and legacy untyped events: ```go package event -type Service interface { - GetManager(context.Context) Manager -} - -type Manager interface { - // Emit emits events to both clients and state machine listeners. These events MUST be emitted deterministically - // and should be assumed to be part of blockchain consensus. - Emit(proto.Message) error - - // EmitLegacy emits legacy untyped events to clients only. These events do not need to be emitted deterministically - // and are not part of blockchain consensus. - EmitLegacy(eventType string, attrs ...LegacyEventAttribute) error - - // EmitClientOnly emits events only to clients. These events do not need to be emitted deterministically - // and are not part of blockchain consensus. - EmitClientOnly(proto.Message) error -} -``` - -Typed events emitted with `Emit` can be observed by other modules and thus must be deterministic and should be assumed -to be part of blockchain consensus (whether they are part of the block or app hash is left to the runtime to specify). - -Events emitted by `EmitLegacy` and `EmitClientOnly` are not considered to be part of consensus and cannot be observed -by other modules. If there is a client-side need to add events in patch releases, these methods can be used. - -Design questions: -* should we allow overriding event managers (like `sdk.Context.WithEventManager`)? - -#### Block Info Service - -The block info `Service` will be defined in the `cosmossdk.io/core/blockinfo` package. - -The `BlockInfo` service allows modules to get a limited set of information about the currently executing block -that does not depend on any specific version of Tendermint: -```go -package blockinfo - -type Service interface { - GetBlockInfo(ctx context.Context) BlockInfo -} - -type BlockInfo struct { - ChainID string - Height int64 - Time time.Time - Hash []byte -} -``` - -Only a limited set of modules need any other information from the Tendermint block header and specific versions -of runtime modules tied to specific Tendermint versions can expose this functionality to modules that need it. -The basic `BlockInfo` service is left fairly generic to insulate the vast majority of other modules from unneeded -exposure to changes in the Tendermint protocol. - -#### Gas Service - -The gas `Service` and `Meter` types will be defined in the `cosmossdk.io/core/gas` package. - -The gas service handles tracking of gas consumptions at the block and transaction level and also allows -for overriding the gas meter passed to child calls: -```go -package gas - -type Service interface { - GetMeter(context.Context) Meter - GetBlockMeter(context.Context) Meter - WithMeter(ctx context.Context, meter Meter) context.Context - WithBlockMeter(ctx context.Context, meter Meter) context.Context -} -``` - -#### Inter-module Client - -Runtime module implementations should provide an instance of the `appmodule.RootInterModuleClient` interface which -will allow modules to send messages to and make queries against other modules as described in [ADR 033](./adr-033-protobuf-inter-module-comm.md). - -```go -type InterModuleClient interface { - grpc.ClientConnInterface - - // Address is the ADR-028 address of this client against which messages will be authenticated. - Address() []byte -} - -type RootInterModuleClient interface { - InterModuleClient - - DerivedClient(key []byte) InterModuleClient -} -``` - -The `RootInterModuleClient` allows a module to make inter-module calls using its root [ADR 028](./adr-028-public-key-addresses.md) -address (as returned by the `Address` method). - -This client can be used with both `MsgClient`'s and `QueryClient`'s and the protobuf option -`cosmos.msg.v1.service` will allow the router to detect whether a given service is a query or msg service and -route requests appropriately. - -Module clients that use [ADR 028](./adr-028-public-key-addresses.md) derived module addresses -can be created using the `DerivedClient` method. - -By default, all `Msg`'s registered using the core API will be available for inter-module routing. Queries will only -be exposed for inter-module routing if their `rpc` methods have the protobuf option `cosmos.query.v1.internal` -set to true. - -The inter-module router will provide a unified interface for sending `Msg`'s and queries -which ensures all required pre-processing steps are uniformly executed by all modules which need such functionality. - -Runtime modules may choose to allow different types of "admin" access to individual modules which may allow for -bypassing certain authentication checks. This could allow `x/authz` to allow sending messages on behalf of all -addresses, for example. - -#### `appmodule.Service` Bundle Service - -To allow modules to declare a dependency on a single "bundle" service, runtime modules should provide an implementation -of the `appmodule.Service` interface: - -```go -package appmodule type Service interface { - store.KVStoreService - store.MemoryStoreService - store.TransientStoreService - event.Service - blockinfo.Service - gas.Service - RootInterModuleClient + // EmitProtoEvent emits events represented as a protobuf message (as described in ADR 032). + // + // Callers SHOULD assume that these events may be included in consensus. These events + // MUST be emitted deterministically and adding, removing or changing these events SHOULD + // be considered state-machine breaking. + EmitProtoEvent(ctx context.Context, event protoiface.MessageV1) error + + // EmitKVEvent emits an event based on an event and kv-pair attributes. + // + // These events will not be part of consensus and adding, removing or changing these events is + // not a state-machine breaking change. + EmitKVEvent(ctx context.Context, eventType string, attrs ...KVEventAttribute) error + + // EmitProtoEventNonConsensus emits events represented as a protobuf message (as described in ADR 032), without + // including it in blockchain consensus. + // + // These events will not be part of consensus and adding, removing or changing events is + // not a state-machine breaking change. + EmitProtoEventNonConsensus(ctx context.Context, event protoiface.MessageV1) error } ``` -To maintain API compatibility, if new core services are added, a new `cosmossdk.io/core/appmodule/v2.Service` should -be added which extends this service and bundles the new core services, ex: -```go -package v2 - -import "cosmossdk.io/core/appmodule" +Typed events emitted with `EmitProto` should be assumed to be part of blockchain consensus (whether they are part of +the block or app hash is left to the runtime to specify). -type Service interface { - appmodule.Service - SomeNewService - AnotherNewService -} -``` +Events emitted by `EmitKVEvent` and `EmitProtoEventNonConsensus` are not considered to be part of consensus and cannot be observed +by other modules. If there is a client-side need to add events in patch releases, these methods can be used. ### Core `AppModule` extension interfaces @@ -295,66 +179,87 @@ implementations. #### `MsgServer` and `QueryServer` registration -The `Handler` struct type will implement `grpc.ServiceRegistrar` interface which will allow for registering -`MsgServer` and `QueryServer` implementations directly with the `Handler` struct like this: -```go - h := &appmodule.Handler{} - types.RegisterMsgServer(h, keeper.NewMsgServerImpl(am.keeper)) - types.RegisterQueryServer(h, am.keeper) -``` +`MsgServer` and `QueryServer` registration is done by implementing the `HasServices` extension interface: -Service registrations will be stored in the `Handler.Services` field using the `ServiceImpl` struct: ```go -type ServiceImpl struct { - Desc *grpc.ServiceDesc - Impl interface{} +type HasServices interface { + AppModule + + RegisterServices(grpc.ServiceRegistrar) } + ``` -Because of the `cosmos.msg.v1.service` protobuf option, required for `Msg` services, the same handler struct can be +Because of the `cosmos.msg.v1.service` protobuf option, required for `Msg` services, the same `ServiceRegitrar` can be used to register both `Msg` and query services. #### Genesis The genesis `Handler` functions - `DefaultGenesis`, `ValidateGenesis`, `InitGenesis` and `ExportGenesis` - are specified -against the `GenesisSource` and `GenesisTarget` interfaces which will abstract over genesis sources which may be single -JSON files or collections of JSON objects that can be efficiently streamed. They will also include helper functions for -interacting with genesis data represented by single `proto.Message` types. +against the `GenesisSource` and `GenesisTarget` interfaces which will abstract over genesis sources which may be a single +JSON object or collections of JSON objects that can be efficiently streamed. ```go -type GenesisSource interface { - ReadMessage(proto.Message) error - OpenReader(field string) (io.ReadCloser, error) - ReadRawJSON() (json.RawMessage, error) -} - -type GenesisTarget interface { - WriteMessage(proto.Message) error - OpenWriter(field string) (io.WriteCloser, error) - WriteRawJSON(json.RawMessage) error -} +// GenesisSource is a source for genesis data in JSON format. It may abstract over a +// single JSON object or separate files for each field in a JSON object that can +// be streamed over. Modules should open a separate io.ReadCloser for each field that +// is required. When fields represent arrays they can efficiently be streamed +// over. If there is no data for a field, this function should return nil, nil. It is +// important that the caller closes the reader when done with it. +type GenesisSource = func(field string) (io.ReadCloser, error) + +// GenesisTarget is a target for writing genesis data in JSON format. It may +// abstract over a single JSON object or JSON in separate files that can be +// streamed over. Modules should open a separate io.WriteCloser for each field +// and should prefer writing fields as arrays when possible to support efficient +// iteration. It is important the caller closers the writer AND checks the error +// when done with it. It is expected that a stream of JSON data is written +// to the writer. +type GenesisTarget = func(field string) (io.WriteCloser, error) ``` -All genesis objects for a given module are expected to conform to the semantics of a JSON object. That object may -represent a single genesis state `proto.Message` which is the case for most current modules, or it may represent a set -of nested JSON structures which may optionally be streamed as arrays from individual files which is the way the -[ORM](./adr-055-orm.md) is designed. This streaming genesis support may be beneficial for chains with extremely large -amounts of state that can't fit into memory. +All genesis objects for a given module are expected to conform to the semantics of a JSON object. +Each field in the JSON object should be read and written separately to support streaming genesis. +The [ORM](./adr-055-orm.md) and [collections](./adr-062-collections-state-layer.md) both support +streaming genesis and modules using these frameworks generally do not need to write any manual +genesis code. -Modules which use a single `proto.Message` can use the `GenesisSource.ReadMessage` and `GenesisTarget.ReadMessage` -methods without needing to deal with raw JSON or codecs. +To support genesis, modules should implement the `HasGenesis` extension interface: +```go +type HasGenesis interface { + AppModule + + // DefaultGenesis writes the default genesis for this module to the target. + DefaultGenesis(GenesisTarget) error + + // ValidateGenesis validates the genesis data read from the source. + ValidateGenesis(GenesisSource) error -Modules which use streaming genesis can use the -`GenesisSource.OpenReader` and `GenesisTarget.OpenWriter` methods. In the case of modules using the ORM, all JSON -handling is done automatically by the ORM and a single line will be sufficient for registering all of that functionality -(ex. `ormDb.RegisterGenesis(handler)`). + // InitGenesis initializes module state from the genesis source. + InitGenesis(context.Context, GenesisSource) error -Low-level `ReadRawJSON` and `WriteRawJSON` are provided in case modules use some other sort of legacy genesis logic -we haven't anticipated. + // ExportGenesis exports module state to the genesis target. + ExportGenesis(context.Context, GenesisTarget) error +} +``` #### Begin and End Blockers -The `BeginBlock` and `EndBlock` methods will simply take a `context.Context`, because: +Modules that have functionality that runs before transactions (begin blockers) or after transactions +(end blockers) should implement the has `HasBeginBlocker` and/or `HasEndBlocker` interfaces: +```go +type HasBeginBlocker interface { + AppModule + BeginBlock(context.Context) error +} + +type HasEndBlocker interface { + AppModule + EndBlock(context.Context) error +} +``` + +The `BeginBlock` and `EndBlock` methods will take a `context.Context`, because: * most modules don't need Tendermint information other than `BlockInfo` so we can eliminate dependencies on specific Tendermint versions * for the few modules that need Tendermint block headers and/or return validator updates, specific versions of the @@ -377,76 +282,26 @@ We know these types will change at the Tendermint level and that also a very lim functionality, so they are intentionally kept out of core to keep core limited to the necessary, minimal set of stable APIs. -#### Event Listeners - -Handlers allow event listeners for typed events to be registered that will be called deterministically whenever those -events are called in the state machine. Event listeners are functions that take a context, the protobuf message type of -the event and optionally return an error. If an event listener returns a non-nil error, this error will fail the process -that emitted the event and revert any state transitions that this process would have caused. - -Event listeners for typed events can be added to the handler struct either by populating the `EventListeners` field -or using generic helper methods: -```go -appmodule.AddEventListener(handler, func (ctx context.Context, e *EventReceive)) { ... }) -``` - -Event listeners provide a standardized alternative to module hooks, such as `StakingHooks`, even though these hooks -are still supported and described in [ADR 057: App Wiring](./adr-057-app-wiring-1.md) - -Only one event listener per event type can be defined per module. Event listeners will be called in a deterministic -order based on alphabetically sorting module names. If a more customizable order is desired, additional parameters -to the runtime module config object can be added to support optional custom ordering. - -Only events emitted using `EventManager.Emit` are observable using event listeners. - -#### Upgrade Handlers - -Upgrade handlers can be specified using the `UpgradeHandlers` field that takes an array of `UpgradeHandler` structs: -```go -type UpgradeHandler struct { - FromModule protoreflect.FullName - Handler func(context.Context) error -} -``` - -In the [ADR 057: App Wiring](./adr-057-app-wiring-1.md) it is specified that each version of each module should be -identified by a unique protobuf message type called the module config object. For example for the consensus version 3 -of the bank module, we would actually have a unique type `cosmos.bank.module.v3.Module` to identify this module. -In the [ModuleDescriptor](../proto/cosmos/app/v1alpha1/module.proto) for the module config object, `MigrateFromInfo` -objects should be provided which specify the full-qualified names of the modules that this module can migrate from. -For example, `cosmos.bank.module.v3.Module` might specify that it can migrate from `cosmos.bank.module.v2.Module`. -The app wiring framework will ensure that if the `ModuleDescriptor` specifies that a module can upgrade from another -module, an `UpgradeHandler` specifying that `FromModule` must be provided. - -This pattern of identifying from module versions will allow a module to upgrade from a version it is not a direct -descendant of. For example, someone could fork staking and allow upgrading from the mainline SDK staking. The mainline -SDK staking could later merge some of the forked changes and allow upgrading from the fork back to mainline. This -is intended to allow smooth forking and merging patterns in the ecosystem for simpler and more diverse innovation. - -A helper method on handler will be provided to simplify upgrade handler registration, ex: -```go -func (h *Handler) RegisterUpgradeHandler(fromModule protoreflect.FullName, handler func(context.Context) error) -``` - #### Remaining Parts of AppModule The current `AppModule` framework handles a number of additional concerns which aren't addressed by this core API. -These include the registration of: -* gogo proto and amino interface types +These include: +* gas +* block headers +* upgrades +* registration of gogo proto and amino interface types * cobra query and tx commands * gRPC gateway * crisis module invariants * simulations -The design proposed here relegates the registration of these things to other structures besides the `Handler` struct -defined here. In the case of gogo proto and amino interfaces, the registration of these generally should happen as early +Additional `AppModule` extension interfaces either inside or outside of core will need to be specified to handle +these concerns. + +In the case of gogo proto and amino interfaces, the registration of these generally should happen as early as possible during initialization and in [ADR 057: App Wiring](./adr-057-app-wiring-1.md), protobuf type registration happens before dependency injection (although this could alternatively be done dedicated DI providers). -Commands should likely be handled at a different level of the framework as they are purely a client concern. Currently, -we use the cobra framework, but there have been discussions of potentially using other frameworks, automatically -generating CLI commands, and even letting libraries outside the SDK totally manage this. - gRPC gateway registration should probably be handled by the runtime module, but the core API shouldn't depend on gRPC gateway types as 1) we are already using an older version and 2) it's possible the framework can do this registration automatically in the future. So for now, the runtime module should probably provide some sort of specific type for doing @@ -471,21 +326,33 @@ func ProvideGrpcGateway() GrpcGatewayInfo { Crisis module invariants and simulations are subject to potential redesign and should be managed with types defined in the crisis and simulation modules respectively. +Extension interface for CLI commands will be provided via the `cosmossdk.io/client/v2` module and its +[autocli](./adr-058-auto-generated-cli.md) framework. + #### Example Usage Here is an example of setting up a hypothetical `foo` v2 module which uses the [ORM](./adr-055-orm.md) for its state management and genesis. ```go -func ProvideApp(config *foomodulev2.Module, evtSvc event.EventService, db orm.ModuleDB) (Keeper, *Handler){ + +type Keeper struct { + db orm.ModuleDB + evtSrv event.Service +} + +func (k Keeper) RegisterServices(r grpc.ServiceRegistrar) { + foov1.RegisterMsgServer(r, k) + foov1.RegisterQueryServer(r, k) +} + +func (k Keeper) BeginBlock(context.Context) error { + return nil +} + +func ProvideApp(config *foomodulev2.Module, evtSvc event.EventService, db orm.ModuleDB) (Keeper, appmodule.AppModule){ k := &Keeper{db: db, evtSvc: evtSvc} - h := &Handler{} - foov1.RegisterMsgServer(h, k) - foov1.RegisterQueryServer(h, k) - h.RegisterBeginBlocker(k.BeginBlock) - db.RegisterGenesis(h) - h.RegisterUpgradeHandler("foo.module.v1.Module", k.MigrateFromV1) - return k, h + return k, k } ``` @@ -497,6 +364,16 @@ should check this compatibility version and return an error if the current `Runt than the version of the core API that this runtime version can support. When new features are adding to the `core` module API that runtime modules are required to support, this version should be incremented. +### Testing + +A mock implementation of all services should be provided in core to allow for unit testing of modules +without needing to depend on any particular version of runtime. Mock services should +allow tests to observe service behavior or provide a non-production implementation - for instance memory +stores can be used to mock stores. + +For integration testing, a mock runtime implementation should be provided that allows composing different app modules +together for testing without a dependency on runtime or Tendermint. + ## Consequences ### Backwards Compatibility @@ -508,6 +385,10 @@ drop support and only support the core API plus any runtime module specific APIs The core module itself should strive to remain at the go semantic version `v1` as long as possible and follow design principles that allow for strong long-term support (LTS). +Older versions of the SDK can support modules built against core with adaptors that convert wrap core `AppModule` +implementations in implementations of `AppModule` that conform to that version of the SDK's semantics as well +as by providing service implementations by wrapping `sdk.Context`. + ### Positive * better API encapsulation and separation of concerns @@ -525,17 +406,17 @@ principles that allow for strong long-term support (LTS). * modules will need to be refactored to use this API * some replacements for `AppModule` functionality still need to be defined in follow-ups (type registration, commands, invariants, simulations) and this will take additional design work -* the upgrade module may need upgrades to support the new upgrade handler system described here ## Further Discussions -* how to register: - * gogo proto and amino interface types - * cobra commands - * invariants - * simulations -* should event and gas services allow callers to replace the event manager and gas meter in the context? -* should we allow a way for emitting typed events which aren't part of consensus? +* gas +* block headers +* upgrades +* registration of gogo proto and amino interface types +* cobra query and tx commands +* gRPC gateway +* crisis module invariants +* simulations ## References From f330fa36a3703aa8435aa305ae8b6ffc80e7096e Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Tue, 24 Jan 2023 12:16:34 -0500 Subject: [PATCH 23/23] updates --- docs/architecture/adr-063-core-module-api.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/architecture/adr-063-core-module-api.md b/docs/architecture/adr-063-core-module-api.md index 660ade07d56c..a977688ec71d 100644 --- a/docs/architecture/adr-063-core-module-api.md +++ b/docs/architecture/adr-063-core-module-api.md @@ -4,10 +4,11 @@ * 2022-08-18 First Draft * 2022-12-08 First Draft +* 2023-01-24 Updates ## Status -PROPOSED Not Implemented +ACCEPTED Partially Implemented ## Abstract