Skip to content

Commit

Permalink
address PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
cds95 committed May 19, 2024
1 parent 8fe1dd6 commit bb8684a
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 419 deletions.
21 changes: 2 additions & 19 deletions contracts/src/v0.8/keystone/CapabilityRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -183,20 +183,6 @@ contract CapabilityRegistry is OwnerIsCreator, TypeAndVersionInterface {
/// configured
event ConfigSet(uint32 donId, uint32 configCount);

/// @notice This event is emitted when a new DON is created
/// @param donId The ID of the newly created DON
/// @param isPublic True if the newly created DON is public
event DONAdded(uint256 donId, bool isPublic);

/// @notice This event is emitted when a DON is removed
/// @param donId The ID of the removed DON
event DONRemoved(uint32 donId);

/// @notice This event is emitted when a new DON is created
/// @param donId The ID of the updated DON
/// @param isPublic True if the updated DON is public
event DONUpdated(uint256 donId, bool isPublic);

/// @notice This error is emitted when a DON does not exist
/// @param donId The ID of the nonexistent DON
error DONDoesNotExist(uint32 donId);
Expand Down Expand Up @@ -562,10 +548,8 @@ contract CapabilityRegistry is OwnerIsCreator, TypeAndVersionInterface {
) external onlyOwner {
uint32 id = s_donId;
s_dons[id].id = id;
uint32 configCount = 1; // Initialize config count to start at 1
_setDONConfig(id, configCount, nodes, capabilityConfigurations, isPublic);
_setDONConfig(id, 1, nodes, capabilityConfigurations, isPublic);
++s_donId;
emit DONAdded(id, isPublic);
}

/// @notice Updates a DON's configuration. This allows
Expand All @@ -586,7 +570,6 @@ contract CapabilityRegistry is OwnerIsCreator, TypeAndVersionInterface {
if (configCount == 0) revert DONDoesNotExist(donId);
_setDONConfig(donId, ++configCount, nodes, capabilityConfigurations, isPublic);
++s_donId;
emit DONUpdated(donId, isPublic);
}

/// @notice Removes DONs from the Capability Registry
Expand All @@ -599,7 +582,7 @@ contract CapabilityRegistry is OwnerIsCreator, TypeAndVersionInterface {
// DON config count starts at index 1
if (don.configCount == 0) revert DONDoesNotExist(donId);
delete s_dons[donId];
emit DONRemoved(donId);
emit ConfigSet(donId, 0);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {BaseTest} from "./BaseTest.t.sol";
import {CapabilityRegistry} from "../CapabilityRegistry.sol";

contract CapabilityRegistry_AddDONTest is BaseTest {
event DONAdded(uint256 donId, bool isPublic);
event ConfigSet(uint32 donId, uint32 configCount);

uint32 private constant DON_ID = 1;
Expand Down Expand Up @@ -161,8 +160,6 @@ contract CapabilityRegistry_AddDONTest is BaseTest {

vm.expectEmit(true, true, true, true, address(s_capabilityRegistry));
emit ConfigSet(DON_ID, 1);
vm.expectEmit(true, true, true, true, address(s_capabilityRegistry));
emit DONAdded(DON_ID, true);
s_capabilityRegistry.addDON(nodes, capabilityConfigs, true);

(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {BaseTest} from "./BaseTest.t.sol";
import {CapabilityRegistry} from "../CapabilityRegistry.sol";

contract CapabilityRegistry_RemoveDONsTest is BaseTest {
event DONRemoved(uint32 donId);
event ConfigSet(uint32 donId, uint32 configCount);

uint32 private constant DON_ID = 1;
uint32 private constant TEST_NODE_OPERATOR_ONE_ID = 0;
Expand Down Expand Up @@ -81,7 +81,7 @@ contract CapabilityRegistry_RemoveDONsTest is BaseTest {
uint32[] memory donIDs = new uint32[](1);
donIDs[0] = DON_ID;
vm.expectEmit(true, true, true, true, address(s_capabilityRegistry));
emit DONRemoved(DON_ID);
emit ConfigSet(DON_ID, 0);
s_capabilityRegistry.removeDONs(donIDs);

(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {BaseTest} from "./BaseTest.t.sol";
import {CapabilityRegistry} from "../CapabilityRegistry.sol";

contract CapabilityRegistry_UpdateDONTest is BaseTest {
event DONUpdated(uint256 donId, bool isPublic);
event ConfigSet(uint32 donId, uint32 configCount);

uint32 private constant DON_ID = 1;
Expand Down Expand Up @@ -194,8 +193,6 @@ contract CapabilityRegistry_UpdateDONTest is BaseTest {

vm.expectEmit(true, true, true, true, address(s_capabilityRegistry));
emit ConfigSet(DON_ID, expectedConfigCount);
vm.expectEmit(true, true, true, true, address(s_capabilityRegistry));
emit DONUpdated(DON_ID, expectedDONIsPublic);
s_capabilityRegistry.updateDON(DON_ID, nodes, capabilityConfigs, expectedDONIsPublic);

(
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 b4c900aae9e022f01abbac7993d41f93912247613ac6270b0c4da4ef6f2016e3
keystone_capability_registry: ../../../contracts/solc/v0.8.19/CapabilityRegistry/CapabilityRegistry.abi ../../../contracts/solc/v0.8.19/CapabilityRegistry/CapabilityRegistry.bin 0f3be7185a134d687c284e01453ab0534c85d89b8ffb4fb3e8d3f19d41b6b555
keystone_capability_registry: ../../../contracts/solc/v0.8.19/CapabilityRegistry/CapabilityRegistry.abi ../../../contracts/solc/v0.8.19/CapabilityRegistry/CapabilityRegistry.bin 9071d50b46256a36b777ff444a58354c318d7d6bbe86a9ae28bf91a664502fc9
ocr3_capability: ../../../contracts/solc/v0.8.19/OCR3Capability/OCR3Capability.abi ../../../contracts/solc/v0.8.19/OCR3Capability/OCR3Capability.bin 9dcbdf55bd5729ba266148da3f17733eb592c871c2108ccca546618628fd9ad2

0 comments on commit bb8684a

Please sign in to comment.