Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

can't call the other contract's function by interface but other client is ok for same code.! #1121

Closed
W-B-S opened this issue Feb 12, 2019 · 4 comments

Comments

@W-B-S
Copy link

W-B-S commented Feb 12, 2019

eth_sendTransaction
[下午5:45:41]    > {
[下午5:45:41]    >   "jsonrpc": "2.0",
[下午5:45:41]    >   "id": 24050,
[下午5:45:41]    >   "method": "eth_sendTransaction",
[下午5:45:41]    >   "params": [
[下午5:45:41]    >     {
[下午5:45:41]    >       "from": "0xc1831d70d220a5a4567efdc6be12aec815a4680b",
[下午5:45:41]    >       "to": "0x714ce7e9eacebc877042f0a6b025bf063b9929da",
[下午5:45:41]    >       "data": "0xb11bead40000000000000000000000008456693bd3bc2004db327f4e4fae04ca39837800",
[下午5:45:41]    >       "value": "0x0",
[下午5:45:41]    >       "gas": "0xd4d7"
[下午5:45:41]    >     }
[下午5:45:41]    >   ]
[下午5:45:41]    > }
[下午5:45:41]  <   {
[下午5:45:41]  <     "id": 24050,
[下午5:45:41]  <     "jsonrpc": "2.0",
[下午5:45:41]  <     "result": "0x0c298c8624d96cb86332ded7720d4949fbb999e7018d0770b4e142bf612042ab",
[下午5:45:41]  <     "error": {
[下午5:45:41]  <       "message": "VM Exception while processing transaction: revert",
[下午5:45:41]  <       "code": -32000,
[下午5:45:41]  <       "data": {
[下午5:45:41]  <         "0x0c298c8624d96cb86332ded7720d4949fbb999e7018d0770b4e142bf612042ab": {
[下午5:45:41]  <           "error": "revert",
[下午5:45:41]  <           "program_counter": 3572,
[下午5:45:41]  <           "return": "0x0"
[下午5:45:41]  <         },
[下午5:45:41]  <         "stack": "Error\n    at Function.RuntimeError.fromResults (/Applications/Ganache.app/Contents/Resources/app.asar/node_modules/ganache-core/lib/utils/runtimeerror.js:91:13)\n    at /Applications/Ganache.app/Contents/Resources/app.asar/node_modules/ganache-core/lib/blockchain_double.js:539:26\n    at /Applications/Ganache.app/Contents/Resources/app.asar/node_modules/ganache-core/node_modules/async/internal/once.js:12:16\n    at replenish (/Applications/Ganache.app/Contents/Resources/app.asar/node_modules/ganache-core/node_modules/async/internal/eachOfLimit.js:61:25)\n    at /Applications/Ganache.app/Contents/Resources/app.asar/node_modules/ganache-core/node_modules/async/internal/eachOfLimit.js:71:9\n    at eachLimit (/Applications/Ganache.app/Contents/Resources/app.asar/node_modules/ganache-core/node_modules/async/eachLimit.js:43:36)\n    at /Applications/Ganache.app/Contents/Resources/app.asar/node_modules/ganache-core/node_modules/async/internal/doLimit.js:9:16\n    at VM.AsyncEventEmitter.emit (/Applications/Ganache.app/Contents/Resources/app.asar/node_modules/ganache-core/node_modules/async-eventemitter/lib/AsyncEventEmitter.js:42:3)\n    at afterBlock (/Applications/Ganache.app/Contents/Resources/app.asar/node_modules/ganache-core/node_modules/ethereumjs-vm/dist/runBlock.js:52:10)\n    at /Applications/Ganache.app/Contents/Resources/app.asar/node_modules/ganache-core/node_modules/ethereumjs-vm/dist/runBlock.js:174:9\n    at /Applications/Ganache.app/Contents/Resources/app.asar/node_modules/ganache-core/node_modules/ethereumjs-vm/dist/cache.js:110:7\n    at /Applications/Ganache.app/Contents/Resources/app.asar/node_modules/ganache-core/node_modules/async/dist/async.js:473:16\n    at replenish (/Applications/Ganache.app/Contents/Resources/app.asar/node_modules/ganache-core/node_modules/async/dist/async.js:1006:25)\n    at /Applications/Ganache.app/Contents/Resources/app.asar/node_modules/ganache-core/node_modules/async/dist/async.js:1016:9\n    at eachLimit$1 (/Applications/Ganache.app/Contents/Resources/app.asar/node_modules/ganache-core/node_modules/async/dist/async.js:3196:24)\n    at Object.<anonymous> (/Applications/Ganache.app/Contents/Resources/app.asar/node_modules/ganache-core/node_modules/async/dist/async.js:1046:16)\n    at /Applications/Ganache.app/Contents/Resources/app.asar/node_modules/ganache-core/node_modules/ethereumjs-vm/dist/cache.js:106:11\n    at /Applications/Ganache.app/Contents/Resources/app.asar/node_modules/ganache-core/node_modules/async/dist/async.js:969:16\n    at next (/Applications/Ganache.app/Contents/Resources/app.asar/node_modules/ganache-core/node_modules/async/dist/async.js:5225:18)\n    at /Applications/Ganache.app/Contents/Resources/app.asar/node_modules/ganache-core/node_modules/ethereumjs-vm/dist/cache.js:103:7\n    at next (/Applications/Ganache.app/Contents/Resources/app.asar/node_modules/ganache-core/node_modules/async/dist/async.js:5223:28)\n    at /Applications/Ganache.app/Contents/Resources/app.asar/node_modules/ganache-core/node_modules/ethereumjs-vm/dist/cache.js:103:7",
[下午5:45:41]  <         "name": "RuntimeError"
[下午5:45:41]  <       }
[下午5:45:41]  <     }
[下午5:45:41]  <   }
[下午5:45:41] 
[下午5:45:41]   Transaction: 0x0c298c8624d96cb86332ded7720d4949fbb999e7018d0770b4e142bf612042ab
[下午5:45:41]   Gas usage: 54060
[下午5:45:41]   Block Number: 4
[下午5:45:41]   Block Time: Tue Feb 12 2019 17:45:41 GMT+0800 (CST)
[下午5:45:41]   Runtime Error: revert
@OnlyOneJMJQ
Copy link
Contributor

Am I correct in thinking you are able to call your contract's function using a client other than Ganache, but in Ganache you receive the above error?

@nicholasjpaterno
Copy link
Contributor

@W-B-S, are you using a gasEstimate to derive the 0xd4d7 gas limit?

@nicholasjpaterno
Copy link
Contributor

I believe this is related to trufflesuite/ganache/pull/292

@davidmurdoch davidmurdoch changed the title can't call the other contact's function by interface but other client is ok for same code.! can't call the other contract's function by interface but other client is ok for same code.! Mar 22, 2019
@davidmurdoch
Copy link
Member

This should now be fixed in our latest beta: https://github.com/trufflesuite/ganache/releases/tag/v2.0.1-beta.0 Let me know if you have any issues or if the fix doesn't work for you.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

No branches or pull requests

4 participants