Skip to content

Commit

Permalink
change to senderAcc
Browse files Browse the repository at this point in the history
  • Loading branch information
freeelancer committed Mar 7, 2024
1 parent 33943b0 commit d8a0a4f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
10 changes: 5 additions & 5 deletions x/smartaccount/ante/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,20 +156,20 @@ func (sad SmartAccountAuthDecorator) GetParamsForCustomAuthVerification(
return nil, nil, nil, err
}

acc, err := authante.GetSignerAcc(ctx, sad.accountKeeper, account)
senderAcc, err := authante.GetSignerAcc(ctx, sad.accountKeeper, senderAddr)
if err != nil {
return nil, nil, nil, err
}
var accNum uint64
var senderAccNum uint64
if ctx.BlockHeight() != 0 {
accNum = acc.GetAccountNumber()
senderAccNum = senderAcc.GetAccountNumber()
}

signerData := authsigning.SignerData{
Address: senderAddr.String(),
ChainID: ctx.ChainID(),
AccountNumber: accNum,
Sequence: acc.GetSequence(),
AccountNumber: senderAccNum,
Sequence: senderAcc.GetSequence(),
PubKey: signature.PubKey,
}

Expand Down
9 changes: 5 additions & 4 deletions x/smartaccount/ante/tests/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ func (s *AnteTestSuite) TestAuthAnteHandler() {
func (s *AnteTestSuite) BuildDefaultMsgTx(accountIndex int, msgs ...sdk.Msg) client.TxBuilder {
pk := s.TestAccPrivs[accountIndex]
sender := s.TestAccs[accountIndex]
acc := s.App.Keepers.AccountKeeper.GetAccount(s.Ctx, msgs[0].GetSigners()[0])
senderAcc := s.App.Keepers.AccountKeeper.GetAccount(s.Ctx, sender)
senderSeq := senderAcc.GetSequence()
txBuilder := s.EncodingConfig.TxConfig.NewTxBuilder()
err := txBuilder.SetMsgs(
msgs...,
Expand All @@ -109,8 +110,8 @@ func (s *AnteTestSuite) BuildDefaultMsgTx(accountIndex int, msgs ...sdk.Msg) cli
signer := authsigning.SignerData{
Address: sender.String(),
ChainID: "test",
AccountNumber: acc.GetAccountNumber(),
Sequence: acc.GetSequence(),
AccountNumber: senderAcc.GetAccountNumber(),
Sequence: senderSeq,
PubKey: pk.PubKey(),
}

Expand All @@ -132,7 +133,7 @@ func (s *AnteTestSuite) BuildDefaultMsgTx(accountIndex int, msgs ...sdk.Msg) cli
txBuilder,
pk,
s.EncodingConfig.TxConfig,
acc.GetSequence(),
senderSeq,
)
require.NoError(s.T(), err)

Expand Down

0 comments on commit d8a0a4f

Please sign in to comment.