Skip to content

Commit

Permalink
address PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
cds95 committed Jun 4, 2024
1 parent 2a78b68 commit df04262
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 45 deletions.
16 changes: 6 additions & 10 deletions contracts/src/v0.8/keystone/CapabilityRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -710,22 +710,18 @@ contract CapabilityRegistry is OwnerIsCreator, TypeAndVersionInterface {
/// @param capabilityId The Capability ID
/// @return bytes The DON specific configuration for the capability stored on the capability registry
/// @return bytes The DON specific configuration stored on the capability's configuration contract
function getDONCapabilityConfig(
uint32 donId,
bytes32 capabilityId
) external view returns (bytes memory, bytes memory) {
function getCapabilityConfigs(uint32 donId, bytes32 capabilityId) external view returns (bytes memory, bytes memory) {
uint32 configCount = s_dons[donId].configCount;
DONCapabilityConfig storage donCapabilityConfig = s_dons[donId].config[configCount];

bytes memory capabilityConfig = donCapabilityConfig.capabilityConfigs[capabilityId];
bytes memory capabilityConfigContractConfig;
bytes memory donCapabilityConfig = s_dons[donId].config[configCount].capabilityConfigs[capabilityId];
bytes memory globalCapabilityConfig;

if (bytes32(capabilityConfig) != bytes32("") && s_capabilities[capabilityId].configurationContract != address(0)) {
capabilityConfigContractConfig = ICapabilityConfiguration(s_capabilities[capabilityId].configurationContract)
if (s_capabilities[capabilityId].configurationContract != address(0)) {
globalCapabilityConfig = ICapabilityConfiguration(s_capabilities[capabilityId].configurationContract)
.getCapabilityConfiguration(donId);
}

return (capabilityConfig, capabilityConfigContractConfig);
return (donCapabilityConfig, globalCapabilityConfig);
}

/// @notice Sets the configuration for a DON
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,12 @@ contract CapabilityRegistry_AddDONTest is BaseTest {
assertEq(donInfo.capabilityConfigurations[0].capabilityId, s_basicHashedCapabilityId);

(bytes memory capabilityRegistryDONConfig, bytes memory capabilityConfigContractConfig) = s_capabilityRegistry
.getDONCapabilityConfig(DON_ID, s_basicHashedCapabilityId);
.getCapabilityConfigs(DON_ID, s_basicHashedCapabilityId);
assertEq(capabilityRegistryDONConfig, BASIC_CAPABILITY_CONFIG);
assertEq(capabilityConfigContractConfig, bytes(""));

(bytes memory capabilityRegistryDONConfigTwo, bytes memory capabilityConfigContractConfigTwo) = s_capabilityRegistry
.getDONCapabilityConfig(DON_ID, s_capabilityWithConfigurationContractId);
.getCapabilityConfigs(DON_ID, s_capabilityWithConfigurationContractId);
assertEq(capabilityRegistryDONConfigTwo, CONFIG_CAPABILITY_CONFIG);
assertEq(capabilityConfigContractConfigTwo, CONFIG_CAPABILITY_CONFIG);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ contract CapabilityRegistry_RemoveDONsTest is BaseTest {
assertEq(donInfo.capabilityConfigurations.length, 0);

(bytes memory capabilityRegistryDONConfig, bytes memory capabilityConfigContractConfig) = s_capabilityRegistry
.getDONCapabilityConfig(DON_ID, s_basicHashedCapabilityId);
.getCapabilityConfigs(DON_ID, s_basicHashedCapabilityId);

assertEq(capabilityRegistryDONConfig, bytes(""));
assertEq(capabilityConfigContractConfig, bytes(""));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ contract CapabilityRegistry_UpdateDONTest is BaseTest {
assertEq(donInfo.capabilityConfigurations[0].capabilityId, s_basicHashedCapabilityId);

(bytes memory capabilityRegistryDONConfig, bytes memory capabilityConfigContractConfig) = s_capabilityRegistry
.getDONCapabilityConfig(DON_ID, s_basicHashedCapabilityId);
.getCapabilityConfigs(DON_ID, s_basicHashedCapabilityId);
assertEq(capabilityRegistryDONConfig, BASIC_CAPABILITY_CONFIG);
assertEq(capabilityConfigContractConfig, bytes(""));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ contract CapabilityRegistry_UpdateNodeOperatorTest is BaseTest {
}

function test_RevertWhen_NodeOperatorIdAndParamLengthsMismatch() public {
changePrank(ADMIN);
changePrank(ADMIN);
CapabilityRegistry.NodeOperator[] memory nodeOperators = new CapabilityRegistry.NodeOperator[](1);
nodeOperators[0] = CapabilityRegistry.NodeOperator({admin: NEW_NODE_OPERATOR_ADMIN, name: NEW_NODE_OPERATOR_NAME});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,7 @@ contract CapabilityConfigurationContract is ICapabilityConfiguration, ERC165 {
return s_donConfiguration[donId];
}

function beforeCapabilityConfigSet(
bytes32[] calldata nodes,
bytes calldata config,
uint64 configCount,
uint32 donId
) external {
function beforeCapabilityConfigSet(bytes32[] calldata, bytes calldata config, uint64, uint32 donId) external {
// In practice a real capability configuration contract will do more than just store
// the config for a DON
s_donConfiguration[donId] = config;
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GETH_VERSION: 1.13.8
forwarder: ../../../contracts/solc/v0.8.19/KeystoneForwarder/KeystoneForwarder.abi ../../../contracts/solc/v0.8.19/KeystoneForwarder/KeystoneForwarder.bin ed9164cfe4619dff824b11df46b66f4c6834b2ca072923f10d9ebc57ce508ed8
keystone_capability_registry: ../../../contracts/solc/v0.8.19/CapabilityRegistry/CapabilityRegistry.abi ../../../contracts/solc/v0.8.19/CapabilityRegistry/CapabilityRegistry.bin 6ddde14173b0109fcd6f83a8fa25647858e74903af3133d667d5863b032181af
keystone_capability_registry: ../../../contracts/solc/v0.8.19/CapabilityRegistry/CapabilityRegistry.abi ../../../contracts/solc/v0.8.19/CapabilityRegistry/CapabilityRegistry.bin d95781054b4491e1469038a2857372f7bbaf455a244e138880579d15bb9471c6
ocr3_capability: ../../../contracts/solc/v0.8.19/OCR3Capability/OCR3Capability.abi ../../../contracts/solc/v0.8.19/OCR3Capability/OCR3Capability.bin 9dcbdf55bd5729ba266148da3f17733eb592c871c2108ccca546618628fd9ad2

0 comments on commit df04262

Please sign in to comment.