provable-things / ethereum-api

Provable API for Ethereum smart contracts
https://docs.provable.xyz/#ethereum
MIT License
801 stars 427 forks source link

Truffle Compiler Warning: This function only accepts a single "bytes" argument. #56

Closed Shirlines closed 5 years ago

Shirlines commented 6 years ago

I'm getting this error using OraclizeAPI_0.5.sol, I've tried solidity versions 0.4.18 to 0.4.20, Can you please help me out?

truffle/contracts/OraclizeAPI_0.5.sol:962:50: Warning: This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data. oraclize_randomDS_setCommitment(queryId, keccak256(delay_bytes8_left, args[1], sha256(args[0]), args[2]));

Shirlines commented 6 years ago

I even tried OraclizeAPI_0.4.sol with solidity version 0.4.18, still get the error

D-Nice commented 6 years ago

This error is something that would arise from the solc version, and should not show on the solc versions you mentioned. Are you sure you're using the compilers mentioned? Truffle normally comes with its own solc bundled. My recommendations is to downgrade to Truffle 4.1.3, which ships with solc 0.4.19 iirc.

chapati23 commented 6 years ago

This needs to be addressed before solc 0.5, though. Because this will fail, all uses of keccak256(a, b) need to be changed to keccak256(abi.encodePacked(a,b)) according to the solidity docs

Should be a straightforward pull request, let me know if you want me to take a pass.

D-Nice commented 5 years ago

We were going to wait for 0.5 to come out before releasing the needed changes, as there would be lots of breaking changes. However, since 0.4.25 unexpectedly came out, but understandably for the circumstances, based on requests we did make a 0.4.25 version (actually compatible down to 0.4.22), which should silence all the compiler warnings in that range and drop deprecated methods. https://github.com/oraclize/ethereum-api/blob/master/oraclizeAPI_0.4.25.sol