diff options
author | Remco Bloemen <remco@wicked.ventures> | 2018-02-22 08:22:24 +0800 |
---|---|---|
committer | Amir Bandeali <abandeali1@gmail.com> | 2018-04-21 04:56:16 +0800 |
commit | 655c1eb90fb4da08a2374280e2fd5fb786f67f3b (patch) | |
tree | 45e844f2018e2186665107330db72285c4e24a37 | |
parent | af6885db81d0c5e516be0531b9089c6174978685 (diff) | |
download | dexon-sol-tools-655c1eb90fb4da08a2374280e2fd5fb786f67f3b.tar dexon-sol-tools-655c1eb90fb4da08a2374280e2fd5fb786f67f3b.tar.gz dexon-sol-tools-655c1eb90fb4da08a2374280e2fd5fb786f67f3b.tar.bz2 dexon-sol-tools-655c1eb90fb4da08a2374280e2fd5fb786f67f3b.tar.lz dexon-sol-tools-655c1eb90fb4da08a2374280e2fd5fb786f67f3b.tar.xz dexon-sol-tools-655c1eb90fb4da08a2374280e2fd5fb786f67f3b.tar.zst dexon-sol-tools-655c1eb90fb4da08a2374280e2fd5fb786f67f3b.zip |
Add SignatureType.Invalid and documentation
-rw-r--r-- | packages/contracts/src/contracts/current/protocol/Exchange/MixinSignatureValidator.sol | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/MixinSignatureValidator.sol b/packages/contracts/src/contracts/current/protocol/Exchange/MixinSignatureValidator.sol index 1e072f001..d7020caa2 100644 --- a/packages/contracts/src/contracts/current/protocol/Exchange/MixinSignatureValidator.sol +++ b/packages/contracts/src/contracts/current/protocol/Exchange/MixinSignatureValidator.sol @@ -27,6 +27,7 @@ contract MixinSignatureValidator is { enum SignatureType { Illegal, // Default value + Invalid, Caller, Ecrecover, EIP712, @@ -51,10 +52,30 @@ contract MixinSignatureValidator is bytes32 s; // Always illegal signature + // This is always an implicit option, since a signer can create a + // signature array with invalid type or length. We may as well make + // it an explicit option. This aids testing and analysis. It is + // also the initialization value for the enum type. if (signatureType == SignatureType.Illegal) { revert(); + // Always invalid signature + // Like Illegal, this is always implicitely available and therefore + // offered dxplicitely. It can be implicitely creates by providing + // a validly formatted but incorrect signature. + } else if (signatureType == SignatureType.Invalid) { + require(signature.length == 1); + isValid = false; + return; + // Implicitly signed by caller + // The signer has initiated the call. In the case of non-contract + // accounts it means the transaction itself was signed. + // Example: lets say for a particular operation three signatures + // A, B are required. To submit the transaction, A and B can give + // a signatue to C, who can then submit the transaction using + // `Caller` for his own signature. Or A and C can sign and B can + // submit using `Caller`. Having `Caller` allows this flexibility. } else if (signatureType == SignatureType.Caller) { require(signature.length == 1); isValid = signer == msg.sender; |