diff options
author | Amir Bandeali <abandeali1@gmail.com> | 2018-07-06 04:29:11 +0800 |
---|---|---|
committer | Amir Bandeali <abandeali1@gmail.com> | 2018-07-07 02:53:59 +0800 |
commit | 0ea3b10efd121012b528b4368290f5b598c74b5d (patch) | |
tree | 7c2eccb11946875c783cc1993e56b527d0571ebe /packages/contracts/src/2.0.0/protocol/Exchange/MixinTransactions.sol | |
parent | d634775d4018499fb0d590010c7d07dfd9047fd1 (diff) | |
download | dexon-0x-contracts-0ea3b10efd121012b528b4368290f5b598c74b5d.tar.gz dexon-0x-contracts-0ea3b10efd121012b528b4368290f5b598c74b5d.tar.zst dexon-0x-contracts-0ea3b10efd121012b528b4368290f5b598c74b5d.zip |
Only reset currentContextAddress if it was previously updated
Diffstat (limited to 'packages/contracts/src/2.0.0/protocol/Exchange/MixinTransactions.sol')
-rw-r--r-- | packages/contracts/src/2.0.0/protocol/Exchange/MixinTransactions.sol | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/MixinTransactions.sol b/packages/contracts/src/2.0.0/protocol/Exchange/MixinTransactions.sol index 823e14316..88d2da7d7 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/MixinTransactions.sol +++ b/packages/contracts/src/2.0.0/protocol/Exchange/MixinTransactions.sol @@ -99,9 +99,10 @@ contract MixinTransactions is "FAILED_EXECUTION" ); - // Reset current transaction signer - // TODO: Check if gas is paid when currentContextAddress is already 0. - currentContextAddress = address(0); + // Reset current transaction signer if it was previously updated + if (signerAddress != msg.sender) { + currentContextAddress = address(0); + } } /// @dev Calculates EIP712 hash of the Transaction. @@ -120,13 +121,15 @@ contract MixinTransactions is { bytes32 schemaHash = EIP712_ZEROEX_TRANSACTION_SCHEMA_HASH; bytes32 dataHash = keccak256(data); + // Assembly for more efficiently computing: // keccak256(abi.encode( - // EIP712_ZEROEX_TRANSACTION_SCHEMA_HASH, - // salt, - // signerAddress, - // keccak256(data) - // )); + // EIP712_ZEROEX_TRANSACTION_SCHEMA_HASH, + // salt, + // signerAddress, + // keccak256(data) + // )); + assembly { let memPtr := mload(64) mstore(memPtr, schemaHash) |