py_ecc icon indicating copy to clipboard operation
py_ecc copied to clipboard

Process unexpectedly ends with status code `-1073741571` on windows

Open gtg2619 opened this issue 1 year ago • 8 comments

What happened?

Testing pairing mapping under Windows resulted in the process exiting unexpectedly and no other output. Running results on windows 0d1498b2d3b30dea540aaef7125d4451 Compared running results under Linux 07199a6823d5051a064873e7022e3e80

Code that produced the error

from py_ecc.bn128 import G1, G2, pairing, multiply

A = multiply(G2, 5)
B = multiply(G1, 6)
print(pairing(A, B))

Full error output

(no output)

Fill this section in if you know how this could or should be fixed

No response

py-ecc Version

7.0.0

Python Version

3.8.4

Operating System

win

Output from pip freeze

PS C:\Users\#####\Desktop\zk-tmpd> python -m pip freeze
aiocache==0.12.2
aiocqhttp==1.4.4
aiofiles==23.2.1
aiohttp==3.8.6
aiosignal==1.3.1
anyio==3.7.1
argcomplete==2.0.0
arrow==1.3.0
async-timeout==4.0.3
asyncio==3.4.3
attrs==22.2.0
Automat==22.10.0
base58==2.1.1
bcrypt==4.0.1
beautifulsoup4==4.12.2
binaryornot==0.4.4
bitarray==2.8.2
blinker==1.6.2
bump2version==1.0.1
bumpversion==0.6.0
cached-property==1.5.2
capstone==5.0.0
cashews==6.3.0
certifi==2022.12.7
cffi==1.15.1
chardet==5.1.0
charset-normalizer==2.0.12
click==8.1.3
colorama==0.4.6
colored-traceback==0.3.0
configobj==5.0.8
constantly==15.1.0
contourpy==1.1.1
cookiecutter==2.5.0
cryptography==41.0.7
cssselect==1.2.0
cycler==0.12.1
cytoolz==0.12.1
defusedxml==0.7.1
distlib==0.3.7
ecdsa==0.18.0
eth-abi==4.2.1
eth-account==0.10.0
eth-hash==0.5.2
eth-keyfile==0.7.0
eth-keys==0.4.0
eth-rlp==1.0.0
eth-typing==3.5.2
eth-utils==2.3.1
exceptiongroup==1.1.0
fenjing==0.5.4
filelock==3.13.1
Flask==3.0.0
fonttools==4.49.0
frozenlist==1.4.0
gmpy2==2.1.5
h11==0.14.0
h2==4.1.0
hexbytes==0.3.1
hpack==4.0.0
httpcore==0.17.3
httpx==0.24.1
Hypercorn==0.15.0
hyperframe==6.0.1
hyperlink==21.0.0
hypothesis==6.68.2
idna==3.4
importlib-metadata==6.6.0
importlib-resources==6.1.0
incremental==22.10.0
intervaltree==3.1.0
ipfshttpclient==0.8.0a2
itsdangerous==2.1.2
Jinja2==3.1.2
jmespath==1.0.1
jsonschema==4.19.1
jsonschema-specifications==2023.7.1
kiwisolver==1.4.5
libnum==1.7.1
lru-dict==1.1.8
lxml==4.9.2
Mako==1.2.4
markdown-it-py==3.0.0
MarkupSafe==2.1.2
matplotlib==3.7.5
mdurl==0.1.2
multiaddr==0.0.9
multidict==6.0.4
mypy==1.6.0
mypy-extensions==1.0.0
nb-cli==1.2.6
netaddr==0.9.0
nonebot==1.9.1
noneprompt==0.1.9
ntlm-auth==1.5.0
numpy==1.24.4
packaging==23.1
paramiko==3.1.0
parsel==1.8.1
parsimonious==0.9.0
Pillow==10.0.0
pkgutil_resolve_name==1.3.10
platformdirs==4.0.0
plumbum==1.8.1
poseidon==0.3.1
priority==2.0.0
promise==2.3
prompt-toolkit==3.0.41
protobuf==4.25.1
psutil==5.9.5
pwntools==4.11.0
py-ecc==7.0.0
pyasn1==0.4.8
pyasn1-modules==0.3.0
pycparser==2.21
pycryptodome==3.17
pycurl @ file:///C:/Users/24974/Desktop/pycurl-7.45.1-cp38-cp38-win_amd64.whl#sha256=07f7957d3506550a339ecb1fa8acc705ce63f42a49863626e647cbb3eb0a69ee    
pydantic==1.10.13
PyDispatcher==2.0.7
pyelftools==0.29
pyfiglet==0.8.post1
Pygments==2.15.1
PyJWT==2.7.0
pymitter==0.4.0
PyNaCl==1.5.0
pyOpenSSL==23.3.0
pyparsing==3.0.9
pyserial==3.5
PySocks==1.7.1
python-dateutil==2.8.2
python-slugify==8.0.1
pyunormalize==15.0.0
pywin32==306
PyYAML==6.0.1
Quart==0.19.4
queuelib==1.6.2
randcrack==0.2.0
referencing==0.30.2
regex==2023.10.3
requests==2.28.2
requests-ntlm==1.1.0
retrying==1.3.4
rich==13.7.0
rlp==4.0.0
ROPGadget==7.3
rpds-py==0.10.6
rpyc==5.3.1
rsa==4.9
sage==0.0.0
Scrapy==1.5.1
service-identity==23.1.0
six==1.16.0
sniffio==1.3.0
sortedcontainers==2.4.0
soupsieve==2.4.1
taskgroup==0.0.0a4
termcolor==2.3.0
text-unidecode==1.3
tomli==2.0.1
tomlkit==0.12.3
toolz==0.12.0
Twisted==22.10.0
twisted-iocpsupport==1.0.3
types-python-dateutil==2.8.19.14
typing_extensions==4.7.0
unicorn==2.0.1.post1
urllib3==1.26.14
varint==1.0.2
virtualenv==20.24.7
w3lib==2.1.1
watchfiles==0.21.0
wcwidth==0.2.12
web3==6.13.0
websocket-client==1.7.0
websockets==12.0
Werkzeug==3.0.1
wsproto==1.2.0
yarl==1.9.2
z3-solver==4.12.2.0
zipp==3.15.0
zope.interface==6.0

gtg2619 avatar Feb 24 '24 06:02 gtg2619

I also tried sys.setrecursionlimit() to solve this, but it makes output to be None.

gtg2619 avatar Feb 29 '24 09:02 gtg2619

Did you manage to solve the issue? I am facing a similar issue on a Mac M2, RecursionError: maximum recursion depth exceeded

`--------------------------------------------------------------------------- RecursionError Traceback (most recent call last) Cell In[24], line 5 2 B = multiply(G1, 6) 3 C = multiply(G2, 5 * 6) ----> 5 pairing(A, B) == pairing(C, G1)

File /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/py_ecc/bn128/bn128_pairing.py:110, in pairing(Q, P) 108 assert is_on_curve(Q, b2) 109 assert is_on_curve(P, b) --> 110 return miller_loop(twist(Q), cast_point_to_fq12(P))

File /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/py_ecc/bn128/bn128_pairing.py:103, in miller_loop(Q, P) 101 f = f * linefunc(R, nQ2, P) 102 # R = add(R, nQ2) This line is in many specifications but technically does nothing --> 103 return f ** ((field_modulus**12 - 1) // curve_order)

File /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/py_ecc/fields/field_elements.py:276, in FQP.pow(self, other) 274 return type(self)(self.coeffs) 275 elif other % 2 == 0: --> 276 return (self * self) ** (other // 2) 277 else: 278 return ((self * self) ** int(other // 2)) * self

File /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/py_ecc/fields/field_elements.py:276, in FQP.pow(self, other) 274 return type(self)(self.coeffs) 275 elif other % 2 == 0: --> 276 return (self * self) ** (other // 2) 277 else: 278 return ((self * self) ** int(other // 2)) * self

[... skipping similar frames: FQP.__pow__ at line 276 (3 times)]

File /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/py_ecc/fields/field_elements.py:278, in FQP.pow(self, other) 276 return (self * self) ** (other // 2) 277 else: --> 278 return ((self * self) ** int(other // 2)) * self

[... skipping similar frames: FQP.__pow__ at line 276 (2 times)]

File /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/py_ecc/fields/field_elements.py:278, in FQP.pow(self, other) 276 return (self * self) ** (other // 2) 277 else: --> 278 return ((self * self) ** int(other // 2)) * self

[... skipping similar frames: FQP.__pow__ at line 276 (368 times), FQP.__pow__ at line 278 (359 times)]

File /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/py_ecc/fields/field_elements.py:278, in FQP.pow(self, other) 276 return (self * self) ** (other // 2) 277 else: --> 278 return ((self * self) ** int(other // 2)) * self

File /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/py_ecc/fields/field_elements.py:276, in FQP.pow(self, other) 274 return type(self)(self.coeffs) 275 elif other % 2 == 0: --> 276 return (self * self) ** (other // 2) 277 else: 278 return ((self * self) ** int(other // 2)) * self

File /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/py_ecc/fields/field_elements.py:246, in FQP.mul(self, other) 242 for i in range(self.degree): 243 b[exp + i] -= top * self.FQP_corresponding_FQ_class( 244 self.modulus_coeffs[i] 245 ) --> 246 return type(self)(b) 247 else: 248 raise TypeError( 249 "Expected an int or FQ object or FQP object, " 250 f"but got object of type {type(other)}" 251 )

File /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/py_ecc/fields/field_elements.py:374, in FQ12.init(self, coeffs) 371 if self.FQ12_MODULUS_COEFFS is None: 372 raise AttributeError("FQ12 Modulus Coeffs haven't been specified") --> 374 super().init(coeffs, self.FQ12_MODULUS_COEFFS)

File /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/py_ecc/fields/field_elements.py:208, in FQP.init(self, coeffs, modulus_coeffs) 204 # Encoding all coefficients in the corresponding type FQ 205 self.FQP_corresponding_FQ_class = type( 206 "FQP_corresponding_FQ_class", (FQ,), {"field_modulus": self.field_modulus} 207 ) # type: Type[FQ] --> 208 self.coeffs = tuple( 209 self.FQP_corresponding_FQ_class(c) for c in coeffs 210 ) # type: Tuple[IntOrFQ, ...] 211 # The coefficients of the modulus, without the leading [1] 212 self.modulus_coeffs = tuple(modulus_coeffs) # type: Tuple[IntOrFQ, ...]

File /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/py_ecc/fields/field_elements.py:209, in (.0) 204 # Encoding all coefficients in the corresponding type FQ 205 self.FQP_corresponding_FQ_class = type( 206 "FQP_corresponding_FQ_class", (FQ,), {"field_modulus": self.field_modulus} 207 ) # type: Type[FQ] 208 self.coeffs = tuple( --> 209 self.FQP_corresponding_FQ_class(c) for c in coeffs 210 ) # type: Tuple[IntOrFQ, ...] 211 # The coefficients of the modulus, without the leading [1] 212 self.modulus_coeffs = tuple(modulus_coeffs) # type: Tuple[IntOrFQ, ...]

RecursionError: maximum recursion depth exceeded`

0xfoudy avatar Apr 14 '24 15:04 0xfoudy

The error doesn't show when switching from Python 3.12.1 to Python 3.9.6

0xfoudy avatar Apr 14 '24 16:04 0xfoudy

We don't support Python 3.12 here yet. @gtg2619 what Python version are you using?

kclowes avatar Apr 15 '24 18:04 kclowes

We don't support Python 3.12 here yet. @gtg2619 what Python version are you using?

Python 3.8.4 (tags/v3.8.4:dfa645a, Jul 13 2020, 16:46:45) [MSC v.1924 64 bit (AMD64)]

gtg2619 avatar Apr 16 '24 02:04 gtg2619

I'm not able to replicate even with Python 3.12 and it's going to be hard for the team to debug since none of us have windows machines. I've heard that our libraries tend to work better with WSL, so maybe you could try that? I'll leave this open in case there is someone out there who might have a solution/workaround. Sorry I can't be of more help!

kclowes avatar Apr 25 '24 21:04 kclowes

Did you manage to sovle this? I have the same problem on Windows.

paronikyanarmen avatar Jun 21 '24 08:06 paronikyanarmen

Did you manage to sovle this? I have the same problem on Windows.

I switched to python 3.9.6 to solve this

0xfoudy avatar Jul 16 '24 10:07 0xfoudy