harmony-one / sdk

Javascript SDK of Harmony protocol.
MIT License
92 stars 43 forks source link

Returned error: invalid address: 0x0000000000000000000000000000000000000000 #95

Closed gupadhyaya closed 3 years ago

gupadhyaya commented 3 years ago

Running harmony localnet or node using ganache-cli is broken. Could be due to this change.

This error is similar to truffle deploy error as reported in this post. For the truffle error, temporary work around was passing -- skip-dry-run option or specifying skipDryRun: true in the truffle network config.

Steps to reproduce:

Error: Returned error: Returned error: invalid address: 0x0000000000000000000000000000000000000000
    at Object.ErrorResponse (/Users/gupadhyaya/demo/node_modules/web3-core-helpers/lib/errors.js:28:19)
    at /Users/gupadhyaya/demo/node_modules/web3-core-requestmanager/lib/index.js:303:36
    at XMLHttpRequest.request.onreadystatechange (/Users/gupadhyaya/demo/node_modules/web3-providers-http/lib/index.js:98:13)
    at XMLHttpRequestEventTarget.dispatchEvent (/Users/gupadhyaya/demo/node_modules/xhr2-cookies/dist/xml-http-request-event-target.js:34:22)
    at XMLHttpRequest._setReadyState (/Users/gupadhyaya/demo/node_modules/xhr2-cookies/dist/xml-http-request.js:208:14)
    at XMLHttpRequest._onHttpResponseEnd (/Users/gupadhyaya/demo/node_modules/xhr2-cookies/dist/xml-http-request.js:318:14)
    at IncomingMessage.<anonymous> (/Users/gupadhyaya/demo/node_modules/xhr2-cookies/dist/xml-http-request.js:289:61)
    at IncomingMessage.emit (node:events:381:22)
    at endReadableNT (node:internal/streams/readable:1307:12)
    at processTicksAndRejections (node:internal/process/task_queues:81:21) {
  data: {
    stack: 'Error: Returned error: invalid address: 0x0000000000000000000000000000000000000000\n' +
      '    at Object.ErrorResponse (/Users/gupadhyaya/.nvm/versions/node/v10.17.0/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:53:1421880)\n' +
      '    at /Users/gupadhyaya/.nvm/versions/node/v10.17.0/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:53:1420752\n' +
      '    at t.n.onreadystatechange (/Users/gupadhyaya/.nvm/versions/node/v10.17.0/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:89:10247)\n' +
      '    at t.e.dispatchEvent (/Users/gupadhyaya/.nvm/versions/node/v10.17.0/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:17:47987)\n' +
      '    at t._setReadyState (/Users/gupadhyaya/.nvm/versions/node/v10.17.0/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:89:15283)\n' +
      '    at t._onHttpResponseEnd (/Users/gupadhyaya/.nvm/versions/node/v10.17.0/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:89:18380)\n' +
      '    at IncomingMessage.<anonymous> (/Users/gupadhyaya/.nvm/versions/node/v10.17.0/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:89:17635)\n' +
      '    at IncomingMessage.emit (events.js:203:15)\n' +
      '    at endReadableNT (_stream_readable.js:1145:12)\n' +
      '    at process._tickCallback (internal/process/next_tick.js:63:19)',
    name: 'Error'
  }
}
peekpi commented 3 years ago

It look like that Ganache is unable to sync blocks from Harmony node. Query the latest block number from Ganache does not change. If Ganache connects to Geth, it will always return the latest block number. I’ll debug it with ganache src code.

hypnagonia commented 3 years ago

currently known eth_estimateGas is the method that fails ganache calculates gas using ethereum js vm implementation instead of quering RPC directly https://github.com/trufflesuite/ganache-core/blob/develop/src/chains/ethereum/ethereum/src/helpers/gas-estimator.ts#L255

gupadhyaya commented 3 years ago

fixed in this PR: https://github.com/harmony-one/harmony/pull/3837

DSBUGAY2 commented 3 years ago

one1yr7j2xulp5z2z54sshvzzx0yque4wwsd6xw6zq

toniton commented 3 years ago

Hi @gupadhyaya!

Since this issue has been resolved, is it okay to remove the info from the documentation here: https://docs.harmony.one/home/developers/tools/using-ganache?

I have created a PR here: https://github.com/harmony-one/docs-home/pull/42