Skip to content

Commit

Permalink
docs: Ignore tips when TipDecorator is absent (#12105) (#12107)
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Jun 1, 2022
1 parent df70191 commit 53ab1a0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion client/flags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 4 additions & 2 deletions docs/core/tips.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
13 changes: 10 additions & 3 deletions proto/cosmos/tx/v1beta1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 53ab1a0

Please sign in to comment.