Skip to content

Commit

Permalink
add don and type to getAllConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
RensR committed Sep 23, 2024
1 parent 72b0884 commit 4318f80
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
18 changes: 11 additions & 7 deletions contracts/src/v0.8/ccip/capability/CCIPHome.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ import {HomeBase} from "./HomeBase.sol";

import {EnumerableSet} from "../../vendor/openzeppelin-solidity/v5.0.2/contracts/utils/structs/EnumerableSet.sol";

/// @notice CCIPHome stores the configuration for the CCIP capability.
/// We have two classes of configuration: chain configuration and DON (in the CapabilitiesRegistry sense) configuration.
/// Each chain will have a single configuration which includes information like the router address.
/// Each CR DON will have up to four configurations: for each of (commit, exec), one blue and one green configuration.
/// This is done in order to achieve "blue-green" deployments.
contract CCIPHome is HomeBase {
using EnumerableSet for EnumerableSet.UintSet;

Expand Down Expand Up @@ -116,12 +121,11 @@ contract CCIPHome is HomeBase {
return (versionedConfig, false);
}

function getAllConfigs()
external
view
returns (VersionedConfig memory primaryConfig, VersionedConfig memory secondaryConfig)
{
(StoredConfig memory primaryStoredConfig, bool primaryOk) = _getPrimaryStoredConfig(0, 0);
function getAllConfigs(
uint32 donId,
uint8 pluginType
) external view returns (VersionedConfig memory primaryConfig, VersionedConfig memory secondaryConfig) {
(StoredConfig memory primaryStoredConfig, bool primaryOk) = _getPrimaryStoredConfig(donId, pluginType);

if (primaryOk) {
primaryConfig = VersionedConfig({
Expand All @@ -131,7 +135,7 @@ contract CCIPHome is HomeBase {
});
}

(StoredConfig memory secondaryStoredConfig, bool secondaryOk) = _getSecondaryStoredConfig(0, 0);
(StoredConfig memory secondaryStoredConfig, bool secondaryOk) = _getSecondaryStoredConfig(donId, pluginType);

if (secondaryOk) {
secondaryConfig = VersionedConfig({
Expand Down
13 changes: 6 additions & 7 deletions contracts/src/v0.8/ccip/capability/RMNHome.sol
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,11 @@ contract RMNHome is HomeBase {
return (versionedConfig, false);
}

function getAllConfigs()
external
view
returns (VersionedConfig memory primaryConfig, VersionedConfig memory secondaryConfig)
{
(StoredConfig memory primaryStoredConfig, bool primaryOk) = _getPrimaryStoredConfig(0, 0);
function getAllConfigs(
uint32 donId,
uint8 pluginType
) external view returns (VersionedConfig memory primaryConfig, VersionedConfig memory secondaryConfig) {
(StoredConfig memory primaryStoredConfig, bool primaryOk) = _getPrimaryStoredConfig(donId, pluginType);

if (primaryOk) {
primaryConfig = VersionedConfig({
Expand All @@ -88,7 +87,7 @@ contract RMNHome is HomeBase {
});
}

(StoredConfig memory secondaryStoredConfig, bool secondaryOk) = _getSecondaryStoredConfig(0, 0);
(StoredConfig memory secondaryStoredConfig, bool secondaryOk) = _getSecondaryStoredConfig(donId, pluginType);

if (secondaryOk) {
secondaryConfig = VersionedConfig({
Expand Down

0 comments on commit 4318f80

Please sign in to comment.