Skip to content
This repository has been archived by the owner on May 13, 2022. It is now read-only.

Extract balance message hash logic for EIP712 in a separate contract #200

Merged
merged 4 commits into from
Nov 28, 2017

Conversation

loredanacirstea
Copy link
Contributor

@loredanacirstea loredanacirstea commented Nov 28, 2017

merge after #198

fixes #181 - you can change the balance proof message hash logic at any point.

EIP712 is not standardized and can have breaking changes.

  • adds a setter in the uRaiden contract for setting the URaidenEIP712HelperContract address, callable only by the RaidenMicroTransferChannels contract owner
  • exposes getMessageHash as a pure function, used in the uRaiden verifyBalanceProof function

@@ -0,0 +1,34 @@
pragma solidity ^0.4.17;

contract URaidenEIP712HelperContract {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

###Naming Suggestion###

We call the microraiden contract RaidenMicroTransferChannels.sol so the library contract should also use micro and not u. So I would suggest something like MicoRaidenEIP712Helper. or MicroRaidenEIP712Signer. No need to keep the contract part in the name. We know it's a contract.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MicoRaidenEIP712Helper it is then. I tried a couple of names, but I knew you are better at this and will probably find a good one hahah.

pure
returns (bytes32)
{
// Used in the RaidenMicroTransferChannels contract
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove comment. Already written above.

// The hashed strings should be kept in sync with this function's parameters
// (variable names and types)
bytes32 message_hash = keccak256(
keccak256('address receiver', 'uint32 block_created', 'uint192 balance', 'address contract'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test here guarantees that they are kept in sync, right? If not then we need such a test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EIP712 is not standardized and can have breaking changes.
- adds a setter in the uRaiden contract for setting the `URaidenEIP712HelperContract` address, callable only by the `RaidenMicroTransferChannels` contract owner
- exposes `getMessageHash` as a `pure` function, used in the uRaiden `verifyBalanceProof` function
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

eth_signTypedData - add verifyBalanceProofPrepend() ; prepend schema hash
2 participants