Skip to content

Commit

Permalink
refactor: moved simulation check
Browse files Browse the repository at this point in the history
javiersuweijie committed Mar 12, 2024
1 parent bbb9e44 commit 2a77d90
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions x/smartaccount/ante/auth.go
Original file line number Diff line number Diff line change
@@ -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 {

0 comments on commit 2a77d90

Please sign in to comment.