kyokan / plasma

Golang implementation and extension of the Minimum Viable Plasma specification
http://plasma.kyokan.io/
70 stars 24 forks source link

Deposit (runtime error) #111

Open hasancana opened 5 years ago

hasancana commented 5 years ago

Hi,

I have setup plasma and unfortunately I am gettting the error below when trying to deposit to Plasma contract.

INFO[0000] depositing funds                              address=0xf17f52151EbEF6C7334FAD080c5704D77216b732 amount=10 subsystem=EthClient
INFO[0010] successfully deposited funds                  amount=10 subsystem=EthClient txHash=0x0323b88c99c5f4ef29c0dda57b2966f839501727583cf7659c943167687b4f54
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/kyokan/plasma/cmd/plasmacli/cmd.Deposit(0x47d83a0, 0xc00000f280, 0xc00000e420, 0x2a, 0xc00008eba0, 0x47d83a0)
    /Users/hasancana/Documents/go/src/github.com/kyokan/plasma/cmd/plasmacli/cmd/deposit.go:64 +0x28b
github.com/kyokan/plasma/cmd/plasmacli/cmd.glob..func2(0x4c3e920, 0xc00000e3c0, 0x2, 0x2, 0x0, 0x0)
    /Users/hasancana/Documents/go/src/github.com/kyokan/plasma/cmd/plasmacli/cmd/deposit.go:47 +0x17e
github.com/kyokan/plasma/vendor/github.com/spf13/cobra.(*Command).execute(0x4c3e920, 0xc00000e360, 0x2, 0x2, 0x4c3e920, 0xc00000e360)
    /Users/hasancana/Documents/go/src/github.com/kyokan/plasma/vendor/github.com/spf13/cobra/command.go:762 +0x460
github.com/kyokan/plasma/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0x4c3eb80, 0x403deda, 0x4bf68e0, 0xc000000180)
    /Users/hasancana/Documents/go/src/github.com/kyokan/plasma/vendor/github.com/spf13/cobra/command.go:852 +0x2ea
github.com/kyokan/plasma/vendor/github.com/spf13/cobra.(*Command).Execute(...)
    /Users/hasancana/Documents/go/src/github.com/kyokan/plasma/vendor/github.com/spf13/cobra/command.go:800
github.com/kyokan/plasma/cmd/plasmacli/cmd.Execute()
    /Users/hasancana/Documents/go/src/github.com/kyokan/plasma/cmd/plasmacli/cmd/root.go:23 +0x31
main.main()
    /Users/hasancana/Documents/go/src/github.com/kyokan/plasma/cmd/plasmacli/main.go:6 +0x20
mslipper commented 5 years ago

Hey there! Can you please post the deposit command that you used on the CLI?

hasancana commented 5 years ago

./target/plasmacli deposit 0xF12b5dd4EAD5F743C6BaA640B0216200e89B60Da 10

hasancana commented 5 years ago

I think the same problem is when trying to deposit through JS. It seems that return values are missing. It seems to be same when running the plasmacli

(node:20525) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'returnValues' of undefined
    at PlasmaContract.<anonymous> (/Users/hasancana/Documents/go/src/github.com/kyokan/plasma/prova/node_modules/kyokan-plasma-client/lib/contract/PlasmaContract.js:30:47)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/hasancana/Documents/go/src/github.com/kyokan/plasma/prova/node_modules/kyokan-plasma-client/lib/contract/PlasmaContract.js:4:58)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:20525) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:20525) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Plasmacontract.js (line 30)

const ev = receipt.events.Deposit.returnValues;
            return {
                nonce: numbers_1.toBig(ev.depositNonce),
                owner: ev.depositor,
                amount: numbers_1.toBig(ev.amount),
                createdAt: ev.createdAt,
                ethBlockNum: ev.ethBlockNum,
            };

Printing receipt on console events is empty:

{ transactionHash:
   '0xdec8cbc1b0058cb89bb87e4f06a2369ba029cb485a17cbb81fae61223345e83e',
  transactionIndex: 0,
  blockHash:
   '0xda0b4a65aead04697fedc01277f61d63f717b4bfb00508f9c613db1f2380803a',
  blockNumber: 73686,
  from: '0x627306090abab3a6e1400e9345bc60c78a8bef57',
  to: '0xf12b5dd4ead5f743c6baa640b0216200e89b60da',
  gasUsed: 22680,
  cumulativeGasUsed: 22680,
  contractAddress: null,
  status: true,
  logsBloom:
   '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
  v: '0x1b',
  r:
   '0x13e96a8272d187ca8be0c6538f884ba94f7a06ae4ca387a52f744bd4acbe543f',
  s:
   '0x7f3cc5427f39261619371ce48e0a2793bd7adc22ae56f51303d60c3746438f28',
  events: {} }

Whenever I initiate a deposit:

ganache

[ganache-out] eth_sendTransaction
[ganache-out] eth_getTransactionReceipt
[ganache-out] eth_subscribe
[ganache-out] 
[ganache-out]   Transaction: 0x02947a0ffee2b694700673de9a428025e2e884d6939014a34931e5ba85eb0e85
[ganache-out]   Gas usage: 22680
[ganache-out]   Block Number: 73864
[ganache-out]   Block Time: Thu Oct 17 2019 13:53:24 GMT+0200 (Central European Summer Time)
[ganache-out] 
[ganache-out] eth_getTransactionReceipt
[ganache-out] eth_unsubscribe
[ganache-out] eth_getBlockByNumber
[ganache-out] eth_getBlockByNumber
[ganache-out] eth_getBlockByNumber

PlasmaD

INFO[0016] no deposit exits found                        chainsawProcess=txExits head=73859 subsystem=Chainsaw tail=73855
INFO[0016] no transaction exits found                    chainsawProcess=txExits head=73859 subsystem=Chainsaw tail=73855
INFO[0021] processing blocks                             subsystem=Chainsaw
INFO[0021] no deposit exits found                        chainsawProcess=txExits head=73864 subsystem=Chainsaw tail=73860
INFO[0021] no transaction exits found                    chainsawProcess=txExits head=73864 subsystem=Chainsaw tail=73860
INFO[0026] processing blocks                             subsystem=Chainsaw
INFO[0026] no deposit exits found                        chainsawProcess=txExits head=73868 subsystem=Chainsaw tail=73865
INFO[0026] no transaction exits found                    chainsawProcess=txExits head=73868 subsystem=Chainsaw tail=73865
INFO[0031] processing blocks                             subsystem=Chainsaw
INFO[0031] no deposit exits found                        chainsawProcess=txExits head=73873 subsystem=Chainsaw tail=73869
INFO[0031] no transaction exits found                    chainsawProcess=txExits head=73873 subsystem=Chainsaw tail=73869
INFO[0036] processing blocks                             subsystem=Chainsaw
mslipper commented 5 years ago

Interesting. I'll take a look at this. Which Ganache version are you using?

hasancana commented 5 years ago

Ganache GUI Version 2.1.1 (2.1.1.818) (with build/config-local.yaml) Ganache CLI v6.7.0 (ganache-core: 2.8.0)

hasancana commented 5 years ago

Ether is being subtracted from the address on main ethereum node, same amount is showing up on PlasamMVP contract balance, but on the plasma chain side balance still remains 0.

Screen Shot 2019-10-21 at 11 12 32 AM Screen Shot 2019-10-21 at 11 13 00 AM Screen Shot 2019-10-21 at 11 13 38 AM

./target/plasmacli balance { "address": "0x8624206450B5fcda7e695ce5454fcAEAAc28cd32", "balance": "0" }