fix(x/auth): check if simulation in verifyIsOnCurve (#19099)

Co-authored-by: Marko <marbar3778@yahoo.com>
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
This commit is contained in:
Julián Toledano 2024-01-24 14:13:25 +01:00 committed by GitHub
parent 3c4a91efd0
commit 38d56db428
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 0 deletions

View File

@ -48,3 +48,8 @@ Ref: https://keepachangelog.com/en/1.0.0/
* [#18817](https://github.com/cosmos/cosmos-sdk/pull/18817) SigVerification, GasConsumption, IncreaseSequence ante decorators have all been joined into one SigVerification decorator. Gas consumption during TX validation flow has reduced.
* [#19093](https://github.com/cosmos/cosmos-sdk/pull/19093) SetPubKeyDecorator was merged into SigVerification, gas consumption is almost halved for a simple tx.
### Bug Fixes
* [#19099](https://github.com/cosmos/cosmos-sdk/pull/19099) `verifyIsOnCurve` now checks if we are simulating to avoid malformed public key error.

View File

@ -95,6 +95,11 @@ func OnlyLegacyAminoSigners(sigData signing.SignatureData) bool {
}
func verifyIsOnCurve(pubKey cryptotypes.PubKey) (err error) {
// when simulating pubKey.Key will always be nil
if pubKey.Bytes() == nil {
return nil
}
switch typedPubKey := pubKey.(type) {
case *secp256k1.PubKey:
pubKeyObject, err := secp256k1dcrd.ParsePubKey(typedPubKey.Bytes())