aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/src
diff options
context:
space:
mode:
authorRemco Bloemen <remco@wicked.ventures>2018-02-22 08:22:24 +0800
committerAmir Bandeali <abandeali1@gmail.com>2018-04-21 04:56:16 +0800
commit655c1eb90fb4da08a2374280e2fd5fb786f67f3b (patch)
tree45e844f2018e2186665107330db72285c4e24a37 /packages/contracts/src
parentaf6885db81d0c5e516be0531b9089c6174978685 (diff)
downloaddexon-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
Diffstat (limited to 'packages/contracts/src')
-rw-r--r--packages/contracts/src/contracts/current/protocol/Exchange/MixinSignatureValidator.sol21
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;