Skip to content

Commit

Permalink
Optimize AnteHandle method to skip checks if disabledMsgs is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
fx0x55 committed Aug 1, 2024
1 parent 3509552 commit 6a56f89
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/ante/authz.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ func NewAuthzLimiterDecorator(disabledMsgTypes []string) AuthzLimiterDecorator {
}

func (ald AuthzLimiterDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) {
if len(ald.disabledMsgs) == 0 {
return next(ctx, tx, simulate)

Check warning on line 52 in app/ante/authz.go

View check run for this annotation

Codecov / codecov/patch

app/ante/authz.go#L52

Added line #L52 was not covered by tests
}

if err := ald.checkDisabledMsgs(tx.GetMsgs(), false, 0); err != nil {
return ctx, errorsmod.Wrapf(errortypes.ErrUnauthorized, err.Error())
}
Expand Down

0 comments on commit 6a56f89

Please sign in to comment.