Skip to content

Commit

Permalink
Add missing GSNBouncerSignature test
Browse files Browse the repository at this point in the history
  • Loading branch information
nventuro committed Aug 2, 2019
1 parent 15ada12 commit 3328834
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion test/gsn/GSNBouncerSignature.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { fixSignature } = require('../helpers/sign');

const GSNBouncerSignatureMock = artifacts.require('GSNBouncerSignatureMock');

contract('GSNBouncerSignature', function ([_, deployer, signer, other]) {
contract('GSNBouncerSignature', function ([_, signer, other]) {
beforeEach(async function () {
this.recipient = await GSNBouncerSignatureMock.new(signer);
});
Expand Down Expand Up @@ -54,5 +54,19 @@ contract('GSNBouncerSignature', function ([_, deployer, signer, other]) {

await expectEvent.inTransaction(tx, GSNBouncerSignatureMock, 'MockFunctionCalled');
});

it('rejects relay requests where all parameters are signed by an invalid signer', async function () {
const approveFunction = async (data) =>
fixSignature(
await web3.eth.sign(
web3.utils.soliditySha3(
// eslint-disable-next-line max-len
data.relay_address, data.from, data.encodedFunctionCall, data.txfee, data.gas_price, data.gas_limit, data.nonce, data.relay_hub_address, this.recipient.address
), other
)
);

await gsn.expectGSNError(this.recipient.mockFunction({ value: 0, useGSN: true, approveFunction }));
});
});
});

0 comments on commit 3328834

Please sign in to comment.