-
Notifications
You must be signed in to change notification settings - Fork 30
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Signing with Web3 for callGasRelayed in IdentityGasRelayed.sol #22
Comments
It should be
All key holders should sign the same thing, then the result (r,s,v) should be concatenated, and then concatenated with other signatures. Note that this contract needs to be updated to latest solidity (which might make things easier), and was not formally audited. |
@3esmit Thanks! |
There's an existing bug that causes Also, to build the message, what we did, in order to not build the hashed message manually, was invoking the hashing function of the contract directly
And then, sign it with ------- EDIT ---- |
I am trying to work out what is the appropriate way to sign offline for the
_messageSignatures
, incallGasRelayed(...)
, in IdentityGasRelay.sol.The params dev instruction states "rsv concatenated ethereum signed message". Which web3 "signing" method is used to arrive at these r,s and v values? As I understand, these change with the encodings and
We have:
bytes32 signHash = getSignHash( callGasRelayHash( _to, _value, keccak256(_data), _nonce, _gasPrice, _gasLimit, _gasToken ) );
Where callGasRelayHash is:
_callGasRelayHash = keccak256( address(this), CALL_PREFIX, _to, _value, _dataHash, _nonce, _gasPrice, _gasLimit, _gasToken );
and getSignHash is:
signHash = keccak256("\x19Ethereum Signed Message:\n32", _hash);
so inline, the signHash is equivalent to:
keccak256("\x19Ethereum Signed Message:\n32", keccak256( address(this), CALL_PREFIX, _to, _value, keccak256(_data), _nonce, _gasPrice, _gasLimit, _gasToken ) )
Signatures included in
_messageSignatures
are eventually checked against thissignHash
using ecrecover, which takes the r,s and v values after extraction from_messageSignatures
.If the desired transaction to be relayed is of form:
var tx = { _to, _value, _data, _nonce, _gasPrice, _gasLimit, _gasToken }
How best to sign it offchain so the caller of callGasRelayed() has the correct
_messageSignatures
?The text was updated successfully, but these errors were encountered: