From 2a77d90aee621855b54b0b9dd5586e0ec1d31dcb Mon Sep 17 00:00:00 2001 From: javiersuweijie Date: Tue, 12 Mar 2024 17:34:33 +0800 Subject: [PATCH] refactor: moved simulation check --- x/smartaccount/ante/auth.go | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/x/smartaccount/ante/auth.go b/x/smartaccount/ante/auth.go index 1234001a..10328de8 100644 --- a/x/smartaccount/ante/auth.go +++ b/x/smartaccount/ante/auth.go @@ -63,15 +63,6 @@ func (sad SmartAccountAuthDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simu account := signers[0] accountStr := account.String() - // skip authorization checks if simulate since no signatures will be provided - if simulate { - setting, err := sad.smartAccountKeeper.GetSetting(ctx, accountStr) - if err == nil { - ctx = ctx.WithValue(types.ModuleName, setting) - } - return next(ctx, tx, simulate) - } - // check if the tx is from a smart account setting, err := sad.smartAccountKeeper.GetSetting(ctx, accountStr) if sdkerrors.ErrKeyNotFound.Is(err) { @@ -86,6 +77,10 @@ func (sad SmartAccountAuthDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simu return ctx, err } ctx = ctx.WithValue(types.ModuleName, setting) + // skip authorization checks if simulate since no signatures will be provided + if simulate { + return next(ctx, tx, simulate) + } // Current smartaccount only supports one signer (TODO review in the future) if len(signers) != 1 {