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: sequence in sign-batch #13200

Merged
merged 13 commits into from
Sep 13, 2022
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (types) [#12154](https://github.com/cosmos/cosmos-sdk/pull/12154) Add `baseAccountGetter` to avoid invalid account error when create vesting account.
* (x/crisis) [#12208](https://github.com/cosmos/cosmos-sdk/pull/12208) Fix progress index of crisis invariant assertion logs.
* (types) [#12229](https://github.com/cosmos/cosmos-sdk/pull/12229) Increase sdk.Dec maxApproxRootIterations to 300
* (x/auth) [#13200](https://github.com/cosmos/cosmos-sdk/pull/13200) Fix wrong sequences in `sign-batch`

### State Machine Breaking

Expand Down
21 changes: 20 additions & 1 deletion x/auth/client/cli/tx_sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,26 @@ func makeSignBatchCmd() func(cmd *cobra.Command, args []string) error {
scanner := authclient.NewBatchScanner(txCfg, infile)

if !clientCtx.Offline {
txFactory = txFactory.WithAccountNumber(0).WithSequence(0)
if ms == "" {
from, err := cmd.Flags().GetString(flags.FlagFrom)
if err != nil {
return err
}

addr, _, _, err := client.GetFromFields(clientCtx, txFactory.Keybase(), from)
if err != nil {
return err
}

acc, err := txFactory.AccountRetriever().GetAccount(clientCtx, addr)
if err != nil {
return err
}

txFactory = txFactory.WithAccountNumber(acc.GetAccountNumber()).WithSequence(acc.GetSequence())
} else {
txFactory = txFactory.WithAccountNumber(0).WithSequence(0)
}
}

for sequence := txFactory.Sequence(); scanner.Scan(); sequence++ {
Expand Down