crossbario / autobahn-python

WebSocket and WAMP in Python for Twisted and asyncio
https://crossbar.io/autobahn
MIT License
2.47k stars 763 forks source link

eip712: failure on pypy #1253

Open oberstet opened 4 years ago

oberstet commented 4 years ago

cpython (success):

(cpy374_1) oberstet@intel-nuci7:~/scm/crossbario/autobahn-python/examples/xbr$ make typed 
python test_typed.py --gateway http://localhost:1545

using web3.py v5.2.0
connected via provider "http://localhost:1545"
Provider set - xbrtoken=0xCfEB869F69431e42cdB54A4F4f105C19C080A601
Provider set - xbrnetwork=0x254dffcd3277C0b1660F6d42EFbB754edaBAbC2B
Using private key: a4985a2ed93107886e9a1f12c7b8e2e351cc1d26c42f3aab7f220f3a7d08fda6
Account address: 3f979903acbd194ca450dc956df17a6df392ec08
Account canonical address: 0x3F979903ACBd194cA450DC956df17A6dF392ec08
Ok, MSG_HASH = 0xb5dc3216d43579455cb01520c4cb0e624d60859457d80f48df7c74d7344e4932
Ok, signed typed data (using key 0x3F979903ACBd194cA450DC956df17A6dF392ec08):
SIGNATURE = 0xcde46611fae9f28e3475c8fdbd58035dfd3cf22040e2cf90f4655d9cc768111b25d08b87bbd926e161407d894ffae343a07223a976ca38dbc9c54ea4aeaa51661b
Ok, verified signature was signed by 0x3F979903ACBd194cA450DC956df17A6dF392ec08
(cpy374_1) oberstet@intel-nuci7:~/scm/crossbario/autobahn-python/examples/xbr$ 

pypy (failure):

(pypy3_1) oberstet@intel-nuci7:~/scm/crossbario/autobahn-python/examples/xbr$ make typed 
python test_typed.py --gateway http://localhost:1545

using web3.py v5.2.0
connected via provider "http://localhost:1545"
Provider set - xbrtoken=0xCfEB869F69431e42cdB54A4F4f105C19C080A601
Traceback (most recent call last):
  File "test_typed.py", line 94, in <module>
    xbr.setProvider(w3)
  File "/home/oberstet/scm/crossbario/autobahn-python/autobahn/xbr/__init__.py", line 109, in setProvider
    xbrtoken = _w3.eth.contract(address=XBR_DEBUG_TOKEN_ADDR, abi=XBR_TOKEN_ABI)
  File "/home/oberstet/pypy3_1/site-packages/web3/eth.py", line 435, in contract
    ContractFactory = ContractFactoryClass.factory(self.web3, **kwargs)
  File "/home/oberstet/pypy3_1/site-packages/web3/contract.py", line 301, in factory
    'address': partial(normalize_address, kwargs['web3'].ens),
  File "/home/oberstet/pypy3_1/site-packages/web3/main.py", line 235, in ens
    return ENS.fromWeb3(self)
  File "/home/oberstet/pypy3_1/site-packages/ens/main.py", line 73, in fromWeb3
    return cls(web3.manager.provider, addr=addr)
  File "/home/oberstet/pypy3_1/site-packages/ens/main.py", line 61, in __init__
    self.ens = self.web3.eth.contract(abi=abis.ENS, address=ens_addr)
  File "/home/oberstet/pypy3_1/site-packages/web3/eth.py", line 438, in contract
    return ContractFactory(address)
  File "/home/oberstet/pypy3_1/site-packages/web3/contract.py", line 284, in __init__
    self.address = normalize_address(self.web3.ens, address)
  File "/home/oberstet/pypy3_1/site-packages/web3/_utils/normalizers.py", line 211, in normalize_address
    validate_name_has_address(ens, address)
  File "/home/oberstet/pypy3_1/site-packages/web3/_utils/ens.py", line 34, in validate_name_has_address
    raise NameNotFound("Could not find address for name %r" % name)
web3.exceptions.NameNotFound: Could not find address for name '0x314159265dD8dbb310642f98f50C066173C1259b'
Makefile:5: recipe for target 'typed' failed
make: *** [typed] Error 1
oberstet commented 4 years ago

succeeds on:

(pypy35_1) oberstet@intel-nuci7:~/scm/crossbario/autobahn-python/examples/xbr$ python -V
Python 3.5.3 (928a4f70d3de, Feb 08 2019, 10:42:58)
[PyPy 7.0.0 with GCC 6.2.0 20160901]

fails on:

(pypy3_1) oberstet@intel-nuci7:~/scm/crossbario/autobahn-python/examples/xbr$ python -V
Python 3.6.1 (784b254d6699, Apr 14 2019, 10:22:42)
[PyPy 7.1.1-beta0 with GCC 6.2.0 20160901]

success log on pypy 7.0.0:

(pypy35_1) oberstet@intel-nuci7:~/scm/crossbario/autobahn-python/examples/xbr$ which python && python -V
/home/oberstet/pypy35_1/bin/python
Python 3.5.3 (928a4f70d3de, Feb 08 2019, 10:42:58)
[PyPy 7.0.0 with GCC 6.2.0 20160901]
(pypy35_1) oberstet@intel-nuci7:~/scm/crossbario/autobahn-python/examples/xbr$ make typed 
python test_typed.py --gateway http://localhost:1545
using web3.py v4.9.2
connected via provider "http://localhost:1545"
Provider set - xbrtoken=0xCfEB869F69431e42cdB54A4F4f105C19C080A601
Provider set - xbrnetwork=0x254dffcd3277C0b1660F6d42EFbB754edaBAbC2B
Using private key: a4985a2ed93107886e9a1f12c7b8e2e351cc1d26c42f3aab7f220f3a7d08fda6
Account address: 3f979903acbd194ca450dc956df17a6df392ec08
Account canonical address: 0x3F979903ACBd194cA450DC956df17A6dF392ec08
Ok, MSG_HASH = 0xb5dc3216d43579455cb01520c4cb0e624d60859457d80f48df7c74d7344e4932
Ok, signed typed data (using key 0x3F979903ACBd194cA450DC956df17A6dF392ec08):
SIGNATURE = 0xcde46611fae9f28e3475c8fdbd58035dfd3cf22040e2cf90f4655d9cc768111b25d08b87bbd926e161407d894ffae343a07223a976ca38dbc9c54ea4aeaa51661b
Ok, verified signature was signed by 0x3F979903ACBd194cA450DC956df17A6dF392ec08
(pypy35_1) oberstet@intel-nuci7:~/scm/crossbario/autobahn-python/examples/xbr$ 
oberstet commented 4 years ago

see also https://github.com/ethereum/eth-utils/issues/173