From 854c024ad9c6a9fbe8d3551cb9e6c3f55bc5fdfe Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 16 Dec 2024 11:24:37 +0100 Subject: [PATCH] chore: package release prep + update UPGRADING.md (backport #22864) (#22883) Co-authored-by: Julien Robert --- README.md | 55 ++++++++++++++----------- RELEASE_PROCESS.md | 31 ++++++++++++++ UPGRADING.md | 14 +++++++ docs/build/building-modules/00-intro.md | 2 + x/group/go.mod | 3 -- x/group/testutil/app_config.go | 1 - 6 files changed, 77 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 108c49357c78..cf3575c23790 100644 --- a/README.md +++ b/README.md @@ -34,8 +34,6 @@ The Cosmos SDK is a framework for building blockchain applications. [CometBFT (BFT Consensus)](https://github.com/cometbft/cometbft) and the Cosmos SDK are written in the Go programming language. Cosmos SDK is used to build [Gaia](https://github.com/cosmos/gaia), the implementation of the Cosmos Hub. -**WARNING**: The Cosmos SDK has mostly stabilized, but we are still making some breaking changes. - **Note**: Always use the latest maintained [Go](https://go.dev/dl) version for building Cosmos SDK applications. ## Quick Start @@ -64,16 +62,23 @@ The IBC module for the Cosmos SDK has its own [cosmos/ibc-go repository](https:/ The version matrix below shows which versions of the Cosmos SDK, modules and libraries are compatible with each other. +> [!IMPORTANT] +> Cosmos SDK `v2` corresponds to a chain using the `runtime/v2`, `server/v2/**`, and `store/v2` packages. The `github.com/cosmos/cosmos-sdk` module has a less important role in a `v2` chain. + #### Core Dependencies Core dependencies are the core libraries that an application may depend on. Core dependencies not mentioned here as compatible across all maintained SDK versions. +See an exhaustive list of core dependencies at [cosmossdk.io](https://cosmossdk.io). -| Cosmos SDK | cosmossdk.io/core | cosmossdk.io/api | cosmossdk.io/x/tx | -| ---------- | ----------------- | ---------------- | ----------------- | -| 0.52.z | 1.y.z | 0.8.z | 0.14.z | -| 0.50.z | 0.11.z | 0.7.z | 0.13.z | -| 0.47.z | 0.5.z | 0.3.z | N/A | +| Version | v2 | 0.52.z | 0.50.z | 0.47.z | +| ------------------------ | ----- | --------- | -------------- | ------- | +| cosmossdk.io/core | 1.y.z | 1.y.z | 0.11.z | 0.5.z | +| cosmossdk.io/api | 0.8.z | 0.8.z | 0.7.z | 0.3.z | +| cosmossdk.io/x/tx | 1.y.z | 1.y.z | < 1.y.z | N/A | +| cosmossdk.io/store | N/A | >= 1.10.z | 1.0.0 >= 1.9.z | N/A | +| cosmossdk.io/store/v2 | 2.y.z | N/A | N/A | N/A | +| cosmossdk.io/collections | 1.y.z | 1.y.z | < 1.y.z | < 1.y.z | #### Module Dependencies @@ -83,24 +88,24 @@ Module Dependencies are the modules that an application may depend on and which > X signals that the module was not spun out into its own go.mod file. > N/A signals that the module was not available in the Cosmos SDK at that time. -| Cosmos SDK | 0.50.z | 0.52.z | -| --------------------------- | ------ | ------ | -| cosmossdk.io/x/accounts | N/A | 0.2.z | -| cosmossdk.io/x/bank | X | 0.2.z | -| cosmossdk.io/x/circuit | 0.1.z | 0.2.z | -| cosmossdk.io/x/consensus | X | 0.2.z | -| cosmossdk.io/x/distribution | X | 0.2.z | -| cosmossdk.io/x/epochs | N/A | 0.2.z | -| cosmossdk.io/x/evidence | 0.1.z | 0.2.z | -| cosmossdk.io/x/feegrant | 0.1.z | 0.2.z | -| cosmossdk.io/x/gov | X | 0.2.z | -| cosmossdk.io/x/group | X | 0.2.z | -| cosmossdk.io/x/mint | X | 0.2.z | -| cosmossdk.io/x/nft | 0.1.z | 0.2.z | -| cosmossdk.io/x/protocolpool | N/A | 0.2.z | -| cosmossdk.io/x/slashing | X | 0.2.z | -| cosmossdk.io/x/staking | X | 0.2.z | -| cosmossdk.io/x/upgrade | 0.1.z | 0.2.z | +| Cosmos SDK | v2 | 0.52.z | 0.50.z | +| --------------------------- | ----- | ------ | ------ | +| cosmossdk.io/x/accounts | 0.2.z | 0.2.z | N/A | +| cosmossdk.io/x/bank | 0.2.z | 0.2.z | X | +| cosmossdk.io/x/circuit | 0.2.z | 0.2.z | 0.1.z | +| cosmossdk.io/x/consensus | 0.2.z | 0.2.z | X | +| cosmossdk.io/x/distribution | 0.2.z | 0.2.z | X | +| cosmossdk.io/x/epochs | 0.2.z | 0.2.z | N/A | +| cosmossdk.io/x/evidence | 0.2.z | 0.2.z | 0.1.z | +| cosmossdk.io/x/feegrant | 0.2.z | 0.2.z | 0.1.z | +| cosmossdk.io/x/gov | 0.2.z | 0.2.z | X | +| cosmossdk.io/x/group | 0.2.z | 0.2.z | X | +| cosmossdk.io/x/mint | 0.2.z | 0.2.z | X | +| cosmossdk.io/x/nft | 0.2.z | 0.2.z | 0.1.z | +| cosmossdk.io/x/protocolpool | 0.2.z | 0.2.z | N/A | +| cosmossdk.io/x/slashing | 0.2.z | 0.2.z | X | +| cosmossdk.io/x/staking | 0.2.z | 0.2.z | X | +| cosmossdk.io/x/upgrade | 0.2.z | 0.2.z | 0.1.z | ## Disambiguation diff --git a/RELEASE_PROCESS.md b/RELEASE_PROCESS.md index 23f52d0381e9..8fa84ed8f410 100644 --- a/RELEASE_PROCESS.md +++ b/RELEASE_PROCESS.md @@ -233,6 +233,37 @@ Those modules can be considered as part of the Cosmos SDK, but features and impr * When a module is supposed to be used in an app (e.g `x/` modules), due to the dependency on the SDK, tagging a new version of a module must be done from a Cosmos SDK release branch. A compatibility matrix must be provided in the `README.md` of that module with the corresponding versions. * Modules that import the SDK but do not need to be imported in an app (`e.g. cosmovisor`) must be released from the `main` branch and follow the process defined below. +> [!IMPORTANT] +> A module depending on a non stabilized version of `github.com/cosmos/cosmos-sdk` (any version prior to the removal of baseapp, runtime, server) SHOULD NOT be tagged following semver. +> For instance, modules are still using 0ver until the main `github.com/cosmos/cosmos-sdk` has stabilized. + ### Modules that do not depend on the Cosmos SDK Modules that do not depend on the Cosmos SDK can be released at any time from the `main` branch of the Cosmos SDK repository. + +## Go Monorepo Branching Strategy + +The Cosmos SDK uses a monorepo structure with multiple Go modules. Some components are tagged from the main branch, while others are tagged from release branches, as described above. + +Here's the strategy for managing this structure: + +All modules that do not depend on the Cosmos SDK and tagged from main in a release branch **must be removed from the release branch**. + +There are two exceptions to this rule, due to the stabilization of core v1: `cosmossdk.io/x/tx` and `cosmossdk.io/store` are still tagged from the `release/v0.50.x` branch for `v0.50.x` releases. + +### Rationale + +This strategy provides several benefits: + +1. Clean separation: Release branches only contain components that are actually released from those branches. +2. Avoid confusion: Prevents having outdated versions of standalone go modules in release branches. +3. Accurate representation: The release branch accurately represents what's being released from that branch. +4. Consistency: Aligns with the tagging strategy - components tagged from main aren't in release branches, and vice versa. + +### Additional Considerations + +* When backporting changes, be aware that standalone go modules changes will not be present in release branches. +* To reference the full state of the SDK at the time of branching, consider creating a separate tag on main at the point where each release branch is created. +* Ensure thorough testing of the release branch structure to avoid any integration issues. + +This branching strategy helps maintain a clear separation between components tagged from main and those tagged from release branches, while ensuring that release branches accurately represent the state of components that depend on the SDK. diff --git a/UPGRADING.md b/UPGRADING.md index 61641e571ed2..a9aee57cf21c 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -455,6 +455,16 @@ This change was made to allow legacy proposals to be compatible with server/v2. If you wish to migrate to server/v2, you should update your proposal handler to take in a `context.Context` and use services. On the other hand, if you wish to keep using baseapp, simply unwrap the sdk context in your proposal handler. +#### `x/mint` + +The `x/mint` module has been updated to work with a mint function [`MintFn`](https://docs.cosmos.network/v0.52/build/modules/mint#mintfn). + +When using the default inflation calculation function and runtime, no change is required. The depinject configuration of mint automatically sets it if none is provided. However, when not using runtime, the mint function must be set in on the mint keeper: + +```diff ++ mintKeeper.SetMintFn(keeper.DefaultMintFn(types.DefaultInflationCalculationFn, stakingKeeper, mintKeeper)) +``` + #### `x/protocolpool` Introducing a new `x/protocolpool` module to handle community pool funds. Its store must be added while upgrading to v0.52.x. @@ -488,3 +498,7 @@ storetypes.StoreUpgrades{ 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). + +#### `tools/benchmark` + +Introducing [`tools/benchmark`](https://github.com/cosmos/cosmos-sdk/tree/main/tools/benchmark) a Cosmos SDK module for benchmarking your chain. It is a standalone module that can be added to your chain to stress test it. This module should NOT be added in a production environment. diff --git a/docs/build/building-modules/00-intro.md b/docs/build/building-modules/00-intro.md index bd8e78a42380..10b21db77e18 100644 --- a/docs/build/building-modules/00-intro.md +++ b/docs/build/building-modules/00-intro.md @@ -63,6 +63,8 @@ While there are no definitive guidelines for writing modules, here are some impo The SDK provides a set of APIs that a module can implement, and a set of services that a module can use. Those APIs are defined in the `cosmossdk.io/core/appmodule` package, and are used to defined the module capabilities, which is used by `runtime` during the wiring of the application. +Whenever possible, a module should strive to use only the core APIs (`cosmossdk.io/core`) and not import the `github.com/cosmos/cosmos-sdk` module. This makes modules reusable accross SDK versions and reduces the risk of breaking changes. + Learn more about the core APIs for modules [here](../../learn/advanced/02-core.md). ## Main Components of Cosmos SDK Modules diff --git a/x/group/go.mod b/x/group/go.mod index 17577aa13b50..cd4e230e386b 100644 --- a/x/group/go.mod +++ b/x/group/go.mod @@ -11,7 +11,6 @@ require ( cosmossdk.io/math v1.4.0 cosmossdk.io/store v1.1.1-0.20240909133312-50288938d1b6 cosmossdk.io/x/accounts v0.0.0-20240913065641-0064ccbce64e - cosmossdk.io/x/authz v0.0.0-00010101000000-000000000000 cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91 cosmossdk.io/x/consensus v0.0.0-00010101000000-000000000000 cosmossdk.io/x/gov v0.0.0-20231113122742-912390d5fc4a @@ -188,10 +187,8 @@ replace ( cosmossdk.io/client/v2 => ../../client/v2 cosmossdk.io/store => cosmossdk.io/store v1.0.0-rc.0.0.20241204123127-eb3bf8b0469d // main cosmossdk.io/x/accounts => ../accounts - cosmossdk.io/x/authz => ../authz cosmossdk.io/x/bank => ../bank cosmossdk.io/x/consensus => ../consensus - cosmossdk.io/x/distribution => ../distribution cosmossdk.io/x/epochs => ../epochs cosmossdk.io/x/gov => ../gov cosmossdk.io/x/mint => ../mint diff --git a/x/group/testutil/app_config.go b/x/group/testutil/app_config.go index 017808f605d7..7d5c25768057 100644 --- a/x/group/testutil/app_config.go +++ b/x/group/testutil/app_config.go @@ -2,7 +2,6 @@ package testutil import ( _ "cosmossdk.io/x/accounts" // import as blank for app wiring - _ "cosmossdk.io/x/authz" // import as blank for app wiring _ "cosmossdk.io/x/bank" // import as blank for app wiring _ "cosmossdk.io/x/consensus" // import as blank for app wiring _ "cosmossdk.io/x/group/module" // import as blank for app wiring