Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt committed Sep 19, 2024
1 parent e843c72 commit 87751ac
Show file tree
Hide file tree
Showing 22 changed files with 120 additions and 46 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@

/x/accounts/ @testinginprod @sontrinh16 @cosmos/sdk-core-dev
/x/auth/ @facundomedica @testinginprod @aaronc @cosmos/sdk-core-dev
/x/auth/tx/config @julienrbrt @akhilkumarpilli @kocubinski @cosmos/sdk-core-dev
/x/authz/ @akhilkumarpilli @raynaudoe @cosmos/sdk-core-dev
/x/bank/ @julienrbrt @sontrinh16 @cosmos/sdk-core-dev
/x/bank/v2 @julienrbrt @hieuvubk @akhilkumarpilli @cosmos/sdk-core-dev
Expand All @@ -65,6 +66,7 @@
/x/staking/ @facundomedica @testinginprod @JulianToledano @ziscky @cosmos/sdk-core-dev
/x/tx/ @kocubinski @testinginprod @aaronc @cosmos/sdk-core-dev
/x/upgrade/ @facundomedica @cool-develope @akhilkumarpilli @lucaslopezf @cosmos/sdk-core-dev
/x/validate @julienrbrt @akhilkumarpilli @kocubinski @cosmos/sdk-core-dev

# go mods

Expand Down
11 changes: 4 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i
* (cli) [#21372](https://github.com/cosmos/cosmos-sdk/pull/21372) Add a `bulk-add-genesis-account` genesis command to add many genesis accounts at once.
* (crypto/keyring) [#21653](https://github.com/cosmos/cosmos-sdk/pull/21653) New Linux-only backend that adds Linux kernel's `keyctl` support.
* (runtime) [#21704](https://github.com/cosmos/cosmos-sdk/pull/21704) Add StoreLoader in simappv2.
* (x/validate) [#21822](https://github.com/cosmos/cosmos-sdk/pull/21822) New module solely responsible for providing ante/post handlers and tx validators for v2. It can be extended by the app developer to provide extra tx validators.
* In comparison to x/auth/tx/config, there is no app config to skip ante/post handlers, as overwriting them is baseapp or not injecting the x/validate module has the same effect.

### Improvements

Expand All @@ -61,16 +63,11 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i
### API Breaking Changes

* (types/mempool) [#21744](https://github.com/cosmos/cosmos-sdk/pull/21744) Update types/mempool.Mempool interface to take decoded transactions. This avoid to decode the transaction twice.
* (x/auth/tx/config) [#21822](https://github.com/cosmos/cosmos-sdk/pull/21822) Sign mode textual is no more automatically added to tx config when using runtime. Should be added manually on the server side.
* (x/auth/tx/config) [#21822](https://github.com/cosmos/cosmos-sdk/pull/21822) This depinject module now only provide txconfig and tx config options. `x/validate` now handles the providing of ante/post handlers, alongside tx validators for v2. The corresponding app config options have been removed from the depinject module config.

### Deprecated

### TO SORT

* (x/auth/tx/config) Sign mode textual not more automatically added to tx config when using runtime. Should be added manually on the server side.
* (x/auth/tx/config) This depinject module now only provide txconfig and tx config options. x/validate now handlers the providing of ante/post handlers, alongside tx validators for v2. The corresponding app config options have been removed
* (x/validate) New module solely responsible for providing ante/post handlers and tx validators for v2. It can be extended by the app developer to provide extra tx validators.
* In comparison to x/auth/tx/config, there is no app config to skip ante/post handlers, as overwriting them is baseapp or not injecting the x/validate module has the same effect.

## [v0.52.0](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.52.0) - 2024-XX-XX

Every module contains its own CHANGELOG.md. Please refer to the module you are interested in.
Expand Down
14 changes: 12 additions & 2 deletions UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ For non depinject users, simply call `RegisterLegacyAminoCodec` and `RegisterInt

Additionally, thanks to the genesis simplification, as explained in [the genesis interface update](#genesis-interface), the module manager `InitGenesis` and `ExportGenesis` methods do not require the codec anymore.

##### GRPC WEB
##### gRPC Web

Grpc-web embedded client has been removed from the server. If you would like to use grpc-web, you can use the [envoy proxy](https://www.envoyproxy.io/docs/envoy/latest/start/start). Here's how to set it up:

Expand Down Expand Up @@ -319,6 +319,11 @@ used as a TTL for the transaction and is used to provide replay protection. See
[ADR-070](https://github.com/cosmos/cosmos-sdk/blob/main/docs/architecture/adr-070-unordered-transactions.md)
for more details.

#### Sign Mode Textual

With the split of `x/auth/tx/config` in two (x/auth/tx/config as depinject module for txconfig and tx options) and `x/validate`, sign mode textual is no more automatically configured when using runtime (it was previously the case).
For the same instructions than for legacy app wiring to enable sign mode textual (see in v0.50 UPGRADING documentation).

### Depinject `app_config.go` / `app.yml`

With the introduction of [environment in modules](#core-api), depinject automatically creates the environment for all modules.
Expand Down Expand Up @@ -459,7 +464,7 @@ if err != nil {
}
```

### `x/crisis`
#### `x/crisis`

The `x/crisis` module was removed due to it not being supported or functional any longer.

Expand Down Expand Up @@ -503,6 +508,11 @@ storetypes.StoreUpgrades{
}
```

#### `x/validate`

Introducing `x/validate` a module that is solely used for registering default ante/post handlers and global tx validators when using runtime and runtime/v2. If you wish to set your custom ante/post handlers, no need to use this module.
You can however always extend them by adding extra tx validators (see `x/validate` documentation).

## [v0.50.x](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.50.0-alpha.0)

### Migration to CometBFT (Part 2)
Expand Down
1 change: 1 addition & 0 deletions simapp/simd/cmd/testnet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func Test_TestnetCmd(t *testing.T) {
configurator.StakingModule(),
configurator.ConsensusModule(),
configurator.TxModule(),
configurator.ValidateModule(),
configurator.MintModule(),
)
var moduleManager *module.Manager
Expand Down
1 change: 1 addition & 0 deletions tests/e2e/auth/keeper/app_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ var AppConfig = configurator.NewAppConfig(
configurator.VestingModule(),
configurator.StakingModule(),
configurator.TxModule(),
configurator.ValidateModule(),
configurator.ConsensusModule(),
configurator.GenutilModule(),
)
1 change: 1 addition & 0 deletions tests/e2e/baseapp/block_gas_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ func TestBaseApp_BlockGas(t *testing.T) {
configurator.AccountsModule(),
configurator.AuthModule(),
configurator.TxModule(),
configurator.ValidateModule(),
configurator.ConsensusModule(),
configurator.BankModule(),
configurator.StakingModule(),
Expand Down
1 change: 1 addition & 0 deletions tests/integration/bank/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ func createTestSuite(t *testing.T, genesisAccounts []authtypes.GenesisAccount) s
configurator.AuthModule(),
configurator.StakingModule(),
configurator.TxModule(),
configurator.ValidateModule(),
configurator.ConsensusModule(),
configurator.BankModule(),
configurator.GovModule(),
Expand Down
1 change: 1 addition & 0 deletions tests/integration/distribution/appconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ var AppConfig = configurator.NewAppConfig(
configurator.BankModule(),
configurator.StakingModule(),
configurator.TxModule(),
configurator.ValidateModule(),
configurator.ConsensusModule(),
configurator.GenutilModule(),
configurator.DistributionModule(),
Expand Down
1 change: 1 addition & 0 deletions tests/integration/evidence/app_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ var AppConfig = configurator.NewAppConfig(
configurator.StakingModule(),
configurator.SlashingModule(),
configurator.TxModule(),
configurator.ValidateModule(),
configurator.ConsensusModule(),
configurator.EvidenceModule(),
configurator.GenutilModule(),
Expand Down
1 change: 1 addition & 0 deletions tests/integration/mint/app_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ var AppConfig = configurator.NewAppConfig(
configurator.BankModule(),
configurator.StakingModule(),
configurator.TxModule(),
configurator.ValidateModule(),
configurator.ConsensusModule(),
configurator.GenutilModule(),
configurator.MintModule(),
Expand Down
1 change: 1 addition & 0 deletions tests/integration/protocolpool/app_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ var AppConfig = configurator.NewAppConfig(
configurator.BankModule(),
configurator.StakingModule(),
configurator.TxModule(),
configurator.ValidateModule(),
configurator.ConsensusModule(),
configurator.GenutilModule(),
configurator.MintModule(),
Expand Down
1 change: 1 addition & 0 deletions tests/integration/runtime/query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func initFixture(t assert.TestingT) *fixture {
configurator.AccountsModule(),
configurator.AuthModule(),
configurator.TxModule(),
configurator.ValidateModule(),
configurator.ConsensusModule(),
configurator.BankModule(),
configurator.StakingModule(),
Expand Down
1 change: 1 addition & 0 deletions tests/integration/server/grpc/out_of_gas_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func (s *IntegrationTestOutOfGasSuite) SetupSuite() {
configurator.StakingModule(),
configurator.ConsensusModule(),
configurator.TxModule(),
configurator.ValidateModule(),
), baseapp.SetQueryGasLimit(10))
s.NoError(err)
s.cfg.NumValidators = 1
Expand Down
1 change: 1 addition & 0 deletions tests/integration/server/grpc/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ func (s *IntegrationTestSuite) SetupSuite() {
configurator.StakingModule(),
configurator.ConsensusModule(),
configurator.TxModule(),
configurator.ValidateModule(),
))
s.NoError(err)
s.cfg.NumValidators = 1
Expand Down
1 change: 1 addition & 0 deletions tests/integration/slashing/app_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ var AppConfig = configurator.NewAppConfig(
configurator.StakingModule(),
configurator.SlashingModule(),
configurator.TxModule(),
configurator.ValidateModule(),
configurator.ConsensusModule(),
configurator.GenutilModule(),
configurator.MintModule(),
Expand Down
1 change: 1 addition & 0 deletions tests/integration/slashing/slashing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ func TestSlashingMsgs(t *testing.T) {
configurator.StakingModule(),
configurator.SlashingModule(),
configurator.TxModule(),
configurator.ValidateModule(),
configurator.ConsensusModule(),
configurator.BankModule(),
),
Expand Down
1 change: 1 addition & 0 deletions tests/integration/staking/app_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ var AppConfig = configurator.NewAppConfig(
configurator.BankModule(),
configurator.StakingModule(),
configurator.TxModule(),
configurator.ValidateModule(),
configurator.ConsensusModule(),
configurator.GenutilModule(),
configurator.MintModule(),
Expand Down
18 changes: 16 additions & 2 deletions testutil/configurator/configurator.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,16 @@ import (
slashingmodulev1 "cosmossdk.io/api/cosmos/slashing/module/v1"
stakingmodulev1 "cosmossdk.io/api/cosmos/staking/module/v1"
txconfigv1 "cosmossdk.io/api/cosmos/tx/config/v1"
validatemodulev1 "cosmossdk.io/api/cosmos/validate/module/v1"
vestingmodulev1 "cosmossdk.io/api/cosmos/vesting/module/v1"
"cosmossdk.io/depinject"
"cosmossdk.io/depinject/appconfig"

"github.com/cosmos/cosmos-sdk/testutil"
_ "github.com/cosmos/cosmos-sdk/x/auth" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/genutil" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/validate" // import as blank for app wiring
)

// Config should never need to be instantiated manually and is solely used for ModuleOption.
Expand Down Expand Up @@ -183,13 +188,22 @@ func ParamsModule() ModuleOption {

func TxModule() ModuleOption {
return func(config *Config) {
config.ModuleConfigs[testutil.TxModuleName] = &appv1alpha1.ModuleConfig{
Name: testutil.TxModuleName,
config.ModuleConfigs[testutil.AuthTxConfigDepinjectModuleName] = &appv1alpha1.ModuleConfig{
Name: testutil.AuthTxConfigDepinjectModuleName,
Config: appconfig.WrapAny(&txconfigv1.Config{}),
}
}
}

func ValidateModule() ModuleOption {
return func(config *Config) {
config.ModuleConfigs[testutil.ValidateModuleName] = &appv1alpha1.ModuleConfig{
Name: testutil.ValidateModuleName,
Config: appconfig.WrapAny(&validatemodulev1.Module{}),
}
}
}

func StakingModule() ModuleOption {
return func(config *Config) {
config.ModuleConfigs[testutil.StakingModuleName] = &appv1alpha1.ModuleConfig{
Expand Down
39 changes: 20 additions & 19 deletions testutil/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,24 @@ package testutil
// Those constants are defined here to be used in the SDK without importing those modules.

const (
AccountsModuleName = "accounts"
AuthModuleName = "auth"
AuthzModuleName = "authz"
BankModuleName = "bank"
CircuitModuleName = "circuit"
DistributionModuleName = "distribution"
EvidenceModuleName = "evidence"
FeegrantModuleName = "feegrant"
GovModuleName = "gov"
GroupModuleName = "group"
MintModuleName = "mint"
NFTModuleName = "nft"
ParamsModuleName = "params"
ProtocolPoolModuleName = "protocolpool"
SlashingModuleName = "slashing"
StakingModuleName = "staking"
TxModuleName = "tx"
UpgradeModuleName = "upgrade"
EpochsModuleName = "epochs"
AccountsModuleName = "accounts"
AuthModuleName = "auth"
AuthzModuleName = "authz"
BankModuleName = "bank"
CircuitModuleName = "circuit"
DistributionModuleName = "distribution"
EvidenceModuleName = "evidence"
FeegrantModuleName = "feegrant"
GovModuleName = "gov"
GroupModuleName = "group"
MintModuleName = "mint"
NFTModuleName = "nft"
ParamsModuleName = "params"
ProtocolPoolModuleName = "protocolpool"
SlashingModuleName = "slashing"
StakingModuleName = "staking"
AuthTxConfigDepinjectModuleName = "tx"
UpgradeModuleName = "upgrade"
EpochsModuleName = "epochs"
ValidateModuleName = "validate"
)
18 changes: 14 additions & 4 deletions x/auth/tx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ This document specifies the `x/auth/tx` package of the Cosmos SDK.

This package represents the Cosmos SDK implementation of the `client.TxConfig`, `client.TxBuilder`, `client.TxEncoder` and `client.TxDecoder` interfaces.

It contains as well a depinject module and app module the registration of ante/post handler via `runtime` and tx validator via `runtime/v2`.

## Contents

* [`x/auth/tx`](#xauthtx)
Expand All @@ -28,7 +26,8 @@ It contains as well a depinject module and app module the registration of ante/p
* [`TxConfig`](#txconfig)
* [`TxBuilder`](#txbuilder)
* [`TxEncoder`/ `TxDecoder`](#txencoder-txdecoder)
* [Depinject \& App Module](#depinject--app-module)
* [`x/auth/tx/config`](#xauthtxconfig)
* [Storage](#storage)
* [Client](#client)
* [CLI](#cli)
* [Query](#query)
Expand Down Expand Up @@ -71,11 +70,22 @@ A `client.TxBuilder` can be accessed with `TxConfig.NewTxBuilder()`.

More information about `TxEncoder` and `TxDecoder` can be found [here](https://docs.cosmos.network/main/core/encoding#transaction-encoding).

## Depinject & App Module
## `x/auth/tx/config`

The `x/auth/tx/config` contains a depinject module.
The depinject module is to outputs the `TxConfig` and `TxConfigOptions` for the app.

### Storage

This module has no store key. Do not forget to add the module name in the `SkipStoreKeys` runtime config present in the app config.

```go
SkipStoreKeys: []string{
authtxconfig.DepinjectModuleName,
validate.ModuleName,
},
```

## Client

### CLI
Expand Down
34 changes: 32 additions & 2 deletions x/validate/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,35 @@
# x/validate

The `x/validate` is an app module solely there to setup ante/post handlers on an runtime app (via baseapp options) and the tx validator on the runtime/v2 app (via app module).
:::tip
This module is only required when using runtime and runtime v2 and you want to make use of the pre-defined ante/poste handlers or tx validators.
:::

Module specific tx validators should be registered on their own modules.
The `x/validate` is an app module solely there to setup ante/post handlers on a runtime app (via baseapp options) and the global tx validators on a runtime/v2 app (via app module). Depinject will automatically inject the ante/post handlers and tx validators into the app. Module specific tx validators should be registered on their own modules.

## Extra TxValidators

It is possible to add extra tx validators to the app. This is useful when you want to add extra tx validators that do not belong to one specific module. For example, you can add a tx validator that checks if the tx is signed by a specific address.

In your `app.go`, when using runtime/v2, supply the extra tx validators using `depinject`:

```go
appConfig = depinject.Configs(
AppConfig(),
depinject.Supply(
[]appmodulev2.TxValidator[transaction.Tx]{
// Add extra tx validators here
}
),
)
```

## Storage

This module has no store key. Do not forget to add the module name in the `SkipStoreKeys` runtime config present in the app config.

```go
SkipStoreKeys: []string{
authtxconfig.DepinjectModuleName,
validate.ModuleName,
},
```
Loading

0 comments on commit 87751ac

Please sign in to comment.