Loopring/hello_loopring

Pycryptodome keccak.new() takes 0 positional arguments but 1 was given

ebirbe opened this issue · 1 comments

Hello, I was trying the trading example in my local machine and started downloading the python dependencies manually as soon as I get some ModuleNotFoundError.

At some point I got something like ImportError: cannot import name 'keccak', so searching for it on internet I installed pycryptodome, but got next error:

Traceback (most recent call last):
  File "trading/trading_example.py", line 3, in <module>
    from trading.loopring_rest_sample import LoopringRestApiSample
  File "/home/erick/src/hello_loopring/trading/loopring_rest_sample.py", line 19, in <module>
    from ethsnarks.eddsa import PureEdDSA, PoseidonEdDSA
  File "/home/erick/src/hello_loopring/ethsnarks/eddsa.py", line 10, in <module>
    from .mimc import mimc_hash
  File "/home/erick/src/hello_loopring/ethsnarks/mimc/__init__.py", line 1, in <module>
    from .permutation import mimc, mimc_hash, mimc_hash_md
  File "/home/erick/src/hello_loopring/ethsnarks/mimc/permutation.py", line 32, in <module>
    assert H(123) == 38632140595220392354280998614525578145353818029287874088356304829962854601866
  File "/home/erick/src/hello_loopring/ethsnarks/mimc/permutation.py", line 29, in H
    hashed = keccak_256(data).digest()
  File "/home/erick/src/hello_loopring/ethsnarks/sha3.py", line 7, in <lambda>
    keccak_256 = lambda *args: keccak.new(*args, digest_bits=256)
TypeError: new() takes 0 positional arguments but 1 was given

Looking at the code here I found it could be solved installing pysha3 instead. But I think it should be checked in order to support pycryptodome as it suppose to be.

Also, it would be fine to have a requirements.txt file.

PR is merged, thanks!
One more thing you may need is setting PYTHONPATH to the project root.