Skip to content

Commit

Permalink
Revert on non-contract entrypoint (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdehoog authored Nov 1, 2023
1 parent 25fdbc7 commit 1c7eb30
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Paymaster.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ contract Paymaster is BasePaymaster {
constructor(IEntryPoint _entryPoint, address _verifyingSigner) BasePaymaster(_entryPoint) {
require(_verifyingSigner != address(0), "Paymaster: verifyingSigner cannot be address(0)");
require(_verifyingSigner != msg.sender, "Paymaster: verifyingSigner cannot be the owner");
require(address(_entryPoint).code.length > 0, "Paymaster: passed _entryPoint is not currently a contract");
verifyingSigner = _verifyingSigner;
}

Expand Down
5 changes: 5 additions & 0 deletions test/Paymaster.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ contract PaymasterTest is Test {
new Paymaster(entrypoint, address(this));
}

function test_entryPointNotAContract() public {
vm.expectRevert("Paymaster: passed _entryPoint is not currently a contract");
new Paymaster(IEntryPoint(address(0x1234)), PAYMASTER_SIGNER);
}

function test_noRenounceOwnership() public {
vm.expectRevert("Paymaster: renouncing ownership is not allowed");
paymaster.renounceOwnership();
Expand Down

0 comments on commit 1c7eb30

Please sign in to comment.