Open hanstf opened 5 years ago
Hm, thanks for this. We'll have to dig into it, but we're about to release #2466, which should fix at least the undefined transaction hash. I don't expect it will fix the other issues you describe, but we'll see!
@gnidan sure thing! will try that version out and let you know. Thanks.
@hanstf I am seeing this too but with Geth 1.9.6 (stable). If you move down to a lower Truffle version than 5.0.41 does this go away?
Couple of triage notes. Not sure why this isn't being caught by the tests here, but this line:
is not bound correctly to an event emitter. You can see how that's typically done in the handlers.js.
There's also an (unrelated?) problem in override.extractReceipt
where the error message is incorrectly split by an open parenthesis. This won't work if there are sub-parentheses in the printed receipt.
https://github.com/trufflesuite/truffle/blob/8fdd56f7c45f2b36baeaa71e94f74d956cde1e79/packages/contract/lib/override.js#L14-L26
A better split point is the EVM:
(believe it or not!)
Mea culpa as usual.
@gnidan Updated to the latest truffle contract 4.0.37 but it still happening I am still receiving this
{ tx: undefined,
receipt:
{ stack:
'n: Exceeds block gas limit\n at k._queueTransaction (/home/hanstf/Documents/projects/erc721-smartcontract-lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:37:578780)\n at k.queueRawTransaction (/home/hanstf/Documents/projects/erc721-smartcontract-lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:37:577344)\n at b.eth_sendRawTransaction (/home/hanstf/Documents/projects/erc721-smartcontract-lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:37:567858)\n at b.handleRequest (/home/hanstf/Documents/projects/erc721-smartcontract-lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:37:564744)\n at t (/home/hanstf/Documents/projects/erc721-smartcontract-lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:37:439038)\n at a.handleRequest (/home/hanstf/Documents/projects/erc721-smartcontract-lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:37:563051)\n at t (/home/hanstf/Documents/projects/erc721-smartcontract-lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:37:439038)\n at c.f.handleRequest (/home/hanstf/Documents/projects/erc721-smartcontract-lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:37:556029)\n at c.handleRequest (/home/hanstf/Documents/projects/erc721-smartcontract-lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:37:553855)\n at t (/home/hanstf/Documents/projects/erc721-smartcontract-lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:37:439038)\n at s.handleRequest (/home/hanstf/Documents/projects/erc721-smartcontract-lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:37:562065)\n at t (/home/hanstf/Documents/projects/erc721-smartcontract-lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:37:439038)\n at a.handleRequest (/home/hanstf/Documents/projects/erc721-smartcontract-lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:37:561512)\n at t (/home/hanstf/Documents/projects/erc721-smartcontract-lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:37:439038)\n at d._handleAsync (/home/hanstf/Documents/projects/erc721-smartcontract-lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:37:439074)\n at Timeout._onTimeout (/home/hanstf/Documents/projects/erc721-smartcontract-lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:37:438499)',
name: 'n',
rawLogs: undefined,
logs: [] },
logs: [] }
@cgewecke tried the truffle contract v4.0.32 but is shows the same?
I was looking at that too, the extractReceipt is checking too general.
But what I also don't understand is in testnet, I was getting a js object but then in ganache, I got an js Error with stack trace in its message. I also waiting the feedback from ganache, maybe this because ganache does not return standard error object?
@hanstf Thanks for checking the truffle version (Do you mean 5.0.32?) Also are you running ganache-cli with --noVMErrorsOnRPCResponse
?
That flag is described as:
--noVMErrorsOnRPCResponse: Do not transmit transaction failures as RPC errors. Enable this flag for error reporting behaviour which is compatible with other clients such as geth and Parity.
@cgewecke I am not sure which truffle version was it, I tried it with https://www.npmjs.com/package/@truffle/contract/v/4.0.32
actually that flag does not make any difference. It gave me exactly the same error either way.
I also test different function that will revert because of this
modifier onlyMinter() {
require(isMinter(msg.sender));
_;
}
after checking my ganache logs, I don't even see any eth_sendRawTransaction
.
I guess the error was since the
params.gas = await execute.getGasEstimate.call(
constructor,
params,
network.blockLimit
);
but it was always resolved in getGasEstimate
function. Below was the last logs in my ganache, after that it was only eth_getBlockByNumber
calls.
eth_estimateGas
> {
> "id": 4,
> "jsonrpc": "2.0",
> "params": [
> {
> "from": "0x0a0d381d407bb53201616e5a085a7cfde8be8975",
> "to": "0x38825d339c071e479f382a16ac8032b16d8a690c",
> "data": "0x50bb4e7f000000000000000000000000c510bd27cb758084196ddb3f025638f559340f8d00000000000000000000000000000000000000000000000000000000000325740000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000f72616e646f6d5f75726c5f323836360000000000000000000000000000000000"
> }
> ],
> "method": "eth_estimateGas"
> }
< {
< "id": 4,
< "jsonrpc": "2.0",
< "error": {
< "message": "execution error: revert",
< "code": -32000,
< "data": {
< "stack": "Error: execution error: revert\n at /home/hanstf/Documents/projects/erc721-smartcontract-lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:69:18800\n at /home/hanstf/Documents/projects/erc721-smartcontract-lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:61:657175\n at /home/hanstf/Documents/projects/erc721-smartcontract-lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:2:19209\n at i (/home/hanstf/Documents/projects/erc721-smartcontract-lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:2:34308)\n at /home/hanstf/Documents/projects/erc721-smartcontract-lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:37:1762711\n at /home/hanstf/Documents/projects/erc721-smartcontract-lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:2:93723\n at /home/hanstf/Documents/projects/erc721-smartcontract-lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:25:392\n at s (/home/hanstf/Documents/projects/erc721-smartcontract-lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:25:5516)\n at /home/hanstf/Documents/projects/erc721-smartcontract-lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:25:317\n at /home/hanstf/Documents/projects/erc721-smartcontract-lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:61:675236\n at /home/hanstf/Documents/projects/erc721-smartcontract-lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:2:16307\n at o (/home/hanstf/Documents/projects/erc721-smartcontract-lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:2:19731)\n at /home/hanstf/Documents/projects/erc721-smartcontract-lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:2:19209\n at /home/hanstf/Documents/projects/erc721-smartcontract-lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:61:668716\n at /home/hanstf/Documents/projects/erc721-smartcontract-lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:61:666579\n at /home/hanstf/Documents/projects/erc721-smartcontract-lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:61:676052",
< "name": "Error"
< }
< }
< }
Also the error from truffle that was catch inside the override.start
was also exactly the same error.
I have submitted my issue in ganache here but seems there is no feedback about it, so I am trying to submit it here since it can be error from the truffle contract.
Issue
truffle contract always resolve ganache error with undefined tx and stack trace as receipt
Steps to Reproduce
To move forward, when I try to run the function twice but with lower gas as shown below
I will be getting uncaught error from truffle contract
Expected Behavior
Rejected promiEvent instead of resolved with undefined tx receipt
Actual Results
Environment
truffle version
): 5.0.41node --version
): 10.10.0npm --version
): 6.4.1