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

A misleading error message if an interface is not implemented completely #1063

Closed
mushketyk opened this issue Jun 24, 2018 · 4 comments
Closed

Comments

@mushketyk
Copy link

If a contract inherits an interface and does not implement one of the methods Truffle test displays the following error:

$ truffle test  
Using network 'test'.

Compiling ./contracts/Interface.sol...
Compiling ./contracts/Contract.sol...


  Contract: Contract
    1) "before each" hook for "contract is initialized"


  0 passing (129ms)
  1 failing

  1) Contract: Contract
       "before each" hook for "contract is initialized":
     Error: The contract code couldn't be stored, please check your gas amount.
      at Object.callback (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/contract.js:147:1)
      at /usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/method.js:142:1
      at /usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/requestmanager.js:89:1
      at /usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-provider/wrapper.js:134:1
      at XMLHttpRequest.request.onreadystatechange (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/httpprovider.js:128:1)
      at XMLHttpRequestEventTarget.dispatchEvent (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:64:1)
      at XMLHttpRequest._setReadyState (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:354:1)
      at XMLHttpRequest._onHttpResponseEnd (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:509:1)
      at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:469:1)
      at endReadableNT (_stream_readable.js:1106:12)
      at process._tickCallback (internal/process/next_tick.js:114:19)

Is it possible output a better error message in this case?

@cgewecke
Copy link
Contributor

cgewecke commented Jun 24, 2018

@mushketyk Agree - we're tracking this problem for Migrations in #971 and there's a little more detail about why this happens here. That case is being addressed with PR #1028.

However you are seeing this with truffle test and I'd like to make sure we handle that correctly. Could you show anything of your beforeEach hook (if there is one) or your migrations.js files (if you've written any)?

@mushketyk
Copy link
Author

@cgewecke

Here is my beforeEach method:

  beforeEach(async function() {
    funding = await TestCrowdFundingWithDeadline.new(1, 10, beneficiary, {from: owner, gas: 2000000});
  });

It just deploys a contract.

For migrations, for now I only have a default migration that is defined like:

var Migrations = artifacts.require("./Migrations.sol");

module.exports = function(deployer) {
  deployer.deploy(Migrations);
};

@stale
Copy link

stale bot commented Nov 8, 2018

Thank you for raising this issue! It has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. If you would like to keep this issue open, please respond with information about the current state of this problem.

@stale stale bot added the stale label Nov 8, 2018
@stale
Copy link

stale bot commented Nov 15, 2018

There has been no new activity on this issue since it was marked as stale 7 days ago, so it is being automatically closed. If you'd like help with this or a different problem, please open a new issue. Thanks!

@stale stale bot closed this as completed Nov 15, 2018
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

2 participants