From d8a0a4feb612bdb4fc513b3c7d1b9ccdb0d643d1 Mon Sep 17 00:00:00 2001 From: freeelancer Date: Thu, 7 Mar 2024 17:04:05 +0800 Subject: [PATCH] change to senderAcc --- x/smartaccount/ante/auth.go | 10 +++++----- x/smartaccount/ante/tests/auth_test.go | 9 +++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/x/smartaccount/ante/auth.go b/x/smartaccount/ante/auth.go index caaefe46..c7899b22 100644 --- a/x/smartaccount/ante/auth.go +++ b/x/smartaccount/ante/auth.go @@ -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, } diff --git a/x/smartaccount/ante/tests/auth_test.go b/x/smartaccount/ante/tests/auth_test.go index ef42c946..4c86320f 100644 --- a/x/smartaccount/ante/tests/auth_test.go +++ b/x/smartaccount/ante/tests/auth_test.go @@ -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..., @@ -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(), } @@ -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)