From 33183fe4c8793d7520e5f936324c8607754a4a26 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Mon, 23 Oct 2023 19:46:40 +0200 Subject: [PATCH] chore: move upgrading section and remove empty package (#18223) --- UPGRADING.md | 96 +++++++++++++++++++++++----------------------- x/gov/codec/doc.go | 19 --------- 2 files changed, 48 insertions(+), 67 deletions(-) delete mode 100644 x/gov/codec/doc.go diff --git a/UPGRADING.md b/UPGRADING.md index 93b745cb74..736f1eff14 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -32,54 +32,6 @@ clientCtx = clientCtx. Refer to SimApp `root_v2.go` and `root.go` for an example with an app v2 and a legacy app. -#### Textual sign mode - -A new sign mode is available in the SDK that produces more human readable output, currently only available on Ledger -devices but soon to be implemented in other UIs. - -:::tip -This sign mode does not allow offline signing -::: - -When using (legacy) application wiring, the following must be added to `app.go` after setting the app's bank keeper: - -```golang - enabledSignModes := append(tx.DefaultSignModes, sigtypes.SignMode_SIGN_MODE_TEXTUAL) - txConfigOpts := tx.ConfigOptions{ - EnabledSignModes: enabledSignModes, - TextualCoinMetadataQueryFn: txmodule.NewBankKeeperCoinMetadataQueryFn(app.BankKeeper), - } - txConfig, err := tx.NewTxConfigWithOptions( - appCodec, - txConfigOpts, - ) - if err != nil { - log.Fatalf("Failed to create new TxConfig with options: %v", err) - } - app.txConfig = txConfig -``` - -And in the application client (usually `root.go`): - -```golang - if !clientCtx.Offline { - txConfigOpts.EnabledSignModes = append(txConfigOpts.EnabledSignModes, signing.SignMode_SIGN_MODE_TEXTUAL) - txConfigOpts.TextualCoinMetadataQueryFn = txmodule.NewGRPCCoinMetadataQueryFn(clientCtx) - txConfigWithTextual, err := tx.NewTxConfigWithOptions( - codec.NewProtoCodec(clientCtx.InterfaceRegistry), - txConfigOpts, - ) - if err != nil { - return err - } - clientCtx = clientCtx.WithTxConfig(txConfigWithTextual) - } -``` - -When using `depinject` / `app v2`, **it's enabled by default** if there's a bank keeper present. - -To learn more see the [docs](https://docs.cosmos.network/main/learn/advanced/transactions#sign_mode_textual) and the [ADR-050](https://docs.cosmos.network/main/build/architecture/adr-050-sign-mode-textual). - ### Modules #### `x/group` @@ -453,6 +405,54 @@ if err := app.RegisterStreamingServices(appOpts, app.kvStoreKeys()); err != nil 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. +##### Textual sign mode + +A new sign mode is available in the SDK that produces more human readable output, currently only available on Ledger +devices but soon to be implemented in other UIs. + +:::tip +This sign mode does not allow offline signing +::: + +When using (legacy) application wiring, the following must be added to `app.go` after setting the app's bank keeper: + +```golang + enabledSignModes := append(tx.DefaultSignModes, sigtypes.SignMode_SIGN_MODE_TEXTUAL) + txConfigOpts := tx.ConfigOptions{ + EnabledSignModes: enabledSignModes, + TextualCoinMetadataQueryFn: txmodule.NewBankKeeperCoinMetadataQueryFn(app.BankKeeper), + } + txConfig, err := tx.NewTxConfigWithOptions( + appCodec, + txConfigOpts, + ) + if err != nil { + log.Fatalf("Failed to create new TxConfig with options: %v", err) + } + app.txConfig = txConfig +``` + +And in the application client (usually `root.go`): + +```golang + if !clientCtx.Offline { + txConfigOpts.EnabledSignModes = append(txConfigOpts.EnabledSignModes, signing.SignMode_SIGN_MODE_TEXTUAL) + txConfigOpts.TextualCoinMetadataQueryFn = txmodule.NewGRPCCoinMetadataQueryFn(clientCtx) + txConfigWithTextual, err := tx.NewTxConfigWithOptions( + codec.NewProtoCodec(clientCtx.InterfaceRegistry), + txConfigOpts, + ) + if err != nil { + return err + } + clientCtx = clientCtx.WithTxConfig(txConfigWithTextual) + } +``` + +When using `depinject` / `app v2`, **it's enabled by default** if there's a bank keeper present. + +To learn more see the [docs](https://docs.cosmos.network/main/learn/advanced/transactions#sign_mode_textual) and the [ADR-050](https://docs.cosmos.network/main/build/architecture/adr-050-sign-mode-textual). + ### Modules #### `**all**` diff --git a/x/gov/codec/doc.go b/x/gov/codec/doc.go deleted file mode 100644 index c3f3b76564..0000000000 --- a/x/gov/codec/doc.go +++ /dev/null @@ -1,19 +0,0 @@ -/* -Package codec provides a singleton instance of Amino codec that should be used to register -any concrete type that can later be referenced inside a MsgSubmitProposal instance so that they -can be (de)serialized properly. - -Amino types should be ideally registered inside this codec within the init function of each module's -codec.go file as follows: - - func init() { - // ... - - RegisterLegacyAminoCodec(govcodec.Amino) - RegisterLegacyAminoCodec(groupcodec.Amino) - - } - -The codec instance is put inside this package and not the x/gov/types package in order to avoid any dependency cycle. -*/ -package codec