diff --git a/contracts/src/v0.8/ccip/capability/CCIPConfig.sol b/contracts/src/v0.8/ccip/capability/CCIPConfig.sol index f6b41950f3..3414f4912f 100644 --- a/contracts/src/v0.8/ccip/capability/CCIPConfig.sol +++ b/contracts/src/v0.8/ccip/capability/CCIPConfig.sol @@ -230,13 +230,15 @@ contract CCIPConfig is ITypeAndVersion, ICapabilityConfiguration, OwnerIsCreator ocr3Config.offchainConfig = newOcr3Config.offchainConfig; // Remove all excess nodes - for (uint256 j = newOcr3Config.nodes.length; j < ocr3Config.nodes.length; ++j) { + while (ocr3Config.nodes.length > newOcr3Config.nodes.length) { ocr3Config.nodes.pop(); } // Assign nodes for (uint256 j = 0; j < newOcr3Config.nodes.length; ++j) { - ocr3Config.nodes[j] = newOcr3Config.nodes[j]; + if (j >= ocr3Config.nodes.length) { + ocr3Config.nodes.push(newOcr3Config.nodes[j]); + } } } diff --git a/contracts/src/v0.8/ccip/test/capability/CCIPConfig.t.sol b/contracts/src/v0.8/ccip/test/capability/CCIPConfig.t.sol index 92a18d4482..2511fac12c 100644 --- a/contracts/src/v0.8/ccip/test/capability/CCIPConfig.t.sol +++ b/contracts/src/v0.8/ccip/test/capability/CCIPConfig.t.sol @@ -477,6 +477,7 @@ contract CCIPConfig_validateConfig is CCIPConfigSetup { nodes[i].transmitterKey = bytes(""); } + config.nodes = nodes; vm.expectRevert(abi.encodeWithSelector(CCIPConfig.NotEnoughTransmitters.selector, numberOfTransmitters, 4)); s_ccipCC.validateConfig(config); }