diff --git a/test/gsn/GSNBouncerSignature.test.js b/test/gsn/GSNBouncerSignature.test.js index 2d55c5f11e1..212cc15fab0 100644 --- a/test/gsn/GSNBouncerSignature.test.js +++ b/test/gsn/GSNBouncerSignature.test.js @@ -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); }); @@ -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 })); + }); }); });