File tree 2 files changed +13
-3
lines changed
2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -24,10 +24,8 @@ contract Paymaster is BasePaymaster {
24
24
uint256 private constant SIGNATURE_OFFSET = VALID_TIMESTAMP_OFFSET + 64 ;
25
25
26
26
constructor (IEntryPoint _entryPoint , address _verifyingSigner ) BasePaymaster (_entryPoint) Ownable () {
27
- require (_verifyingSigner != address (0 ), "Paymaster: verifyingSigner cannot be address(0) " );
28
- require (_verifyingSigner != msg .sender , "Paymaster: verifyingSigner cannot be the owner " );
29
27
require (address (_entryPoint).code.length > 0 , "Paymaster: passed _entryPoint is not currently a contract " );
30
- verifyingSigner = _verifyingSigner;
28
+ setVerifyingSigner ( _verifyingSigner) ;
31
29
}
32
30
33
31
/**
@@ -90,6 +88,8 @@ contract Paymaster is BasePaymaster {
90
88
}
91
89
92
90
function setVerifyingSigner (address _verifyingSigner ) public onlyOwner {
91
+ require (_verifyingSigner != address (0 ), "Paymaster: verifyingSigner cannot be address(0) " );
92
+ require (_verifyingSigner != msg .sender , "Paymaster: verifyingSigner cannot be the owner " );
93
93
verifyingSigner = _verifyingSigner;
94
94
}
95
95
Original file line number Diff line number Diff line change @@ -41,6 +41,16 @@ contract PaymasterTest is Test {
41
41
new Paymaster (entrypoint, address (this ));
42
42
}
43
43
44
+ function test_zeroAddressSetVerifyingSigner () public {
45
+ vm.expectRevert ("Paymaster: verifyingSigner cannot be address(0) " );
46
+ paymaster.setVerifyingSigner (address (0 ));
47
+ }
48
+
49
+ function test_ownerSetVerifyingSigner () public {
50
+ vm.expectRevert ("Paymaster: verifyingSigner cannot be the owner " );
51
+ paymaster.setVerifyingSigner (address (this ));
52
+ }
53
+
44
54
function test_entryPointNotAContract () public {
45
55
vm.expectRevert ("Paymaster: passed _entryPoint is not currently a contract " );
46
56
new Paymaster (IEntryPoint (address (0x1234 )), PAYMASTER_SIGNER);
You can’t perform that action at this time.
0 commit comments