Coincurve library experiments #113
3 fail, 4 skipped, 1β063 pass in 33s
1β070 testsβββ1β063 β
ββ33s β±οΈ
ββββ2 suitesββββββ4 π€
ββββ2 filesββββββββ3 β
Results for commit 4ba8e1d.
Annotations
Check warning on line 0 in tests.unit_tests.test_crypto.test_crypto.TestCrypto
github-actions / Test Results
test_deterministic_signatures_1_spsk1zkqrmst1yg2c4xi3crWcZPqgdc9KtPtb9SAZWYHAdiQzdHy7j (tests.unit_tests.test_crypto.test_crypto.TestCrypto) failed
unit_test_results.xmlβ[took 0s]
Raw output
ValueError: Invalid encoding, prefix or length mismatch.
v = b'0E\x02!\x00\x99;\xce\x00?\xf0\x0e\xff\xd0\x92\xba\xae\xfd1GF9\xcd\xb0\xe8n\xc3\xdd+`](e\xcd\x8b\x92\xd6\x02 ~\x9e\x02\xb4\xe5T\x9c$6\xd1\xda\xee\xb1\x8a*\x8bl\x9c>\x8f!4\x00\xa2\x9b\xfa\x08\xa9\xac\xe5Z\x06'
prefix = b'spsig'
def base58_encode(v: bytes, prefix: bytes) -> bytes:
"""Encode data using Base58 with checksum and add an according binary prefix in the end.
:param v: Array of bytes
:param prefix: Human-readable prefix (use b'') e.g. b'tz', b'KT', etc
:returns: bytes (use string.decode())
"""
try:
> encoding = next(encoding for encoding in base58_encodings if len(v) == encoding[3] and prefix == encoding[0])
E StopIteration
src/pytezos/crypto/encoding.py:105: StopIteration
The above exception was the direct cause of the following exception:
a = (<tests.unit_tests.test_crypto.test_crypto.TestCrypto testMethod=test_deterministic_signatures_1_spsk1zkqrmst1yg2c4xi3crWcZPqgdc9KtPtb9SAZWYHAdiQzdHy7j>,)
kw = {}
@wraps(func)
def standalone_func(*a, **kw):
> return func(*(a + p.args), **p.kwargs, **kw)
../../../.cache/pypoetry/virtualenvs/pytezos-fxeZDpKs-py3.10/lib/python3.10/site-packages/parameterized/parameterized.py:620:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/unit_tests/test_crypto/test_crypto.py:131: in test_deterministic_signatures
signature = key.sign(msg)
src/pytezos/jupyter.py:90: in __call__
return method(self.obj, *args, **kwargs)
src/pytezos/crypto/key.py:462: in sign
return base58_encode(signature, prefix).decode()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
v = b'0E\x02!\x00\x99;\xce\x00?\xf0\x0e\xff\xd0\x92\xba\xae\xfd1GF9\xcd\xb0\xe8n\xc3\xdd+`](e\xcd\x8b\x92\xd6\x02 ~\x9e\x02\xb4\xe5T\x9c$6\xd1\xda\xee\xb1\x8a*\x8bl\x9c>\x8f!4\x00\xa2\x9b\xfa\x08\xa9\xac\xe5Z\x06'
prefix = b'spsig'
def base58_encode(v: bytes, prefix: bytes) -> bytes:
"""Encode data using Base58 with checksum and add an according binary prefix in the end.
:param v: Array of bytes
:param prefix: Human-readable prefix (use b'') e.g. b'tz', b'KT', etc
:returns: bytes (use string.decode())
"""
try:
encoding = next(encoding for encoding in base58_encodings if len(v) == encoding[3] and prefix == encoding[0])
except StopIteration as e:
> raise ValueError('Invalid encoding, prefix or length mismatch.') from e
E ValueError: Invalid encoding, prefix or length mismatch.
src/pytezos/crypto/encoding.py:107: ValueError
Check warning on line 0 in tests.unit_tests.test_crypto.test_crypto.TestCrypto
github-actions / Test Results
test_sign_and_verify_1_spsk1zkqrmst1yg2c4xi3crWcZPqgdc9KtPtb9SAZWYHAdiQzdHy7j (tests.unit_tests.test_crypto.test_crypto.TestCrypto) failed
unit_test_results.xmlβ[took 0s]
Raw output
ValueError: Invalid encoding, prefix or length mismatch.
v = b'0D\x02 :<&,\xed\x93\x9c\x0fU\xde\xda6\x9d"Z1\xde\xa2\x84\xa8\xda\xae\xd3\x03\x17\x1bu\xac]\x1cq\xe4\x02 \x0e\xbc\xf6\x84\x0b\xd1?w\xe5\xe5\xb6Syob\xcd\xc9\x89{\xc4A\xfe_\x07\xe5\xc6N\x15\x01~\x06\''
prefix = b'spsig'
def base58_encode(v: bytes, prefix: bytes) -> bytes:
"""Encode data using Base58 with checksum and add an according binary prefix in the end.
:param v: Array of bytes
:param prefix: Human-readable prefix (use b'') e.g. b'tz', b'KT', etc
:returns: bytes (use string.decode())
"""
try:
> encoding = next(encoding for encoding in base58_encodings if len(v) == encoding[3] and prefix == encoding[0])
E StopIteration
src/pytezos/crypto/encoding.py:105: StopIteration
The above exception was the direct cause of the following exception:
a = (<tests.unit_tests.test_crypto.test_crypto.TestCrypto testMethod=test_sign_and_verify_1_spsk1zkqrmst1yg2c4xi3crWcZPqgdc9KtPtb9SAZWYHAdiQzdHy7j>,)
kw = {}
@wraps(func)
def standalone_func(*a, **kw):
> return func(*(a + p.args), **p.kwargs, **kw)
../../../.cache/pypoetry/virtualenvs/pytezos-fxeZDpKs-py3.10/lib/python3.10/site-packages/parameterized/parameterized.py:620:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/unit_tests/test_crypto/test_crypto.py:107: in test_sign_and_verify
sig = key.sign(msg)
src/pytezos/jupyter.py:90: in __call__
return method(self.obj, *args, **kwargs)
src/pytezos/crypto/key.py:462: in sign
return base58_encode(signature, prefix).decode()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
v = b'0D\x02 :<&,\xed\x93\x9c\x0fU\xde\xda6\x9d"Z1\xde\xa2\x84\xa8\xda\xae\xd3\x03\x17\x1bu\xac]\x1cq\xe4\x02 \x0e\xbc\xf6\x84\x0b\xd1?w\xe5\xe5\xb6Syob\xcd\xc9\x89{\xc4A\xfe_\x07\xe5\xc6N\x15\x01~\x06\''
prefix = b'spsig'
def base58_encode(v: bytes, prefix: bytes) -> bytes:
"""Encode data using Base58 with checksum and add an according binary prefix in the end.
:param v: Array of bytes
:param prefix: Human-readable prefix (use b'') e.g. b'tz', b'KT', etc
:returns: bytes (use string.decode())
"""
try:
encoding = next(encoding for encoding in base58_encodings if len(v) == encoding[3] and prefix == encoding[0])
except StopIteration as e:
> raise ValueError('Invalid encoding, prefix or length mismatch.') from e
E ValueError: Invalid encoding, prefix or length mismatch.
src/pytezos/crypto/encoding.py:107: ValueError
Check warning on line 0 in tests.unit_tests.test_crypto.test_crypto.TestCrypto
github-actions / Test Results
test_verify_ext_signatures_1_sppk7aMNM3xh14haqEyaxNjSt7hXanCDyoWtRcxF8wbtya859ak6yZT (tests.unit_tests.test_crypto.test_crypto.TestCrypto) failed
unit_test_results.xmlβ[took 0s]
Raw output
ValueError: The DER-encoded signature could not be parsed.
a = (<tests.unit_tests.test_crypto.test_crypto.TestCrypto testMethod=test_verify_ext_signatures_1_sppk7aMNM3xh14haqEyaxNjSt7hXanCDyoWtRcxF8wbtya859ak6yZT>,)
kw = {}
@wraps(func)
def standalone_func(*a, **kw):
> return func(*(a + p.args), **p.kwargs, **kw)
../../../.cache/pypoetry/virtualenvs/pytezos-fxeZDpKs-py3.10/lib/python3.10/site-packages/parameterized/parameterized.py:620:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/unit_tests/test_crypto/test_crypto.py:95: in test_verify_ext_signatures
key.verify(sig, msg)
src/pytezos/jupyter.py:90: in __call__
return method(self.obj, *args, **kwargs)
src/pytezos/crypto/key.py:494: in verify
if not pk.verify(
../../../.cache/pypoetry/virtualenvs/pytezos-fxeZDpKs-py3.10/lib/python3.10/site-packages/coincurve/keys.py:447: in verify
verified = lib.secp256k1_ecdsa_verify(self.context.ctx, der_to_cdata(signature), msg_hash, self.public_key)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
der = b'\x99;\xce\x00?\xf0\x0e\xff\xd0\x92\xba\xae\xfd1GF9\xcd\xb0\xe8n\xc3\xdd+`](e\xcd\x8b\x92\xd6~\x9e\x02\xb4\xe5T\x9c$6\xd1\xda\xee\xb1\x8a*\x8bl\x9c>\x8f!4\x00\xa2\x9b\xfa\x08\xa9\xac\xe5Z\x06'
context = GLOBAL_CONTEXT
def der_to_cdata(der: bytes, context: Context = GLOBAL_CONTEXT):
cdata = ffi.new('secp256k1_ecdsa_signature *')
parsed = lib.secp256k1_ecdsa_signature_parse_der(context.ctx, cdata, der, len(der))
if not parsed:
> raise ValueError('The DER-encoded signature could not be parsed.')
E ValueError: The DER-encoded signature could not be parsed.
../../../.cache/pypoetry/virtualenvs/pytezos-fxeZDpKs-py3.10/lib/python3.10/site-packages/coincurve/ecdsa.py:25: ValueError