move nonce check as first step (gas relayer pays this gas)

This commit is contained in:
Ricardo Guilherme Schmidt 2018-03-22 13:09:02 -03:00
parent 789252ba97
commit 3bdba827c9

View File

@ -38,11 +38,11 @@ contract IdentityGasRelay is Identity {
) )
external external
{ {
require(_nonce == nonce);
uint startGas = gasleft(); uint startGas = gasleft();
require(startGas >= _gasMinimal); require(startGas >= _gasMinimal);
uint256 requiredKey = _to == address(this) ? MANAGEMENT_KEY : ACTION_KEY; uint256 requiredKey = _to == address(this) ? MANAGEMENT_KEY : ACTION_KEY;
require(minimumApprovalsByKeyPurpose[requiredKey] == 1); require(minimumApprovalsByKeyPurpose[requiredKey] == 1);
require(_nonce == nonce);
nonce++; nonce++;
bytes32 _signedHash = getSignHash( bytes32 _signedHash = getSignHash(
@ -105,9 +105,9 @@ contract IdentityGasRelay is Identity {
) )
external external
{ {
require(_nonce == nonce);
uint startGas = gasleft(); uint startGas = gasleft();
require(startGas >= _gasMinimal); require(startGas >= _gasMinimal);
require(_nonce == nonce);
nonce++; nonce++;
_callGasRelayedMultiSigned(_to, _value, _data, _nonce, _gasPrice, _gasMinimal, _gasToken, _messageSignatures); _callGasRelayedMultiSigned(_to, _value, _data, _nonce, _gasPrice, _gasMinimal, _gasToken, _messageSignatures);
if (_gasPrice > 0) { if (_gasPrice > 0) {