In @0x/contracts-exchange: Fix comments in MixinSignatureValidator.sol.

This commit is contained in:
Lawrence Forman 2019-04-12 12:29:56 -04:00 committed by Amir Bandeali
parent cfa8796b18
commit 7de9a36d01

View File

@ -111,7 +111,7 @@ contract MixinSignatureValidator is
)); ));
} }
// Pop last byte off of signature byte array. // Read the last byte off of signature byte array.
uint8 signatureTypeRaw = uint8(signature[signature.length-1]); uint8 signatureTypeRaw = uint8(signature[signature.length-1]);
// Ensure signature is supported // Ensure signature is supported
@ -219,12 +219,6 @@ contract MixinSignatureValidator is
return isValid; return isValid;
// Signature verified by validator contract. // Signature verified by validator contract.
// If used with an order, the maker of the order can still be an EOA.
// A signature using this type should be encoded as:
// | Offset | Length | Contents |
// | 0x00 | x | Signature to validate |
// | 0x00 + x | 20 | Address of validator contract |
// | 0x14 + x | 1 | Signature type is always "\x06" |
} else if (signatureType == SignatureType.Validator) { } else if (signatureType == SignatureType.Validator) {
isValid = isValidValidatorSignature( isValid = isValidValidatorSignature(
hash, hash,
@ -282,7 +276,6 @@ contract MixinSignatureValidator is
assembly { assembly {
mstore(signature, signatureLength) mstore(signature, signatureLength)
} }
// Static call the verification function. // Static call the verification function.
(bool didSucceed, bytes memory returnData) = walletAddress.staticcall(callData); (bool didSucceed, bytes memory returnData) = walletAddress.staticcall(callData);
// Return data should be a single bool. // Return data should be a single bool.
@ -311,6 +304,13 @@ contract MixinSignatureValidator is
view view
returns (bool isValid) returns (bool isValid)
{ {
// If used with an order, the maker of the order can still be an EOA.
// A signature using this type should be encoded as:
// | Offset | Length | Contents |
// | 0x00 | x | Signature to validate |
// | 0x00 + x | 20 | Address of validator contract |
// | 0x14 + x | 1 | Signature type is always "\x06" |
uint256 signatureLength = signature.length; uint256 signatureLength = signature.length;
// Read the validator address from the signature. // Read the validator address from the signature.
address validatorAddress = signature.readAddress(signatureLength - 21); address validatorAddress = signature.readAddress(signatureLength - 21);