Data returns 0x0000... in contracts that use libraries that are created with `.new`
See original GitHub issueIs there anything special to know about using MyContract.new(...)
for contracts that use libraries? I’m having an issue where the deployed contract is working but a manual new
does not properly link (specifically, data stored via the library, such as with the using ... for
syntax, is coming back as 0x0000...
).
This works:
// getData is a getter that retrieves data stored via a library
truffle(default)> MyContract.deployed().getData() // prints correct data
This returns 0x0000...
for all values stored using the library:
// this should print the exact same data (different contract instance, but initialized the same way and same getter)
truffle(default)> MyContract.new().then(contract => contract.getData().then(console.log)) // prints 0x0000...
Unless I am missing something, this seems to be a bug. I can provide more details but I wanted to check first if I was missing something obvious.
Issue
Undeployed contracts are not linked properly.
Steps to Reproduce
- Deploy a contract that uses a library to store data
- Call a getter to see that data returns
0x0000...
(I can provide more details if necessary)
Expected Behavior
Expect data to be stored and retrieved successfully.
Actual Results
Data stored with library returns 0x0000...
Data stored using the main contract without any library functions works fine.
Environment
- Operating System: OSX El Capitan
- Truffle version: 3.0.0-2
- Ethereum client: TestRPC 3.0.0
- node version: 6.1.0
- npm version: 3.8.6
Issue Analytics
- State:
- Created 7 years ago
- Comments:11 (11 by maintainers)
Downgraded to v0.16.0. Works now.
Sorry this issue wandered from its original stated problem.
How should we proceed with documenting/identifying the
0.17.0-beta
incompatibility? If it’s a web3 bug, just skipping0.17.0-beta
might be smart.npm will not install
0.17.0-beta
automatically if the specified version range is^0.16.0
, since the-beta
is there.truffle#beta specifies web3
^0.16.0
. truffle#beta specifies ether-pudding^3.2.0
. ether-pudding#0.16.0 specifies web3^0.15.3
.That’s all fine. I think the problem is that I am explicitly using web3
0.17.0-beta
in my project. I guess there is a peer dependency to use the same version of web3 that is used by truffle.