fix: change the behavior of offline mode correctly (#15123)
## Description Closes: #15109 Change to work only when `FlagAccountNumber` and `FlagSequence` are in offline mode. In other cases, use `AccountRetriever` to populate those values. --- ### Author Checklist *All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.* I have... - [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] added `!` to the type prefix if API or client breaking change - [ ] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#pr-targeting)) - [ ] provided a link to the relevant issue or specification - [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/building-modules) - [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#testing) - [ ] added a changelog entry to `CHANGELOG.md` - [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] updated the relevant documentation or specification - [ ] reviewed "Files changed" and left comments if necessary - [ ] confirmed all CI checks have passed ### Reviewers Checklist *All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.* I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed `!` in the type prefix if API or client breaking change - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable)
This commit is contained in:
+14
-3
@@ -1213,9 +1213,20 @@ func (s *E2ETestSuite) TestCLIMultisign() {
|
||||
sign2File := testutil.WriteToNewTempFile(s.T(), account2Signature.String())
|
||||
defer sign2File.Close()
|
||||
|
||||
// Does not work in offline mode.
|
||||
_, err = authclitestutil.TxMultiSignExec(val1.ClientCtx, multisigRecord.Name, multiGeneratedTxFile.Name(), "--offline", sign1File.Name(), sign2File.Name())
|
||||
s.Require().EqualError(err, fmt.Sprintf("couldn't verify signature for address %s", addr1))
|
||||
// Work in offline mode.
|
||||
multisigAccNum, multisigSeq, err := val1.ClientCtx.AccountRetriever.GetAccountNumberSequence(val1.ClientCtx, addr)
|
||||
s.Require().NoError(err)
|
||||
_, err = authclitestutil.TxMultiSignExec(
|
||||
val1.ClientCtx,
|
||||
multisigRecord.Name,
|
||||
multiGeneratedTxFile.Name(),
|
||||
fmt.Sprintf("--%s", flags.FlagOffline),
|
||||
fmt.Sprintf("--%s=%d", flags.FlagAccountNumber, multisigAccNum),
|
||||
fmt.Sprintf("--%s=%d", flags.FlagSequence, multisigSeq),
|
||||
sign1File.Name(),
|
||||
sign2File.Name(),
|
||||
)
|
||||
s.Require().NoError(err)
|
||||
|
||||
val1.ClientCtx.Offline = false
|
||||
multiSigWith2Signatures, err := authclitestutil.TxMultiSignExec(val1.ClientCtx, multisigRecord.Name, multiGeneratedTxFile.Name(), sign1File.Name(), sign2File.Name())
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
errorsmod "cosmossdk.io/errors"
|
||||
|
||||
"cosmossdk.io/simapp"
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/flags"
|
||||
@@ -90,6 +91,8 @@ func (s *E2ETestSuite) SetupSuite() {
|
||||
sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(1)),
|
||||
),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s", flags.FlagOffline),
|
||||
fmt.Sprintf("--%s=0", flags.FlagAccountNumber),
|
||||
fmt.Sprintf("--%s=2", flags.FlagSequence),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()),
|
||||
|
||||
Reference in New Issue
Block a user