From 71bb257474d24aece386b691120feb933598ec64 Mon Sep 17 00:00:00 2001 From: Amaury M <1293565+amaurym@users.noreply.github.com> Date: Wed, 1 Jun 2022 10:05:17 +0200 Subject: [PATCH] docs: Ignore tips with TipDecorator is absent --- client/flags/flags.go | 2 +- docs/core/tips.md | 6 ++++-- proto/cosmos/tx/v1beta1/tx.proto | 13 ++++++++++--- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/client/flags/flags.go b/client/flags/flags.go index b120e2fb7262..12bd7fd24cf4 100644 --- a/client/flags/flags.go +++ b/client/flags/flags.go @@ -123,7 +123,7 @@ func AddTxFlagsToCmd(cmd *cobra.Command) { cmd.Flags().Uint64(FlagTimeoutHeight, 0, "Set a block timeout height to prevent the tx from being committed past a certain height") cmd.Flags().String(FlagFeePayer, "", "Fee payer pays fees for the transaction instead of deducting from the signer") cmd.Flags().String(FlagFeeGranter, "", "Fee granter grants fees for the transaction") - cmd.Flags().String(FlagTip, "", "Tip is the amount that is going to be transferred to the fee payer on the target chain. This flag is only valid when used with --aux") + cmd.Flags().String(FlagTip, "", "Tip is the amount that is going to be transferred to the fee payer on the target chain. This flag is only valid when used with --aux, and is ignored if the target chain didn't enable the TipDecorator") cmd.Flags().Bool(FlagAux, false, "Generate aux signer data instead of sending a tx") // --gas can accept integers and "auto" diff --git a/docs/core/tips.md b/docs/core/tips.md index 45914a185c58..1f7ef11b8c55 100644 --- a/docs/core/tips.md +++ b/docs/core/tips.md @@ -72,10 +72,12 @@ In both cases, using `SIGN_MODE_LEGACY_AMINO_JSON` is recommended only if hardwa ## Enabling Tips on your Chain -The transaction tips functionality is introduced in Cosmos SDK v0.46, so earlier versions do not have support for tips. It is however not included by default in a v0.46 app. Enabling tips on your chain is done by adding the `TipDecorator` in your posthandler chain: +The transaction tips functionality is introduced in Cosmos SDK v0.46, so earlier versions do not have support for tips. It is however not included by default in a v0.46 app. Sending a transaction with tips to a chain which didn't enable tips will result in a no-op, i.e. the `tip` field in the transaction will be ignored. + +Enabling tips on a chain is done by adding the `TipDecorator` in the posthandler chain: ```go -// HandlerOptions are the options required for constructing a default SDK PostHandler. +// HandlerOptions are the options required for constructing a SDK PostHandler which supports tips. type HandlerOptions struct { BankKeeper types.BankKeeper } diff --git a/proto/cosmos/tx/v1beta1/tx.proto b/proto/cosmos/tx/v1beta1/tx.proto index b015604e3177..a71a3e115dc5 100644 --- a/proto/cosmos/tx/v1beta1/tx.proto +++ b/proto/cosmos/tx/v1beta1/tx.proto @@ -87,8 +87,12 @@ message SignDocDirectAux { // sequence is the sequence number of the signing account. uint64 sequence = 5; - // Tip is the optional tip used for meta-transactions. It should be left - // empty if the signer is not the tipper for this transaction. + // Tip is the optional tip used for transactions fees paid in another denom. + // It should be left empty if the signer is not the tipper for this + // transaction. + // + // This field is ignored if the chain didn't enable tips, i.e. didn't add the + // `TipDecorator` in its posthandler. Tip tip = 6; } @@ -138,7 +142,10 @@ message AuthInfo { // of the signers. This can be estimated via simulation. Fee fee = 2; - // Tip is the optional tip used for meta-transactions. + // Tip is the optional tip used for transactions fees paid in another denom. + // + // This field is ignored if the chain didn't enable tips, i.e. didn't add the + // `TipDecorator` in its posthandler. // // Since: cosmos-sdk 0.46 Tip tip = 3;