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

"contract binary not set. Can't deploy new instance." when deploying simple contract #231

Closed
zweicoder opened this issue Aug 9, 2016 · 14 comments

Comments

@zweicoder
Copy link

zweicoder commented Aug 9, 2016

contract JudgeSubscriber {
    function judgeCallback(bytes32 uuid, address liar) external;
}

This interface throws contract binary not set. Can't deploy new instance. when deployed with
deployer.deploy(JudgeSubscriber);

More info from @elenadimitrova from Gitter who reproduced it:

I can reproduce however I do get random failures on truffle migrate --reset
sometimes it succeeds in deploying and sometimes it fails with contract binary not set and sometimes it gets stuck and testrpc emits numerous eth_getFilterChanges calls

@zweicoder
Copy link
Author

zweicoder commented Aug 9, 2016

btw I ended up not deploying this contract and just imported it for use in other contracts, but will just log the possible bug here

@tcoulter
Copy link
Contributor

tcoulter commented Aug 9, 2016

Your contract is an abstract contract and will therefore have no binary.
You need to give the function judgeCallback a definition or else the
solidity compiler won't produce a binary for it.

On Aug 9, 2016 7:01 AM, "zweicoder" notifications@github.com wrote:

contract JudgeSubscriber {
function judgeCallback(bytes32 uuid, address liar) external;
}

This interface throws contract binary not set. Can't deploy new instance.
when deployed with
deployer.deploy(JudgeSubscriber);

More info from @elenadimitrova https://github.com/elenadimitrova from
Gitter who reproduced it:

I can reproduce however I do get random failures on truffle migrate
--reset
sometimes it succeeds in deploying and sometimes it fails with contract
binary not set and sometimes it gets stuck and testrpc emits numerous
eth_getFilterChanges calls


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#231, or mute the thread
https://github.com/notifications/unsubscribe-auth/AAFp1ZgmK9tOY5vTWWh6N-fsZpBY3r7Qks5qeIgXgaJpZM4JgG6b
.

@tcoulter
Copy link
Contributor

tcoulter commented Aug 9, 2016

The TestRPC's filter changes is a separate issue I've seen as well.

On Aug 9, 2016 7:01 AM, "zweicoder" notifications@github.com wrote:

contract JudgeSubscriber {
function judgeCallback(bytes32 uuid, address liar) external;
}

This interface throws contract binary not set. Can't deploy new instance.
when deployed with
deployer.deploy(JudgeSubscriber);

More info from @elenadimitrova https://github.com/elenadimitrova from
Gitter who reproduced it:

I can reproduce however I do get random failures on truffle migrate
--reset
sometimes it succeeds in deploying and sometimes it fails with contract
binary not set and sometimes it gets stuck and testrpc emits numerous
eth_getFilterChanges calls


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#231, or mute the thread
https://github.com/notifications/unsubscribe-auth/AAFp1ZgmK9tOY5vTWWh6N-fsZpBY3r7Qks5qeIgXgaJpZM4JgG6b
.

@zweicoder
Copy link
Author

ok thanks for the info!

@tcoulter
Copy link
Contributor

I'm going to close this one for housekeeping purposes. If you run into any more issues please open a new ticket!

@danfinlay
Copy link

I just had this error too, @tcoulter. I wouldn't doubt I've got an abstract contract on my hands. Any idea if there's a way to get an error saying which method isn't implemented?

@DavidBurela
Copy link

During the last 2 weeks I have come across this error twice, and both times resolved it by doing a Google search and this issue comes up with the answer:

Check that you haven't accidentally made your class abstract by having a method you didn't implement

Maybe the error message should be updated to give a hint towards that.

@qjflores
Copy link

I got this error with Truffle 3.1.1 after running truffle test

The error message was coming from Function.new while deploying a contract through inheritance.

The error stopped after running truffle migrate

@vongohren
Copy link

If you have one function that is an abstract function in your contract.

function addr(string _name) constant returns (address o_owner)

The whole contract is compiled as an abstract contract, so you will get this error message.
It might be like me, that you never ment to write an abstract contract, but a but fast copy pasting of some code, and simsallabim, you have some abstract functions without thinking about it.
So either add functions bodies to them or remove them.

Then your contract will compile.

@seanavery
Copy link

Similar issue migrating ERC20 token standard contract.

contract ERC20Events {
    event Transfer(address indexed from, address indexed to, uint value);
    event Approval( address indexed owner, address indexed spender, uint value);
}

contract ERC20Stateless {
    function totalSupply() constant returns (uint supply);
    function balanceOf( address who ) constant returns (uint value);
    function allowance(address owner, address spender) constant returns (uint _allowance);
}
contract ERC20Stateful {
    function transfer( address to, uint value) returns (bool ok);
    function transferFrom( address from, address to, uint value) returns (bool ok);
    function approve(address spender, uint value) returns (bool ok);
}

contract ERC20 is ERC20Stateless, ERC20Stateful, ERC20Events {}

Yes, this an "abstract" contract as the methods are not implemented. I have attempted to add my Token.sol implementation onto the same file where the ERC20 standard is implemented; However, am still getting contract binary is not set error.

Has anyone had success migrating the ERC20 contract?

@pizzarob
Copy link

pizzarob commented Feb 13, 2019

I get this error after updating a contract and running tests. I need to remove the build folder and recompile the contracts and then run the tests to fix.

@pizzarob
Copy link

pizzarob commented Sep 9, 2019

This is still happening intermittently - not sure what causes it. All methods are implemented and all constructors are properly called.

@pizzarob
Copy link

pizzarob commented Sep 9, 2019

Ok the issue for me was that I had an interface defined in a contract that had the same name as one of my contracts. The interface was being compiled and I expected the contract to be compiled. I've suffixed all my interfaces with Interface and this has solved the issue.

@gnidan gnidan reopened this Sep 9, 2019
@gnidan gnidan closed this as completed Sep 9, 2019
@gnidan
Copy link
Contributor

gnidan commented Sep 9, 2019

@pizza-r0b sounds like this can stay closed, as a duplicate of #1087

Thanks for sharing findings of your investigation!

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

No branches or pull requests

9 participants