From a69addc7c0668f687c0df65c1b4faca1c941b0d8 Mon Sep 17 00:00:00 2001 From: Rens Rooimans Date: Fri, 20 Sep 2024 15:10:33 +0200 Subject: [PATCH] add 165 test --- contracts/gas-snapshots/ccip.gas-snapshot | 2 ++ contracts/src/v0.8/ccip/capability/CCIPHome.sol | 2 ++ .../src/v0.8/ccip/test/capability/CCIPHome.t.sol | 12 +++++++++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/contracts/gas-snapshots/ccip.gas-snapshot b/contracts/gas-snapshots/ccip.gas-snapshot index 2e9914afef..9e14950e1c 100644 --- a/contracts/gas-snapshots/ccip.gas-snapshot +++ b/contracts/gas-snapshots/ccip.gas-snapshot @@ -65,6 +65,8 @@ CCIPHome_chainConfig:test_getCapabilityConfiguration_Success() (gas: 9594) CCIPHome_chainConfig:test_getPaginatedCCIPHomes_Success() (gas: 370990) CCIPHome_constructor:test_constructor_Success() (gas: 2988852) CCIPHome_constructor:test_constructor_ZeroAddressNotAllowed_Revert() (gas: 61020) +CCIPHome_supportsInterface:test_getCapabilityConfiguration_Success() (gas: 9485) +CCIPHome_supportsInterface:test_supportsInterface_Success() (gas: 8964) CCIPHome_updatePluginConfig:test__updatePluginConfig_InvalidConfigLength_Reverts() (gas: 19611) CCIPHome_updatePluginConfig:test__updatePluginConfig_InvalidConfigStateTransition_Reverts() (gas: 19418) CCIPHome_updatePluginConfig:test_getCapabilityConfiguration_Success() (gas: 9631) diff --git a/contracts/src/v0.8/ccip/capability/CCIPHome.sol b/contracts/src/v0.8/ccip/capability/CCIPHome.sol index 76eae80515..03752831dc 100644 --- a/contracts/src/v0.8/ccip/capability/CCIPHome.sol +++ b/contracts/src/v0.8/ccip/capability/CCIPHome.sol @@ -151,6 +151,8 @@ contract CCIPHome is ITypeAndVersion, ICapabilityConfiguration, OwnerIsCreator, } /// @inheritdoc IERC165 + /// @dev The CapabilitiesRegistry contract will call this function with the `ICapabilityConfiguration` interface ID. + /// If that call doesn't succeed, no config can be set. function supportsInterface(bytes4 interfaceId) external pure override returns (bool) { return interfaceId == type(ICapabilityConfiguration).interfaceId || interfaceId == type(IERC165).interfaceId; } diff --git a/contracts/src/v0.8/ccip/test/capability/CCIPHome.t.sol b/contracts/src/v0.8/ccip/test/capability/CCIPHome.t.sol index 4e921295c9..27a2396905 100644 --- a/contracts/src/v0.8/ccip/test/capability/CCIPHome.t.sol +++ b/contracts/src/v0.8/ccip/test/capability/CCIPHome.t.sol @@ -1,8 +1,10 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.24; -import {CCIPHome} from "../../capability/CCIPHome.sol"; +import {ICapabilityConfiguration} from "../../../keystone/interfaces/ICapabilityConfiguration.sol"; import {ICapabilitiesRegistry} from "../../interfaces/ICapabilitiesRegistry.sol"; + +import {CCIPHome} from "../../capability/CCIPHome.sol"; import {Internal} from "../../libraries/Internal.sol"; import {CCIPHomeHelper} from "../helpers/CCIPHomeHelper.sol"; import {Test} from "forge-std/Test.sol"; @@ -1210,6 +1212,14 @@ contract CCIPHome_updatePluginConfig is CCIPHomeSetup { } } +contract CCIPHome_supportsInterface is CCIPHomeSetup { + function test_supportsInterface_Success() public { + assertTrue( + s_ccipCC.supportsInterface(type(ICapabilityConfiguration).interfaceId), "supportsInterface must return true" + ); + } +} + contract CCIPHome_beforeCapabilityConfigSet is CCIPHomeSetup { function test_beforeCapabilityConfigSet_ZeroLengthConfig_Success() public { changePrank(CAPABILITIES_REGISTRY);