diff --git a/test/features/basic-features/scenarios/crypto_verify_bls.scen.json b/test/features/basic-features/scenarios/crypto_verify_bls.scen.json index fc67a3745..99d683d28 100644 --- a/test/features/basic-features/scenarios/crypto_verify_bls.scen.json +++ b/test/features/basic-features/scenarios/crypto_verify_bls.scen.json @@ -58,7 +58,7 @@ "expect": { "out": [], "status": "10", - "message": "str:err blsSignatureDeserialize 0032a2ddf341c08d1eb7232f05dc34e4454155e676b58c40fddf9a036562ac2c01533d2d557cb49d73aa9d7a89744696", + "message": "str:signature is invalid", "logs": "*", "gas": "*", "refund": "*" diff --git a/test/features/basic-features/scenarios/crypto_verify_bls_aggregated_signature.scen.json b/test/features/basic-features/scenarios/crypto_verify_bls_aggregated_signature.scen.json index 546c0d4c9..490fb1de8 100644 --- a/test/features/basic-features/scenarios/crypto_verify_bls_aggregated_signature.scen.json +++ b/test/features/basic-features/scenarios/crypto_verify_bls_aggregated_signature.scen.json @@ -70,7 +70,7 @@ "expect": { "out": [], "status": "10", - "message": "str:err blsSignatureDeserialize 0012858363e8caa5b398d3febdd7bc01bc2fae1fef8f486ff4d84a5f3342f2d38085904eb10b73c0879a45d23585ce8f", + "message": "str:signature is invalid", "logs": "*", "gas": "*", "refund": "*" diff --git a/test/features/basic-features/scenarios/crypto_verify_bls_share.scen.json b/test/features/basic-features/scenarios/crypto_verify_bls_share.scen.json index fa7c21611..2fe8473f5 100644 --- a/test/features/basic-features/scenarios/crypto_verify_bls_share.scen.json +++ b/test/features/basic-features/scenarios/crypto_verify_bls_share.scen.json @@ -58,7 +58,7 @@ "expect": { "out": [], "status": "10", - "message": "str:err blsSignatureDeserialize ff725db195e37aa237cdbbda76270d4a229b6e7a3651104dc58c4349c0388e8546976fe54a04240530b99064e434c90f", + "message": "str:signature is invalid", "logs": "*", "gas": "*", "refund": "*" diff --git a/test/features/basic-features/scenarios/crypto_verify_secp256r1.scen.json b/test/features/basic-features/scenarios/crypto_verify_secp256r1.scen.json index 1c35b4627..5d22d63d9 100644 --- a/test/features/basic-features/scenarios/crypto_verify_secp256r1.scen.json +++ b/test/features/basic-features/scenarios/crypto_verify_secp256r1.scen.json @@ -57,7 +57,7 @@ "expect": { "out": [], "status": "10", - "message": "str:signature verification failed", + "message": "str:signature is invalid", "logs": "*", "gas": "*", "refund": "*" diff --git a/vmhost/errors.go b/vmhost/errors.go index e57facf55..f5a3faa55 100644 --- a/vmhost/errors.go +++ b/vmhost/errors.go @@ -301,3 +301,6 @@ var ErrNilMapOpcodeAddress = errors.New("nil map opcode address") // ErrOpcodeIsNotAllowed signals that opcode is not allowed for the address var ErrOpcodeIsNotAllowed = errors.New("opcode is not allowed") + +// ErrInvalidSignature signals that a signature verification failed +var ErrInvalidSignature = errors.New("signature is invalid") diff --git a/vmhost/vmhooks/cryptoei.go b/vmhost/vmhooks/cryptoei.go index 5415f34b7..6b3d6096e 100644 --- a/vmhost/vmhooks/cryptoei.go +++ b/vmhost/vmhooks/cryptoei.go @@ -2,6 +2,7 @@ package vmhooks import ( "crypto/elliptic" + "github.com/multiversx/mx-chain-vm-go/crypto/signing/secp256" "github.com/multiversx/mx-chain-vm-go/executor" "github.com/multiversx/mx-chain-vm-go/math" @@ -401,7 +402,7 @@ func ManagedVerifyBLSWithHost( } if invalidSigErr != nil { - WithFaultAndHost(host, invalidSigErr, runtime.CryptoAPIErrorShouldFailExecution()) + WithFaultAndHost(host, vmhost.ErrInvalidSignature, runtime.CryptoAPIErrorShouldFailExecution()) return -1 } @@ -659,7 +660,7 @@ func ManagedVerifyCustomSecp256k1WithHost( } if invalidSigErr != nil { - WithFaultAndHost(host, invalidSigErr, runtime.CryptoAPIErrorShouldFailExecution()) + WithFaultAndHost(host, vmhost.ErrInvalidSignature, runtime.CryptoAPIErrorShouldFailExecution()) return -1 }