From d3cdf281a6a8cefb9a6627388313bf0c8dc309a7 Mon Sep 17 00:00:00 2001 From: Akshay Aggarwal Date: Thu, 22 Jun 2023 16:26:57 +0100 Subject: [PATCH] Allow zero address to be used as proposed admin address --- .../2_1/KeeperRegistryLogicB2_1.sol | 1 - .../v0.8/automation/KeeperRegistry2_1.test.ts | 19 ++++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/contracts/src/v0.8/dev/automation/2_1/KeeperRegistryLogicB2_1.sol b/contracts/src/v0.8/dev/automation/2_1/KeeperRegistryLogicB2_1.sol index 21dada7e893..322e3d6b182 100644 --- a/contracts/src/v0.8/dev/automation/2_1/KeeperRegistryLogicB2_1.sol +++ b/contracts/src/v0.8/dev/automation/2_1/KeeperRegistryLogicB2_1.sol @@ -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; diff --git a/contracts/test/v0.8/automation/KeeperRegistry2_1.test.ts b/contracts/test/v0.8/automation/KeeperRegistry2_1.test.ts index 7a8d6a853ad..246475558fc 100644 --- a/contracts/test/v0.8/automation/KeeperRegistry2_1.test.ts +++ b/contracts/test/v0.8/automation/KeeperRegistry2_1.test.ts @@ -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 () => {