From 0e5749ab8effbfe37afdfc42710ca1537721f31f Mon Sep 17 00:00:00 2001 From: Facundo Medica <14063057+facundomedica@users.noreply.github.com> Date: Tue, 5 Sep 2023 09:18:03 +0200 Subject: [PATCH] docs: Add notes regarding BeginBlocker and EndBlocker to upgrading.md (#17620) --- UPGRADING.md | 57 ++++++++++++++++++++++++++++++++++------------------ 1 file changed, 37 insertions(+), 20 deletions(-) diff --git a/UPGRADING.md b/UPGRADING.md index 1faeac4597..712bb5dfcc 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -294,7 +294,7 @@ References to `types/store.go` which contained aliases for store types have been ##### Extract Store to a standalone module -The `store` module is extracted to have a separate go.mod file which allows it be a standalone module. +The `store` module is extracted to have a separate go.mod file which allows it be a standalone module. All the store imports are now renamed to use `cosmossdk.io/store` instead of `github.com/cosmos/cosmos-sdk/store` across the SDK. ##### Streaming @@ -311,17 +311,17 @@ if err := app.RegisterStreamingServices(appOpts, app.kvStoreKeys()); err != nil #### Client -The return type of the interface method `TxConfig.SignModeHandler()` has been changed from `x/auth/signing.SignModeHandler` to `x/tx/signing.HandlerMap`. This change is transparent to most users as the `TxConfig` interface is typically implemented by private `x/auth/tx.config` struct (as returned by `auth.NewTxConfig`) which has been updated to return the new type. If users have implemented their own `TxConfig` interface, they will need to update their implementation to return the new type. +The return type of the interface method `TxConfig.SignModeHandler()` has been changed from `x/auth/signing.SignModeHandler` to `x/tx/signing.HandlerMap`. This change is transparent to most users as the `TxConfig` interface is typically implemented by private `x/auth/tx.config` struct (as returned by `auth.NewTxConfig`) which has been updated to return the new type. If users have implemented their own `TxConfig` interface, they will need to update their implementation to return the new type. ### Modules #### `**all**` * [RFC 001](https://docs.cosmos.network/main/rfc/rfc-001-tx-validation) has defined a simplification of the message validation process for modules. -The `sdk.Msg` interface has been updated to not require the implementation of the `ValidateBasic` method. -It is now recommended to validate message directly in the message server. When the validation is performed in the message server, the `ValidateBasic` method on a message is no longer required and can be removed. + The `sdk.Msg` interface has been updated to not require the implementation of the `ValidateBasic` method. + It is now recommended to validate message directly in the message server. When the validation is performed in the message server, the `ValidateBasic` method on a message is no longer required and can be removed. -* Messages no longer need to implement the `LegacyMsg` interface and implementations of `GetSignBytes` can be deleted. Because of this change, global legacy Amino codec definitions and their registration in `init()` can safely be removed as well. +* Messages no longer need to implement the `LegacyMsg` interface and implementations of `GetSignBytes` can be deleted. Because of this change, global legacy Amino codec definitions and their registration in `init()` can safely be removed as well. * The `AppModuleBasic` interface has been simplifed. Defining `GetTxCmd() *cobra.Command` and `GetQueryCmd() *cobra.Command` is no longer required. The module manager detects when module commands are defined. If AutoCLI is enabled, `EnhanceRootCommand()` will add the auto-generated commands to the root command, unless a custom module command is defined and register that one instead. @@ -337,9 +337,28 @@ It is now recommended to validate message directly in the message server. When t * `x/slashing` * `x/upgrade` +* 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) ++ BeginBlock(context.Context) error +``` + +```diff +- EndBlock(sdk.Context, abci.RequestEndBlock) []abci.ValidatorUpdate ++ EndBlock(context.Context) error +``` + +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) +``` + #### `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. +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. #### `x/capability` @@ -384,14 +403,14 @@ By default, the new `ProposalCancelRatio` parameter is set to `0.5` during migra ##### Extract evidence to a standalone module -The `x/evidence` module is extracted to have a separate go.mod file which allows it be a standalone module. +The `x/evidence` module is extracted to have a separate go.mod file which allows it be a standalone module. All the evidence imports are now renamed to use `cosmossdk.io/x/evidence` instead of `github.com/cosmos/cosmos-sdk/x/evidence` across the SDK. #### `x/nft` ##### Extract nft to a standalone module -The `x/nft` module is extracted to have a separate go.mod file which allows it to be a standalone module. +The `x/nft` module is extracted to have a separate go.mod file which allows it to be a standalone module. All the evidence imports are now renamed to use `cosmossdk.io/x/nft` instead of `github.com/cosmos/cosmos-sdk/x/nft` across the SDK. #### x/feegrant @@ -405,7 +424,7 @@ All the feegrant imports are now renamed to use `cosmossdk.io/x/feegrant` instea ##### Extract upgrade to a standalone module -The `x/upgrade` module is extracted to have a separate go.mod file which allows it to be a standalone module. +The `x/upgrade` module is extracted to have a separate go.mod file which allows it to be a standalone module. All the upgrade imports are now renamed to use `cosmossdk.io/x/upgrade` instead of `github.com/cosmos/cosmos-sdk/x/upgrade` across the SDK. ### Tooling @@ -414,7 +433,7 @@ All the upgrade imports are now renamed to use `cosmossdk.io/x/upgrade` instead Rosetta has moved to it's own [repo](https://github.com/cosmos/rosetta) and not imported by the Cosmos SDK SimApp by default. Any user who is interested on using the tool can connect it standalone to any node without the need to add it as part of the node binary. -The rosetta tool also allows multi chain connections. +The rosetta tool also allows multi chain connections. ## [v0.47.x](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.0) @@ -613,8 +632,8 @@ The `gov` module has been updated to support a minimum proposal deposit at submi parameter called `MinInitialDepositRatio`. When multiplied by the existing `MinDeposit` parameter, it produces the necessary proportion of coins needed at the proposal submission time. The motivation for this change is to prevent proposal spamming. -By default, the new `MinInitialDepositRatio` parameter is set to zero during migration. The value of zero signifies that this -feature is disabled. If chains wish to utilize the minimum proposal deposits at time of submission, the migration logic needs to be +By default, the new `MinInitialDepositRatio` parameter is set to zero during migration. The value of zero signifies that this +feature is disabled. If chains wish to utilize the minimum proposal deposits at time of submission, the migration logic needs to be modified to set the new parameter to the desired value. ##### New `Proposal.Proposer` field @@ -755,13 +774,11 @@ The keyring has been refactored in v0.46. * The keys' implementation has been refactored to be serialized as proto. * `keyring.NewInMemory` and `keyring.New` takes now a `codec.Codec`. * Take `keyring.Record` instead of `Info` as first argument in: - * `MkConsKeyOutput` - * `MkValKeyOutput` - * `MkAccKeyOutput` + _ `MkConsKeyOutput` + _ `MkValKeyOutput` \* `MkAccKeyOutput` * Rename: - * `SavePubKey` to `SaveOfflineKey` and remove the `algo` argument. - * `NewMultiInfo`, `NewLedgerInfo` to `NewLegacyMultiInfo`, `newLegacyLedgerInfo` respectively. - * `NewOfflineInfo` to `newLegacyOfflineInfo` and move it to `migration_test.go`. + _ `SavePubKey` to `SaveOfflineKey` and remove the `algo` argument. + _ `NewMultiInfo`, `NewLedgerInfo` to `NewLegacyMultiInfo`, `newLegacyLedgerInfo` respectively. \* `NewOfflineInfo` to `newLegacyOfflineInfo` and move it to `migration_test.go`. ### PostHandler @@ -788,7 +805,7 @@ mistakes. #### `x/params` -* The `x/params` module has been depreacted in favour of each module housing and providing way to modify their parameters. Each module that has parameters that are changable during runtime have an authority, the authority can be a module or user account. The Cosmos SDK team recommends migrating modules away from using the param module. An example of how this could look like can be found [here](https://github.com/cosmos/cosmos-sdk/pull/12363). +* The `x/params` module has been depreacted in favour of each module housing and providing way to modify their parameters. Each module that has parameters that are changable during runtime have an authority, the authority can be a module or user account. The Cosmos SDK team recommends migrating modules away from using the param module. An example of how this could look like can be found [here](https://github.com/cosmos/cosmos-sdk/pull/12363). * The Param module will be maintained until April 18, 2023. At this point the module will reach end of life and be removed from the Cosmos SDK. #### `x/gov` @@ -811,7 +828,7 @@ Instead, the SDK uses [`buf`](https://buf.build). Clients should have their own The protos can as well be downloaded using `buf export buf.build/cosmos/cosmos-sdk:8cb30a2c4de74dc9bd8d260b1e75e176 --output `. -Cosmos message protobufs should be extended with `cosmos.msg.v1.signer`: +Cosmos message protobufs should be extended with `cosmos.msg.v1.signer`: ```protobuf message MsgSetWithdrawAddress {