Skip to content

Commit

Permalink
Add invalid signature on relay entry test
Browse files Browse the repository at this point in the history
  • Loading branch information
ngrinkevich committed Mar 6, 2019
1 parent 5970005 commit d73cf7f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions contracts/solidity/test/TestRelayEntry.js
Original file line number Diff line number Diff line change
@@ -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');
Expand All @@ -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;
Expand Down

0 comments on commit d73cf7f

Please sign in to comment.