refactor: precise compiler assertions and cleanup module.go (backport #17718) (#17724)

Co-authored-by: Julien Robert <julien@rbrt.fr>
This commit is contained in:
mergify[bot] 2023-09-13 19:08:56 +00:00 committed by GitHub
parent 4c083c6f23
commit 32969cf7cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 369 additions and 289 deletions

View File

@ -308,7 +308,7 @@ The return type of the interface method `TxConfig.SignModeHandler()` has been ch
* `x/slashing`
* `x/upgrade`
* BeginBlock and EndBlock have changed their signature, so it is important that any module implementing them are updated accordingly.
* `BeginBlock` and `EndBlock` have changed their signature, so it is important that any module implementing them are updated accordingly.
```diff
- BeginBlock(sdk.Context, abci.RequestBeginBlock)
@ -320,18 +320,38 @@ The return type of the interface method `TxConfig.SignModeHandler()` has been ch
+ EndBlock(context.Context) error
```
In case a module requires to return `abci.ValidatorUpdate` from `EndBlock`, it can use the `HasABCIEndblock` interface instead.
In case a module requires to return `abci.ValidatorUpdate` from `EndBlock`, it can use the `HasABCIEndBlock` interface instead.
```diff
- EndBlock(sdk.Context, abci.RequestEndBlock) []abci.ValidatorUpdate
+ EndBlock(context.Context) ([]abci.ValidatorUpdate, error)
```
`GetSigners()` is no longer required to be implemented on `Msg` types. The SDK will automatically infer the signers from the `Signer` field on the message. The signer field is required on all messages unless using a custom signer function.
:::tip
It is possible to ensure that a module implements the correct interfaces by using compiler assertions in your `x/{moduleName}/module.go`:
```go
var (
_ module.AppModuleBasic = (*AppModule)(nil)
_ module.AppModuleSimulation = (*AppModule)(nil)
_ module.HasGenesis = (*AppModule)(nil)
To find out more please read the [signer field](./05-protobuf-annotations.md#signer) & [here](https://github.com/cosmos/cosmos-sdk/blob/7352d0bce8e72121e824297df453eb1059c28da8/docs/docs/build/building-modules/02-messages-and-queries.md#L40)documentation.
_ appmodule.AppModule = (*AppModule)(nil)
_ appmodule.HasBeginBlocker = (*AppModule)(nil)
_ appmodule.HasEndBlocker = (*AppModule)(nil)
...
)
```
Read more on those interfaces [here](https://docs.cosmos.network/v0.50/building-modules/module-manager#application-module-interfaces).
:::
* `GetSigners()` is no longer required to be implemented on `Msg` types. The SDK will automatically infer the signers from the `Signer` field on the message. The signer field is required on all messages unless using a custom signer function.
To find out more please read the [signer field](./05-protobuf-annotations.md#signer) & [here](https://github.com/cosmos/cosmos-sdk/blob/7352d0bce8e72121e824297df453eb1059c28da8/docs/docs/build/building-modules/02-messages-and-queries.md#L40) documentation.
<!-- Link to docs once redeployed -->
#### `x/auth`
For ante handler construction via `ante.NewAnteHandler`, the field `ante.HandlerOptions.SignModeHandler` has been updated to `x/tx/signing/HandlerMap` from `x/auth/signing/SignModeHandler`. Callers typically fetch this value from `client.TxConfig.SignModeHandler()` (which is also changed) so this change should be transparent to most users.

View File

@ -42,7 +42,7 @@ The above interfaces are mostly embedding smaller interfaces (extension interfac
* [`appmodule.HasPrecommit`](#hasprecommit): The extension interface that contains information about the `AppModule` and `Precommit`.
* [`appmodule.HasPrepareCheckState`](#haspreparecheckstate): The extension interface that contains information about the `AppModule` and `PrepareCheckState`.
* [`appmodule.HasService` / `module.HasServices`](#hasservices): The extension interface for modules to register services.
* [`module.HasABCIEndblock`](#hasabciendblock): The extension interface that contains information about the `AppModule`, `EndBlock` and returns an updated validator set.
* [`module.HasABCIEndBlock`](#hasabciendblock): The extension interface that contains information about the `AppModule`, `EndBlock` and returns an updated validator set.
* (legacy) [`module.HasInvariants`](#hasinvariants): The extension interface for registering invariants.
* (legacy) [`module.HasConsensusVersion`](#hasconsensusversion): The extension interface for declaring a module consensus version.
@ -198,7 +198,7 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/core/appmodule/module.
### `HasEndBlocker`
The `HasEndBlocker` is an extension interface from `appmodule.AppModule`. All modules that have an `EndBlock` method implement this interface. If a module need to return validator set updates (staking), they can use `HasABCIEndblock`
The `HasEndBlocker` is an extension interface from `appmodule.AppModule`. All modules that have an `EndBlock` method implement this interface. If a module need to return validator set updates (staking), they can use `HasABCIEndBlock`
```go reference
https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/core/appmodule/module.go#L66-L72
@ -206,9 +206,9 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/core/appmodule/module.
* `EndBlock(context.Context) error`: This method gives module developers the option to implement logic that is automatically triggered at the end of each block.
### `HasABCIEndblock`
### `HasABCIEndBlock`
The `HasABCIEndblock` is an extension interface from `module.AppModule`. All modules that have an `EndBlock` which return validator set updates implement this interface.
The `HasABCIEndBlock` is an extension interface from `module.AppModule`. All modules that have an `EndBlock` which return validator set updates implement this interface.
```go reference
https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/types/module/module.go#L222-L225
@ -309,7 +309,7 @@ The module manager is used throughout the application whenever an action on a co
* `ExportGenesisForModules(ctx context.Context, cdc codec.JSONCodec, modulesToExport []string)`: Behaves the same as `ExportGenesis`, except takes a list of modules to export.
* `BeginBlock(ctx context.Context) error`: At the beginning of each block, this function is called from [`BaseApp`](../../develop/advanced/00-baseapp.md#beginblock) and, in turn, calls the [`BeginBlock`](./05-beginblock-endblock.md) function of each modules implementing the `appmodule.HasBeginBlocker` interface, in the order defined in `OrderBeginBlockers`. It creates a child [context](../../develop/advanced/02-context.md) with an event manager to aggregate [events](../../develop/advanced/08-events.md) emitted from each modules.
* `EndBlock(ctx context.Context) error`: At the end of each block, this function is called from [`BaseApp`](../../develop/advanced/00-baseapp.md#endblock) and, in turn, calls the [`EndBlock`](./05-beginblock-endblock.md) function of each modules implementing the `appmodule.HasEndBlocker` interface, in the order defined in `OrderEndBlockers`. It creates a child [context](../../develop/advanced/02-context.md) with an event manager to aggregate [events](../../develop/advanced/08-events.md) emitted from all modules. The function returns an `abci` which contains the aforementioned events, as well as validator set updates (if any).
* `EndBlock(context.Context) ([]abci.ValidatorUpdate, error)`: At the end of each block, this function is called from [`BaseApp`](../../develop/advanced/00-baseapp.md#endblock) and, in turn, calls the [`EndBlock`](./05-beginblock-endblock.md) function of each modules implementing the `module.HasABCIEndblock` interface, in the order defined in `OrderEndBlockers`. It creates a child [context](../../develop/advanced/02-context.md) with an event manager to aggregate [events](../../develop/advanced/08-events.md) emitted from all modules. The function returns an `abci` which contains the aforementioned events, as well as validator set updates (if any).
* `EndBlock(context.Context) ([]abci.ValidatorUpdate, error)`: At the end of each block, this function is called from [`BaseApp`](../../develop/advanced/00-baseapp.md#endblock) and, in turn, calls the [`EndBlock`](./05-beginblock-endblock.md) function of each modules implementing the `module.HasABCIEndBlock` interface, in the order defined in `OrderEndBlockers`. It creates a child [context](../../develop/advanced/02-context.md) with an event manager to aggregate [events](../../develop/advanced/08-events.md) emitted from all modules. The function returns an `abci` which contains the aforementioned events, as well as validator set updates (if any).
* `Precommit(ctx context.Context)`: During [`Commit`](../../develop/advanced/00-baseapp.md#commit), this function is called from `BaseApp` immediately before the [`deliverState`](../../develop/advanced/00-baseapp.md#state-updates) is written to the underlying [`rootMultiStore`](../../develop/advanced/04-store.md#commitmultistore) and, in turn calls the `Precommit` function of each modules implementing the `HasPrecommit` interface, in the order defined in `OrderPrecommiters`. It creates a child [context](../../develop/advanced/02-context.md) where the underlying `CacheMultiStore` is that of the newly committed block's [`finalizeblockstate`](../../develop/advanced/00-baseapp.md#state-updates).
* `PrepareCheckState(ctx context.Context)`: During [`Commit`](../../develop/advanced/00-baseapp.md#commit), this function is called from `BaseApp` immediately after the [`deliverState`](../../develop/advanced/00-baseapp.md#state-updates) is written to the underlying [`rootMultiStore`](../../develop/advanced/04-store.md#commitmultistore) and, in turn calls the `PrepareCheckState` function of each module implementing the `HasPrepareCheckState` interface, in the order defined in `OrderPrepareCheckStaters`. It creates a child [context](../../develop/advanced/02-context.md) where the underlying `CacheMultiStore` is that of the next block's [`checkState`](../../develop/advanced/00-baseapp.md#state-updates). Writes to this state will be present in the [`checkState`](../../develop/advanced/00-baseapp.md#state-updates) of the next block, and therefore this method can be used to prepare the `checkState` for the next block.

View File

@ -20,7 +20,7 @@ sidebar_position: 1
In 0.47.0, Prepare and Process Proposal were added that allow app developers to do arbitrary work at those phases, but they do not influence the work that will be done in BeginBlock. If an application required `BeginBlock` to execute prior to any sort of work is done then this is not possible today (0.50.0).
When needed, `BeginBlocker` and `EndBlocker` are implemented as part of the [`HasBeginBlocker`, `HasABCIEndblocker` and `EndBlocker` interfaces](./01-module-manager.md#appmodule). This means either can be left-out if not required. The `BeginBlock` and `EndBlock` methods of the interface implemented in `module.go` generally defer to `BeginBlocker` and `EndBlocker` methods respectively, which are usually implemented in `abci.go`.
When needed, `BeginBlocker` and `EndBlocker` are implemented as part of the [`HasBeginBlocker`, `HasABCIEndBlocker` and `EndBlocker` interfaces](./01-module-manager.md#appmodule). This means either can be left-out if not required. The `BeginBlock` and `EndBlock` methods of the interface implemented in `module.go` generally defer to `BeginBlocker` and `EndBlocker` methods respectively, which are usually implemented in `abci.go`.
The actual implementation of `BeginBlocker` and `EndBlocker` in `abci.go` are very similar to that of a [`Msg` service](./03-msg-services.md):

View File

@ -11,13 +11,13 @@ require (
cosmossdk.io/log v1.2.1
cosmossdk.io/math v1.1.2
cosmossdk.io/store v1.0.0-rc.0
cosmossdk.io/tools/confix v0.0.0-20230818115413-c402c51a1508
cosmossdk.io/x/circuit v0.0.0-20230830091712-93ab28fe0ea1
cosmossdk.io/x/evidence v0.0.0-20230830091712-93ab28fe0ea1
cosmossdk.io/x/feegrant v0.0.0-20230830091712-93ab28fe0ea1
cosmossdk.io/x/nft v0.0.0-20230830091712-93ab28fe0ea1
cosmossdk.io/tools/confix v0.0.0-20230913185058-9b5a203d35bc
cosmossdk.io/x/circuit v0.0.0-20230913185058-9b5a203d35bc
cosmossdk.io/x/evidence v0.0.0-20230913185058-9b5a203d35bc
cosmossdk.io/x/feegrant v0.0.0-20230913185058-9b5a203d35bc
cosmossdk.io/x/nft v0.0.0-20230913185058-9b5a203d35bc
cosmossdk.io/x/tx v0.9.2-0.20230913111958-e394604f8382
cosmossdk.io/x/upgrade v0.0.0-20230913161052-9f2c39bb9d01
cosmossdk.io/x/upgrade v0.0.0-20230913185058-9b5a203d35bc
github.com/cometbft/cometbft v0.38.0
github.com/cosmos/cosmos-db v1.0.0
// this version is not used as it is always replaced by the latest Cosmos SDK version

View File

@ -205,20 +205,20 @@ cosmossdk.io/math v1.1.2 h1:ORZetZCTyWkI5GlZ6CZS28fMHi83ZYf+A2vVnHNzZBM=
cosmossdk.io/math v1.1.2/go.mod h1:l2Gnda87F0su8a/7FEKJfFdJrM0JZRXQaohlgJeyQh0=
cosmossdk.io/store v1.0.0-rc.0 h1:9DwOjuUYxDtYxn/REkTxGQAmxlIGfRroB35MQ8TrxF4=
cosmossdk.io/store v1.0.0-rc.0/go.mod h1:FtBDOJmwtOZfmKKF65bKZbTYgS3bDNjjo3nP76dAegk=
cosmossdk.io/tools/confix v0.0.0-20230818115413-c402c51a1508 h1:axKhxRa3M9QW2GdKJUsSyzo44gxcwSOTGeomtkbQClM=
cosmossdk.io/tools/confix v0.0.0-20230818115413-c402c51a1508/go.mod h1:qcJ1zwLIMefpDHZuYSa73yBe/k5HyQ5H1Jg9PWv30Ts=
cosmossdk.io/x/circuit v0.0.0-20230830091712-93ab28fe0ea1 h1:SbR6MUhK3YXuKVHv0Z1ofFknDLMhRCQQV8UH2zoHOQA=
cosmossdk.io/x/circuit v0.0.0-20230830091712-93ab28fe0ea1/go.mod h1:ALy2NjqAWYoGJErqIpuIjv+6EgZTR+1qOGIoph8eRy4=
cosmossdk.io/x/evidence v0.0.0-20230830091712-93ab28fe0ea1 h1:LK55x/lSPLxO9I8WILXxyXo7YG5ju9p/HNOiMpWOIlE=
cosmossdk.io/x/evidence v0.0.0-20230830091712-93ab28fe0ea1/go.mod h1:33bXWFTGlCBR2RGW7XoISoPVyxQJWTyB9xFCntoXKSE=
cosmossdk.io/x/feegrant v0.0.0-20230830091712-93ab28fe0ea1 h1:sWyGV9xn/+5HyW9zF6GUaizQNZdYTvgoY7rPjrAIWNw=
cosmossdk.io/x/feegrant v0.0.0-20230830091712-93ab28fe0ea1/go.mod h1:LvCHtqYn7tA6VT2ZGSGfsqVlCudm/OFNVYxtt2+zL28=
cosmossdk.io/x/nft v0.0.0-20230830091712-93ab28fe0ea1 h1:YpE6N2yzG1NMvHzqkVbvObknB2S8q0G1rn5N7bP5gW4=
cosmossdk.io/x/nft v0.0.0-20230830091712-93ab28fe0ea1/go.mod h1:M4FXuqMk3cKuCm6K3HHCk337+3NEh+h7V5ocNnDo7PI=
cosmossdk.io/tools/confix v0.0.0-20230913185058-9b5a203d35bc h1:+8XcN/fVm2/3RCxmnCli9kURKWtJexm3dpeGGAujBPQ=
cosmossdk.io/tools/confix v0.0.0-20230913185058-9b5a203d35bc/go.mod h1:BjHnrWAKPImcU/q23cFQoP+u22WhylkDz2JUL4r0Nd8=
cosmossdk.io/x/circuit v0.0.0-20230913185058-9b5a203d35bc h1:zF3zmTxaRpWbUTQzVdqFiuz0T3OdYnQplIdzVjEU36Q=
cosmossdk.io/x/circuit v0.0.0-20230913185058-9b5a203d35bc/go.mod h1:QRG1bAlYXqOlRz+hImZ3mXlF1sSsLJneAO9luIoh5O4=
cosmossdk.io/x/evidence v0.0.0-20230913185058-9b5a203d35bc h1:vDUvyyrwB4lTyIw8eP2wbFmRkxj1CPaq8C86OvN1fa8=
cosmossdk.io/x/evidence v0.0.0-20230913185058-9b5a203d35bc/go.mod h1:18Ty8XADqWaCtT4umY0VIsmQfezH6bc2Mj8dvFI1cic=
cosmossdk.io/x/feegrant v0.0.0-20230913185058-9b5a203d35bc h1:bekdwRzRK3iiKeRaDjF9+K1F/6b8K//Fr7+9wafUak0=
cosmossdk.io/x/feegrant v0.0.0-20230913185058-9b5a203d35bc/go.mod h1:GDfsWm1pdR3YVVS955sBY+OuF3nwShRcFp8D80VShlQ=
cosmossdk.io/x/nft v0.0.0-20230913185058-9b5a203d35bc h1:Jm0ZJ1L6d8YZ6yQydUknNL6Z41gIj/f9PWB77o7NipI=
cosmossdk.io/x/nft v0.0.0-20230913185058-9b5a203d35bc/go.mod h1:B+yw1SVhkUEANcuxisIgiT6cw6re1gGzSsMmY8+lvAI=
cosmossdk.io/x/tx v0.9.2-0.20230913111958-e394604f8382 h1:p/wyc5pVTMtx2/RsKP0fUpOKGbDfy6q6WswJtmARdbg=
cosmossdk.io/x/tx v0.9.2-0.20230913111958-e394604f8382/go.mod h1:MKo9/b5wsoL8dd9y9pvD2yOP1CMvzHIWYxi1l2oLPFo=
cosmossdk.io/x/upgrade v0.0.0-20230913161052-9f2c39bb9d01 h1:V1N66fJvKxreb5vJZdL3R/OlAO8a0KQTRUyYfZFDOC4=
cosmossdk.io/x/upgrade v0.0.0-20230913161052-9f2c39bb9d01/go.mod h1:nLBiFTPw6e4LBT1ZWdGBIOjleiVNaqqmsTxU4GgEYaQ=
cosmossdk.io/x/upgrade v0.0.0-20230913185058-9b5a203d35bc h1:vLTAmHtVdNjil1QgYVUYKvn5UKk5Ntpz2dpMyXW3fMc=
cosmossdk.io/x/upgrade v0.0.0-20230913185058-9b5a203d35bc/go.mod h1:nLBiFTPw6e4LBT1ZWdGBIOjleiVNaqqmsTxU4GgEYaQ=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek=
filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns=

View File

@ -11,11 +11,11 @@ require (
cosmossdk.io/math v1.1.2
cosmossdk.io/simapp v0.0.0-20230620040119-e078f1a49e8b
cosmossdk.io/store v1.0.0-rc.0
cosmossdk.io/x/evidence v0.0.0-20230830091712-93ab28fe0ea1
cosmossdk.io/x/feegrant v0.0.0-20230830091712-93ab28fe0ea1
cosmossdk.io/x/nft v0.0.0-20230830091712-93ab28fe0ea1 // indirect
cosmossdk.io/x/evidence v0.0.0-20230913185058-9b5a203d35bc
cosmossdk.io/x/feegrant v0.0.0-20230913185058-9b5a203d35bc
cosmossdk.io/x/nft v0.0.0-20230913185058-9b5a203d35bc // indirect
cosmossdk.io/x/tx v0.9.2-0.20230913111958-e394604f8382
cosmossdk.io/x/upgrade v0.0.0-20230913161052-9f2c39bb9d01
cosmossdk.io/x/upgrade v0.0.0-20230913185058-9b5a203d35bc
github.com/cometbft/cometbft v0.38.0
github.com/cosmos/cosmos-db v1.0.0
github.com/cosmos/cosmos-proto v1.0.0-beta.3
@ -39,7 +39,7 @@ require (
cloud.google.com/go/storage v1.30.1 // indirect
cosmossdk.io/client/v2 v2.0.0-20230913132541-a4de97633356 // indirect
cosmossdk.io/collections v0.4.0 // indirect
cosmossdk.io/x/circuit v0.0.0-20230830091712-93ab28fe0ea1 // indirect
cosmossdk.io/x/circuit v0.0.0-20230913185058-9b5a203d35bc // indirect
filippo.io/edwards25519 v1.0.0 // indirect
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
github.com/99designs/keyring v1.2.1 // indirect

View File

@ -205,18 +205,18 @@ cosmossdk.io/math v1.1.2 h1:ORZetZCTyWkI5GlZ6CZS28fMHi83ZYf+A2vVnHNzZBM=
cosmossdk.io/math v1.1.2/go.mod h1:l2Gnda87F0su8a/7FEKJfFdJrM0JZRXQaohlgJeyQh0=
cosmossdk.io/store v1.0.0-rc.0 h1:9DwOjuUYxDtYxn/REkTxGQAmxlIGfRroB35MQ8TrxF4=
cosmossdk.io/store v1.0.0-rc.0/go.mod h1:FtBDOJmwtOZfmKKF65bKZbTYgS3bDNjjo3nP76dAegk=
cosmossdk.io/x/circuit v0.0.0-20230830091712-93ab28fe0ea1 h1:SbR6MUhK3YXuKVHv0Z1ofFknDLMhRCQQV8UH2zoHOQA=
cosmossdk.io/x/circuit v0.0.0-20230830091712-93ab28fe0ea1/go.mod h1:ALy2NjqAWYoGJErqIpuIjv+6EgZTR+1qOGIoph8eRy4=
cosmossdk.io/x/evidence v0.0.0-20230830091712-93ab28fe0ea1 h1:LK55x/lSPLxO9I8WILXxyXo7YG5ju9p/HNOiMpWOIlE=
cosmossdk.io/x/evidence v0.0.0-20230830091712-93ab28fe0ea1/go.mod h1:33bXWFTGlCBR2RGW7XoISoPVyxQJWTyB9xFCntoXKSE=
cosmossdk.io/x/feegrant v0.0.0-20230830091712-93ab28fe0ea1 h1:sWyGV9xn/+5HyW9zF6GUaizQNZdYTvgoY7rPjrAIWNw=
cosmossdk.io/x/feegrant v0.0.0-20230830091712-93ab28fe0ea1/go.mod h1:LvCHtqYn7tA6VT2ZGSGfsqVlCudm/OFNVYxtt2+zL28=
cosmossdk.io/x/nft v0.0.0-20230830091712-93ab28fe0ea1 h1:YpE6N2yzG1NMvHzqkVbvObknB2S8q0G1rn5N7bP5gW4=
cosmossdk.io/x/nft v0.0.0-20230830091712-93ab28fe0ea1/go.mod h1:M4FXuqMk3cKuCm6K3HHCk337+3NEh+h7V5ocNnDo7PI=
cosmossdk.io/x/circuit v0.0.0-20230913185058-9b5a203d35bc h1:zF3zmTxaRpWbUTQzVdqFiuz0T3OdYnQplIdzVjEU36Q=
cosmossdk.io/x/circuit v0.0.0-20230913185058-9b5a203d35bc/go.mod h1:QRG1bAlYXqOlRz+hImZ3mXlF1sSsLJneAO9luIoh5O4=
cosmossdk.io/x/evidence v0.0.0-20230913185058-9b5a203d35bc h1:vDUvyyrwB4lTyIw8eP2wbFmRkxj1CPaq8C86OvN1fa8=
cosmossdk.io/x/evidence v0.0.0-20230913185058-9b5a203d35bc/go.mod h1:18Ty8XADqWaCtT4umY0VIsmQfezH6bc2Mj8dvFI1cic=
cosmossdk.io/x/feegrant v0.0.0-20230913185058-9b5a203d35bc h1:bekdwRzRK3iiKeRaDjF9+K1F/6b8K//Fr7+9wafUak0=
cosmossdk.io/x/feegrant v0.0.0-20230913185058-9b5a203d35bc/go.mod h1:GDfsWm1pdR3YVVS955sBY+OuF3nwShRcFp8D80VShlQ=
cosmossdk.io/x/nft v0.0.0-20230913185058-9b5a203d35bc h1:Jm0ZJ1L6d8YZ6yQydUknNL6Z41gIj/f9PWB77o7NipI=
cosmossdk.io/x/nft v0.0.0-20230913185058-9b5a203d35bc/go.mod h1:B+yw1SVhkUEANcuxisIgiT6cw6re1gGzSsMmY8+lvAI=
cosmossdk.io/x/tx v0.9.2-0.20230913111958-e394604f8382 h1:p/wyc5pVTMtx2/RsKP0fUpOKGbDfy6q6WswJtmARdbg=
cosmossdk.io/x/tx v0.9.2-0.20230913111958-e394604f8382/go.mod h1:MKo9/b5wsoL8dd9y9pvD2yOP1CMvzHIWYxi1l2oLPFo=
cosmossdk.io/x/upgrade v0.0.0-20230913161052-9f2c39bb9d01 h1:V1N66fJvKxreb5vJZdL3R/OlAO8a0KQTRUyYfZFDOC4=
cosmossdk.io/x/upgrade v0.0.0-20230913161052-9f2c39bb9d01/go.mod h1:nLBiFTPw6e4LBT1ZWdGBIOjleiVNaqqmsTxU4GgEYaQ=
cosmossdk.io/x/upgrade v0.0.0-20230913185058-9b5a203d35bc h1:vLTAmHtVdNjil1QgYVUYKvn5UKk5Ntpz2dpMyXW3fMc=
cosmossdk.io/x/upgrade v0.0.0-20230913185058-9b5a203d35bc/go.mod h1:nLBiFTPw6e4LBT1ZWdGBIOjleiVNaqqmsTxU4GgEYaQ=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek=
filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns=

View File

@ -541,35 +541,125 @@ func (mr *MockCoreAppModuleMockRecorder) ValidateGenesis(arg0 interface{}) *gomo
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidateGenesis", reflect.TypeOf((*MockCoreAppModule)(nil).ValidateGenesis), arg0)
}
// MockCoreModuleWithPreBlock is a mock of CoreModuleWithPreBlock interface.
type MockCoreModuleWithPreBlock struct {
MockCoreAppModule
recorder *MockCoreModuleWithPreBlockMockRecorder
// MockCoreAppModuleWithPreBlock is a mock of CoreAppModuleWithPreBlock interface.
type MockCoreAppModuleWithPreBlock struct {
ctrl *gomock.Controller
recorder *MockCoreAppModuleWithPreBlockMockRecorder
}
// MockCoreModuleWithPreBlockMockRecorder is the mock recorder for MockCoreModuleWithPreBlock.
type MockCoreModuleWithPreBlockMockRecorder struct {
mock *MockCoreModuleWithPreBlock
// MockCoreAppModuleWithPreBlockMockRecorder is the mock recorder for MockCoreAppModuleWithPreBlock.
type MockCoreAppModuleWithPreBlockMockRecorder struct {
mock *MockCoreAppModuleWithPreBlock
}
// NewMockCoreModuleWithPreBlock creates a new mock instance.
func NewMockCoreModuleWithPreBlock(ctrl *gomock.Controller) *MockCoreModuleWithPreBlock {
mock := &MockCoreModuleWithPreBlock{
MockCoreAppModule: MockCoreAppModule{
ctrl: ctrl,
},
}
mock.recorder = &MockCoreModuleWithPreBlockMockRecorder{mock}
// NewMockCoreAppModuleWithPreBlock creates a new mock instance.
func NewMockCoreAppModuleWithPreBlock(ctrl *gomock.Controller) *MockCoreAppModuleWithPreBlock {
mock := &MockCoreAppModuleWithPreBlock{ctrl: ctrl}
mock.recorder = &MockCoreAppModuleWithPreBlockMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockCoreModuleWithPreBlock) EXPECT() *MockCoreModuleWithPreBlockMockRecorder {
func (m *MockCoreAppModuleWithPreBlock) EXPECT() *MockCoreAppModuleWithPreBlockMockRecorder {
return m.recorder
}
// BeginBlock mocks base method.
func (m *MockCoreAppModuleWithPreBlock) BeginBlock(arg0 context.Context) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "BeginBlock", arg0)
ret0, _ := ret[0].(error)
return ret0
}
// BeginBlock indicates an expected call of BeginBlock.
func (mr *MockCoreAppModuleWithPreBlockMockRecorder) BeginBlock(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BeginBlock", reflect.TypeOf((*MockCoreAppModuleWithPreBlock)(nil).BeginBlock), arg0)
}
// DefaultGenesis mocks base method.
func (m *MockCoreAppModuleWithPreBlock) DefaultGenesis(arg0 appmodule.GenesisTarget) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "DefaultGenesis", arg0)
ret0, _ := ret[0].(error)
return ret0
}
// DefaultGenesis indicates an expected call of DefaultGenesis.
func (mr *MockCoreAppModuleWithPreBlockMockRecorder) DefaultGenesis(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DefaultGenesis", reflect.TypeOf((*MockCoreAppModuleWithPreBlock)(nil).DefaultGenesis), arg0)
}
// EndBlock mocks base method.
func (m *MockCoreAppModuleWithPreBlock) EndBlock(arg0 context.Context) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "EndBlock", arg0)
ret0, _ := ret[0].(error)
return ret0
}
// EndBlock indicates an expected call of EndBlock.
func (mr *MockCoreAppModuleWithPreBlockMockRecorder) EndBlock(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EndBlock", reflect.TypeOf((*MockCoreAppModuleWithPreBlock)(nil).EndBlock), arg0)
}
// ExportGenesis mocks base method.
func (m *MockCoreAppModuleWithPreBlock) ExportGenesis(arg0 context.Context, arg1 appmodule.GenesisTarget) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ExportGenesis", arg0, arg1)
ret0, _ := ret[0].(error)
return ret0
}
// ExportGenesis indicates an expected call of ExportGenesis.
func (mr *MockCoreAppModuleWithPreBlockMockRecorder) ExportGenesis(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExportGenesis", reflect.TypeOf((*MockCoreAppModuleWithPreBlock)(nil).ExportGenesis), arg0, arg1)
}
// InitGenesis mocks base method.
func (m *MockCoreAppModuleWithPreBlock) InitGenesis(arg0 context.Context, arg1 appmodule.GenesisSource) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "InitGenesis", arg0, arg1)
ret0, _ := ret[0].(error)
return ret0
}
// InitGenesis indicates an expected call of InitGenesis.
func (mr *MockCoreAppModuleWithPreBlockMockRecorder) InitGenesis(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InitGenesis", reflect.TypeOf((*MockCoreAppModuleWithPreBlock)(nil).InitGenesis), arg0, arg1)
}
// IsAppModule mocks base method.
func (m *MockCoreAppModuleWithPreBlock) IsAppModule() {
m.ctrl.T.Helper()
m.ctrl.Call(m, "IsAppModule")
}
// IsAppModule indicates an expected call of IsAppModule.
func (mr *MockCoreAppModuleWithPreBlockMockRecorder) IsAppModule() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsAppModule", reflect.TypeOf((*MockCoreAppModuleWithPreBlock)(nil).IsAppModule))
}
// IsOnePerModuleType mocks base method.
func (m *MockCoreAppModuleWithPreBlock) IsOnePerModuleType() {
m.ctrl.T.Helper()
m.ctrl.Call(m, "IsOnePerModuleType")
}
// IsOnePerModuleType indicates an expected call of IsOnePerModuleType.
func (mr *MockCoreAppModuleWithPreBlockMockRecorder) IsOnePerModuleType() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsOnePerModuleType", reflect.TypeOf((*MockCoreAppModuleWithPreBlock)(nil).IsOnePerModuleType))
}
// PreBlock mocks base method.
func (m *MockCoreModuleWithPreBlock) PreBlock(arg0 context.Context) (appmodule.ResponsePreBlock, error) {
func (m *MockCoreAppModuleWithPreBlock) PreBlock(arg0 context.Context) (appmodule.ResponsePreBlock, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "PreBlock", arg0)
ret0, _ := ret[0].(appmodule.ResponsePreBlock)
@ -578,7 +668,49 @@ func (m *MockCoreModuleWithPreBlock) PreBlock(arg0 context.Context) (appmodule.R
}
// PreBlock indicates an expected call of PreBlock.
func (mr *MockCoreModuleWithPreBlockMockRecorder) PreBlock(arg0 interface{}) *gomock.Call {
func (mr *MockCoreAppModuleWithPreBlockMockRecorder) PreBlock(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PreBlock", reflect.TypeOf((*MockCoreModuleWithPreBlock)(nil).PreBlock), arg0)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PreBlock", reflect.TypeOf((*MockCoreAppModuleWithPreBlock)(nil).PreBlock), arg0)
}
// Precommit mocks base method.
func (m *MockCoreAppModuleWithPreBlock) Precommit(arg0 context.Context) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Precommit", arg0)
ret0, _ := ret[0].(error)
return ret0
}
// Precommit indicates an expected call of Precommit.
func (mr *MockCoreAppModuleWithPreBlockMockRecorder) Precommit(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Precommit", reflect.TypeOf((*MockCoreAppModuleWithPreBlock)(nil).Precommit), arg0)
}
// PrepareCheckState mocks base method.
func (m *MockCoreAppModuleWithPreBlock) PrepareCheckState(arg0 context.Context) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "PrepareCheckState", arg0)
ret0, _ := ret[0].(error)
return ret0
}
// PrepareCheckState indicates an expected call of PrepareCheckState.
func (mr *MockCoreAppModuleWithPreBlockMockRecorder) PrepareCheckState(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PrepareCheckState", reflect.TypeOf((*MockCoreAppModuleWithPreBlock)(nil).PrepareCheckState), arg0)
}
// ValidateGenesis mocks base method.
func (m *MockCoreAppModuleWithPreBlock) ValidateGenesis(arg0 appmodule.GenesisSource) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ValidateGenesis", arg0)
ret0, _ := ret[0].(error)
return ret0
}
// ValidateGenesis indicates an expected call of ValidateGenesis.
func (mr *MockCoreAppModuleWithPreBlockMockRecorder) ValidateGenesis(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidateGenesis", reflect.TypeOf((*MockCoreAppModuleWithPreBlock)(nil).ValidateGenesis), arg0)
}

View File

@ -516,31 +516,31 @@ func (mr *MockHasConsensusVersionMockRecorder) ConsensusVersion() *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ConsensusVersion", reflect.TypeOf((*MockHasConsensusVersion)(nil).ConsensusVersion))
}
// MockHasABCIEndblock is a mock of HasABCIEndblock interface.
type MockHasABCIEndblock struct {
// MockHasABCIEndBlock is a mock of HasABCIEndBlock interface.
type MockHasABCIEndBlock struct {
ctrl *gomock.Controller
recorder *MockHasABCIEndblockMockRecorder
recorder *MockHasABCIEndBlockMockRecorder
}
// MockHasABCIEndblockMockRecorder is the mock recorder for MockHasABCIEndblock.
type MockHasABCIEndblockMockRecorder struct {
mock *MockHasABCIEndblock
// MockHasABCIEndBlockMockRecorder is the mock recorder for MockHasABCIEndBlock.
type MockHasABCIEndBlockMockRecorder struct {
mock *MockHasABCIEndBlock
}
// NewMockHasABCIEndblock creates a new mock instance.
func NewMockHasABCIEndblock(ctrl *gomock.Controller) *MockHasABCIEndblock {
mock := &MockHasABCIEndblock{ctrl: ctrl}
mock.recorder = &MockHasABCIEndblockMockRecorder{mock}
// NewMockHasABCIEndBlock creates a new mock instance.
func NewMockHasABCIEndBlock(ctrl *gomock.Controller) *MockHasABCIEndBlock {
mock := &MockHasABCIEndBlock{ctrl: ctrl}
mock.recorder = &MockHasABCIEndBlockMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockHasABCIEndblock) EXPECT() *MockHasABCIEndblockMockRecorder {
func (m *MockHasABCIEndBlock) EXPECT() *MockHasABCIEndBlockMockRecorder {
return m.recorder
}
// EndBlock mocks base method.
func (m *MockHasABCIEndblock) EndBlock(arg0 context.Context) ([]types.ValidatorUpdate, error) {
func (m *MockHasABCIEndBlock) EndBlock(arg0 context.Context) ([]types.ValidatorUpdate, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "EndBlock", arg0)
ret0, _ := ret[0].([]types.ValidatorUpdate)
@ -549,13 +549,13 @@ func (m *MockHasABCIEndblock) EndBlock(arg0 context.Context) ([]types.ValidatorU
}
// EndBlock indicates an expected call of EndBlock.
func (mr *MockHasABCIEndblockMockRecorder) EndBlock(arg0 interface{}) *gomock.Call {
func (mr *MockHasABCIEndBlockMockRecorder) EndBlock(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EndBlock", reflect.TypeOf((*MockHasABCIEndblock)(nil).EndBlock), arg0)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EndBlock", reflect.TypeOf((*MockHasABCIEndBlock)(nil).EndBlock), arg0)
}
// Name mocks base method.
func (m *MockHasABCIEndblock) Name() string {
func (m *MockHasABCIEndBlock) Name() string {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Name")
ret0, _ := ret[0].(string)
@ -563,43 +563,43 @@ func (m *MockHasABCIEndblock) Name() string {
}
// Name indicates an expected call of Name.
func (mr *MockHasABCIEndblockMockRecorder) Name() *gomock.Call {
func (mr *MockHasABCIEndBlockMockRecorder) Name() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Name", reflect.TypeOf((*MockHasABCIEndblock)(nil).Name))
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Name", reflect.TypeOf((*MockHasABCIEndBlock)(nil).Name))
}
// RegisterGRPCGatewayRoutes mocks base method.
func (m *MockHasABCIEndblock) RegisterGRPCGatewayRoutes(arg0 client.Context, arg1 *runtime.ServeMux) {
func (m *MockHasABCIEndBlock) RegisterGRPCGatewayRoutes(arg0 client.Context, arg1 *runtime.ServeMux) {
m.ctrl.T.Helper()
m.ctrl.Call(m, "RegisterGRPCGatewayRoutes", arg0, arg1)
}
// RegisterGRPCGatewayRoutes indicates an expected call of RegisterGRPCGatewayRoutes.
func (mr *MockHasABCIEndblockMockRecorder) RegisterGRPCGatewayRoutes(arg0, arg1 interface{}) *gomock.Call {
func (mr *MockHasABCIEndBlockMockRecorder) RegisterGRPCGatewayRoutes(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterGRPCGatewayRoutes", reflect.TypeOf((*MockHasABCIEndblock)(nil).RegisterGRPCGatewayRoutes), arg0, arg1)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterGRPCGatewayRoutes", reflect.TypeOf((*MockHasABCIEndBlock)(nil).RegisterGRPCGatewayRoutes), arg0, arg1)
}
// RegisterInterfaces mocks base method.
func (m *MockHasABCIEndblock) RegisterInterfaces(arg0 types0.InterfaceRegistry) {
func (m *MockHasABCIEndBlock) RegisterInterfaces(arg0 types0.InterfaceRegistry) {
m.ctrl.T.Helper()
m.ctrl.Call(m, "RegisterInterfaces", arg0)
}
// RegisterInterfaces indicates an expected call of RegisterInterfaces.
func (mr *MockHasABCIEndblockMockRecorder) RegisterInterfaces(arg0 interface{}) *gomock.Call {
func (mr *MockHasABCIEndBlockMockRecorder) RegisterInterfaces(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterInterfaces", reflect.TypeOf((*MockHasABCIEndblock)(nil).RegisterInterfaces), arg0)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterInterfaces", reflect.TypeOf((*MockHasABCIEndBlock)(nil).RegisterInterfaces), arg0)
}
// RegisterLegacyAminoCodec mocks base method.
func (m *MockHasABCIEndblock) RegisterLegacyAminoCodec(arg0 *codec.LegacyAmino) {
func (m *MockHasABCIEndBlock) RegisterLegacyAminoCodec(arg0 *codec.LegacyAmino) {
m.ctrl.T.Helper()
m.ctrl.Call(m, "RegisterLegacyAminoCodec", arg0)
}
// RegisterLegacyAminoCodec indicates an expected call of RegisterLegacyAminoCodec.
func (mr *MockHasABCIEndblockMockRecorder) RegisterLegacyAminoCodec(arg0 interface{}) *gomock.Call {
func (mr *MockHasABCIEndBlockMockRecorder) RegisterLegacyAminoCodec(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterLegacyAminoCodec", reflect.TypeOf((*MockHasABCIEndblock)(nil).RegisterLegacyAminoCodec), arg0)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterLegacyAminoCodec", reflect.TypeOf((*MockHasABCIEndBlock)(nil).RegisterLegacyAminoCodec), arg0)
}

View File

@ -14,7 +14,7 @@ type AppModuleWithAllExtensions interface {
module.HasGenesis
module.HasInvariants
module.HasConsensusVersion
module.HasABCIEndblock
module.HasABCIEndBlock
module.HasName
}
@ -25,7 +25,7 @@ type AppModuleWithAllExtensionsABCI interface {
module.HasABCIGenesis
module.HasInvariants
module.HasConsensusVersion
module.HasABCIEndblock
module.HasABCIEndBlock
module.HasName
}
@ -39,3 +39,8 @@ type CoreAppModule interface {
appmodule.HasPrecommit
appmodule.HasPrepareCheckState
}
type CoreAppModuleWithPreBlock interface {
CoreAppModule
appmodule.HasPreBlocker
}

View File

@ -197,6 +197,7 @@ type HasABCIGenesis interface {
// AppModule is the form for an application module. Most of
// its functionality has been moved to extension interfaces.
// Deprecated: use appmodule.AppModule with a combination of extension interfaes interfaces instead.
type AppModule interface {
AppModuleBasic
}
@ -222,7 +223,12 @@ type HasConsensusVersion interface {
ConsensusVersion() uint64
}
type HasABCIEndblock interface {
// HasABCIEndblock is a released typo of HasABCIEndBlock.
// Deprecated: use HasABCIEndBlock instead.
type HasABCIEndblock HasABCIEndBlock
// HasABCIEndBlock is the interface for modules that need to run code at the end of the block.
type HasABCIEndBlock interface {
AppModule
EndBlock(context.Context) ([]abci.ValidatorUpdate, error)
}
@ -397,7 +403,7 @@ func (m *Manager) SetOrderEndBlockers(moduleNames ...string) {
return !hasEndBlock
}
_, hasABCIEndBlock := module.(HasABCIEndblock)
_, hasABCIEndBlock := module.(HasABCIEndBlock)
return !hasABCIEndBlock
})
m.OrderEndBlockers = moduleNames
@ -788,7 +794,7 @@ func (m *Manager) EndBlock(ctx sdk.Context) (sdk.EndBlock, error) {
if err != nil {
return sdk.EndBlock{}, err
}
} else if module, ok := m.Modules[moduleName].(HasABCIEndblock); ok {
} else if module, ok := m.Modules[moduleName].(HasABCIEndBlock); ok {
moduleValUpdates, err := module.EndBlock(ctx)
if err != nil {
return sdk.EndBlock{}, err

View File

@ -96,7 +96,7 @@ func TestBasicManager(t *testing.T) {
func TestAssertNoForgottenModules(t *testing.T) {
mockCtrl := gomock.NewController(t)
t.Cleanup(mockCtrl.Finish)
mockAppModule1 := mock.NewMockHasABCIEndblock(mockCtrl)
mockAppModule1 := mock.NewMockHasABCIEndBlock(mockCtrl)
mockAppModule3 := mock.NewMockCoreAppModule(mockCtrl)
mockAppModule1.EXPECT().Name().Times(2).Return("module1")
@ -316,8 +316,8 @@ func TestManager_EndBlock(t *testing.T) {
mockCtrl := gomock.NewController(t)
t.Cleanup(mockCtrl.Finish)
mockAppModule1 := mock.NewMockHasABCIEndblock(mockCtrl)
mockAppModule2 := mock.NewMockHasABCIEndblock(mockCtrl)
mockAppModule1 := mock.NewMockHasABCIEndBlock(mockCtrl)
mockAppModule2 := mock.NewMockHasABCIEndBlock(mockCtrl)
mockAppModule3 := mock.NewMockAppModule(mockCtrl)
mockAppModule1.EXPECT().Name().Times(2).Return("module1")
mockAppModule2.EXPECT().Name().Times(2).Return("module2")
@ -469,7 +469,7 @@ func TestCoreAPIManager_PreBlock(t *testing.T) {
mockCtrl := gomock.NewController(t)
t.Cleanup(mockCtrl.Finish)
mockAppModule1 := mock.NewMockCoreModuleWithPreBlock(mockCtrl)
mockAppModule1 := mock.NewMockCoreAppModuleWithPreBlock(mockCtrl)
mm := module.NewManagerFromMap(map[string]appmodule.AppModule{
"module1": mockAppModule1,
"module2": mock.NewMockCoreAppModule(mockCtrl),

View File

@ -5,7 +5,6 @@ import (
"encoding/json"
"fmt"
abci "github.com/cometbft/cometbft/abci/types"
gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime"
modulev1 "cosmossdk.io/api/cosmos/auth/module/v1"
@ -33,9 +32,12 @@ const (
)
var (
_ module.AppModule = AppModule{}
_ module.AppModuleBasic = AppModuleBasic{}
_ module.AppModuleBasic = AppModule{}
_ module.AppModuleSimulation = AppModule{}
_ module.HasGenesis = AppModule{}
_ module.HasServices = AppModule{}
_ appmodule.AppModule = AppModule{}
)
// AppModuleBasic defines the basic application module used by the auth module.
@ -92,8 +94,6 @@ type AppModule struct {
legacySubspace exported.Subspace
}
var _ appmodule.AppModule = AppModule{}
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
func (am AppModule) IsOnePerModuleType() {}
@ -110,11 +110,6 @@ func NewAppModule(cdc codec.Codec, accountKeeper keeper.AccountKeeper, randGenAc
}
}
// Name returns the auth module's name.
func (AppModule) Name() string {
return types.ModuleName
}
// RegisterServices registers a GRPC query service to respond to the
// module-specific GRPC queries.
func (am AppModule) RegisterServices(cfg module.Configurator) {
@ -141,11 +136,10 @@ func (am AppModule) RegisterServices(cfg module.Configurator) {
// InitGenesis performs genesis initialization for the auth module. It returns
// no validator updates.
func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate {
func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) {
var genesisState types.GenesisState
cdc.MustUnmarshalJSON(data, &genesisState)
am.accountKeeper.InitGenesis(ctx, genesisState)
return []abci.ValidatorUpdate{}
}
// ExportGenesis returns the exported genesis state as raw bytes for the auth

View File

@ -24,8 +24,10 @@ import (
)
var (
_ module.AppModule = AppModule{}
_ module.AppModuleBasic = AppModuleBasic{}
_ module.AppModuleBasic = AppModule{}
_ appmodule.AppModule = AppModule{}
_ appmodule.HasServices = AppModule{}
)
// AppModuleBasic defines the basic application module used by the sub-vesting
@ -87,11 +89,6 @@ func NewAppModule(ak keeper.AccountKeeper, bk types.BankKeeper) AppModule {
}
}
var (
_ appmodule.AppModule = AppModule{}
_ appmodule.HasServices = AppModule{}
)
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
func (am AppModule) IsOnePerModuleType() {}

View File

@ -29,8 +29,13 @@ import (
)
var (
_ module.AppModuleBasic = AppModuleBasic{}
_ module.AppModuleBasic = AppModule{}
_ module.AppModuleSimulation = AppModule{}
_ module.HasGenesis = AppModule{}
_ module.HasServices = AppModule{}
_ appmodule.AppModule = AppModule{}
_ appmodule.HasBeginBlocker = AppModule{}
)
// AppModuleBasic defines the basic application module used by the authz module.
@ -97,6 +102,7 @@ func (ab AppModuleBasic) GetTxCmd() *cobra.Command {
// AppModule implements the sdk.AppModule interface
type AppModule struct {
AppModuleBasic
keeper keeper.Keeper
accountKeeper authz.AccountKeeper
bankKeeper authz.BankKeeper
@ -114,23 +120,12 @@ func NewAppModule(cdc codec.Codec, keeper keeper.Keeper, ak authz.AccountKeeper,
}
}
var (
_ appmodule.AppModule = AppModule{}
_ appmodule.HasBeginBlocker = AppModule{}
_ module.HasGenesis = AppModule{}
)
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
func (am AppModule) IsOnePerModuleType() {}
// IsAppModule implements the appmodule.AppModule interface.
func (am AppModule) IsAppModule() {}
// Name returns the authz module's name.
func (AppModule) Name() string {
return authz.ModuleName
}
// InitGenesis performs genesis initialization for the authz module. It returns
// no validator updates.
func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) {

View File

@ -37,10 +37,13 @@ import (
const ConsensusVersion = 4
var (
_ module.AppModule = AppModule{}
_ module.AppModuleBasic = AppModuleBasic{}
_ module.AppModuleBasic = AppModule{}
_ module.AppModuleSimulation = AppModule{}
_ module.HasGenesis = AppModule{}
_ module.HasServices = AppModule{}
_ module.HasInvariants = AppModule{}
_ appmodule.AppModule = AppModule{}
)
// AppModuleBasic defines the basic application module used by the bank module.
@ -104,8 +107,6 @@ type AppModule struct {
legacySubspace exported.Subspace
}
var _ appmodule.AppModule = AppModule{}
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
func (am AppModule) IsOnePerModuleType() {}
@ -141,9 +142,6 @@ func NewAppModule(cdc codec.Codec, keeper keeper.Keeper, accountKeeper types.Acc
}
}
// Name returns the bank module's name.
func (AppModule) Name() string { return types.ModuleName }
// RegisterInvariants registers the bank module invariants.
func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {
keeper.RegisterInvariants(ir, am.keeper)

View File

@ -33,8 +33,11 @@ import (
const ConsensusVersion = 1
var (
_ module.AppModuleBasic = AppModuleBasic{}
_ module.AppModuleBasic = AppModule{}
_ module.HasGenesis = AppModule{}
_ module.HasServices = AppModule{}
_ appmodule.AppModule = AppModule{}
)
// AppModuleBasic defines the basic application module used by the circuit module.
@ -90,8 +93,6 @@ type AppModule struct {
keeper keeper.Keeper
}
var _ appmodule.AppModule = AppModule{}
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
func (am AppModule) IsOnePerModuleType() {}

View File

@ -28,8 +28,10 @@ import (
const ConsensusVersion = 1
var (
_ module.AppModule = AppModule{}
_ module.AppModuleBasic = AppModuleBasic{}
_ module.AppModuleBasic = AppModule{}
_ appmodule.AppModule = AppModule{}
_ appmodule.HasServices = AppModule{}
)
// AppModuleBasic defines the basic application module used by the consensus module.
@ -64,11 +66,6 @@ type AppModule struct {
keeper keeper.Keeper
}
var (
_ appmodule.AppModule = AppModule{}
_ appmodule.HasServices = AppModule{}
)
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
func (am AppModule) IsOnePerModuleType() {}
@ -90,9 +87,6 @@ func NewAppModule(cdc codec.Codec, keeper keeper.Keeper) AppModule {
}
}
// Name returns the consensus module's name.
func (AppModule) Name() string { return types.ModuleName }
// ConsensusVersion implements AppModule/ConsensusVersion.
func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion }

View File

@ -35,7 +35,14 @@ import (
// ConsensusVersion defines the current x/crisis module consensus version.
const ConsensusVersion = 2
var _ module.AppModuleBasic = AppModuleBasic{}
var (
_ module.AppModuleBasic = AppModule{}
_ module.HasGenesis = AppModule{}
_ module.HasServices = AppModule{}
_ appmodule.AppModule = AppModule{}
_ appmodule.HasEndBlocker = AppModule{}
)
// Module init related flags
const (
@ -114,12 +121,6 @@ func NewAppModule(keeper *keeper.Keeper, skipGenesisInvariants bool, ss exported
}
}
var (
_ appmodule.AppModule = AppModule{}
_ appmodule.HasEndBlocker = AppModule{}
_ module.HasGenesis = AppModule{}
)
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
func (am AppModule) IsOnePerModuleType() {}
@ -131,11 +132,6 @@ func AddModuleInitFlags(startCmd *cobra.Command) {
startCmd.Flags().Bool(FlagSkipGenesisInvariants, false, "Skip x/crisis invariants check on startup")
}
// Name returns the crisis module's name.
func (AppModule) Name() string {
return types.ModuleName
}
// RegisterServices registers module services.
func (am AppModule) RegisterServices(cfg module.Configurator) {
types.RegisterMsgServer(cfg.MsgServer(), am.keeper)

View File

@ -34,8 +34,14 @@ import (
const ConsensusVersion = 3
var (
_ module.AppModuleBasic = AppModuleBasic{}
_ module.AppModuleBasic = AppModule{}
_ module.AppModuleSimulation = AppModule{}
_ module.HasGenesis = AppModule{}
_ module.HasServices = AppModule{}
_ module.HasInvariants = AppModule{}
_ appmodule.AppModule = AppModule{}
_ appmodule.HasBeginBlocker = AppModule{}
)
// AppModuleBasic defines the basic application module used by the distribution module.
@ -115,23 +121,12 @@ func NewAppModule(
}
}
var (
_ appmodule.AppModule = AppModule{}
_ appmodule.HasBeginBlocker = AppModule{}
_ module.HasGenesis = AppModule{}
)
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
func (am AppModule) IsOnePerModuleType() {}
// IsAppModule implements the appmodule.AppModule interface.
func (am AppModule) IsAppModule() {}
// Name returns the distribution module's name.
func (AppModule) Name() string {
return types.ModuleName
}
// RegisterInvariants registers the distribution module invariants.
func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {
keeper.RegisterInvariants(ir, am.keeper)

View File

@ -30,8 +30,13 @@ import (
)
var (
_ module.AppModuleBasic = AppModuleBasic{}
_ module.AppModuleBasic = AppModule{}
_ module.AppModuleSimulation = AppModule{}
_ module.HasGenesis = AppModule{}
_ appmodule.AppModule = AppModule{}
_ appmodule.HasServices = AppModule{}
_ appmodule.HasBeginBlocker = AppModule{}
)
// ----------------------------------------------------------------------------
@ -117,24 +122,12 @@ func NewAppModule(keeper keeper.Keeper) AppModule {
}
}
var (
_ appmodule.AppModule = AppModule{}
_ appmodule.HasServices = AppModule{}
_ appmodule.HasBeginBlocker = AppModule{}
_ module.HasGenesis = AppModule{}
)
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
func (am AppModule) IsOnePerModuleType() {}
// IsAppModule implements the appmodule.AppModule interface.
func (am AppModule) IsAppModule() {}
// Name returns the evidence module's name.
func (am AppModule) Name() string {
return am.AppModuleBasic.Name()
}
// RegisterServices registers module services.
func (am AppModule) RegisterServices(registrar grpc.ServiceRegistrar) error {
types.RegisterMsgServer(registrar, keeper.NewMsgServerImpl(am.keeper))

View File

@ -28,8 +28,13 @@ import (
)
var (
_ module.AppModuleBasic = AppModuleBasic{}
_ module.AppModuleBasic = AppModule{}
_ module.AppModuleSimulation = AppModule{}
_ module.HasServices = AppModule{}
_ module.HasGenesis = AppModule{}
_ appmodule.AppModule = AppModule{}
_ appmodule.HasEndBlocker = AppModule{}
)
// ----------------------------------------------------------------------------
@ -104,6 +109,7 @@ func (ab AppModuleBasic) GetTxCmd() *cobra.Command {
// AppModule implements an application module for the feegrant module.
type AppModule struct {
AppModuleBasic
keeper keeper.Keeper
accountKeeper feegrant.AccountKeeper
bankKeeper feegrant.BankKeeper
@ -121,23 +127,12 @@ func NewAppModule(cdc codec.Codec, ak feegrant.AccountKeeper, bk feegrant.BankKe
}
}
var (
_ appmodule.AppModule = AppModule{}
_ appmodule.HasEndBlocker = AppModule{}
_ module.HasGenesis = AppModule{}
)
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
func (am AppModule) IsOnePerModuleType() {}
// IsAppModule implements the appmodule.AppModule interface.
func (am AppModule) IsAppModule() {}
// Name returns the feegrant module's name.
func (AppModule) Name() string {
return feegrant.ModuleName
}
// InitGenesis performs genesis initialization for the feegrant module. It returns
// no validator updates.
func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, bz json.RawMessage) {

View File

@ -21,8 +21,10 @@ import (
)
var (
_ module.AppModuleBasic = AppModule{}
_ module.HasABCIGenesis = AppModule{}
_ module.AppModuleBasic = AppModuleBasic{}
_ appmodule.AppModule = AppModule{}
)
// AppModuleBasic defines the basic application module used by the genutil module.
@ -91,8 +93,6 @@ func NewAppModule(accountKeeper types.AccountKeeper,
})
}
var _ appmodule.AppModule = AppModule{}
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
func (AppModule) IsOnePerModuleType() {}

View File

@ -42,6 +42,11 @@ var (
_ module.AppModuleBasic = AppModuleBasic{}
_ module.AppModuleSimulation = AppModule{}
_ module.HasGenesis = AppModule{}
_ module.HasServices = AppModule{}
_ module.HasInvariants = AppModule{}
_ appmodule.AppModule = AppModule{}
_ appmodule.HasEndBlocker = AppModule{}
)
// AppModuleBasic defines the basic application module used by the gov module.
@ -148,11 +153,6 @@ func NewAppModule(
}
}
var (
_ appmodule.AppModule = AppModule{}
_ appmodule.HasEndBlocker = AppModule{}
)
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
func (am AppModule) IsOnePerModuleType() {}
@ -267,11 +267,6 @@ func InvokeSetHooks(keeper *keeper.Keeper, govHooks map[string]govtypes.GovHooks
return nil
}
// Name returns the gov module's name.
func (AppModule) Name() string {
return govtypes.ModuleName
}
// RegisterInvariants registers module invariants
func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {
keeper.RegisterInvariants(ir, am.keeper, am.bankKeeper)

View File

@ -31,8 +31,14 @@ import (
const ConsensusVersion = 2
var (
_ module.AppModuleBasic = AppModuleBasic{}
_ module.AppModuleBasic = AppModule{}
_ module.AppModuleSimulation = AppModule{}
_ module.HasGenesis = AppModule{}
_ module.HasServices = AppModule{}
_ module.HasInvariants = AppModule{}
_ appmodule.AppModule = AppModule{}
_ appmodule.HasEndBlocker = AppModule{}
)
type AppModule struct {
@ -54,12 +60,6 @@ func NewAppModule(cdc codec.Codec, keeper keeper.Keeper, ak group.AccountKeeper,
}
}
var (
_ appmodule.AppModule = AppModule{}
_ appmodule.HasEndBlocker = AppModule{}
_ module.HasGenesis = AppModule{}
)
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
func (am AppModule) IsOnePerModuleType() {}
@ -113,11 +113,6 @@ func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
group.RegisterLegacyAminoCodec(cdc)
}
// Name returns the group module's name.
func (AppModule) Name() string {
return group.ModuleName
}
// RegisterInvariants does nothing, there are no invariants to enforce
func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {
keeper.RegisterInvariants(ir, am.keeper)

View File

@ -30,8 +30,13 @@ import (
const ConsensusVersion = 2
var (
_ module.AppModuleBasic = AppModuleBasic{}
_ module.AppModuleBasic = AppModule{}
_ module.AppModuleSimulation = AppModule{}
_ module.HasGenesis = AppModule{}
_ module.HasServices = AppModule{}
_ appmodule.AppModule = AppModule{}
_ appmodule.HasBeginBlocker = AppModule{}
)
// AppModuleBasic defines the basic application module used by the mint module.
@ -39,8 +44,6 @@ type AppModuleBasic struct {
cdc codec.Codec
}
var _ module.AppModuleBasic = AppModuleBasic{}
// Name returns the mint module's name.
func (AppModuleBasic) Name() string {
return types.ModuleName
@ -116,23 +119,12 @@ func NewAppModule(
}
}
var (
_ appmodule.AppModule = AppModule{}
_ appmodule.HasBeginBlocker = AppModule{}
_ module.HasGenesis = AppModule{}
)
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
func (am AppModule) IsOnePerModuleType() {}
// IsAppModule implements the appmodule.AppModule interface.
func (am AppModule) IsAppModule() {}
// Name returns the mint module's name.
func (AppModule) Name() string {
return types.ModuleName
}
// RegisterServices registers a gRPC query service to respond to the
// module-specific gRPC queries.
func (am AppModule) RegisterServices(cfg module.Configurator) {

View File

@ -28,9 +28,12 @@ import (
)
var (
_ module.AppModule = AppModule{}
_ module.AppModuleBasic = AppModuleBasic{}
_ module.AppModuleBasic = AppModule{}
_ module.AppModuleSimulation = AppModule{}
_ module.HasGenesis = AppModule{}
_ appmodule.AppModule = AppModule{}
_ appmodule.HasServices = AppModule{}
)
// AppModuleBasic defines the basic application module used by the nft module.
@ -109,23 +112,12 @@ func NewAppModule(cdc codec.Codec, keeper keeper.Keeper, ak nft.AccountKeeper, b
}
}
var (
_ appmodule.AppModule = AppModule{}
_ appmodule.HasServices = AppModule{}
_ module.HasGenesis = AppModule{}
)
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
func (am AppModule) IsOnePerModuleType() {}
// IsAppModule implements the appmodule.AppModule interface.
func (am AppModule) IsAppModule() {}
// Name returns the nft module's name.
func (AppModule) Name() string {
return nft.ModuleName
}
// InitGenesis performs genesis initialization for the nft module. It returns
// no validator updates.
func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) {

View File

@ -22,9 +22,11 @@ import (
)
var (
_ module.AppModule = AppModule{}
_ module.AppModuleBasic = AppModuleBasic{}
_ module.AppModuleBasic = AppModule{}
_ module.AppModuleSimulation = AppModule{}
_ module.HasServices = AppModule{}
_ appmodule.AppModule = AppModule{}
)
// ConsensusVersion defines the current x/params module consensus version.
@ -69,8 +71,6 @@ func NewAppModule(k keeper.Keeper) AppModule {
}
}
var _ appmodule.AppModule = AppModule{}
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
func (am AppModule) IsOnePerModuleType() {}

View File

@ -33,8 +33,13 @@ import (
const ConsensusVersion = 4
var (
_ module.AppModuleBasic = AppModuleBasic{}
_ module.AppModuleBasic = AppModule{}
_ module.AppModuleSimulation = AppModule{}
_ module.HasGenesis = AppModule{}
_ module.HasServices = AppModule{}
_ appmodule.AppModule = AppModule{}
_ appmodule.HasBeginBlocker = AppModule{}
)
// AppModuleBasic defines the basic application module used by the slashing module.
@ -42,8 +47,6 @@ type AppModuleBasic struct {
cdc codec.Codec
}
var _ module.AppModuleBasic = AppModuleBasic{}
// Name returns the slashing module's name.
func (AppModuleBasic) Name() string {
return types.ModuleName
@ -122,23 +125,12 @@ func NewAppModule(
}
}
var (
_ appmodule.AppModule = AppModule{}
_ appmodule.HasBeginBlocker = AppModule{}
_ module.HasGenesis = AppModule{}
)
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
func (am AppModule) IsOnePerModuleType() {}
// IsAppModule implements the appmodule.AppModule interface.
func (am AppModule) IsAppModule() {}
// Name returns the slashing module's name.
func (AppModule) Name() string {
return types.ModuleName
}
// RegisterServices registers module services.
func (am AppModule) RegisterServices(cfg module.Configurator) {
types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper))

View File

@ -37,11 +37,15 @@ const (
)
var (
_ appmodule.AppModule = AppModule{}
_ appmodule.HasBeginBlocker = AppModule{}
_ module.HasABCIEndblock = AppModule{}
_ module.AppModuleBasic = AppModuleBasic{}
_ module.AppModuleSimulation = AppModule{}
_ module.HasServices = AppModule{}
_ module.HasInvariants = AppModule{}
_ module.HasABCIGenesis = AppModule{}
_ module.HasABCIEndBlock = AppModule{}
_ appmodule.AppModule = AppModule{}
_ appmodule.HasBeginBlocker = AppModule{}
)
// AppModuleBasic defines the basic application module used by the staking module.
@ -50,8 +54,6 @@ type AppModuleBasic struct {
ak types.AccountKeeper
}
var _ module.AppModuleBasic = AppModuleBasic{}
// Name returns the staking module's name.
func (AppModuleBasic) Name() string {
return types.ModuleName
@ -124,22 +126,12 @@ func NewAppModule(
}
}
var (
_ appmodule.AppModule = AppModule{}
_ appmodule.HasBeginBlocker = AppModule{}
)
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
func (am AppModule) IsOnePerModuleType() {}
// IsAppModule implements the appmodule.AppModule interface.
func (am AppModule) IsAppModule() {}
// Name returns the staking module's name.
func (AppModule) Name() string {
return types.ModuleName
}
// RegisterInvariants registers the staking module invariants.
func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {
keeper.RegisterInvariants(ir, am.keeper)

View File

@ -39,7 +39,14 @@ func init() {
// ConsensusVersion defines the current x/upgrade module consensus version.
const ConsensusVersion uint64 = 2
var _ module.AppModuleBasic = AppModuleBasic{}
var (
_ module.AppModuleBasic = AppModule{}
_ module.HasGenesis = AppModule{}
_ module.HasServices = AppModule{}
_ appmodule.AppModule = AppModule{}
_ appmodule.HasPreBlocker = AppModule{}
)
// AppModuleBasic implements the sdk.AppModuleBasic interface
type AppModuleBasic struct {
@ -97,12 +104,6 @@ func NewAppModule(keeper *keeper.Keeper, ac address.Codec) AppModule {
}
}
var (
_ appmodule.AppModule = AppModule{}
_ appmodule.HasPreBlocker = AppModule{}
_ module.HasGenesis = AppModule{}
)
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
func (am AppModule) IsOnePerModuleType() {}