Browse Source

Add SignatureBouncer test for when msg.data is too short (#1360)

* add test for msg.data too short

* fix test to hit that branch

* Update SignatureBouncer.test.js
Francisco Giordano 7 years ago
parent
commit
1a4e5346ed
2 changed files with 13 additions and 0 deletions
  1. 7 0
      contracts/mocks/SignatureBouncerMock.sol
  2. 6 0
      test/drafts/SignatureBouncer.test.js

+ 7 - 0
contracts/mocks/SignatureBouncerMock.sol

@@ -63,4 +63,11 @@ contract SignatureBouncerMock is SignatureBouncer, SignerRoleMock {
   {
 
   }
+
+  function tooShortMsgData()
+    public
+    onlyValidSignatureAndData("")
+    view
+  {
+  }
 }

+ 6 - 0
test/drafts/SignatureBouncer.test.js

@@ -128,6 +128,12 @@ contract('SignatureBouncer', function ([_, signer, otherSigner, anyone, authoriz
           )
         );
       });
+
+      it('does not allow msg.data shorter than SIGNATURE_SIZE', async function () {
+        await assertRevert(
+          this.sigBouncer.tooShortMsgData({ from: authorizedUser })
+        );
+      });
     });
   });