Skip to content

Commit

Permalink
Revert extraVerifyIsOnCurve change
Browse files Browse the repository at this point in the history
  • Loading branch information
zivkovicmilos committed Jan 9, 2025
1 parent f546360 commit e69102c
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions x/auth/ante/sigverify.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}

Expand All @@ -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
Expand Down

0 comments on commit e69102c

Please sign in to comment.