Skip to content

Commit

Permalink
Merge branch 'main' into julian/staking-accString-removal
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianToledano authored Mar 13, 2024
2 parents ec42726 + 7193d88 commit 91be717
Show file tree
Hide file tree
Showing 71 changed files with 842 additions and 564 deletions.
36 changes: 33 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i

* (types) [#19672](https://github.com/cosmos/cosmos-sdk/pull/19672) `PreBlock` now returns only an error for consistency with server/v2. The SDK has upgraded x/upgrade accordingly. `ResponsePreBlock` hence has been removed.
* (server) [#19455](https://github.com/cosmos/cosmos-sdk/pull/19455) Allow calling back into the application struct in PostSetup.
* (types) [#19512](https://github.com/cosmos/cosmos-sdk/pull/19512) The notion of basic manager does not exist anymore.
* (types) [#19512](https://github.com/cosmos/cosmos-sdk/pull/19512) The notion of basic manager does not exist anymore (and all related helpers).
* The module manager now can do everything that the basic manager was doing.
* `AppModuleBasic` has been deprecated for extension interfaces. Modules can now implement `HasRegisterInterfaces`, `HasGRPCGateway` and `HasAminoCodec` when relevant.
* `AppModuleBasic` has been deprecated for extension interfaces.
* Modules can now implement `appmodule.HasRegisterInterfaces`, `modue.HasGRPCGateway` and `module.HasAminoCodec` when relevant.
* SDK modules now directly implement those extension interfaces on `AppModule` instead of `AppModuleBasic`.
* (client/keys) [#18950](https://github.com/cosmos/cosmos-sdk/pull/18950) Improve `<appd> keys add`, `<appd> keys import` and `<appd> keys rename` by checking name validation.
* (client/keys) [#18745](https://github.com/cosmos/cosmos-sdk/pull/18745) Improve `<appd> keys export` and `<appd> keys mnemonic` by adding --yes option to skip interactive confirmation.
Expand All @@ -82,6 +83,7 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i
* (crypto | x/auth) [#14372](https://github.com/cosmos/cosmos-sdk/pull/18194) Key checks on signatures antehandle.
* (types) [#18963](https://github.com/cosmos/cosmos-sdk/pull/18963) Swap out amino json encoding of `ABCIMessageLogs` for std lib json encoding
* (x/auth) [#19651](https://github.com/cosmos/cosmos-sdk/pull/19651) Allow empty public keys in `GetSignBytesAdapter`.
* (x/genutil) [#19735](https://github.com/cosmos/cosmos-sdk/pull/19735) Update genesis api to match new `appmodule.HasGenesis` interface.

### Bug Fixes

Expand Down Expand Up @@ -145,7 +147,9 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i
* (types) [#19652](https://github.com/cosmos/cosmos-sdk/pull/19652)
* Moved`types/module.HasRegisterInterfaces` to `cosmossdk.io/core`.
* Moved `RegisterInterfaces` and `RegisterImplementations` from `InterfaceRegistry` to `cosmossdk.io/core/registry.LegacyRegistry` interface.
* (types) [#19627](https://github.com/cosmos/cosmos-sdk/pull/19627) All genesis interfaces now don't take `codec.JsonCodec`. Every module has the codec already, passing it created an unneeded dependency. Additionally, to reflect this change, the module manager does not take a codec either.
* (types) [#19627](https://github.com/cosmos/cosmos-sdk/pull/19627) and [#19735](https://github.com/cosmos/cosmos-sdk/pull/19735) All genesis interfaces now don't take `codec.JsonCodec`.
* Every module has the codec already, passing it created an unneeded dependency.
* Additionally, to reflect this change, the module manager does not take a codec either.

### Client Breaking Changes

Expand All @@ -160,6 +164,25 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i
* (simapp) [#19146](https://github.com/cosmos/cosmos-sdk/pull/19146) Replace `--v` CLI option with `--validator-count`/`-n`.
* (module) [#19370](https://github.com/cosmos/cosmos-sdk/pull/19370) Deprecate `module.Configurator`, use `appmodule.HasMigrations` and `appmodule.HasServices` instead from Core API.

## [v0.50.5](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.50.5) - 2024-03-12

### Features

* (baseapp) [#19626](https://github.com/cosmos/cosmos-sdk/pull/19626) Add `DisableBlockGasMeter` option to `BaseApp`, which removes the block gas meter during transaction execution.

### Improvements

* (x/distribution) [#19707](https://github.com/cosmos/cosmos-sdk/pull/19707) Add autocli config for `DelegationTotalRewards` for CLI consistency with `q rewards` commands in previous versions.
* (x/auth) [#19651](https://github.com/cosmos/cosmos-sdk/pull/19651) Allow empty public keys in `GetSignBytesAdapter`.

### Bug Fixes

* (x/gov) [#19725](https://github.com/cosmos/cosmos-sdk/pull/19725) Fetch a failed proposal tally from proposal.FinalTallyResult in the gprc query.
* (types) [#19709](https://github.com/cosmos/cosmos-sdk/pull/19709) Fix skip staking genesis export when using `CoreAppModuleAdaptor` / `CoreAppModuleBasicAdaptor` for it.
* (x/auth) [#19549](https://github.com/cosmos/cosmos-sdk/pull/19549) Accept custom get signers when injecting `x/auth/tx`.
* (x/staking) Fix a possible bypass of delegator slashing: [GHSA-86h5-xcpx-cfqc](https://github.com/cosmos/cosmos-sdk/security/advisories/GHSA-86h5-xcpx-cfqc)
* (baseapp) Fix a bug in `baseapp.ValidateVoteExtensions` helper ([GHSA-95rx-m9m5-m94v](https://github.com/cosmos/cosmos-sdk/security/advisories/GHSA-95rx-m9m5-m94v)). The helper has been fixed and for avoiding API breaking changes `currentHeight` and `chainID` arguments are ignored. Those arguments are removed from the helper in v0.51+.

## [v0.50.4](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.50.4) - 2023-02-19

### Features
Expand Down Expand Up @@ -577,6 +600,13 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i
* (x/staking) [#14567](https://github.com/cosmos/cosmos-sdk/pull/14567) The `delegator_address` field of `MsgCreateValidator` has been deprecated.
The validator address bytes and delegator address bytes refer to the same account while creating validator (defer only in bech32 notation).

## [v0.47.10](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.10) - 2024-02-27

### Bug Fixes

* (x/staking) Fix a possible bypass of delagator slashing: [GHSA-86h5-xcpx-cfqc](https://github.com/cosmos/cosmos-sdk/security/advisories/GHSA-86h5-xcpx-cfqc)
* (server) [#19573](https://github.com/cosmos/cosmos-sdk/pull/19573) Use proper `db_backend` type when reading chain-id

## [v0.47.9](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.9) - 2024-02-19

### Bug Fixes
Expand Down
11 changes: 7 additions & 4 deletions UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ For non depinject users, simply call `RegisterLegacyAminoCodec` and `RegisterInt
+app.ModuleManager.RegisterInterfaces(interfaceRegistry)
```

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.

##### AnteHandlers

The `GasConsumptionDecorator` and `IncreaseSequenceDecorator` have been merged with the SigVerificationDecorator, so you'll
Expand Down Expand Up @@ -192,15 +194,16 @@ Previous module migrations have been removed. It is required to migrate to v0.50

##### Genesis Interface

All genesis interfaces have been migrated to take context.Context instead of sdk.Context. Secondly, the codec is no longer passed in by the framework. The codec is now passed in by the module.
All genesis interfaces have been migrated to take `context.Context` instead of `sdk.Context`.
Secondly, the codec is no longer passed in by the framework. The codec is now passed in by the module.
Lastly, all InitGenesis and ExportGenesis functions now return an error.

```go
// InitGenesis performs genesis initialization for the authz module.
// InitGenesis performs genesis initialization for the module.
func (am AppModule) InitGenesis(ctx context.Context, data json.RawMessage) error {
}

// ExportGenesis returns the exported genesis state as raw bytes for the authz
// module.
// ExportGenesis returns the exported genesis state as raw bytes for the module.
func (am AppModule) ExportGenesis(ctx context.Context) (json.RawMessage, error) {
}
```
Expand Down
62 changes: 31 additions & 31 deletions api/cosmos/gov/v1/gov.pulsar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion api/cosmos/query/v1/query.pulsar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion core/appmodule/environment.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package appmodule

import (
appmodule "cosmossdk.io/core/appmodule/v2"
"cosmossdk.io/core/appmodule/v2"
)

// Environment is used to get all services to their respective module
Expand Down
3 changes: 3 additions & 0 deletions core/appmodule/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ type MigrationRegistrar = appmodule.MigrationRegistrar

// MigrationHandler is the migration function that each module registers.
type MigrationHandler = appmodule.MigrationHandler

// VersionMap is a map of moduleName -> version
type VersionMap = appmodule.VersionMap
6 changes: 4 additions & 2 deletions proto/cosmos/query/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ option go_package = "github.com/cosmos/cosmos-sdk/types/query";
extend google.protobuf.MethodOptions {
// module_query_safe is set to true when the query is safe to be called from
// within the state machine, for example from another module's Keeper, via
// ADR-033 calls or from CosmWasm contracts.
// a query router calls or from CosmWasm contracts.
// WARNING: marking a query as safe in a non consensus breaking release may cause non determinism.
// It is recommended to only mark a query as safe in a consensus breaking release.
// Concretely, it means that the query is:
// 1. deterministic: given a block height, returns the exact same response
// upon multiple calls; and doesn't introduce any state-machine-breaking
Expand All @@ -32,4 +34,4 @@ extend google.protobuf.MethodOptions {
//
// When set to true, the query can safely be called
bool module_query_safe = 11110001;
}
}
4 changes: 2 additions & 2 deletions runtime/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,9 @@ func (a *App) PrepareCheckStater(ctx sdk.Context) {
func (a *App) InitChainer(ctx sdk.Context, req *abci.RequestInitChain) (*abci.ResponseInitChain, error) {
var genesisState map[string]json.RawMessage
if err := json.Unmarshal(req.AppStateBytes, &genesisState); err != nil {
panic(err)
return nil, err
}
return a.ModuleManager.InitGenesis(ctx, a.cdc, genesisState)
return a.ModuleManager.InitGenesis(ctx, genesisState)
}

// RegisterAPIRoutes registers all application module routes with the provided
Expand Down
15 changes: 2 additions & 13 deletions simapp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1"
"cosmossdk.io/client/v2/autocli"
"cosmossdk.io/core/appmodule"
"cosmossdk.io/log"
storetypes "cosmossdk.io/store/types"
"cosmossdk.io/x/accounts"
Expand Down Expand Up @@ -644,7 +643,7 @@ func (app *SimApp) InitChainer(ctx sdk.Context, req *abci.RequestInitChain) (*ab
if err != nil {
return nil, err
}
return app.ModuleManager.InitGenesis(ctx, app.appCodec, genesisState)
return app.ModuleManager.InitGenesis(ctx, genesisState)
}

// LoadHeight loads a particular height
Expand Down Expand Up @@ -680,18 +679,8 @@ func (app *SimApp) TxConfig() client.TxConfig {

// AutoCliOpts returns the autocli options for the app.
func (app *SimApp) AutoCliOpts() autocli.AppOptions {
modules := make(map[string]appmodule.AppModule, 0)
for _, m := range app.ModuleManager.Modules {
if moduleWithName, ok := m.(module.HasName); ok {
moduleName := moduleWithName.Name()
if appModule, ok := moduleWithName.(appmodule.AppModule); ok {
modules[moduleName] = appModule
}
}
}

return autocli.AppOptions{
Modules: modules,
Modules: app.ModuleManager.Modules,
ModuleOptions: runtimeservices.ExtractAutoCLIOptions(app.ModuleManager.Modules),
}
}
Expand Down
2 changes: 1 addition & 1 deletion simapp/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ func TestUpgradeStateOnGenesis(t *testing.T) {
vm, err := app.UpgradeKeeper.GetModuleVersionMap(ctx)
require.NoError(t, err)
for v, i := range app.ModuleManager.Modules {
if i, ok := i.(module.HasConsensusVersion); ok {
if i, ok := i.(appmodule.HasConsensusVersion); ok {
require.Equal(t, vm[v], i.ConsensusVersion())
}
}
Expand Down
2 changes: 1 addition & 1 deletion simapp/sim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func TestAppImportExport(t *testing.T) {

ctxA := app.NewContextLegacy(true, cmtproto.Header{Height: app.LastBlockHeight()})
ctxB := newApp.NewContextLegacy(true, cmtproto.Header{Height: app.LastBlockHeight()})
_, err = newApp.ModuleManager.InitGenesis(ctxB, app.AppCodec(), genesisState)
_, err = newApp.ModuleManager.InitGenesis(ctxB, genesisState)
if err != nil {
if strings.Contains(err.Error(), "validator set is empty after InitGenesis") {
logger.Info("Skipping simulation as all validators have been unbonded")
Expand Down
6 changes: 4 additions & 2 deletions tests/integration/gov/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,10 @@ func TestImportExportQueues(t *testing.T) {

authGenState, err := s1.AccountKeeper.ExportGenesis(ctx)
require.NoError(t, err)
bankGenState := s1.BankKeeper.ExportGenesis(ctx)
stakingGenState := s1.StakingKeeper.ExportGenesis(ctx)
bankGenState, err := s1.BankKeeper.ExportGenesis(ctx)
require.NoError(t, err)
stakingGenState, err := s1.StakingKeeper.ExportGenesis(ctx)
require.NoError(t, err)

// export the state and import it into a new app
govGenState, _ := gov.ExportGenesis(ctx, s1.GovKeeper)
Expand Down
Loading

0 comments on commit 91be717

Please sign in to comment.