-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New/Consolidated Signature Type(s) and Behavior #33
Labels
status: implemented
Proposed changes have been implemented (and deployed, if smart contract)
type: core
Comments
dekz
changed the title
[3.0] OrderValidator Signature Type(s)
OrderValidator Signature Type(s)
May 6, 2019
It might be valuable to support EIP-1271 as well (either in addition to or as a replacement to the |
Updated to reflect that
|
dorothy-zbornak
changed the title
OrderValidator Signature Type(s)
New/Consolidated Signature Type(s) and Behavior
Jun 26, 2019
Updated for consolidated signature types and EIP-1271 pattern. |
Closed
This was referenced Oct 21, 2019
Updated for new validation and encoding behavior. |
Merged
Closed
mintcloud
added
status: implemented
Proposed changes have been implemented (and deployed, if smart contract)
type: core
and removed
3.0
labels
Apr 10, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
status: implemented
Proposed changes have been implemented (and deployed, if smart contract)
type: core
Summary
Add more robust order and transaction signature validation with the following callback signature types, which accept an entire
Order
orZeroExTransaction
object:Validator
(*replaces existing behavior)EIP1271Wallet
Also, all signature types (including these) will be checked on every fill. This is in contrast to the behavior in
2.0
where we only validate the signature on the first fill.Motivation
In
2.0
, we haveValidator
andWallet
signature types, which can only validate against a hash, which means the order/transaction must be somehow registered with the validator contract prior to execution to determine meaningful context. It would be more useful if the validator contract was provided with the complete order/transaction data so they can implement more nuanced and dynamic filtering criteria.Recent improvements to solidity and
ABIEncoderV2
have made this approach relatively simple to execute.Specification
Restrictions
staticcall()
. If the contract attempts to update state during call, the validation will fail.Validator
signature type must be registered in advance viasetSignatureValidatorApproval()
(unchanged from2.0
). This only has to be done once per validator-signer pair.Signature Encoding
The
Validator
signature type is tightly packed with the ordered fields:The
EIP1271Wallet
signature type is tightly packed with the following ordered fields. Note that the address of the validator contract is implied as the order maker or transaction signer.Implementation
Contracts validating the
Validator
andEIP1271
signature types follow the EIP-1271 pattern and must expose the following callback:EIP-1271
data
EncodingThere are two ways the
data
parameter forEIP1271Wallet
andValidator
signatures can be encoded, depending on what type of data is signed:abi.encodeWithSelector(bytes4(0x3efe50c8), Order order, bytes32 orderHash)
abi.encodeWithSelector(bytes4(0xde047db4), ZeroExTransaction transaction, bytes32 transactionHash)
Example
Here is a complete (if trivial) implementation that validates an Order signature:
The text was updated successfully, but these errors were encountered: