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

Getting different error in ganache-cli than testnet #493

Closed
hanstf opened this issue Oct 22, 2019 · 2 comments
Closed

Getting different error in ganache-cli than testnet #493

hanstf opened this issue Oct 22, 2019 · 2 comments

Comments

@hanstf
Copy link

hanstf commented Oct 22, 2019

When trying to simulate error, I am getting different result which causes truffle-contract to detect that error as receipt in the extractReceipt function

Expected Behavior

Getting the same as testnet

   { code: -32010,
      message:
       'Transaction cost exceeds current gas limit. Limit: 8015630, got: 123232323. Try decreasing supplied gas.' }

Current Behavior

I am getting this error in ganache, which causes truffleContract to detect it as 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"
    }

Possible Solution

Not sure is it the problem from ganache or truffle contract? if truffle-contract should change their behaviour, let me know, I will create the issue in truffle-contract.

Steps to Reproduce (for bugs)

  1. Running ./node_modules/.bin/ganache-cli -m 'blame left final crime wing curious actual light drip trip patient daughter' -p 9988 --verbose
  2. running ./node_modules/.bin/truffle migrate --network docker. the migrated smart contract, is just a normal ERC721 token
  3. run instance.mintWithTokenURI(toWalletAddress, productId, url, { gas: 123232323 }) (assuming that the truffle contract was deployed)
  4. since I was testing for error, so I expected that it should return me error and rejected the promiEvent in truffle-contract, but it was resolved and returning 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: [] }
  1. To move forward, when I try to run the function twice but with lower gas as shown below
instance.mintWithTokenURI(toWalletAddress, productId, url, { gas: 123232323 })
instance.mintWithTokenURI(toWalletAddress, productId, url, { gas: 8015600 })

I will be getting uncaught error from truffle contract

TypeError: this.removeListener is not a function

    at Object.receipt (/home/hanstf/Documents/projects/erc721-smartcontract-lib/node_modules/@truffle/contract/lib/handlers.js:133:10)
    at Function.start (/home/hanstf/Documents/projects/erc721-smartcontract-lib/node_modules/@truffle/contract/lib/override.js:56:24)
    at deferred.catch (/home/hanstf/Documents/projects/erc721-smartcontract-lib/node_modules/@truffle/contract/lib/execute.js:197:56)

This is not the case in testnet.

Context

Since it behave differently in testnet, we are having difficulty to do the testing

Your Environment

  • Version used: 6.7.0
  • Version of Truffle-contract: 4.0.36
  • Version of truffle: 5.0.41
  • NodeJS Version: 10.10
  • Operating System and version (include distro if Linux): Ubuntu 18.04
@davidmurdoch davidmurdoch transferred this issue from trufflesuite/ganache-cli-archive Oct 22, 2019
@davidmurdoch
Copy link
Member

Related to #480

@haltman-at
Copy link
Contributor

This will be fixed in the next major release. Thanks for the report!

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

No branches or pull requests

3 participants