Skip to content

Commit

Permalink
Allow zero address to be used as proposed admin address (#9695)
Browse files Browse the repository at this point in the history
* Allow zero address to be used as proposed admin address

* regen wrappers

* fix test
  • Loading branch information
infiloop2 authored and FelixFan1992 committed Jul 6, 2023
1 parent 683198b commit 88e8fb2
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 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
22 changes: 15 additions & 7 deletions contracts/test/v0.8/automation/KeeperRegistry2_1.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4290,13 +4290,21 @@ describe('KeeperRegistry2_1', () => {
)
})

it('reverts when transferring to zero address', async () => {
await evmRevert(
registry
.connect(admin)
.transferUpkeepAdmin(upkeepId, ethers.constants.AddressZero),
'InvalidRecipient()',
)
it('allows cancelling transfer by reverting to zero address', async () => {
await registry
.connect(admin)
.transferUpkeepAdmin(upkeepId, await payee1.getAddress())
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
Loading

0 comments on commit 88e8fb2

Please sign in to comment.