omgnetwork / plasma-mvp

OmiseGO's research implementation of Minimal Viable Plasma
MIT License
561 stars 158 forks source link

[WIP-don't merge] Fix withdraw & add challenge_exit #184

Closed dcb9 closed 6 years ago

dcb9 commented 6 years ago
# deposit 10 ETH
omg deposit 10000000000000000000 0xfd02EcEE62797e75D86BCff1642EB0844afB28c7

# send a transaction
omg sendtx 1 0 0 0 0 0 0x0 \
    0xfd02EcEE62797e75D86BCff1642EB0844afB28c7 5000000000000000000 \
    0x4B3eC6c9dC67079E82152d6D55d8dd96a8e6AA26 5000000000000000000 \
    3bb369fecdc16b93b99514d8ed9c2e87c5824cf4a6a98d2e8e91b7dd0c063304

# submit the block
omg submitblock 3bb369fecdc16b93b99514d8ed9c2e87c5824cf4a6a98d2e8e91b7dd0c063304

# sign a confirm sig
omg confirm_sig 1000 3bb369fecdc16b93b99514d8ed9c2e87c5824cf4a6a98d2e8e91b7dd0c063304

# withdraw the original deposit (this is a double spend!)
omg withdrawdeposit 0xfd02EcEE62797e75D86BCff1642EB0844afB28c7 1 10000000000000000000

it goes wrong when i send call callenge_exit method.

# challenge an exit
omg challenge_exit 1000 a251b32b0d518f949800d0d7aba1d7a5c47eec32a6e9235d247574440ed2f79402a922d9baf867b1bdc8ef1e3b3f67b071f05d9f184e8ca917a1a065d4c0bf291c \
    0xfd02EcEE62797e75D86BCff1642EB0844afB28c7

Traceback (most recent call last):
  File "/usr/local/bin/omg", line 11, in <module>
    load_entry_point('plasma==0.0.0', 'console_scripts', 'omg')()
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/decorators.py", line 27, in new_func
    return f(get_current_context().obj, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/plasma-0.0.0-py3.6.egg/plasma/cli/cli.py", line 171, in challenge_exit
    client.challenge_exit(blknum, confirmSig, account)
  File "/usr/local/lib/python3.6/site-packages/plasma-0.0.0-py3.6.egg/plasma/client/client.py", line 96, in challenge_exit
    return self.root_chain.challengeExit(utxo_pos, oindex, tx_bytes, proof, sigs, confirmSig, transact={'from': account})
  File "/usr/local/lib/python3.6/site-packages/web3-4.5.0-py3.6.egg/web3/contract.py", line 879, in __call__
    return self.__prepared_function(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/web3-4.5.0-py3.6.egg/web3/contract.py", line 892, in __prepared_function
    return getattr(self._function(*args), modifier)(modifier_dict)
  File "/usr/local/lib/python3.6/site-packages/web3-4.5.0-py3.6.egg/web3/contract.py", line 1142, in transact
    **self.kwargs
  File "/usr/local/lib/python3.6/site-packages/web3-4.5.0-py3.6.egg/web3/contract.py", line 1438, in transact_with_contract_function
    txn_hash = web3.eth.sendTransaction(transact_transaction)
  File "/usr/local/lib/python3.6/site-packages/web3-4.5.0-py3.6.egg/web3/eth.py", line 263, in sendTransaction
    get_buffered_gas_estimate(self.web3, transaction),
  File "/usr/local/lib/python3.6/site-packages/web3-4.5.0-py3.6.egg/web3/utils/transactions.py", line 84, in get_buffered_gas_estimate
    gas_estimate = web3.eth.estimateGas(gas_estimate_transaction)
  File "/usr/local/lib/python3.6/site-packages/web3-4.5.0-py3.6.egg/web3/eth.py", line 304, in estimateGas
    [transaction],
  File "/usr/local/lib/python3.6/site-packages/web3-4.5.0-py3.6.egg/web3/manager.py", line 110, in request_blocking
    raise ValueError(response["error"])
ValueError: {'message': 'VM Exception while processing transaction: revert', 'code': -32000, 'data': {'stack': 'i: VM Exception while processing transaction: revert\n    at Function.i.fromResults (/Users/bob/.config/yarn/global/node_modules/ganache-cli/build/cli.node.js:10:163747)\n    at /Users/bob/.config/yarn/global/node_modules/ganache-cli/build/cli.node.js:30:121033\n    at /Users/bob/.config/yarn/global/node_modules/ganache-cli/build/cli.node.js:134:470163\n    at /Users/bob/.config/yarn/global/node_modules/ganache-cli/build/cli.node.js:2:82454\n    at /Users/bob/.config/yarn/global/node_modules/ganache-cli/build/cli.node.js:2:67763\n    at d (/Users/bob/.config/yarn/global/node_modules/ganache-cli/build/cli.node.js:2:70993)\n    at o (/Users/bob/.config/yarn/global/node_modules/ganache-cli/build/cli.node.js:2:70911)\n    at /Users/bob/.config/yarn/global/node_modules/ganache-cli/build/cli.node.js:2:70705\n    at /Users/bob/.config/yarn/global/node_modules/ganache-cli/build/cli.node.js:2:82434\n    at /Users/bob/.config/yarn/global/node_modules/ganache-cli/build/cli.node.js:134:470108\n    at /Users/bob/.config/yarn/global/node_modules/ganache-cli/build/cli.node.js:134:1259919\n    at /Users/bob/.config/yarn/global/node_modules/ganache-cli/build/cli.node.js:2:67763\n    at d (/Users/bob/.config/yarn/global/node_modules/ganache-cli/build/cli.node.js:2:70993)\n    at /Users/bob/.config/yarn/global/node_modules/ganache-cli/build/cli.node.js:2:71035\n    at Da (/Users/bob/.config/yarn/global/node_modules/ganache-cli/build/cli.node.js:2:80468)\n    at Object.<anonymous> (/Users/bob/.config/yarn/global/node_modules/ganache-cli/build/cli.node.js:2:71124)\n    at /Users/bob/.config/yarn/global/node_modules/ganache-cli/build/cli.node.js:134:1259840\n    at /Users/bob/.config/yarn/global/node_modules/ganache-cli/build/cli.node.js:2:70705\n    at n (/Users/bob/.config/yarn/global/node_modules/ganache-cli/build/cli.node.js:2:85832)\n    at /Users/bob/.config/yarn/global/node_modules/ganache-cli/build/cli.node.js:134:1259792\n    at /Users/bob/.config/yarn/global/node_modules/ganache-cli/build/cli.node.js:2:141510\n    at /Users/bob/.config/yarn/global/node_modules/ganache-cli/build/cli.node.js:25:392', 'name': 'i'}}

I have been stuck here for a few days. Could anyone help to to find out the mistakes?

Thanks