From 1a4e5346ed40e5c02f5ca75d3cdfccb694c641d9 Mon Sep 17 00:00:00 2001 From: Francisco Giordano Date: Thu, 27 Sep 2018 19:40:18 -0300 Subject: [PATCH] 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 --- contracts/mocks/SignatureBouncerMock.sol | 7 +++++++ test/drafts/SignatureBouncer.test.js | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/contracts/mocks/SignatureBouncerMock.sol b/contracts/mocks/SignatureBouncerMock.sol index ad9494033..85076eae6 100644 --- a/contracts/mocks/SignatureBouncerMock.sol +++ b/contracts/mocks/SignatureBouncerMock.sol @@ -63,4 +63,11 @@ contract SignatureBouncerMock is SignatureBouncer, SignerRoleMock { { } + + function tooShortMsgData() + public + onlyValidSignatureAndData("") + view + { + } } diff --git a/test/drafts/SignatureBouncer.test.js b/test/drafts/SignatureBouncer.test.js index b320ca98c..c234687fc 100644 --- a/test/drafts/SignatureBouncer.test.js +++ b/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 }) + ); + }); }); });