-
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.
Implement update node operators in capability registry (#12991)
* implement update node operators in capability registry * address PR feedback * cache owner call * Validate config on NewApplication (#12997) * validate config on new application spawn * Add changeset * Check config only in the rebroadcast-transactions command * Configurable Mercury transmitter parameters (#12680) * Configurable Mercury transmitter parameters * Changeset * Remove commented code * add tag * Rename * LogPoller CLI command to resolve reorg greater than finality depth (#12867) * find lca and remove block after CLI * fix sort.Find typo * make RemoveBlocks local cmd * tests * added changeset * added tags to the changeset * fixed tests * make cmds, vars cases consistent * Fix Node Migration Test Check For Versions (#12982) * fix: prevent query syntax error if allowlist is empty (#12912) Co-authored-by: Morgan Kuphal <[email protected]> * Update wrappers * Formatting --------- Co-authored-by: george-dorin <[email protected]> Co-authored-by: Sam <[email protected]> Co-authored-by: Dmytro Haidashenko <[email protected]> Co-authored-by: Tate <[email protected]> Co-authored-by: Gabriel Paradiso <[email protected]> Co-authored-by: Morgan Kuphal <[email protected]> Co-authored-by: DeividasK <[email protected]>
- Loading branch information
1 parent
0a37c0e
commit 9293126
Showing
6 changed files
with
268 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 | ||
--- | ||
|
||
generate gethwrappers for updating node operators in capability registry #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 update node operator' |
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
60 changes: 60 additions & 0 deletions
60
contracts/src/v0.8/keystone/test/CapabilityRegistry_UpdateNodeOperatorsTest.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,60 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.19; | ||
|
||
import {BaseTest} from "./BaseTest.t.sol"; | ||
import {CapabilityRegistry} from "../CapabilityRegistry.sol"; | ||
|
||
contract CapabilityRegistry_UpdateNodeOperatorTest is BaseTest { | ||
event NodeOperatorUpdated(uint256 nodeOperatorId, address indexed admin, string name); | ||
|
||
uint256 private constant TEST_NODE_OPERATOR_ID = 0; | ||
address private constant NEW_NODE_OPERATOR_ADMIN = address(3); | ||
string private constant NEW_NODE_OPERATOR_NAME = "new-node-operator"; | ||
|
||
function setUp() public override { | ||
BaseTest.setUp(); | ||
changePrank(ADMIN); | ||
s_capabilityRegistry.addNodeOperators(_getNodeOperators()); | ||
} | ||
|
||
function test_RevertWhen_CalledByNonAdminAndNonOwner() public { | ||
changePrank(STRANGER); | ||
vm.expectRevert(CapabilityRegistry.AccessForbidden.selector); | ||
|
||
CapabilityRegistry.NodeOperator[] memory nodeOperators = new CapabilityRegistry.NodeOperator[](1); | ||
nodeOperators[0] = CapabilityRegistry.NodeOperator({admin: NEW_NODE_OPERATOR_ADMIN, name: NEW_NODE_OPERATOR_NAME}); | ||
|
||
uint256[] memory nodeOperatorIds = new uint256[](1); | ||
nodeOperatorIds[0] = TEST_NODE_OPERATOR_ID; | ||
s_capabilityRegistry.updateNodeOperators(nodeOperatorIds, nodeOperators); | ||
} | ||
|
||
function test_RevertWhen_NodeOperatorAdminIsZeroAddress() public { | ||
changePrank(ADMIN); | ||
vm.expectRevert(CapabilityRegistry.InvalidNodeOperatorAdmin.selector); | ||
CapabilityRegistry.NodeOperator[] memory nodeOperators = new CapabilityRegistry.NodeOperator[](1); | ||
nodeOperators[0] = CapabilityRegistry.NodeOperator({admin: address(0), name: NEW_NODE_OPERATOR_NAME}); | ||
|
||
uint256[] memory nodeOperatorIds = new uint256[](1); | ||
nodeOperatorIds[0] = TEST_NODE_OPERATOR_ID; | ||
s_capabilityRegistry.updateNodeOperators(nodeOperatorIds, nodeOperators); | ||
} | ||
|
||
function test_UpdatesNodeOperator() public { | ||
changePrank(ADMIN); | ||
|
||
CapabilityRegistry.NodeOperator[] memory nodeOperators = new CapabilityRegistry.NodeOperator[](1); | ||
nodeOperators[0] = CapabilityRegistry.NodeOperator({admin: NEW_NODE_OPERATOR_ADMIN, name: NEW_NODE_OPERATOR_NAME}); | ||
|
||
uint256[] memory nodeOperatorIds = new uint256[](1); | ||
nodeOperatorIds[0] = TEST_NODE_OPERATOR_ID; | ||
|
||
vm.expectEmit(true, true, true, true, address(s_capabilityRegistry)); | ||
emit NodeOperatorUpdated(TEST_NODE_OPERATOR_ID, NEW_NODE_OPERATOR_ADMIN, NEW_NODE_OPERATOR_NAME); | ||
s_capabilityRegistry.updateNodeOperators(nodeOperatorIds, nodeOperators); | ||
|
||
CapabilityRegistry.NodeOperator memory nodeOperator = s_capabilityRegistry.getNodeOperator(0); | ||
assertEq(nodeOperator.admin, NEW_NODE_OPERATOR_ADMIN); | ||
assertEq(nodeOperator.name, NEW_NODE_OPERATOR_NAME); | ||
} | ||
} |
Oops, something went wrong.