Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(x/auth): Add fees on batch sign #18564

Merged
merged 12 commits into from
Nov 29, 2023
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Bug Fixes

* (baseapp) [#18564](https://github.com/cosmos/cosmos-sdk/pull/18564) Fix total fees when batch signing
raynaudoe marked this conversation as resolved.
Show resolved Hide resolved
raynaudoe marked this conversation as resolved.
Show resolved Hide resolved
* (client/keys) [#18562](https://github.com/cosmos/cosmos-sdk/pull/18562) `keys delete` won't terminate when a key is not found
* (server) [#18537](https://github.com/cosmos/cosmos-sdk/pull/18537) Fix panic when defining minimum gas config as `100stake;100uatom`. Use a `,` delimiter instead of `;`. Fixes the server config getter to use the correct delimiter.
* (client/tx) [#18472](https://github.com/cosmos/cosmos-sdk/pull/18472) Utilizes the correct Pubkey when simulating a transaction.
Expand Down
10 changes: 9 additions & 1 deletion x/auth/client/cli/tx_sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ func makeSignBatchCmd() func(cmd *cobra.Command, args []string) error {
txBuilder := txCfg.NewTxBuilder()
msgs := make([]sdk.Msg, 0)
newGasLimit := uint64(0)
feeAmount := sdk.Coins{}
raynaudoe marked this conversation as resolved.
Show resolved Hide resolved

for scanner.Scan() {
unsignedStdTx := scanner.Tx()
Expand All @@ -129,6 +130,11 @@ func makeSignBatchCmd() func(cmd *cobra.Command, args []string) error {
}
// increment the gas
newGasLimit += fe.GetTx().GetGas()
// Add the fees
fees := fe.GetTx().GetFee()
for _, fee := range fees {
raynaudoe marked this conversation as resolved.
Show resolved Hide resolved
feeAmount = feeAmount.Add(fee)
}
// append messages
msgs = append(msgs, unsignedStdTx.GetMsgs()...)
}
Expand All @@ -140,13 +146,15 @@ func makeSignBatchCmd() func(cmd *cobra.Command, args []string) error {

// set the memo,fees,feeGranter,feePayer from cmd flags
txBuilder.SetMemo(txFactory.Memo())
txBuilder.SetFeeAmount(txFactory.Fees())
txBuilder.SetFeeGranter(clientCtx.FeeGranter)
txBuilder.SetFeePayer(clientCtx.FeePayer)

// set the gasLimit
txBuilder.SetGasLimit(newGasLimit)

// set the feeAmount
txBuilder.SetFeeAmount(feeAmount)
raynaudoe marked this conversation as resolved.
Show resolved Hide resolved

// sign the txs
from, _ := cmd.Flags().GetString(flags.FlagFrom)
err := sigTxOrMultisig(clientCtx, txBuilder, txFactory, from, multisigKey)
Expand Down