diff --git a/Pipfile b/Pipfile index 1f82d1d1c..8e3ff56e4 100644 --- a/Pipfile +++ b/Pipfile @@ -31,7 +31,6 @@ flask = "*" # Third-Party Ethereum py-evm = "*" eth-tester = "*" -coincurve = "*" web3 = "<=5.12.3" eth-utils = "<1.10" py-geth = "*" diff --git a/tests/contracts/lib/test_signature_verifier.py b/tests/contracts/lib/test_signature_verifier.py index bee57a7b2..2c5784747 100644 --- a/tests/contracts/lib/test_signature_verifier.py +++ b/tests/contracts/lib/test_signature_verifier.py @@ -18,7 +18,6 @@ along with nucypher. If not, see . import os -import coincurve import pytest from cryptography.hazmat.backends.openssl import backend from cryptography.hazmat.primitives import hashes @@ -60,11 +59,15 @@ def get_signature_recovery_value(message: bytes, if len(signature) != ecdsa_signature_size: raise ValueError(f"The signature size should be {ecdsa_signature_size} B.") + hash_ctx = hashes.Hash(hashes.SHA256(), backend=backend) + hash_ctx.update(message) + message_hash = hash_ctx.finalize() + + address = canonical_address_from_umbral_key(public_key) for v in (0, 1): v_byte = bytes([v]) - recovered_pubkey = coincurve.PublicKey.from_signature_and_message(signature=signature + v_byte, - message=message) - if bytes(public_key) == recovered_pubkey.format(compressed=True): + recovered = to_canonical_address(Account.recoverHash(message_hash, signature=signature + v_byte)) + if recovered == address: return v_byte else: raise ValueError("Signature recovery failed. "