-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add function to remove operators in Capability Registry (#12979)
* update remove operators function * address PR feedback
- Loading branch information
Showing
6 changed files
with
216 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"chainlink": patch | ||
--- | ||
|
||
update keystone gethwrapper with remove operator function #internal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@chainlink/contracts": patch | ||
--- | ||
|
||
add function to remove node operators from capability registry |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
contracts/src/v0.8/keystone/test/CapabilityRegistry_RemoveNodeOperatorsTest.t.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.19; | ||
|
||
import {BaseTest} from "./BaseTest.t.sol"; | ||
import {CapabilityRegistry} from "../CapabilityRegistry.sol"; | ||
|
||
contract CapabilityRegistry_RemoveNodeOperatorsTest is BaseTest { | ||
event NodeOperatorRemoved(uint256 nodeOperatorId); | ||
|
||
uint256 private constant TEST_NODE_OPERATOR_ONE_ID = 0; | ||
uint256 private constant TEST_NODE_OPERATOR_TWO_ID = 1; | ||
|
||
function setUp() public override { | ||
BaseTest.setUp(); | ||
changePrank(ADMIN); | ||
s_capabilityRegistry.addNodeOperators(_getNodeOperators()); | ||
} | ||
|
||
function test_RevertWhen_CalledByNonOwner() public { | ||
changePrank(STRANGER); | ||
vm.expectRevert("Only callable by owner"); | ||
uint256[] memory nodeOperatorsToRemove = new uint256[](2); | ||
nodeOperatorsToRemove[1] = 1; | ||
s_capabilityRegistry.removeNodeOperators(nodeOperatorsToRemove); | ||
} | ||
|
||
function test_RemovesNodeOperator() public { | ||
changePrank(ADMIN); | ||
|
||
vm.expectEmit(true, true, true, true, address(s_capabilityRegistry)); | ||
emit NodeOperatorRemoved(TEST_NODE_OPERATOR_ONE_ID); | ||
vm.expectEmit(true, true, true, true, address(s_capabilityRegistry)); | ||
emit NodeOperatorRemoved(TEST_NODE_OPERATOR_TWO_ID); | ||
uint256[] memory nodeOperatorsToRemove = new uint256[](2); | ||
nodeOperatorsToRemove[1] = 1; | ||
s_capabilityRegistry.removeNodeOperators(nodeOperatorsToRemove); | ||
|
||
CapabilityRegistry.NodeOperator memory nodeOperatorOne = s_capabilityRegistry.getNodeOperator(0); | ||
assertEq(nodeOperatorOne.admin, address(0)); | ||
assertEq(nodeOperatorOne.name, ""); | ||
|
||
CapabilityRegistry.NodeOperator memory nodeOperatorTwo = s_capabilityRegistry.getNodeOperator(1); | ||
assertEq(nodeOperatorTwo.admin, address(0)); | ||
assertEq(nodeOperatorTwo.name, ""); | ||
} | ||
} |
147 changes: 145 additions & 2 deletions
147
...hwrappers/keystone/generated/keystone_capability_registry/keystone_capability_registry.go
Large diffs are not rendered by default.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
core/gethwrappers/keystone/generation/generated-wrapper-dependency-versions-do-not-edit.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 579334dfcb59da4221823735dc815116745b488ddde327199367e04457aac808 | ||
keystone_capability_registry: ../../../contracts/solc/v0.8.19/CapabilityRegistry/CapabilityRegistry.abi ../../../contracts/solc/v0.8.19/CapabilityRegistry/CapabilityRegistry.bin 9eaa36e45c1b33c1fa72b7e25d6d1ca351413225611abb84ae053270b569cca4 | ||
ocr3_capability: ../../../contracts/solc/v0.8.19/OCR3Capability/OCR3Capability.abi ../../../contracts/solc/v0.8.19/OCR3Capability/OCR3Capability.bin 9dcbdf55bd5729ba266148da3f17733eb592c871c2108ccca546618628fd9ad2 |