omgnetwork / plasma-cash

122 stars 34 forks source link

Got exception when executing example code #102

Open reverde opened 5 years ago

reverde commented 5 years ago

Hi, I got exception when I run the example code in readme

>>> operator.submit_block()
>>> userA.send_transaction(1, 1693390459388381052156419331572168595237271043726428428352746834777341368960, 10, '0x08d92dca9038ea9433254996a2d4f08d43be8227')
>>> operator.submit_block()
>>> userB.start_exit(1693390459388381052156419331572168595237271043726428428352746834777341368960, 1, 2)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/plasma-cash/plasma_cash/client/client.py", line 72, in start_exit
    tx_proof = block.merkle.create_merkle_proof(uid)
  File "/plasma-cash/plasma_cash/utils/merkle/sparse_merkle_tree.py", line 64, in create_merkle_proof
    if sibling_index in self.tree[level]:
IndexError: list index out of range
>>> 

I use python3, ubuntu 18.04.1

Thanks.

reverde commented 5 years ago

Seems the index is wrong. And it should be

userB.start_exit(1693390459388381052156419331572168595237271043726428428352746834777341368960, 1, 3)

or you should delete operator.submit_block() before call the send_transaction() function