Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GSNSignatureBouncer fix #1920

Merged
merged 9 commits into from
Oct 4, 2019
1 change: 1 addition & 0 deletions contracts/GSN/bouncers/GSNBouncerSignature.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ contract GSNBouncerSignature is GSNBouncerBase {
* @dev Sets the trusted signer that is going to be producing signatures to approve relayed calls.
*/
constructor(address trustedSigner) public {
require(trustedSigner != address(0), "GSNBouncerSignature: trusted signer is the zero address");
_trustedSigner = trustedSigner;
}

Expand Down
14 changes: 13 additions & 1 deletion test/GSN/GSNBouncerSignature.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
const { expectEvent } = require('openzeppelin-test-helpers');
const { expectEvent, expectRevert, constants } = require('openzeppelin-test-helpers');
const gsn = require('@openzeppelin/gsn-helpers');
const { fixSignature } = require('../helpers/sign');
const { utils: { toBN } } = require('web3');
const { ZERO_ADDRESS } = constants;

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

Expand All @@ -17,6 +18,17 @@ contract('GSNBouncerSignature', function ([_, signer, other]) {
});
});

context('when constructor is called with a zero address', function () {
it('fails when constructor called with a zero address', async function () {
await expectRevert(
GSNBouncerSignatureMock.new(
ZERO_ADDRESS
),
'GSNBouncerSignature: trusted signer is the zero address'
);
});
});

context('when relay-called', function () {
beforeEach(async function () {
await gsn.fundRecipient(web3, { recipient: this.recipient.address });
Expand Down