Encode arguments with selector before passing into EIP1271 isValidSignature
This commit is contained in:
@@ -220,7 +220,11 @@ contract MixinSignatureValidator is
|
||||
if (signatureType == SignatureType.Validator) {
|
||||
// The entire order is verified by a validator contract.
|
||||
isValid = _validateBytesWithValidator(
|
||||
abi.encode(order, orderHash),
|
||||
abi.encodeWithSelector(
|
||||
IEIP1271Wallet(address(0)).OrderWithHash.selector,
|
||||
order,
|
||||
orderHash
|
||||
),
|
||||
orderHash,
|
||||
signerAddress,
|
||||
signature
|
||||
@@ -228,7 +232,11 @@ contract MixinSignatureValidator is
|
||||
} else if (signatureType == SignatureType.EIP1271Wallet) {
|
||||
// The entire order is verified by a wallet contract.
|
||||
isValid = _validateBytesWithWallet(
|
||||
abi.encode(order, orderHash),
|
||||
abi.encodeWithSelector(
|
||||
IEIP1271Wallet(address(0)).OrderWithHash.selector,
|
||||
order,
|
||||
orderHash
|
||||
),
|
||||
orderHash,
|
||||
signerAddress,
|
||||
signature
|
||||
@@ -268,7 +276,11 @@ contract MixinSignatureValidator is
|
||||
if (signatureType == SignatureType.Validator) {
|
||||
// The entire transaction is verified by a validator contract.
|
||||
isValid = _validateBytesWithValidator(
|
||||
abi.encode(transaction, transactionHash),
|
||||
abi.encodeWithSelector(
|
||||
IEIP1271Wallet(address(0)).ZeroExTransactionWithHash.selector,
|
||||
transaction,
|
||||
transactionHash
|
||||
),
|
||||
transactionHash,
|
||||
signerAddress,
|
||||
signature
|
||||
@@ -276,7 +288,11 @@ contract MixinSignatureValidator is
|
||||
} else if (signatureType == SignatureType.EIP1271Wallet) {
|
||||
// The entire transaction is verified by a wallet contract.
|
||||
isValid = _validateBytesWithWallet(
|
||||
abi.encode(transaction, transactionHash),
|
||||
abi.encodeWithSelector(
|
||||
IEIP1271Wallet(address(0)).ZeroExTransactionWithHash.selector,
|
||||
transaction,
|
||||
transactionHash
|
||||
),
|
||||
transactionHash,
|
||||
signerAddress,
|
||||
signature
|
||||
|
@@ -17,8 +17,11 @@
|
||||
*/
|
||||
|
||||
pragma solidity ^0.5.9;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import "@0x/contracts-utils/contracts/src/LibEIP1271.sol";
|
||||
import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
|
||||
import "@0x/contracts-exchange-libs/contracts/src/LibZeroExTransaction.sol";
|
||||
|
||||
|
||||
contract IEIP1271Wallet is
|
||||
@@ -35,4 +38,24 @@ contract IEIP1271Wallet is
|
||||
external
|
||||
view
|
||||
returns (bytes4 magicValue);
|
||||
|
||||
/// @dev This function's selector is used when ABI encoding the order
|
||||
/// and hash into a byte array before calling `isValidSignature`.
|
||||
/// This function serves no other purpose.
|
||||
function OrderWithHash(
|
||||
LibOrder.Order calldata order,
|
||||
bytes32 orderHash
|
||||
)
|
||||
external
|
||||
pure;
|
||||
|
||||
/// @dev This function's selector is used when ABI encoding the transaction
|
||||
/// and hash into a byte array before calling `isValidSignature`.
|
||||
/// This function serves no other purpose.
|
||||
function ZeroExTransactionWithHash(
|
||||
LibZeroExTransaction.ZeroExTransaction calldata transaction,
|
||||
bytes32 transactionHash
|
||||
)
|
||||
external
|
||||
pure;
|
||||
}
|
||||
|
Reference in New Issue
Block a user