Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

ECRecovery compiler warning #1108

Closed
1 of 2 tasks
linusnorton opened this issue Jul 23, 2018 · 4 comments
Closed
1 of 2 tasks

ECRecovery compiler warning #1108

linusnorton opened this issue Jul 23, 2018 · 4 comments

Comments

@linusnorton
Copy link

linusnorton commented Jul 23, 2018

馃帀 Description

ECRecovery generates a compiler warning with Solidity 0.4.24:

zeppelin-solidity/contracts/ECRecovery.sol:71:12: Warning: This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data.
    return keccak256(
           ^ (Relevant source part starts here and spans across multiple lines).
  • 馃悰 This is a bug report.
  • 馃搱 This is a feature request.

馃捇 Environment

Next, we need to know what your environment looks like.

  • Which version of OpenZeppelin are you using?

1.10.0

  • What network are you deploying to? Ganache? Ropsten?

Ganache

  • How are you deploying your OpenZeppelin-backed contracts? truffle? Remix? Let us know!

Truffle

馃摑 Details

The code:

  function toEthSignedMessageHash(bytes32 hash)
    internal
    pure
    returns (bytes32)
  {
    // 32 is the length in bytes of hash,
    // enforced by the type signature above
    return keccak256(
      "\x19Ethereum Signed Message:\n32",
      hash
    );
  }

Should be:

  function toEthSignedMessageHash(bytes32 hash)
    internal
    pure
    returns (bytes32)
  {
    // 32 is the length in bytes of hash,
    // enforced by the type signature above
    return keccak256(abi.encodePacked(
      "\x19Ethereum Signed Message:\n32",
      hash
    ));
  }

I would be happy to provide a PR if that would be helpful.

@frangio
Copy link
Contributor

frangio commented Jul 23, 2018

Thanks for reporting @linusnorton! This has already been fixed in #951 and is released in v1.11.0.

@frangio frangio closed this as completed Jul 23, 2018
@linusnorton
Copy link
Author

Sorry @frangio I did a search but left :open on. I see 1.11.0 has been merged but not released in npm, is that intentional?

@frangio
Copy link
Contributor

frangio commented Jul 24, 2018

You're probably using the zeppelin-solidity package. We renamed the package to openzeppelin-solidity. You should see a deprecation notice suggesting to install the new one! Let me know if you can see it.

I've just published zeppelin-solidity@1.11.0 but the package remains deprecated and will stop being updated soon.

@linusnorton
Copy link
Author

That was it, I can see it now. Thanks

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

No branches or pull requests

2 participants