From d73cf7f8b58f51c62f76c05ac6c5074df86b0eca Mon Sep 17 00:00:00 2001 From: Nik G Date: Wed, 6 Mar 2019 10:45:58 -0600 Subject: [PATCH] Add invalid signature on relay entry test --- contracts/solidity/test/TestRelayEntry.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/contracts/solidity/test/TestRelayEntry.js b/contracts/solidity/test/TestRelayEntry.js index 24c3f4da23..62fc6dccb8 100644 --- a/contracts/solidity/test/TestRelayEntry.js +++ b/contracts/solidity/test/TestRelayEntry.js @@ -1,3 +1,4 @@ +import exceptThrow from './helpers/expectThrow'; const KeepRandomBeaconProxy = artifacts.require('./KeepRandomBeacon.sol'); const KeepRandomBeaconImplV1 = artifacts.require('./KeepRandomBeaconImplV1.sol'); const KeepGroupStub = artifacts.require('./KeepGroupStub.sol'); @@ -22,6 +23,20 @@ contract('TestRelayEntry', function() { relayEntryGeneratedEvent = keepRandomBeaconImplViaProxy.RelayEntryGenerated(); }); + it("should not be able to submit invalid relay entry", async function() { + let requestID = 1; + let seed = 1; + + // Data generated using client Go code with master secret key 123 + let groupPubKey = "0x1f1954b33144db2b5c90da089e8bde287ec7089d5d6433f3b6becaefdb678b1b2a9de38d14bef2cf9afc3c698a4211fa7ada7b4f036a2dfef0dc122b423259d0"; + let previousEntry = web3.utils.toBN('0x884b130ed81751b63d0f5882483d4a24a7640bdf371f23b78dbeb520c84e3a85'); + + // Invalid signature + let groupSignature = web3.utils.toBN('0x0fb34abfa2a9844a58776650e399bca3e08ab134e42595e03e3efc5a0472bcd8'); + + await exceptThrow(keepRandomBeaconImplViaProxy.relayEntry(requestID, groupSignature, groupPubKey, previousEntry, seed)); + }); + it("should be able to submit valid relay entry", async function() { let requestID = 1; let seed = 1;