Skip to content

Commit

Permalink
add storing of ccip config
Browse files Browse the repository at this point in the history
  • Loading branch information
RensR committed Sep 25, 2024
1 parent 17b57ab commit 57f63e3
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions contracts/src/v0.8/ccip/capability/CCIPHome.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ contract CCIPHome is OwnerIsCreator, ITypeAndVersion, ICapabilityConfiguration,

event ChainConfigRemoved(uint64 chainSelector);
event ChainConfigSet(uint64 chainSelector, ChainConfig chainConfig);
event ConfigSet(bytes32 indexed configDigest, VersionedConfig versionedConfig);
event ConfigSet(bytes32 indexed configDigest, uint32 version, OCR3Config config);
event ConfigRevoked(bytes32 indexed configDigest);
event DynamicConfigSet(bytes32 indexed configDigest, bytes dynamicConfig);
event ConfigPromoted(bytes32 indexed configDigest);
Expand Down Expand Up @@ -298,14 +298,25 @@ contract CCIPHome is OwnerIsCreator, ITypeAndVersion, ICapabilityConfiguration,

uint32 newVersion = ++s_configCount;

VersionedConfig memory newConfig = VersionedConfig({configDigest: newDigest, version: newVersion, config: config});

VersionedConfig storage existingConfig = s_configs[pluginKey][s_primaryConfigIndex ^ 1];
// TODO existingConfig.config = config;
existingConfig.version = newVersion;
existingConfig.configDigest = newDigest;

emit ConfigSet(newConfig.configDigest, newConfig);
existingConfig.config.pluginType = config.pluginType;
existingConfig.config.chainSelector = config.chainSelector;
existingConfig.config.FRoleDON = config.FRoleDON;
existingConfig.config.offchainConfigVersion = config.offchainConfigVersion;
existingConfig.config.offrampAddress = config.offrampAddress;
existingConfig.config.offchainConfig = config.offchainConfig;

while (existingConfig.config.nodes.length > 0) {
existingConfig.config.nodes.pop();
}
for (uint256 i = 0; i < config.nodes.length; ++i) {
existingConfig.config.nodes.push(config.nodes[i]);
}

emit ConfigSet(newDigest, newVersion, config);

return newDigest;
}
Expand Down

0 comments on commit 57f63e3

Please sign in to comment.