Skip to content

Commit

Permalink
Allow zero address to be used as proposed admin address
Browse files Browse the repository at this point in the history
  • Loading branch information
infiloop2 committed Jun 22, 2023
1 parent 6dd9bcc commit d3cdf28
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ contract KeeperRegistryLogicB2_1 is KeeperRegistryBase2_1 {
function transferUpkeepAdmin(uint256 id, address proposed) external {
_requireAdminAndNotCancelled(id);
if (proposed == msg.sender) revert ValueNotChanged();
if (proposed == ZERO_ADDRESS) revert InvalidRecipient();

if (s_proposedAdmin[id] != proposed) {
s_proposedAdmin[id] = proposed;
Expand Down
19 changes: 12 additions & 7 deletions contracts/test/v0.8/automation/KeeperRegistry2_1.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4318,13 +4318,18 @@ describe('KeeperRegistry2_1', () => {
)
})

it('reverts when transferring to zero address', async () => {
await evmRevert(
registry
.connect(admin)
.transferUpkeepAdmin(upkeepId, ethers.constants.AddressZero),
'InvalidRecipient()',
)
it('allows transferring to zero address', async () => {
const tx = await registry
.connect(admin)
.transferUpkeepAdmin(upkeepId, ethers.constants.AddressZero)

await expect(tx)
.to.emit(registry, 'UpkeepAdminTransferRequested')
.withArgs(
upkeepId,
await admin.getAddress(),
ethers.constants.AddressZero,
)
})

it('does not change the upkeep admin', async () => {
Expand Down

0 comments on commit d3cdf28

Please sign in to comment.