From 3a6c3b5f8bd005d72036341bf8314106b36d26f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Carranza=20V=C3=A9lez?= Date: Thu, 14 Jul 2022 14:08:02 +0200 Subject: [PATCH 1/2] fix: check before adding/removing whitelisted addresses [N-23] --- contracts/gateway/L1GraphTokenGateway.sol | 2 ++ 1 file changed, 2 insertions(+) diff --git a/contracts/gateway/L1GraphTokenGateway.sol b/contracts/gateway/L1GraphTokenGateway.sol index ac5b1c6bc..c8fb4baa1 100644 --- a/contracts/gateway/L1GraphTokenGateway.sol +++ b/contracts/gateway/L1GraphTokenGateway.sol @@ -149,6 +149,7 @@ contract L1GraphTokenGateway is GraphTokenGateway, L1ArbitrumMessenger { */ function addToCallhookWhitelist(address _newWhitelisted) external onlyGovernor { require(_newWhitelisted != address(0), "INVALID_ADDRESS"); + require(!callhookWhitelist[_newWhitelisted], "ALREADY_WHITELISTED"); callhookWhitelist[_newWhitelisted] = true; emit AddedToCallhookWhitelist(_newWhitelisted); } @@ -160,6 +161,7 @@ contract L1GraphTokenGateway is GraphTokenGateway, L1ArbitrumMessenger { */ function removeFromCallhookWhitelist(address _notWhitelisted) external onlyGovernor { require(_notWhitelisted != address(0), "INVALID_ADDRESS"); + require(callhookWhitelist[_notWhitelisted], "NOT_WHITELISTED"); callhookWhitelist[_notWhitelisted] = false; emit RemovedFromCallhookWhitelist(_notWhitelisted); } From 37d70a5191a0ac037ee7fb93fa73dc4f73f111b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Carranza=20V=C3=A9lez?= Date: Fri, 15 Jul 2022 13:15:52 +0200 Subject: [PATCH 2/2] test: remove repeated addToCallhookWhitelist --- test/lib/fixtures.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/test/lib/fixtures.ts b/test/lib/fixtures.ts index 54dc8bf3f..5a4f1e53a 100644 --- a/test/lib/fixtures.ts +++ b/test/lib/fixtures.ts @@ -283,9 +283,6 @@ export class NetworkFixture { await l1FixtureContracts.l1Reservoir .connect(deployer) .setL2ReservoirAddress(mockL2ReservoirAddress) - await l1FixtureContracts.l1GraphTokenGateway - .connect(deployer) - .addToCallhookWhitelist(l1FixtureContracts.l1Reservoir.address) await l1FixtureContracts.l1GraphTokenGateway.connect(deployer).setPaused(false) }