diff --git a/x/auth/ante/sigverify.go b/x/auth/ante/sigverify.go index ce2a0d0b75d8..49f91c56c782 100644 --- a/x/auth/ante/sigverify.go +++ b/x/auth/ante/sigverify.go @@ -69,22 +69,24 @@ type AccountAbstractionKeeper interface { // // CONTRACT: Tx must implement SigVerifiableTx interface type SigVerificationDecorator struct { - ak AccountKeeper - aaKeeper AccountAbstractionKeeper - signModeHandler *txsigning.HandlerMap - sigGasConsumer SignatureVerificationGasConsumer + ak AccountKeeper + aaKeeper AccountAbstractionKeeper + signModeHandler *txsigning.HandlerMap + sigGasConsumer SignatureVerificationGasConsumer + extraVerifyIsOnCurve func(pubKey cryptotypes.PubKey) (bool, error) } func NewSigVerificationDecorator(ak AccountKeeper, signModeHandler *txsigning.HandlerMap, sigGasConsumer SignatureVerificationGasConsumer, aaKeeper AccountAbstractionKeeper) SigVerificationDecorator { - return NewSigVerificationDecoratorWithVerifyOnCurve(ak, signModeHandler, sigGasConsumer, aaKeeper) + return NewSigVerificationDecoratorWithVerifyOnCurve(ak, signModeHandler, sigGasConsumer, aaKeeper, nil) } -func NewSigVerificationDecoratorWithVerifyOnCurve(ak AccountKeeper, signModeHandler *txsigning.HandlerMap, sigGasConsumer SignatureVerificationGasConsumer, aaKeeper AccountAbstractionKeeper) SigVerificationDecorator { +func NewSigVerificationDecoratorWithVerifyOnCurve(ak AccountKeeper, signModeHandler *txsigning.HandlerMap, sigGasConsumer SignatureVerificationGasConsumer, aaKeeper AccountAbstractionKeeper, verifyFn func(pubKey cryptotypes.PubKey) (bool, error)) SigVerificationDecorator { return SigVerificationDecorator{ - aaKeeper: aaKeeper, - ak: ak, - signModeHandler: signModeHandler, - sigGasConsumer: sigGasConsumer, + aaKeeper: aaKeeper, + ak: ak, + signModeHandler: signModeHandler, + sigGasConsumer: sigGasConsumer, + extraVerifyIsOnCurve: verifyFn, } } @@ -110,6 +112,12 @@ func OnlyLegacyAminoSigners(sigData signing.SignatureData) bool { } func (svd SigVerificationDecorator) VerifyIsOnCurve(pubKey cryptotypes.PubKey) error { + if svd.extraVerifyIsOnCurve != nil { + handled, err := svd.extraVerifyIsOnCurve(pubKey) + if handled { + return err + } + } // when simulating pubKey.Key will always be nil if pubKey.Bytes() == nil { return nil