Skip to content

Commit

Permalink
reduce branching
Browse files Browse the repository at this point in the history
  • Loading branch information
freeelancer committed Feb 26, 2024
1 parent 23fe780 commit b8f2482
Showing 1 changed file with 10 additions and 19 deletions.
29 changes: 10 additions & 19 deletions x/smartaccount/ante/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,28 +164,19 @@ func (sad SmartAccountAuthDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simu
return ctx, err
}
}
if !success && !setting.Fallback {
if success {
return next(ctx, tx, simulate)
} else if !setting.Fallback {
return ctx, sdkerrors.ErrUnauthorized.Wrap("authorization failed")
} else if !success && setting.Fallback {
// run through the default handlers for signature verification
newCtx, err := sad.defaultVerifySigDecorator(ctx, tx, simulate)
if err != nil {
return newCtx, err
}
// continue to the next handler after default signature verification
return next(newCtx, tx, simulate)
}
} else {
// run through the default handlers for signature verification
newCtx, err := sad.defaultVerifySigDecorator(ctx, tx, simulate)
if err != nil {
return newCtx, err
}
// continue to the next handler after default signature verification
return next(newCtx, tx, simulate)
}

return next(ctx, tx, simulate)
// run through the default handlers for signature verification
newCtx, err := sad.defaultVerifySigDecorator(ctx, tx, simulate)
if err != nil {
return newCtx, err
}
// continue to the next handler after default signature verification
return next(newCtx, tx, simulate)
}

// signatureDataToBz converts a SignatureData into raw bytes signature.
Expand Down

0 comments on commit b8f2482

Please sign in to comment.