From 94740155e599d6314eb8c41d7b30c0e261e13602 Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Mon, 25 Jun 2018 11:01:05 -0700 Subject: Comments for ASM hashing --- .../current/protocol/Exchange/MixinTransactions.sol | 7 +++++++ .../current/protocol/Exchange/libs/LibOrder.sol | 20 ++++++++++++++++++++ 2 files changed, 27 insertions(+) (limited to 'packages/contracts/src') diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/MixinTransactions.sol b/packages/contracts/src/contracts/current/protocol/Exchange/MixinTransactions.sol index 20a4a12df..112e70673 100644 --- a/packages/contracts/src/contracts/current/protocol/Exchange/MixinTransactions.sol +++ b/packages/contracts/src/contracts/current/protocol/Exchange/MixinTransactions.sol @@ -62,6 +62,13 @@ 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) + // )); assembly { let memPtr := mload(64) mstore(memPtr, schemaHash) diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/libs/LibOrder.sol b/packages/contracts/src/contracts/current/protocol/Exchange/libs/LibOrder.sol index f3f1e9277..d1e5da580 100644 --- a/packages/contracts/src/contracts/current/protocol/Exchange/libs/LibOrder.sol +++ b/packages/contracts/src/contracts/current/protocol/Exchange/libs/LibOrder.sol @@ -98,6 +98,26 @@ contract LibOrder is bytes32 schemaHash = EIP712_ORDER_SCHEMA_HASH; bytes32 makerAssetDataHash = keccak256(order.makerAssetData); bytes32 takerAssetDataHash = keccak256(order.takerAssetData); + // Assembly for more efficiently computing: + // keccak256(abi.encodePacked( + // DOMAIN_SEPARATOR_SCHEMA_HASH, + // keccak256(abi.encodePacked(address(this))), + // ORDER_SCHEMA_HASH, + // keccak256(abi.encodePacked( + // order.makerAddress, + // order.takerAddress, + // order.feeRecipientAddress, + // order.senderAddress, + // order.makerAssetAmount, + // order.takerAssetAmount, + // order.makerFee, + // order.takerFee, + // order.expirationTimeSeconds, + // order.salt, + // keccak256(abi.encodePacked(order.makerAssetData)), + // keccak256(abi.encodePacked(order.takerAssetData)) + // )) + // )); assembly { // Backup let temp1 := mload(sub(order, 32)) -- cgit From 46d79e5115421285faa709e16ba6156f2c672f38 Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Thu, 28 Jun 2018 15:41:06 -0700 Subject: Updated hashing comments as-per PR --- .../contracts/current/protocol/Exchange/libs/LibOrder.sol | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'packages/contracts/src') diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/libs/LibOrder.sol b/packages/contracts/src/contracts/current/protocol/Exchange/libs/LibOrder.sol index d1e5da580..954f94f76 100644 --- a/packages/contracts/src/contracts/current/protocol/Exchange/libs/LibOrder.sol +++ b/packages/contracts/src/contracts/current/protocol/Exchange/libs/LibOrder.sol @@ -99,11 +99,7 @@ contract LibOrder is bytes32 makerAssetDataHash = keccak256(order.makerAssetData); bytes32 takerAssetDataHash = keccak256(order.takerAssetData); // Assembly for more efficiently computing: - // keccak256(abi.encodePacked( - // DOMAIN_SEPARATOR_SCHEMA_HASH, - // keccak256(abi.encodePacked(address(this))), - // ORDER_SCHEMA_HASH, - // keccak256(abi.encodePacked( + // keccak256(abi.encode( // order.makerAddress, // order.takerAddress, // order.feeRecipientAddress, @@ -114,10 +110,9 @@ contract LibOrder is // order.takerFee, // order.expirationTimeSeconds, // order.salt, - // keccak256(abi.encodePacked(order.makerAssetData)), - // keccak256(abi.encodePacked(order.takerAssetData)) - // )) - // )); + // keccak256(order.makerAssetData), + // keccak256(order.takerAssetData) + // )); assembly { // Backup let temp1 := mload(sub(order, 32)) -- cgit