From 912f20aecb08b13e2f2c416ed3b41f1b7a0eeb79 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Thu, 2 May 2024 00:38:00 -0400 Subject: [PATCH] Rename type -> id (#13008) --- .changeset/bright-queens-joke.md | 5 + contracts/.changeset/old-seas-doubt.md | 5 + .../src/v0.8/keystone/CapabilityRegistry.sol | 116 +++++++++------- .../src/v0.8/keystone/test/BaseTest.t.sol | 18 +-- ...CapabilityRegistry_AddCapabilityTest.t.sol | 17 ++- .../CapabilityRegistry_AddNodesTest.t.sol | 46 +++---- ...pabilityRegistry_DeprecateCapability.t.sol | 40 +++--- .../CapabilityRegistry_GetCapabilities.t.sol | 12 +- .../CapabilityRegistry_GetCapabilityIds.t.sol | 4 +- .../keystone_capability_registry.go | 126 +++++++++--------- ...rapper-dependency-versions-do-not-edit.txt | 2 +- core/services/workflows/engine.go | 10 +- core/services/workflows/engine_test.go | 22 +-- core/services/workflows/models.go | 5 +- core/services/workflows/models_test.go | 58 ++++---- core/services/workflows/models_yaml.go | 72 +++++----- core/services/workflows/models_yaml_test.go | 2 +- .../workflows/marshalling/workflow_1.yaml | 6 +- .../workflows/marshalling/workflow_2.yaml | 6 +- .../marshalling/workflow_2_spec.json | 8 +- .../workflows/references/failing_1.yaml | 6 +- .../workflows/references/passing_1.yaml | 6 +- .../workflows/versioning/failing_1.yaml | 6 +- .../workflows/versioning/failing_2.yaml | 6 +- .../workflows/versioning/passing_1.yaml | 6 +- .../fixtures/workflows/workflow_schema.json | 16 +-- core/web/jobs_controller_test.go | 8 +- 27 files changed, 333 insertions(+), 301 deletions(-) create mode 100644 .changeset/bright-queens-joke.md create mode 100644 contracts/.changeset/old-seas-doubt.md diff --git a/.changeset/bright-queens-joke.md b/.changeset/bright-queens-joke.md new file mode 100644 index 00000000000..a9dc2c8eb6d --- /dev/null +++ b/.changeset/bright-queens-joke.md @@ -0,0 +1,5 @@ +--- +"chainlink": patch +--- + +#internal Keystone - rename type -> id diff --git a/contracts/.changeset/old-seas-doubt.md b/contracts/.changeset/old-seas-doubt.md new file mode 100644 index 00000000000..d559b3f5641 --- /dev/null +++ b/contracts/.changeset/old-seas-doubt.md @@ -0,0 +1,5 @@ +--- +"@chainlink/contracts": patch +--- + +#internal Keystone - rename type to id diff --git a/contracts/src/v0.8/keystone/CapabilityRegistry.sol b/contracts/src/v0.8/keystone/CapabilityRegistry.sol index ed3a300ac40..9e0a67434fc 100644 --- a/contracts/src/v0.8/keystone/CapabilityRegistry.sol +++ b/contracts/src/v0.8/keystone/CapabilityRegistry.sol @@ -28,10 +28,10 @@ contract CapabilityRegistry is OwnerIsCreator, TypeAndVersionInterface { bytes32 p2pId; /// @notice The signer address for application-layer message verification. address signer; - /// @notice The list of capability IDs this node supports. This list is + /// @notice The list of hashed capability IDs this node supports. This list is /// never empty and all capabilities are guaranteed to exist in the /// CapabilityRegistry. - bytes32[] supportedCapabilityIds; + bytes32[] supportedHashedCapabilityIds; } // CapabilityResponseType indicates whether remote response requires @@ -45,10 +45,16 @@ contract CapabilityRegistry is OwnerIsCreator, TypeAndVersionInterface { } struct Capability { - // Capability type, e.g. "data-streams-reports" + // The `labelledName` is a partially qualified ID for the capability. + // + // Given the following capability ID: {name}:{label1_key}_{label1_value}:{label2_key}_{label2_value}@{version} + // Then we denote the `labelledName` as the `{name}:{label1_key}_{label1_value}:{label2_key}_{label2_value}` portion of the ID. + // + // Ex. id = "data-streams-reports:chain:ethereum@1.0.0" + // labelledName = "data-streams-reports:chain:ethereum" + // // bytes32(string); validation regex: ^[a-z0-9_\-:]{1,32}$ - // Not "type" because that's a reserved keyword in Solidity. - bytes32 capabilityType; + bytes32 labelledName; // Semver, e.g., "1.2.3" // bytes32(string); must be valid Semver + max 32 characters. bytes32 version; @@ -92,8 +98,8 @@ contract CapabilityRegistry is OwnerIsCreator, TypeAndVersionInterface { /// @notice This error is thrown when trying to add a node without /// capabilities or with capabilities that do not exist. - /// @param capabilityIds The IDs of the capabilities that are being added. - error InvalidNodeCapabilities(bytes32[] capabilityIds); + /// @param hashedCapabilityIds The IDs of the capabilities that are being added. + error InvalidNodeCapabilities(bytes32[] hashedCapabilityIds); /// @notice This event is emitted when a new node is added /// @param p2pId The P2P ID of the node @@ -104,15 +110,15 @@ contract CapabilityRegistry is OwnerIsCreator, TypeAndVersionInterface { /// exists. error CapabilityAlreadyExists(); - /// @notice This error is thrown when a capability with the provided ID is + /// @notice This error is thrown when a capability with the provided hashed ID is /// not found. - /// @param capabilityId The ID used for the lookup. - error CapabilityDoesNotExist(bytes32 capabilityId); + /// @param hashedCapabilityId The hashed ID used for the lookup. + error CapabilityDoesNotExist(bytes32 hashedCapabilityId); /// @notice This error is thrown when trying to deprecate a capability that /// is already deprecated. - /// @param capabilityId The ID of the capability that is already deprecated. - error CapabilityAlreadyDeprecated(bytes32 capabilityId); + /// @param hashedCapabilityId The hashed ID of the capability that is already deprecated. + error CapabilityAlreadyDeprecated(bytes32 hashedCapabilityId); /// @notice This error is thrown when trying to add a capability with a /// configuration contract that does not implement the required interface. @@ -138,16 +144,22 @@ contract CapabilityRegistry is OwnerIsCreator, TypeAndVersionInterface { event NodeOperatorUpdated(uint256 nodeOperatorId, address indexed admin, string name); /// @notice This event is emitted when a new capability is added - /// @param capabilityId The ID of the newly added capability - event CapabilityAdded(bytes32 indexed capabilityId); + /// @param hashedCapabilityId The hashed ID of the newly added capability + event CapabilityAdded(bytes32 indexed hashedCapabilityId); /// @notice This event is emitted when a capability is deprecated - /// @param capabilityId The ID of the deprecated capability - event CapabilityDeprecated(bytes32 indexed capabilityId); + /// @param hashedCapabilityId The hashed ID of the deprecated capability + event CapabilityDeprecated(bytes32 indexed hashedCapabilityId); mapping(bytes32 => Capability) private s_capabilities; - EnumerableSet.Bytes32Set private s_capabilityIds; - EnumerableSet.Bytes32Set private s_deprecatedCapabilityIds; + /// @notice Set of hashed capability IDs. + /// A hashed ID is created by the function `getHashedCapabilityId`. + EnumerableSet.Bytes32Set private s_hashedCapabilityIds; + /// @notice Set of deprecated hashed capability IDs, + /// A hashed ID is created by the function `getHashedCapabilityId`. + /// + /// Deprecated capabilities are skipped by the `getCapabilities` function. + EnumerableSet.Bytes32Set private s_deprecatedHashedCapabilityIds; /// @notice Mapping of node operators mapping(uint256 nodeOperatorId => NodeOperator nodeOperator) private s_nodeOperators; @@ -227,14 +239,15 @@ contract CapabilityRegistry is OwnerIsCreator, TypeAndVersionInterface { NodeOperator memory nodeOperator = s_nodeOperators[node.nodeOperatorId]; if (msg.sender != nodeOperator.admin) revert AccessForbidden(); - bool nodeExists = s_nodes[node.p2pId].supportedCapabilityIds.length > 0; + bool nodeExists = s_nodes[node.p2pId].supportedHashedCapabilityIds.length > 0; if (nodeExists || bytes32(node.p2pId) == bytes32("")) revert InvalidNodeP2PId(node.p2pId); - if (node.supportedCapabilityIds.length == 0) revert InvalidNodeCapabilities(node.supportedCapabilityIds); + if (node.supportedHashedCapabilityIds.length == 0) + revert InvalidNodeCapabilities(node.supportedHashedCapabilityIds); - for (uint256 j; j < node.supportedCapabilityIds.length; ++j) { - if (!s_capabilityIds.contains(node.supportedCapabilityIds[j])) - revert InvalidNodeCapabilities(node.supportedCapabilityIds); + for (uint256 j; j < node.supportedHashedCapabilityIds.length; ++j) { + if (!s_hashedCapabilityIds.contains(node.supportedHashedCapabilityIds[j])) + revert InvalidNodeCapabilities(node.supportedHashedCapabilityIds); } s_nodes[node.p2pId] = node; @@ -250,9 +263,8 @@ contract CapabilityRegistry is OwnerIsCreator, TypeAndVersionInterface { } function addCapability(Capability calldata capability) external onlyOwner { - bytes32 capabilityId = getCapabilityID(capability.capabilityType, capability.version); - - if (s_capabilityIds.contains(capabilityId)) revert CapabilityAlreadyExists(); + bytes32 hashedId = getHashedCapabilityId(capability.labelledName, capability.version); + if (s_hashedCapabilityIds.contains(hashedId)) revert CapabilityAlreadyExists(); if (capability.configurationContract != address(0)) { if ( @@ -263,24 +275,26 @@ contract CapabilityRegistry is OwnerIsCreator, TypeAndVersionInterface { ) revert InvalidCapabilityConfigurationContractInterface(capability.configurationContract); } - s_capabilityIds.add(capabilityId); - s_capabilities[capabilityId] = capability; + s_hashedCapabilityIds.add(hashedId); + s_capabilities[hashedId] = capability; - emit CapabilityAdded(capabilityId); + emit CapabilityAdded(hashedId); } /// @notice Deprecates a capability by adding it to the deprecated list - /// @param capabilityId The ID of the capability to deprecate - function deprecateCapability(bytes32 capabilityId) external onlyOwner { - if (!s_capabilityIds.contains(capabilityId)) revert CapabilityDoesNotExist(capabilityId); - if (s_deprecatedCapabilityIds.contains(capabilityId)) revert CapabilityAlreadyDeprecated(capabilityId); - - s_deprecatedCapabilityIds.add(capabilityId); - emit CapabilityDeprecated(capabilityId); + /// @param hashedCapabilityId The ID of the capability to deprecate + function deprecateCapability(bytes32 hashedCapabilityId) external onlyOwner { + if (!s_hashedCapabilityIds.contains(hashedCapabilityId)) revert CapabilityDoesNotExist(hashedCapabilityId); + if (s_deprecatedHashedCapabilityIds.contains(hashedCapabilityId)) + revert CapabilityAlreadyDeprecated(hashedCapabilityId); + + s_deprecatedHashedCapabilityIds.add(hashedCapabilityId); + emit CapabilityDeprecated(hashedCapabilityId); } - function getCapability(bytes32 capabilityID) public view returns (Capability memory) { - return s_capabilities[capabilityID]; + /// @notice This function returns a Capability by its hashed ID. Use `getHashedCapabilityId` to get the hashed ID. + function getCapability(bytes32 hashedId) public view returns (Capability memory) { + return s_capabilities[hashedId]; } /// @notice Returns all capabilities. This operation will copy capabilities @@ -288,21 +302,23 @@ contract CapabilityRegistry is OwnerIsCreator, TypeAndVersionInterface { /// used by view accessors that are queried without any gas fees. /// @return Capability[] An array of capabilities function getCapabilities() external view returns (Capability[] memory) { - bytes32[] memory capabilityIds = s_capabilityIds.values(); + bytes32[] memory hashedCapabilityIds = s_hashedCapabilityIds.values(); // Solidity does not support dynamic arrays in memory, so we create a // fixed-size array and copy the capabilities into it. - Capability[] memory capabilities = new Capability[](capabilityIds.length - s_deprecatedCapabilityIds.length()); + Capability[] memory capabilities = new Capability[]( + hashedCapabilityIds.length - s_deprecatedHashedCapabilityIds.length() + ); // We need to keep track of the new index because we are skipping // deprecated capabilities. uint256 newIndex; - for (uint256 i; i < capabilityIds.length; ++i) { - bytes32 capabilityId = capabilityIds[i]; + for (uint256 i; i < hashedCapabilityIds.length; ++i) { + bytes32 hashedCapabilityId = hashedCapabilityIds[i]; - if (!s_deprecatedCapabilityIds.contains(capabilityId)) { - capabilities[newIndex] = getCapability(capabilityId); + if (!s_deprecatedHashedCapabilityIds.contains(hashedCapabilityId)) { + capabilities[newIndex] = getCapability(hashedCapabilityId); newIndex++; } } @@ -310,16 +326,16 @@ contract CapabilityRegistry is OwnerIsCreator, TypeAndVersionInterface { return capabilities; } - /// @notice This functions returns a Capability ID packed into a bytes32 for cheaper access + /// @notice This functions returns a capability id that has been hashed to fit into a bytes32 for cheaper access /// @return bytes32 A unique identifier for the capability - function getCapabilityID(bytes32 capabilityType, bytes32 version) public pure returns (bytes32) { - return keccak256(abi.encodePacked(capabilityType, version)); + function getHashedCapabilityId(bytes32 labelledName, bytes32 version) public pure returns (bytes32) { + return keccak256(abi.encodePacked(labelledName, version)); } /// @notice Returns whether a capability is deprecated - /// @param capabilityId The ID of the capability to check + /// @param hashedCapabilityId The hashed ID of the capability to check /// @return bool True if the capability is deprecated, false otherwise - function isCapabilityDeprecated(bytes32 capabilityId) external view returns (bool) { - return s_deprecatedCapabilityIds.contains(capabilityId); + function isCapabilityDeprecated(bytes32 hashedCapabilityId) external view returns (bool) { + return s_deprecatedHashedCapabilityIds.contains(hashedCapabilityId); } } diff --git a/contracts/src/v0.8/keystone/test/BaseTest.t.sol b/contracts/src/v0.8/keystone/test/BaseTest.t.sol index 95c8d1e5d3d..b4d12f7ba73 100644 --- a/contracts/src/v0.8/keystone/test/BaseTest.t.sol +++ b/contracts/src/v0.8/keystone/test/BaseTest.t.sol @@ -11,9 +11,9 @@ contract BaseTest is Test, Constants { CapabilityConfigurationContract internal s_capabilityConfigurationContract; CapabilityRegistry.Capability internal s_basicCapability; CapabilityRegistry.Capability internal s_capabilityWithConfigurationContract; - bytes32 internal s_basicCapabilityId; + bytes32 internal s_basicHashedCapabilityId; bytes32 internal s_capabilityWithConfigurationContractId; - bytes32 internal s_nonExistentCapabilityId; + bytes32 internal s_nonExistentHashedCapabilityId; function setUp() public virtual { vm.startPrank(ADMIN); @@ -21,27 +21,27 @@ contract BaseTest is Test, Constants { s_capabilityConfigurationContract = new CapabilityConfigurationContract(); s_basicCapability = CapabilityRegistry.Capability({ - capabilityType: "data-streams-reports", + labelledName: "data-streams-reports", version: "1.0.0", responseType: CapabilityRegistry.CapabilityResponseType.REPORT, configurationContract: address(0) }); s_capabilityWithConfigurationContract = CapabilityRegistry.Capability({ - capabilityType: "read-ethereum-mainnet-gas-price", + labelledName: "read-ethereum-mainnet-gas-price", version: "1.0.2", responseType: CapabilityRegistry.CapabilityResponseType.OBSERVATION_IDENTICAL, configurationContract: address(s_capabilityConfigurationContract) }); - s_basicCapabilityId = s_capabilityRegistry.getCapabilityID( - s_basicCapability.capabilityType, + s_basicHashedCapabilityId = s_capabilityRegistry.getHashedCapabilityId( + s_basicCapability.labelledName, s_basicCapability.version ); - s_capabilityWithConfigurationContractId = s_capabilityRegistry.getCapabilityID( - s_capabilityWithConfigurationContract.capabilityType, + s_capabilityWithConfigurationContractId = s_capabilityRegistry.getHashedCapabilityId( + s_capabilityWithConfigurationContract.labelledName, s_capabilityWithConfigurationContract.version ); - s_nonExistentCapabilityId = s_capabilityRegistry.getCapabilityID("non-existent-capability", "1.0.0"); + s_nonExistentHashedCapabilityId = s_capabilityRegistry.getHashedCapabilityId("non-existent-capability", "1.0.0"); } function _getNodeOperators() internal view returns (CapabilityRegistry.NodeOperator[] memory) { diff --git a/contracts/src/v0.8/keystone/test/CapabilityRegistry_AddCapabilityTest.t.sol b/contracts/src/v0.8/keystone/test/CapabilityRegistry_AddCapabilityTest.t.sol index cf1bc6c8d73..dbcc0ae1712 100644 --- a/contracts/src/v0.8/keystone/test/CapabilityRegistry_AddCapabilityTest.t.sol +++ b/contracts/src/v0.8/keystone/test/CapabilityRegistry_AddCapabilityTest.t.sol @@ -47,10 +47,13 @@ contract CapabilityRegistry_AddCapabilityTest is BaseTest { function test_AddCapability_NoConfigurationContract() public { s_capabilityRegistry.addCapability(s_basicCapability); - bytes32 capabilityId = s_capabilityRegistry.getCapabilityID(bytes32("data-streams-reports"), bytes32("1.0.0")); - CapabilityRegistry.Capability memory storedCapability = s_capabilityRegistry.getCapability(capabilityId); + bytes32 hashedCapabilityId = s_capabilityRegistry.getHashedCapabilityId( + bytes32("data-streams-reports"), + bytes32("1.0.0") + ); + CapabilityRegistry.Capability memory storedCapability = s_capabilityRegistry.getCapability(hashedCapabilityId); - assertEq(storedCapability.capabilityType, s_basicCapability.capabilityType); + assertEq(storedCapability.labelledName, s_basicCapability.labelledName); assertEq(storedCapability.version, s_basicCapability.version); assertEq(uint256(storedCapability.responseType), uint256(s_basicCapability.responseType)); assertEq(storedCapability.configurationContract, s_basicCapability.configurationContract); @@ -59,13 +62,13 @@ contract CapabilityRegistry_AddCapabilityTest is BaseTest { function test_AddCapability_WithConfiguration() public { s_capabilityRegistry.addCapability(s_capabilityWithConfigurationContract); - bytes32 capabilityId = s_capabilityRegistry.getCapabilityID( - bytes32(s_capabilityWithConfigurationContract.capabilityType), + bytes32 hashedCapabilityId = s_capabilityRegistry.getHashedCapabilityId( + bytes32(s_capabilityWithConfigurationContract.labelledName), bytes32(s_capabilityWithConfigurationContract.version) ); - CapabilityRegistry.Capability memory storedCapability = s_capabilityRegistry.getCapability(capabilityId); + CapabilityRegistry.Capability memory storedCapability = s_capabilityRegistry.getCapability(hashedCapabilityId); - assertEq(storedCapability.capabilityType, s_capabilityWithConfigurationContract.capabilityType); + assertEq(storedCapability.labelledName, s_capabilityWithConfigurationContract.labelledName); assertEq(storedCapability.version, s_capabilityWithConfigurationContract.version); assertEq(uint256(storedCapability.responseType), uint256(s_capabilityWithConfigurationContract.responseType)); assertEq(storedCapability.configurationContract, s_capabilityWithConfigurationContract.configurationContract); diff --git a/contracts/src/v0.8/keystone/test/CapabilityRegistry_AddNodesTest.t.sol b/contracts/src/v0.8/keystone/test/CapabilityRegistry_AddNodesTest.t.sol index fe85c144eea..e179cc5cea6 100644 --- a/contracts/src/v0.8/keystone/test/CapabilityRegistry_AddNodesTest.t.sol +++ b/contracts/src/v0.8/keystone/test/CapabilityRegistry_AddNodesTest.t.sol @@ -22,14 +22,14 @@ contract CapabilityRegistry_AddNodesTest is BaseTest { changePrank(STRANGER); CapabilityRegistry.Node[] memory nodes = new CapabilityRegistry.Node[](1); - bytes32[] memory capabilityIds = new bytes32[](1); - capabilityIds[0] = s_basicCapabilityId; + bytes32[] memory hashedCapabilityIds = new bytes32[](1); + hashedCapabilityIds[0] = s_basicHashedCapabilityId; nodes[0] = CapabilityRegistry.Node({ nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, p2pId: P2P_ID, signer: NODE_OPERATOR_ONE_SIGNER_ADDRESS, - supportedCapabilityIds: capabilityIds + supportedHashedCapabilityIds: hashedCapabilityIds }); vm.expectRevert(CapabilityRegistry.AccessForbidden.selector); @@ -40,14 +40,14 @@ contract CapabilityRegistry_AddNodesTest is BaseTest { changePrank(NODE_OPERATOR_ONE_ADMIN); CapabilityRegistry.Node[] memory nodes = new CapabilityRegistry.Node[](1); - bytes32[] memory capabilityIds = new bytes32[](1); - capabilityIds[0] = s_basicCapabilityId; + bytes32[] memory hashedCapabilityIds = new bytes32[](1); + hashedCapabilityIds[0] = s_basicHashedCapabilityId; nodes[0] = CapabilityRegistry.Node({ nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, p2pId: P2P_ID, signer: NODE_OPERATOR_ONE_SIGNER_ADDRESS, - supportedCapabilityIds: capabilityIds + supportedHashedCapabilityIds: hashedCapabilityIds }); s_capabilityRegistry.addNodes(nodes); @@ -59,14 +59,14 @@ contract CapabilityRegistry_AddNodesTest is BaseTest { changePrank(NODE_OPERATOR_ONE_ADMIN); CapabilityRegistry.Node[] memory nodes = new CapabilityRegistry.Node[](1); - bytes32[] memory capabilityIds = new bytes32[](1); - capabilityIds[0] = s_basicCapabilityId; + bytes32[] memory hashedCapabilityIds = new bytes32[](1); + hashedCapabilityIds[0] = s_basicHashedCapabilityId; nodes[0] = CapabilityRegistry.Node({ nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, p2pId: bytes32(""), signer: NODE_OPERATOR_ONE_SIGNER_ADDRESS, - supportedCapabilityIds: capabilityIds + supportedHashedCapabilityIds: hashedCapabilityIds }); vm.expectRevert(abi.encodeWithSelector(CapabilityRegistry.InvalidNodeP2PId.selector, bytes32(""))); @@ -77,15 +77,15 @@ contract CapabilityRegistry_AddNodesTest is BaseTest { changePrank(NODE_OPERATOR_ONE_ADMIN); CapabilityRegistry.Node[] memory nodes = new CapabilityRegistry.Node[](1); - bytes32[] memory capabilityIds = new bytes32[](0); + bytes32[] memory hashedCapabilityIds = new bytes32[](0); nodes[0] = CapabilityRegistry.Node({ nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, p2pId: P2P_ID, signer: NODE_OPERATOR_ONE_SIGNER_ADDRESS, - supportedCapabilityIds: capabilityIds + supportedHashedCapabilityIds: hashedCapabilityIds }); - vm.expectRevert(abi.encodeWithSelector(CapabilityRegistry.InvalidNodeCapabilities.selector, capabilityIds)); + vm.expectRevert(abi.encodeWithSelector(CapabilityRegistry.InvalidNodeCapabilities.selector, hashedCapabilityIds)); s_capabilityRegistry.addNodes(nodes); } @@ -93,17 +93,17 @@ contract CapabilityRegistry_AddNodesTest is BaseTest { changePrank(NODE_OPERATOR_ONE_ADMIN); CapabilityRegistry.Node[] memory nodes = new CapabilityRegistry.Node[](1); - bytes32[] memory capabilityIds = new bytes32[](1); - capabilityIds[0] = s_nonExistentCapabilityId; + bytes32[] memory hashedCapabilityIds = new bytes32[](1); + hashedCapabilityIds[0] = s_nonExistentHashedCapabilityId; nodes[0] = CapabilityRegistry.Node({ nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, p2pId: P2P_ID, signer: NODE_OPERATOR_ONE_SIGNER_ADDRESS, - supportedCapabilityIds: capabilityIds + supportedHashedCapabilityIds: hashedCapabilityIds }); - vm.expectRevert(abi.encodeWithSelector(CapabilityRegistry.InvalidNodeCapabilities.selector, capabilityIds)); + vm.expectRevert(abi.encodeWithSelector(CapabilityRegistry.InvalidNodeCapabilities.selector, hashedCapabilityIds)); s_capabilityRegistry.addNodes(nodes); } @@ -111,15 +111,15 @@ contract CapabilityRegistry_AddNodesTest is BaseTest { changePrank(NODE_OPERATOR_ONE_ADMIN); CapabilityRegistry.Node[] memory nodes = new CapabilityRegistry.Node[](1); - bytes32[] memory capabilityIds = new bytes32[](2); - capabilityIds[0] = s_basicCapabilityId; - capabilityIds[1] = s_capabilityWithConfigurationContractId; + bytes32[] memory hashedCapabilityIds = new bytes32[](2); + hashedCapabilityIds[0] = s_basicHashedCapabilityId; + hashedCapabilityIds[1] = s_capabilityWithConfigurationContractId; nodes[0] = CapabilityRegistry.Node({ nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, p2pId: P2P_ID, signer: NODE_OPERATOR_ONE_SIGNER_ADDRESS, - supportedCapabilityIds: capabilityIds + supportedHashedCapabilityIds: hashedCapabilityIds }); vm.expectEmit(address(s_capabilityRegistry)); @@ -129,8 +129,8 @@ contract CapabilityRegistry_AddNodesTest is BaseTest { CapabilityRegistry.Node memory node = s_capabilityRegistry.getNode(P2P_ID); assertEq(node.nodeOperatorId, TEST_NODE_OPERATOR_ONE_ID); assertEq(node.p2pId, P2P_ID); - assertEq(node.supportedCapabilityIds.length, 2); - assertEq(node.supportedCapabilityIds[0], s_basicCapabilityId); - assertEq(node.supportedCapabilityIds[1], s_capabilityWithConfigurationContractId); + assertEq(node.supportedHashedCapabilityIds.length, 2); + assertEq(node.supportedHashedCapabilityIds[0], s_basicHashedCapabilityId); + assertEq(node.supportedHashedCapabilityIds[1], s_capabilityWithConfigurationContractId); } } diff --git a/contracts/src/v0.8/keystone/test/CapabilityRegistry_DeprecateCapability.t.sol b/contracts/src/v0.8/keystone/test/CapabilityRegistry_DeprecateCapability.t.sol index 2e64ab7411f..b2f67339767 100644 --- a/contracts/src/v0.8/keystone/test/CapabilityRegistry_DeprecateCapability.t.sol +++ b/contracts/src/v0.8/keystone/test/CapabilityRegistry_DeprecateCapability.t.sol @@ -6,7 +6,7 @@ import {BaseTest} from "./BaseTest.t.sol"; import {CapabilityRegistry} from "../CapabilityRegistry.sol"; contract CapabilityRegistry_AddCapabilityTest is BaseTest { - event CapabilityDeprecated(bytes32 indexed capabilityId); + event CapabilityDeprecated(bytes32 indexed hashedCapabilityId); function setUp() public override { BaseTest.setUp(); @@ -17,53 +17,55 @@ contract CapabilityRegistry_AddCapabilityTest is BaseTest { function test_RevertWhen_CalledByNonAdmin() public { changePrank(STRANGER); - bytes32 capabilityId = s_capabilityRegistry.getCapabilityID( - s_basicCapability.capabilityType, + bytes32 hashedCapabilityId = s_capabilityRegistry.getHashedCapabilityId( + s_basicCapability.labelledName, s_basicCapability.version ); vm.expectRevert("Only callable by owner"); - s_capabilityRegistry.deprecateCapability(capabilityId); + s_capabilityRegistry.deprecateCapability(hashedCapabilityId); } function test_RevertWhen_CapabilityDoesNotExist() public { vm.expectRevert( - abi.encodeWithSelector(CapabilityRegistry.CapabilityDoesNotExist.selector, s_nonExistentCapabilityId) + abi.encodeWithSelector(CapabilityRegistry.CapabilityDoesNotExist.selector, s_nonExistentHashedCapabilityId) ); - s_capabilityRegistry.deprecateCapability(s_nonExistentCapabilityId); + s_capabilityRegistry.deprecateCapability(s_nonExistentHashedCapabilityId); } function test_RevertWhen_CapabilityAlreadyDeprecated() public { - bytes32 capabilityId = s_capabilityRegistry.getCapabilityID( - s_basicCapability.capabilityType, + bytes32 hashedCapabilityId = s_capabilityRegistry.getHashedCapabilityId( + s_basicCapability.labelledName, s_basicCapability.version ); - s_capabilityRegistry.deprecateCapability(capabilityId); + s_capabilityRegistry.deprecateCapability(hashedCapabilityId); - vm.expectRevert(abi.encodeWithSelector(CapabilityRegistry.CapabilityAlreadyDeprecated.selector, capabilityId)); - s_capabilityRegistry.deprecateCapability(capabilityId); + vm.expectRevert( + abi.encodeWithSelector(CapabilityRegistry.CapabilityAlreadyDeprecated.selector, hashedCapabilityId) + ); + s_capabilityRegistry.deprecateCapability(hashedCapabilityId); } function test_DeprecatesCapability() public { - bytes32 capabilityId = s_capabilityRegistry.getCapabilityID( - s_basicCapability.capabilityType, + bytes32 hashedCapabilityId = s_capabilityRegistry.getHashedCapabilityId( + s_basicCapability.labelledName, s_basicCapability.version ); - s_capabilityRegistry.deprecateCapability(capabilityId); + s_capabilityRegistry.deprecateCapability(hashedCapabilityId); - assertEq(s_capabilityRegistry.isCapabilityDeprecated(capabilityId), true); + assertEq(s_capabilityRegistry.isCapabilityDeprecated(hashedCapabilityId), true); } function test_EmitsEvent() public { - bytes32 capabilityId = s_capabilityRegistry.getCapabilityID( - s_basicCapability.capabilityType, + bytes32 hashedCapabilityId = s_capabilityRegistry.getHashedCapabilityId( + s_basicCapability.labelledName, s_basicCapability.version ); vm.expectEmit(address(s_capabilityRegistry)); - emit CapabilityDeprecated(capabilityId); - s_capabilityRegistry.deprecateCapability(capabilityId); + emit CapabilityDeprecated(hashedCapabilityId); + s_capabilityRegistry.deprecateCapability(hashedCapabilityId); } } diff --git a/contracts/src/v0.8/keystone/test/CapabilityRegistry_GetCapabilities.t.sol b/contracts/src/v0.8/keystone/test/CapabilityRegistry_GetCapabilities.t.sol index b14397ba4ef..010fb619ba8 100644 --- a/contracts/src/v0.8/keystone/test/CapabilityRegistry_GetCapabilities.t.sol +++ b/contracts/src/v0.8/keystone/test/CapabilityRegistry_GetCapabilities.t.sol @@ -17,12 +17,12 @@ contract CapabilityRegistry_GetCapabilitiesTest is BaseTest { assertEq(capabilities.length, 2); - assertEq(capabilities[0].capabilityType, "data-streams-reports"); + assertEq(capabilities[0].labelledName, "data-streams-reports"); assertEq(capabilities[0].version, "1.0.0"); assertEq(uint256(capabilities[0].responseType), uint256(CapabilityRegistry.CapabilityResponseType.REPORT)); assertEq(capabilities[0].configurationContract, address(0)); - assertEq(capabilities[1].capabilityType, "read-ethereum-mainnet-gas-price"); + assertEq(capabilities[1].labelledName, "read-ethereum-mainnet-gas-price"); assertEq(capabilities[1].version, "1.0.2"); assertEq( uint256(capabilities[1].responseType), @@ -32,16 +32,16 @@ contract CapabilityRegistry_GetCapabilitiesTest is BaseTest { } function test_ExcludesDeprecatedCapabilities() public { - bytes32 capabilityId = s_capabilityRegistry.getCapabilityID( - s_basicCapability.capabilityType, + bytes32 hashedCapabilityId = s_capabilityRegistry.getHashedCapabilityId( + s_basicCapability.labelledName, s_basicCapability.version ); - s_capabilityRegistry.deprecateCapability(capabilityId); + s_capabilityRegistry.deprecateCapability(hashedCapabilityId); CapabilityRegistry.Capability[] memory capabilities = s_capabilityRegistry.getCapabilities(); assertEq(capabilities.length, 1); - assertEq(capabilities[0].capabilityType, "read-ethereum-mainnet-gas-price"); + assertEq(capabilities[0].labelledName, "read-ethereum-mainnet-gas-price"); assertEq(capabilities[0].version, "1.0.2"); assertEq( uint256(capabilities[0].responseType), diff --git a/contracts/src/v0.8/keystone/test/CapabilityRegistry_GetCapabilityIds.t.sol b/contracts/src/v0.8/keystone/test/CapabilityRegistry_GetCapabilityIds.t.sol index de7810b4c15..b3dc333f5c3 100644 --- a/contracts/src/v0.8/keystone/test/CapabilityRegistry_GetCapabilityIds.t.sol +++ b/contracts/src/v0.8/keystone/test/CapabilityRegistry_GetCapabilityIds.t.sol @@ -13,12 +13,12 @@ contract CapabilityRegistry_GetCapabilitiesTest is BaseTest { assertEq(capabilities.length, 2); - assertEq(capabilities[0].capabilityType, "data-streams-reports"); + assertEq(capabilities[0].labelledName, "data-streams-reports"); assertEq(capabilities[0].version, "1.0.0"); assertEq(uint256(capabilities[0].responseType), uint256(CapabilityRegistry.CapabilityResponseType.REPORT)); assertEq(capabilities[0].configurationContract, address(0)); - assertEq(capabilities[1].capabilityType, "read-ethereum-mainnet-gas-price"); + assertEq(capabilities[1].labelledName, "read-ethereum-mainnet-gas-price"); assertEq(capabilities[1].version, "1.0.2"); assertEq( uint256(capabilities[1].responseType), diff --git a/core/gethwrappers/keystone/generated/keystone_capability_registry/keystone_capability_registry.go b/core/gethwrappers/keystone/generated/keystone_capability_registry/keystone_capability_registry.go index b54a101d44e..8ea5e29d99c 100644 --- a/core/gethwrappers/keystone/generated/keystone_capability_registry/keystone_capability_registry.go +++ b/core/gethwrappers/keystone/generated/keystone_capability_registry/keystone_capability_registry.go @@ -31,17 +31,17 @@ var ( ) type CapabilityRegistryCapability struct { - CapabilityType [32]byte + LabelledName [32]byte Version [32]byte ResponseType uint8 ConfigurationContract common.Address } type CapabilityRegistryNode struct { - NodeOperatorId *big.Int - P2pId [32]byte - Signer common.Address - SupportedCapabilityIds [][32]byte + NodeOperatorId *big.Int + P2pId [32]byte + Signer common.Address + SupportedHashedCapabilityIds [][32]byte } type CapabilityRegistryNodeOperator struct { @@ -50,8 +50,8 @@ type CapabilityRegistryNodeOperator struct { } var CapabilityRegistryMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"name\":\"AccessForbidden\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"capabilityId\",\"type\":\"bytes32\"}],\"name\":\"CapabilityAlreadyDeprecated\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CapabilityAlreadyExists\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"capabilityId\",\"type\":\"bytes32\"}],\"name\":\"CapabilityDoesNotExist\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"proposedConfigurationContract\",\"type\":\"address\"}],\"name\":\"InvalidCapabilityConfigurationContractInterface\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"capabilityIds\",\"type\":\"bytes32[]\"}],\"name\":\"InvalidNodeCapabilities\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidNodeOperatorAdmin\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"p2pId\",\"type\":\"bytes32\"}],\"name\":\"InvalidNodeP2PId\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"lengthOne\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"lengthTwo\",\"type\":\"uint256\"}],\"name\":\"LengthMismatch\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"capabilityId\",\"type\":\"bytes32\"}],\"name\":\"CapabilityAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"capabilityId\",\"type\":\"bytes32\"}],\"name\":\"CapabilityDeprecated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"p2pId\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nodeOperatorId\",\"type\":\"uint256\"}],\"name\":\"NodeAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nodeOperatorId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"NodeOperatorAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nodeOperatorId\",\"type\":\"uint256\"}],\"name\":\"NodeOperatorRemoved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nodeOperatorId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"NodeOperatorUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"OwnershipTransferRequested\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"capabilityType\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"version\",\"type\":\"bytes32\"},{\"internalType\":\"enumCapabilityRegistry.CapabilityResponseType\",\"name\":\"responseType\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"configurationContract\",\"type\":\"address\"}],\"internalType\":\"structCapabilityRegistry.Capability\",\"name\":\"capability\",\"type\":\"tuple\"}],\"name\":\"addCapability\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"internalType\":\"structCapabilityRegistry.NodeOperator[]\",\"name\":\"nodeOperators\",\"type\":\"tuple[]\"}],\"name\":\"addNodeOperators\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"nodeOperatorId\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"p2pId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"internalType\":\"bytes32[]\",\"name\":\"supportedCapabilityIds\",\"type\":\"bytes32[]\"}],\"internalType\":\"structCapabilityRegistry.Node[]\",\"name\":\"nodes\",\"type\":\"tuple[]\"}],\"name\":\"addNodes\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"capabilityId\",\"type\":\"bytes32\"}],\"name\":\"deprecateCapability\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCapabilities\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"capabilityType\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"version\",\"type\":\"bytes32\"},{\"internalType\":\"enumCapabilityRegistry.CapabilityResponseType\",\"name\":\"responseType\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"configurationContract\",\"type\":\"address\"}],\"internalType\":\"structCapabilityRegistry.Capability[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"capabilityID\",\"type\":\"bytes32\"}],\"name\":\"getCapability\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"capabilityType\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"version\",\"type\":\"bytes32\"},{\"internalType\":\"enumCapabilityRegistry.CapabilityResponseType\",\"name\":\"responseType\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"configurationContract\",\"type\":\"address\"}],\"internalType\":\"structCapabilityRegistry.Capability\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"capabilityType\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"version\",\"type\":\"bytes32\"}],\"name\":\"getCapabilityID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"p2pId\",\"type\":\"bytes32\"}],\"name\":\"getNode\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"nodeOperatorId\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"p2pId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"internalType\":\"bytes32[]\",\"name\":\"supportedCapabilityIds\",\"type\":\"bytes32[]\"}],\"internalType\":\"structCapabilityRegistry.Node\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"nodeOperatorId\",\"type\":\"uint256\"}],\"name\":\"getNodeOperator\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"internalType\":\"structCapabilityRegistry.NodeOperator\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"capabilityId\",\"type\":\"bytes32\"}],\"name\":\"isCapabilityDeprecated\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"nodeOperatorIds\",\"type\":\"uint256[]\"}],\"name\":\"removeNodeOperators\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"typeAndVersion\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"nodeOperatorIds\",\"type\":\"uint256[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"internalType\":\"structCapabilityRegistry.NodeOperator[]\",\"name\":\"nodeOperators\",\"type\":\"tuple[]\"}],\"name\":\"updateNodeOperators\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x60806040523480156200001157600080fd5b503380600081620000695760405162461bcd60e51b815260206004820152601860248201527f43616e6e6f7420736574206f776e657220746f207a65726f000000000000000060448201526064015b60405180910390fd5b600080546001600160a01b0319166001600160a01b03848116919091179091558116156200009c576200009c81620000a5565b50505062000150565b336001600160a01b03821603620000ff5760405162461bcd60e51b815260206004820152601760248201527f43616e6e6f74207472616e7366657220746f2073656c66000000000000000000604482015260640162000060565b600180546001600160a01b0319166001600160a01b0383811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b61214580620001606000396000f3fe608060405234801561001057600080fd5b50600436106101005760003560e01c806365c14dc711610097578063ae3c241c11610066578063ae3c241c14610292578063c2d483a1146102a5578063ddbe4f82146102b8578063f2fde38b146102cd57600080fd5b806365c14dc71461022257806379ba5097146102425780638da5cb5b1461024a5780639cb7c5f41461027257600080fd5b80631cdf6343116100d35780631cdf634314610194578063229111f5146101a7578063398f3773146101ef57806350c946fe1461020257600080fd5b80630c5801e314610105578063117392ce1461011a578063125700111461012d578063181f5a7714610155575b600080fd5b6101186101133660046116ec565b6102e0565b005b610118610128366004611758565b6105f1565b61014061013b366004611770565b61083c565b60405190151581526020015b60405180910390f35b604080518082018252601881527f4361706162696c697479526567697374727920312e302e3000000000000000006020820152905161014c91906117ed565b6101186101a2366004611800565b61084f565b6101e16101b5366004611842565b604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b60405190815260200161014c565b6101186101fd366004611800565b610912565b610215610210366004611770565b610aab565b60405161014c9190611864565b610235610230366004611770565b610b73565b60405161014c91906118ea565b610118610c50565b60005460405173ffffffffffffffffffffffffffffffffffffffff909116815260200161014c565b610285610280366004611770565b610d4d565b60405161014c91906119cc565b6101186102a0366004611770565b610df7565b6101186102b3366004611800565b610ec2565b6102c061124c565b60405161014c91906119da565b6101186102db366004611a4a565b611391565b828114610328576040517fab8b67c600000000000000000000000000000000000000000000000000000000815260048101849052602481018290526044015b60405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff16905b848110156105e957600086868381811061036057610360611a67565b905060200201359050600085858481811061037d5761037d611a67565b905060200281019061038f9190611a96565b61039890611b9e565b805190915073ffffffffffffffffffffffffffffffffffffffff166103e9576040517feeacd93900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805173ffffffffffffffffffffffffffffffffffffffff16331480159061042657503373ffffffffffffffffffffffffffffffffffffffff851614155b1561045d576040517fef67f5d800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805160008381526007602052604090205473ffffffffffffffffffffffffffffffffffffffff908116911614158061050f57506020808201516040516104a392016117ed565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815282825280516020918201206000868152600783529290922091926104f6926001019101611cb7565b6040516020818303038152906040528051906020012014155b156105d6578051600083815260076020908152604090912080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff90931692909217825582015160019091019061057c9082611da6565b50806000015173ffffffffffffffffffffffffffffffffffffffff167f14c8f513e8a6d86d2d16b0cb64976de4e72386c4f8068eca3b7354373f8fe97a8383602001516040516105cd929190611ec0565b60405180910390a25b5050806105e290611f08565b9050610344565b505050505050565b6105f96113a5565b604080518235602082810191909152808401358284015282518083038401815260609092019092528051910120610631600382611428565b15610668576040517fe288638f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061067a6080840160608501611a4a565b73ffffffffffffffffffffffffffffffffffffffff16146107e5576106a56080830160608401611a4a565b73ffffffffffffffffffffffffffffffffffffffff163b158061078557506106d36080830160608401611a4a565b6040517f01ffc9a70000000000000000000000000000000000000000000000000000000081527f884efe6100000000000000000000000000000000000000000000000000000000600482015273ffffffffffffffffffffffffffffffffffffffff91909116906301ffc9a790602401602060405180830381865afa15801561075f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107839190611f40565b155b156107e55761079a6080830160608401611a4a565b6040517fabb5e3fd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff909116600482015260240161031f565b6107f0600382611443565b506000818152600260205260409020829061080b8282611f62565b505060405181907f65610e5677eedff94555572640e442f89848a109ef8593fa927ac30b2565ff0690600090a25050565b6000610849600583611428565b92915050565b6108576113a5565b60005b8181101561090d57600083838381811061087657610876611a67565b60209081029290920135600081815260079093526040832080547fffffffffffffffffffffffff00000000000000000000000000000000000000001681559093509190506108c76001830182611606565b50506040518181527f1e5877d7b3001d1569bf733b76c7eceda58bd6c031e5b8d0b7042308ba2e9d4f9060200160405180910390a15061090681611f08565b905061085a565b505050565b61091a6113a5565b60005b8181101561090d57600083838381811061093957610939611a67565b905060200281019061094b9190611a96565b61095490611b9e565b805190915073ffffffffffffffffffffffffffffffffffffffff166109a5576040517feeacd93900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600954604080518082018252835173ffffffffffffffffffffffffffffffffffffffff908116825260208086015181840190815260008681526007909252939020825181547fffffffffffffffffffffffff000000000000000000000000000000000000000016921691909117815591519091906001820190610a289082611da6565b50905050600960008154610a3b90611f08565b909155508151602083015160405173ffffffffffffffffffffffffffffffffffffffff909216917fda6697b182650034bd205cdc2dbfabb06bdb3a0a83a2b45bfefa3c4881284e0b91610a9091859190611ec0565b60405180910390a2505080610aa490611f08565b905061091d565b6040805160808101825260008082526020820181905291810191909152606080820152600082815260086020908152604091829020825160808101845281548152600182015481840152600282015473ffffffffffffffffffffffffffffffffffffffff16818501526003820180548551818602810186019096528086529194929360608601939290830182828015610b6357602002820191906000526020600020905b815481526020019060010190808311610b4f575b5050505050815250509050919050565b6040805180820190915260008152606060208201526000828152600760209081526040918290208251808401909352805473ffffffffffffffffffffffffffffffffffffffff1683526001810180549192840191610bd090611c6a565b80601f0160208091040260200160405190810160405280929190818152602001828054610bfc90611c6a565b8015610b635780601f10610c1e57610100808354040283529160200191610b63565b820191906000526020600020905b815481529060010190602001808311610c2c57505050919092525091949350505050565b60015473ffffffffffffffffffffffffffffffffffffffff163314610cd1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4d7573742062652070726f706f736564206f776e657200000000000000000000604482015260640161031f565b60008054337fffffffffffffffffffffffff00000000000000000000000000000000000000008083168217845560018054909116905560405173ffffffffffffffffffffffffffffffffffffffff90921692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a350565b604080516080808201835260008083526020808401829052838501829052606084018290528582526002808252918590208551938401865280548452600180820154928501929092529182015493949293919284019160ff1690811115610db657610db661192d565b6001811115610dc757610dc761192d565b815260029190910154610100900473ffffffffffffffffffffffffffffffffffffffff1660209091015292915050565b610dff6113a5565b610e0a600382611428565b610e43576040517fe181733f0000000000000000000000000000000000000000000000000000000081526004810182905260240161031f565b610e4e600582611428565b15610e88576040517f16950d1d0000000000000000000000000000000000000000000000000000000081526004810182905260240161031f565b610e93600582611443565b5060405181907fdcea1b78b6ddc31592a94607d537543fcaafda6cc52d6d5cc7bbfca1422baf2190600090a250565b60005b8181101561090d576000838383818110610ee157610ee1611a67565b9050602002810190610ef39190611fe4565b610efc90612018565b805160009081526007602090815260408083208151808301909252805473ffffffffffffffffffffffffffffffffffffffff168252600181018054959650939491939092840191610f4c90611c6a565b80601f0160208091040260200160405190810160405280929190818152602001828054610f7890611c6a565b8015610fc55780601f10610f9a57610100808354040283529160200191610fc5565b820191906000526020600020905b815481529060010190602001808311610fa857829003601f168201915b5050505050815250509050806000015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611039576040517fef67f5d800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6020808301516000908152600890915260409020600301541515808061106157506020830151155b156110a05782602001516040517f64e2ee9200000000000000000000000000000000000000000000000000000000815260040161031f91815260200190565b8260600151516000036110e55782606001516040517f3748d4c600000000000000000000000000000000000000000000000000000000815260040161031f91906120ed565b60005b836060015151811015611172576111268460600151828151811061110e5761110e611a67565b6020026020010151600361142890919063ffffffff16565b6111625783606001516040517f3748d4c600000000000000000000000000000000000000000000000000000000815260040161031f91906120ed565b61116b81611f08565b90506110e8565b506020838101805160009081526008835260409081902086518155915160018301558501516002820180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9092169190911790556060850151805186936111f7926003850192910190611640565b505050602083810151845160408051928352928201527f5bfe8a52ad26ac6ee7b0cd46d2fd92be04735a31c45ef8aa3d4b7ea1b61bbc1f910160405180910390a15050508061124590611f08565b9050610ec5565b6060600061125a600361144f565b90506000611268600561145c565b82516112749190612125565b67ffffffffffffffff81111561128c5761128c611ad4565b6040519080825280602002602001820160405280156112fc57816020015b6040805160808101825260008082526020808301829052928201819052606082015282527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9092019101816112aa5790505b5090506000805b835181101561138857600084828151811061132057611320611a67565b6020026020010151905061133e81600561142890919063ffffffff16565b6113775761134b81610d4d565b84848151811061135d5761135d611a67565b6020026020010181905250828061137390611f08565b9350505b5061138181611f08565b9050611303565b50909392505050565b6113996113a5565b6113a281611466565b50565b60005473ffffffffffffffffffffffffffffffffffffffff163314611426576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4f6e6c792063616c6c61626c65206279206f776e657200000000000000000000604482015260640161031f565b565b600081815260018301602052604081205415155b9392505050565b600061143c838361155b565b6060600061143c836115aa565b6000610849825490565b3373ffffffffffffffffffffffffffffffffffffffff8216036114e5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f43616e6e6f74207472616e7366657220746f2073656c66000000000000000000604482015260640161031f565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b60008181526001830160205260408120546115a257508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610849565b506000610849565b6060816000018054806020026020016040519081016040528092919081815260200182805480156115fa57602002820191906000526020600020905b8154815260200190600101908083116115e6575b50505050509050919050565b50805461161290611c6a565b6000825580601f10611622575050565b601f0160209004906000526020600020908101906113a2919061168b565b82805482825590600052602060002090810192821561167b579160200282015b8281111561167b578251825591602001919060010190611660565b5061168792915061168b565b5090565b5b80821115611687576000815560010161168c565b60008083601f8401126116b257600080fd5b50813567ffffffffffffffff8111156116ca57600080fd5b6020830191508360208260051b85010111156116e557600080fd5b9250929050565b6000806000806040858703121561170257600080fd5b843567ffffffffffffffff8082111561171a57600080fd5b611726888389016116a0565b9096509450602087013591508082111561173f57600080fd5b5061174c878288016116a0565b95989497509550505050565b60006080828403121561176a57600080fd5b50919050565b60006020828403121561178257600080fd5b5035919050565b6000815180845260005b818110156117af57602081850181015186830182015201611793565b5060006020828601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010191505092915050565b60208152600061143c6020830184611789565b6000806020838503121561181357600080fd5b823567ffffffffffffffff81111561182a57600080fd5b611836858286016116a0565b90969095509350505050565b6000806040838503121561185557600080fd5b50508035926020909101359150565b6000602080835260a0830184518285015281850151604085015273ffffffffffffffffffffffffffffffffffffffff6040860151166060850152606085015160808086015281815180845260c0870191508483019350600092505b808310156118df57835182529284019260019290920191908401906118bf565b509695505050505050565b6020815273ffffffffffffffffffffffffffffffffffffffff8251166020820152600060208301516040808401526119256060840182611789565b949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b80518252602081015160208301526040810151600281106119a6577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b604083015260609081015173ffffffffffffffffffffffffffffffffffffffff16910152565b60808101610849828461195c565b6020808252825182820181905260009190848201906040850190845b81811015611a1c57611a0983855161195c565b92840192608092909201916001016119f6565b50909695505050505050565b73ffffffffffffffffffffffffffffffffffffffff811681146113a257600080fd5b600060208284031215611a5c57600080fd5b813561143c81611a28565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc1833603018112611aca57600080fd5b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040805190810167ffffffffffffffff81118282101715611b2657611b26611ad4565b60405290565b6040516080810167ffffffffffffffff81118282101715611b2657611b26611ad4565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715611b9657611b96611ad4565b604052919050565b600060408236031215611bb057600080fd5b611bb8611b03565b8235611bc381611a28565b815260208381013567ffffffffffffffff80821115611be157600080fd5b9085019036601f830112611bf457600080fd5b813581811115611c0657611c06611ad4565b611c36847fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601611b4f565b91508082523684828501011115611c4c57600080fd5b80848401858401376000908201840152918301919091525092915050565b600181811c90821680611c7e57607f821691505b60208210810361176a577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000602080835260008454611ccb81611c6a565b80848701526040600180841660008114611cec5760018114611d2457611d52565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff008516838a01528284151560051b8a01019550611d52565b896000528660002060005b85811015611d4a5781548b8201860152908301908801611d2f565b8a0184019650505b509398975050505050505050565b601f82111561090d57600081815260208120601f850160051c81016020861015611d875750805b601f850160051c820191505b818110156105e957828155600101611d93565b815167ffffffffffffffff811115611dc057611dc0611ad4565b611dd481611dce8454611c6a565b84611d60565b602080601f831160018114611e275760008415611df15750858301515b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600386901b1c1916600185901b1785556105e9565b6000858152602081207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08616915b82811015611e7457888601518255948401946001909101908401611e55565b5085821015611eb057878501517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600388901b60f8161c191681555b5050505050600190811b01905550565b8281526040602082015260006119256040830184611789565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611f3957611f39611ed9565b5060010190565b600060208284031215611f5257600080fd5b8151801515811461143c57600080fd5b813581556020820135600182015560028101604083013560028110611f8657600080fd5b81546060850135611f9681611a28565b74ffffffffffffffffffffffffffffffffffffffff008160081b1660ff84167fffffffffffffffffffffff000000000000000000000000000000000000000000841617178455505050505050565b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81833603018112611aca57600080fd5b60006080823603121561202a57600080fd5b612032611b2c565b8235815260208084013581830152604084013561204e81611a28565b6040830152606084013567ffffffffffffffff8082111561206e57600080fd5b9085019036601f83011261208157600080fd5b81358181111561209357612093611ad4565b8060051b91506120a4848301611b4f565b81815291830184019184810190368411156120be57600080fd5b938501935b838510156120dc578435825293850193908501906120c3565b606087015250939695505050505050565b6020808252825182820181905260009190848201906040850190845b81811015611a1c57835183529284019291840191600101612109565b8181038181111561084957610849611ed956fea164736f6c6343000813000a", + ABI: "[{\"inputs\":[],\"name\":\"AccessForbidden\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"hashedCapabilityId\",\"type\":\"bytes32\"}],\"name\":\"CapabilityAlreadyDeprecated\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CapabilityAlreadyExists\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"hashedCapabilityId\",\"type\":\"bytes32\"}],\"name\":\"CapabilityDoesNotExist\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"proposedConfigurationContract\",\"type\":\"address\"}],\"name\":\"InvalidCapabilityConfigurationContractInterface\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"hashedCapabilityIds\",\"type\":\"bytes32[]\"}],\"name\":\"InvalidNodeCapabilities\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidNodeOperatorAdmin\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"p2pId\",\"type\":\"bytes32\"}],\"name\":\"InvalidNodeP2PId\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"lengthOne\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"lengthTwo\",\"type\":\"uint256\"}],\"name\":\"LengthMismatch\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"hashedCapabilityId\",\"type\":\"bytes32\"}],\"name\":\"CapabilityAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"hashedCapabilityId\",\"type\":\"bytes32\"}],\"name\":\"CapabilityDeprecated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"p2pId\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nodeOperatorId\",\"type\":\"uint256\"}],\"name\":\"NodeAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nodeOperatorId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"NodeOperatorAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nodeOperatorId\",\"type\":\"uint256\"}],\"name\":\"NodeOperatorRemoved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nodeOperatorId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"NodeOperatorUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"OwnershipTransferRequested\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"labelledName\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"version\",\"type\":\"bytes32\"},{\"internalType\":\"enumCapabilityRegistry.CapabilityResponseType\",\"name\":\"responseType\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"configurationContract\",\"type\":\"address\"}],\"internalType\":\"structCapabilityRegistry.Capability\",\"name\":\"capability\",\"type\":\"tuple\"}],\"name\":\"addCapability\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"internalType\":\"structCapabilityRegistry.NodeOperator[]\",\"name\":\"nodeOperators\",\"type\":\"tuple[]\"}],\"name\":\"addNodeOperators\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"nodeOperatorId\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"p2pId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"internalType\":\"bytes32[]\",\"name\":\"supportedHashedCapabilityIds\",\"type\":\"bytes32[]\"}],\"internalType\":\"structCapabilityRegistry.Node[]\",\"name\":\"nodes\",\"type\":\"tuple[]\"}],\"name\":\"addNodes\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"hashedCapabilityId\",\"type\":\"bytes32\"}],\"name\":\"deprecateCapability\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCapabilities\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"labelledName\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"version\",\"type\":\"bytes32\"},{\"internalType\":\"enumCapabilityRegistry.CapabilityResponseType\",\"name\":\"responseType\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"configurationContract\",\"type\":\"address\"}],\"internalType\":\"structCapabilityRegistry.Capability[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"hashedId\",\"type\":\"bytes32\"}],\"name\":\"getCapability\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"labelledName\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"version\",\"type\":\"bytes32\"},{\"internalType\":\"enumCapabilityRegistry.CapabilityResponseType\",\"name\":\"responseType\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"configurationContract\",\"type\":\"address\"}],\"internalType\":\"structCapabilityRegistry.Capability\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"labelledName\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"version\",\"type\":\"bytes32\"}],\"name\":\"getHashedCapabilityId\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"p2pId\",\"type\":\"bytes32\"}],\"name\":\"getNode\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"nodeOperatorId\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"p2pId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"internalType\":\"bytes32[]\",\"name\":\"supportedHashedCapabilityIds\",\"type\":\"bytes32[]\"}],\"internalType\":\"structCapabilityRegistry.Node\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"nodeOperatorId\",\"type\":\"uint256\"}],\"name\":\"getNodeOperator\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"internalType\":\"structCapabilityRegistry.NodeOperator\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"hashedCapabilityId\",\"type\":\"bytes32\"}],\"name\":\"isCapabilityDeprecated\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"nodeOperatorIds\",\"type\":\"uint256[]\"}],\"name\":\"removeNodeOperators\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"typeAndVersion\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"nodeOperatorIds\",\"type\":\"uint256[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"internalType\":\"structCapabilityRegistry.NodeOperator[]\",\"name\":\"nodeOperators\",\"type\":\"tuple[]\"}],\"name\":\"updateNodeOperators\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + Bin: "0x60806040523480156200001157600080fd5b503380600081620000695760405162461bcd60e51b815260206004820152601860248201527f43616e6e6f7420736574206f776e657220746f207a65726f000000000000000060448201526064015b60405180910390fd5b600080546001600160a01b0319166001600160a01b03848116919091179091558116156200009c576200009c81620000a5565b50505062000150565b336001600160a01b03821603620000ff5760405162461bcd60e51b815260206004820152601760248201527f43616e6e6f74207472616e7366657220746f2073656c66000000000000000000604482015260640162000060565b600180546001600160a01b0319166001600160a01b0383811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b61214580620001606000396000f3fe608060405234801561001057600080fd5b50600436106101005760003560e01c806365c14dc711610097578063ae3c241c11610066578063ae3c241c14610292578063c2d483a1146102a5578063ddbe4f82146102b8578063f2fde38b146102cd57600080fd5b806365c14dc71461022257806379ba5097146102425780638da5cb5b1461024a5780639cb7c5f41461027257600080fd5b80631cdf6343116100d35780631cdf63431461019457806336b402fb146101a7578063398f3773146101ef57806350c946fe1461020257600080fd5b80630c5801e314610105578063117392ce1461011a578063125700111461012d578063181f5a7714610155575b600080fd5b6101186101133660046116ec565b6102e0565b005b610118610128366004611758565b6105f1565b61014061013b366004611770565b61083c565b60405190151581526020015b60405180910390f35b604080518082018252601881527f4361706162696c697479526567697374727920312e302e3000000000000000006020820152905161014c91906117ed565b6101186101a2366004611800565b61084f565b6101e16101b5366004611842565b604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b60405190815260200161014c565b6101186101fd366004611800565b610912565b610215610210366004611770565b610aab565b60405161014c9190611864565b610235610230366004611770565b610b73565b60405161014c91906118ea565b610118610c50565b60005460405173ffffffffffffffffffffffffffffffffffffffff909116815260200161014c565b610285610280366004611770565b610d4d565b60405161014c91906119cc565b6101186102a0366004611770565b610df7565b6101186102b3366004611800565b610ec2565b6102c061124c565b60405161014c91906119da565b6101186102db366004611a4a565b611391565b828114610328576040517fab8b67c600000000000000000000000000000000000000000000000000000000815260048101849052602481018290526044015b60405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff16905b848110156105e957600086868381811061036057610360611a67565b905060200201359050600085858481811061037d5761037d611a67565b905060200281019061038f9190611a96565b61039890611b9e565b805190915073ffffffffffffffffffffffffffffffffffffffff166103e9576040517feeacd93900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805173ffffffffffffffffffffffffffffffffffffffff16331480159061042657503373ffffffffffffffffffffffffffffffffffffffff851614155b1561045d576040517fef67f5d800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805160008381526007602052604090205473ffffffffffffffffffffffffffffffffffffffff908116911614158061050f57506020808201516040516104a392016117ed565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815282825280516020918201206000868152600783529290922091926104f6926001019101611cb7565b6040516020818303038152906040528051906020012014155b156105d6578051600083815260076020908152604090912080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff90931692909217825582015160019091019061057c9082611da6565b50806000015173ffffffffffffffffffffffffffffffffffffffff167f14c8f513e8a6d86d2d16b0cb64976de4e72386c4f8068eca3b7354373f8fe97a8383602001516040516105cd929190611ec0565b60405180910390a25b5050806105e290611f08565b9050610344565b505050505050565b6105f96113a5565b604080518235602082810191909152808401358284015282518083038401815260609092019092528051910120610631600382611428565b15610668576040517fe288638f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061067a6080840160608501611a4a565b73ffffffffffffffffffffffffffffffffffffffff16146107e5576106a56080830160608401611a4a565b73ffffffffffffffffffffffffffffffffffffffff163b158061078557506106d36080830160608401611a4a565b6040517f01ffc9a70000000000000000000000000000000000000000000000000000000081527f884efe6100000000000000000000000000000000000000000000000000000000600482015273ffffffffffffffffffffffffffffffffffffffff91909116906301ffc9a790602401602060405180830381865afa15801561075f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107839190611f40565b155b156107e55761079a6080830160608401611a4a565b6040517fabb5e3fd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff909116600482015260240161031f565b6107f0600382611443565b506000818152600260205260409020829061080b8282611f62565b505060405181907f65610e5677eedff94555572640e442f89848a109ef8593fa927ac30b2565ff0690600090a25050565b6000610849600583611428565b92915050565b6108576113a5565b60005b8181101561090d57600083838381811061087657610876611a67565b60209081029290920135600081815260079093526040832080547fffffffffffffffffffffffff00000000000000000000000000000000000000001681559093509190506108c76001830182611606565b50506040518181527f1e5877d7b3001d1569bf733b76c7eceda58bd6c031e5b8d0b7042308ba2e9d4f9060200160405180910390a15061090681611f08565b905061085a565b505050565b61091a6113a5565b60005b8181101561090d57600083838381811061093957610939611a67565b905060200281019061094b9190611a96565b61095490611b9e565b805190915073ffffffffffffffffffffffffffffffffffffffff166109a5576040517feeacd93900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600954604080518082018252835173ffffffffffffffffffffffffffffffffffffffff908116825260208086015181840190815260008681526007909252939020825181547fffffffffffffffffffffffff000000000000000000000000000000000000000016921691909117815591519091906001820190610a289082611da6565b50905050600960008154610a3b90611f08565b909155508151602083015160405173ffffffffffffffffffffffffffffffffffffffff909216917fda6697b182650034bd205cdc2dbfabb06bdb3a0a83a2b45bfefa3c4881284e0b91610a9091859190611ec0565b60405180910390a2505080610aa490611f08565b905061091d565b6040805160808101825260008082526020820181905291810191909152606080820152600082815260086020908152604091829020825160808101845281548152600182015481840152600282015473ffffffffffffffffffffffffffffffffffffffff16818501526003820180548551818602810186019096528086529194929360608601939290830182828015610b6357602002820191906000526020600020905b815481526020019060010190808311610b4f575b5050505050815250509050919050565b6040805180820190915260008152606060208201526000828152600760209081526040918290208251808401909352805473ffffffffffffffffffffffffffffffffffffffff1683526001810180549192840191610bd090611c6a565b80601f0160208091040260200160405190810160405280929190818152602001828054610bfc90611c6a565b8015610b635780601f10610c1e57610100808354040283529160200191610b63565b820191906000526020600020905b815481529060010190602001808311610c2c57505050919092525091949350505050565b60015473ffffffffffffffffffffffffffffffffffffffff163314610cd1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4d7573742062652070726f706f736564206f776e657200000000000000000000604482015260640161031f565b60008054337fffffffffffffffffffffffff00000000000000000000000000000000000000008083168217845560018054909116905560405173ffffffffffffffffffffffffffffffffffffffff90921692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a350565b604080516080808201835260008083526020808401829052838501829052606084018290528582526002808252918590208551938401865280548452600180820154928501929092529182015493949293919284019160ff1690811115610db657610db661192d565b6001811115610dc757610dc761192d565b815260029190910154610100900473ffffffffffffffffffffffffffffffffffffffff1660209091015292915050565b610dff6113a5565b610e0a600382611428565b610e43576040517fe181733f0000000000000000000000000000000000000000000000000000000081526004810182905260240161031f565b610e4e600582611428565b15610e88576040517f16950d1d0000000000000000000000000000000000000000000000000000000081526004810182905260240161031f565b610e93600582611443565b5060405181907fdcea1b78b6ddc31592a94607d537543fcaafda6cc52d6d5cc7bbfca1422baf2190600090a250565b60005b8181101561090d576000838383818110610ee157610ee1611a67565b9050602002810190610ef39190611fe4565b610efc90612018565b805160009081526007602090815260408083208151808301909252805473ffffffffffffffffffffffffffffffffffffffff168252600181018054959650939491939092840191610f4c90611c6a565b80601f0160208091040260200160405190810160405280929190818152602001828054610f7890611c6a565b8015610fc55780601f10610f9a57610100808354040283529160200191610fc5565b820191906000526020600020905b815481529060010190602001808311610fa857829003601f168201915b5050505050815250509050806000015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611039576040517fef67f5d800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6020808301516000908152600890915260409020600301541515808061106157506020830151155b156110a05782602001516040517f64e2ee9200000000000000000000000000000000000000000000000000000000815260040161031f91815260200190565b8260600151516000036110e55782606001516040517f3748d4c600000000000000000000000000000000000000000000000000000000815260040161031f91906120ed565b60005b836060015151811015611172576111268460600151828151811061110e5761110e611a67565b6020026020010151600361142890919063ffffffff16565b6111625783606001516040517f3748d4c600000000000000000000000000000000000000000000000000000000815260040161031f91906120ed565b61116b81611f08565b90506110e8565b506020838101805160009081526008835260409081902086518155915160018301558501516002820180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9092169190911790556060850151805186936111f7926003850192910190611640565b505050602083810151845160408051928352928201527f5bfe8a52ad26ac6ee7b0cd46d2fd92be04735a31c45ef8aa3d4b7ea1b61bbc1f910160405180910390a15050508061124590611f08565b9050610ec5565b6060600061125a600361144f565b90506000611268600561145c565b82516112749190612125565b67ffffffffffffffff81111561128c5761128c611ad4565b6040519080825280602002602001820160405280156112fc57816020015b6040805160808101825260008082526020808301829052928201819052606082015282527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9092019101816112aa5790505b5090506000805b835181101561138857600084828151811061132057611320611a67565b6020026020010151905061133e81600561142890919063ffffffff16565b6113775761134b81610d4d565b84848151811061135d5761135d611a67565b6020026020010181905250828061137390611f08565b9350505b5061138181611f08565b9050611303565b50909392505050565b6113996113a5565b6113a281611466565b50565b60005473ffffffffffffffffffffffffffffffffffffffff163314611426576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4f6e6c792063616c6c61626c65206279206f776e657200000000000000000000604482015260640161031f565b565b600081815260018301602052604081205415155b9392505050565b600061143c838361155b565b6060600061143c836115aa565b6000610849825490565b3373ffffffffffffffffffffffffffffffffffffffff8216036114e5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f43616e6e6f74207472616e7366657220746f2073656c66000000000000000000604482015260640161031f565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b60008181526001830160205260408120546115a257508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610849565b506000610849565b6060816000018054806020026020016040519081016040528092919081815260200182805480156115fa57602002820191906000526020600020905b8154815260200190600101908083116115e6575b50505050509050919050565b50805461161290611c6a565b6000825580601f10611622575050565b601f0160209004906000526020600020908101906113a2919061168b565b82805482825590600052602060002090810192821561167b579160200282015b8281111561167b578251825591602001919060010190611660565b5061168792915061168b565b5090565b5b80821115611687576000815560010161168c565b60008083601f8401126116b257600080fd5b50813567ffffffffffffffff8111156116ca57600080fd5b6020830191508360208260051b85010111156116e557600080fd5b9250929050565b6000806000806040858703121561170257600080fd5b843567ffffffffffffffff8082111561171a57600080fd5b611726888389016116a0565b9096509450602087013591508082111561173f57600080fd5b5061174c878288016116a0565b95989497509550505050565b60006080828403121561176a57600080fd5b50919050565b60006020828403121561178257600080fd5b5035919050565b6000815180845260005b818110156117af57602081850181015186830182015201611793565b5060006020828601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010191505092915050565b60208152600061143c6020830184611789565b6000806020838503121561181357600080fd5b823567ffffffffffffffff81111561182a57600080fd5b611836858286016116a0565b90969095509350505050565b6000806040838503121561185557600080fd5b50508035926020909101359150565b6000602080835260a0830184518285015281850151604085015273ffffffffffffffffffffffffffffffffffffffff6040860151166060850152606085015160808086015281815180845260c0870191508483019350600092505b808310156118df57835182529284019260019290920191908401906118bf565b509695505050505050565b6020815273ffffffffffffffffffffffffffffffffffffffff8251166020820152600060208301516040808401526119256060840182611789565b949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b80518252602081015160208301526040810151600281106119a6577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b604083015260609081015173ffffffffffffffffffffffffffffffffffffffff16910152565b60808101610849828461195c565b6020808252825182820181905260009190848201906040850190845b81811015611a1c57611a0983855161195c565b92840192608092909201916001016119f6565b50909695505050505050565b73ffffffffffffffffffffffffffffffffffffffff811681146113a257600080fd5b600060208284031215611a5c57600080fd5b813561143c81611a28565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc1833603018112611aca57600080fd5b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040805190810167ffffffffffffffff81118282101715611b2657611b26611ad4565b60405290565b6040516080810167ffffffffffffffff81118282101715611b2657611b26611ad4565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715611b9657611b96611ad4565b604052919050565b600060408236031215611bb057600080fd5b611bb8611b03565b8235611bc381611a28565b815260208381013567ffffffffffffffff80821115611be157600080fd5b9085019036601f830112611bf457600080fd5b813581811115611c0657611c06611ad4565b611c36847fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601611b4f565b91508082523684828501011115611c4c57600080fd5b80848401858401376000908201840152918301919091525092915050565b600181811c90821680611c7e57607f821691505b60208210810361176a577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000602080835260008454611ccb81611c6a565b80848701526040600180841660008114611cec5760018114611d2457611d52565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff008516838a01528284151560051b8a01019550611d52565b896000528660002060005b85811015611d4a5781548b8201860152908301908801611d2f565b8a0184019650505b509398975050505050505050565b601f82111561090d57600081815260208120601f850160051c81016020861015611d875750805b601f850160051c820191505b818110156105e957828155600101611d93565b815167ffffffffffffffff811115611dc057611dc0611ad4565b611dd481611dce8454611c6a565b84611d60565b602080601f831160018114611e275760008415611df15750858301515b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600386901b1c1916600185901b1785556105e9565b6000858152602081207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08616915b82811015611e7457888601518255948401946001909101908401611e55565b5085821015611eb057878501517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600388901b60f8161c191681555b5050505050600190811b01905550565b8281526040602082015260006119256040830184611789565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611f3957611f39611ed9565b5060010190565b600060208284031215611f5257600080fd5b8151801515811461143c57600080fd5b813581556020820135600182015560028101604083013560028110611f8657600080fd5b81546060850135611f9681611a28565b74ffffffffffffffffffffffffffffffffffffffff008160081b1660ff84167fffffffffffffffffffffff000000000000000000000000000000000000000000841617178455505050505050565b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81833603018112611aca57600080fd5b60006080823603121561202a57600080fd5b612032611b2c565b8235815260208084013581830152604084013561204e81611a28565b6040830152606084013567ffffffffffffffff8082111561206e57600080fd5b9085019036601f83011261208157600080fd5b81358181111561209357612093611ad4565b8060051b91506120a4848301611b4f565b81815291830184019184810190368411156120be57600080fd5b938501935b838510156120dc578435825293850193908501906120c3565b606087015250939695505050505050565b6020808252825182820181905260009190848201906040850190845b81811015611a1c57835183529284019291840191600101612109565b8181038181111561084957610849611ed956fea164736f6c6343000813000a", } var CapabilityRegistryABI = CapabilityRegistryMetaData.ABI @@ -212,9 +212,9 @@ func (_CapabilityRegistry *CapabilityRegistryCallerSession) GetCapabilities() ([ return _CapabilityRegistry.Contract.GetCapabilities(&_CapabilityRegistry.CallOpts) } -func (_CapabilityRegistry *CapabilityRegistryCaller) GetCapability(opts *bind.CallOpts, capabilityID [32]byte) (CapabilityRegistryCapability, error) { +func (_CapabilityRegistry *CapabilityRegistryCaller) GetCapability(opts *bind.CallOpts, hashedId [32]byte) (CapabilityRegistryCapability, error) { var out []interface{} - err := _CapabilityRegistry.contract.Call(opts, &out, "getCapability", capabilityID) + err := _CapabilityRegistry.contract.Call(opts, &out, "getCapability", hashedId) if err != nil { return *new(CapabilityRegistryCapability), err @@ -226,17 +226,17 @@ func (_CapabilityRegistry *CapabilityRegistryCaller) GetCapability(opts *bind.Ca } -func (_CapabilityRegistry *CapabilityRegistrySession) GetCapability(capabilityID [32]byte) (CapabilityRegistryCapability, error) { - return _CapabilityRegistry.Contract.GetCapability(&_CapabilityRegistry.CallOpts, capabilityID) +func (_CapabilityRegistry *CapabilityRegistrySession) GetCapability(hashedId [32]byte) (CapabilityRegistryCapability, error) { + return _CapabilityRegistry.Contract.GetCapability(&_CapabilityRegistry.CallOpts, hashedId) } -func (_CapabilityRegistry *CapabilityRegistryCallerSession) GetCapability(capabilityID [32]byte) (CapabilityRegistryCapability, error) { - return _CapabilityRegistry.Contract.GetCapability(&_CapabilityRegistry.CallOpts, capabilityID) +func (_CapabilityRegistry *CapabilityRegistryCallerSession) GetCapability(hashedId [32]byte) (CapabilityRegistryCapability, error) { + return _CapabilityRegistry.Contract.GetCapability(&_CapabilityRegistry.CallOpts, hashedId) } -func (_CapabilityRegistry *CapabilityRegistryCaller) GetCapabilityID(opts *bind.CallOpts, capabilityType [32]byte, version [32]byte) ([32]byte, error) { +func (_CapabilityRegistry *CapabilityRegistryCaller) GetHashedCapabilityId(opts *bind.CallOpts, labelledName [32]byte, version [32]byte) ([32]byte, error) { var out []interface{} - err := _CapabilityRegistry.contract.Call(opts, &out, "getCapabilityID", capabilityType, version) + err := _CapabilityRegistry.contract.Call(opts, &out, "getHashedCapabilityId", labelledName, version) if err != nil { return *new([32]byte), err @@ -248,12 +248,12 @@ func (_CapabilityRegistry *CapabilityRegistryCaller) GetCapabilityID(opts *bind. } -func (_CapabilityRegistry *CapabilityRegistrySession) GetCapabilityID(capabilityType [32]byte, version [32]byte) ([32]byte, error) { - return _CapabilityRegistry.Contract.GetCapabilityID(&_CapabilityRegistry.CallOpts, capabilityType, version) +func (_CapabilityRegistry *CapabilityRegistrySession) GetHashedCapabilityId(labelledName [32]byte, version [32]byte) ([32]byte, error) { + return _CapabilityRegistry.Contract.GetHashedCapabilityId(&_CapabilityRegistry.CallOpts, labelledName, version) } -func (_CapabilityRegistry *CapabilityRegistryCallerSession) GetCapabilityID(capabilityType [32]byte, version [32]byte) ([32]byte, error) { - return _CapabilityRegistry.Contract.GetCapabilityID(&_CapabilityRegistry.CallOpts, capabilityType, version) +func (_CapabilityRegistry *CapabilityRegistryCallerSession) GetHashedCapabilityId(labelledName [32]byte, version [32]byte) ([32]byte, error) { + return _CapabilityRegistry.Contract.GetHashedCapabilityId(&_CapabilityRegistry.CallOpts, labelledName, version) } func (_CapabilityRegistry *CapabilityRegistryCaller) GetNode(opts *bind.CallOpts, p2pId [32]byte) (CapabilityRegistryNode, error) { @@ -300,9 +300,9 @@ func (_CapabilityRegistry *CapabilityRegistryCallerSession) GetNodeOperator(node return _CapabilityRegistry.Contract.GetNodeOperator(&_CapabilityRegistry.CallOpts, nodeOperatorId) } -func (_CapabilityRegistry *CapabilityRegistryCaller) IsCapabilityDeprecated(opts *bind.CallOpts, capabilityId [32]byte) (bool, error) { +func (_CapabilityRegistry *CapabilityRegistryCaller) IsCapabilityDeprecated(opts *bind.CallOpts, hashedCapabilityId [32]byte) (bool, error) { var out []interface{} - err := _CapabilityRegistry.contract.Call(opts, &out, "isCapabilityDeprecated", capabilityId) + err := _CapabilityRegistry.contract.Call(opts, &out, "isCapabilityDeprecated", hashedCapabilityId) if err != nil { return *new(bool), err @@ -314,12 +314,12 @@ func (_CapabilityRegistry *CapabilityRegistryCaller) IsCapabilityDeprecated(opts } -func (_CapabilityRegistry *CapabilityRegistrySession) IsCapabilityDeprecated(capabilityId [32]byte) (bool, error) { - return _CapabilityRegistry.Contract.IsCapabilityDeprecated(&_CapabilityRegistry.CallOpts, capabilityId) +func (_CapabilityRegistry *CapabilityRegistrySession) IsCapabilityDeprecated(hashedCapabilityId [32]byte) (bool, error) { + return _CapabilityRegistry.Contract.IsCapabilityDeprecated(&_CapabilityRegistry.CallOpts, hashedCapabilityId) } -func (_CapabilityRegistry *CapabilityRegistryCallerSession) IsCapabilityDeprecated(capabilityId [32]byte) (bool, error) { - return _CapabilityRegistry.Contract.IsCapabilityDeprecated(&_CapabilityRegistry.CallOpts, capabilityId) +func (_CapabilityRegistry *CapabilityRegistryCallerSession) IsCapabilityDeprecated(hashedCapabilityId [32]byte) (bool, error) { + return _CapabilityRegistry.Contract.IsCapabilityDeprecated(&_CapabilityRegistry.CallOpts, hashedCapabilityId) } func (_CapabilityRegistry *CapabilityRegistryCaller) Owner(opts *bind.CallOpts) (common.Address, error) { @@ -414,16 +414,16 @@ func (_CapabilityRegistry *CapabilityRegistryTransactorSession) AddNodes(nodes [ return _CapabilityRegistry.Contract.AddNodes(&_CapabilityRegistry.TransactOpts, nodes) } -func (_CapabilityRegistry *CapabilityRegistryTransactor) DeprecateCapability(opts *bind.TransactOpts, capabilityId [32]byte) (*types.Transaction, error) { - return _CapabilityRegistry.contract.Transact(opts, "deprecateCapability", capabilityId) +func (_CapabilityRegistry *CapabilityRegistryTransactor) DeprecateCapability(opts *bind.TransactOpts, hashedCapabilityId [32]byte) (*types.Transaction, error) { + return _CapabilityRegistry.contract.Transact(opts, "deprecateCapability", hashedCapabilityId) } -func (_CapabilityRegistry *CapabilityRegistrySession) DeprecateCapability(capabilityId [32]byte) (*types.Transaction, error) { - return _CapabilityRegistry.Contract.DeprecateCapability(&_CapabilityRegistry.TransactOpts, capabilityId) +func (_CapabilityRegistry *CapabilityRegistrySession) DeprecateCapability(hashedCapabilityId [32]byte) (*types.Transaction, error) { + return _CapabilityRegistry.Contract.DeprecateCapability(&_CapabilityRegistry.TransactOpts, hashedCapabilityId) } -func (_CapabilityRegistry *CapabilityRegistryTransactorSession) DeprecateCapability(capabilityId [32]byte) (*types.Transaction, error) { - return _CapabilityRegistry.Contract.DeprecateCapability(&_CapabilityRegistry.TransactOpts, capabilityId) +func (_CapabilityRegistry *CapabilityRegistryTransactorSession) DeprecateCapability(hashedCapabilityId [32]byte) (*types.Transaction, error) { + return _CapabilityRegistry.Contract.DeprecateCapability(&_CapabilityRegistry.TransactOpts, hashedCapabilityId) } func (_CapabilityRegistry *CapabilityRegistryTransactor) RemoveNodeOperators(opts *bind.TransactOpts, nodeOperatorIds []*big.Int) (*types.Transaction, error) { @@ -523,32 +523,32 @@ func (it *CapabilityRegistryCapabilityAddedIterator) Close() error { } type CapabilityRegistryCapabilityAdded struct { - CapabilityId [32]byte - Raw types.Log + HashedCapabilityId [32]byte + Raw types.Log } -func (_CapabilityRegistry *CapabilityRegistryFilterer) FilterCapabilityAdded(opts *bind.FilterOpts, capabilityId [][32]byte) (*CapabilityRegistryCapabilityAddedIterator, error) { +func (_CapabilityRegistry *CapabilityRegistryFilterer) FilterCapabilityAdded(opts *bind.FilterOpts, hashedCapabilityId [][32]byte) (*CapabilityRegistryCapabilityAddedIterator, error) { - var capabilityIdRule []interface{} - for _, capabilityIdItem := range capabilityId { - capabilityIdRule = append(capabilityIdRule, capabilityIdItem) + var hashedCapabilityIdRule []interface{} + for _, hashedCapabilityIdItem := range hashedCapabilityId { + hashedCapabilityIdRule = append(hashedCapabilityIdRule, hashedCapabilityIdItem) } - logs, sub, err := _CapabilityRegistry.contract.FilterLogs(opts, "CapabilityAdded", capabilityIdRule) + logs, sub, err := _CapabilityRegistry.contract.FilterLogs(opts, "CapabilityAdded", hashedCapabilityIdRule) if err != nil { return nil, err } return &CapabilityRegistryCapabilityAddedIterator{contract: _CapabilityRegistry.contract, event: "CapabilityAdded", logs: logs, sub: sub}, nil } -func (_CapabilityRegistry *CapabilityRegistryFilterer) WatchCapabilityAdded(opts *bind.WatchOpts, sink chan<- *CapabilityRegistryCapabilityAdded, capabilityId [][32]byte) (event.Subscription, error) { +func (_CapabilityRegistry *CapabilityRegistryFilterer) WatchCapabilityAdded(opts *bind.WatchOpts, sink chan<- *CapabilityRegistryCapabilityAdded, hashedCapabilityId [][32]byte) (event.Subscription, error) { - var capabilityIdRule []interface{} - for _, capabilityIdItem := range capabilityId { - capabilityIdRule = append(capabilityIdRule, capabilityIdItem) + var hashedCapabilityIdRule []interface{} + for _, hashedCapabilityIdItem := range hashedCapabilityId { + hashedCapabilityIdRule = append(hashedCapabilityIdRule, hashedCapabilityIdItem) } - logs, sub, err := _CapabilityRegistry.contract.WatchLogs(opts, "CapabilityAdded", capabilityIdRule) + logs, sub, err := _CapabilityRegistry.contract.WatchLogs(opts, "CapabilityAdded", hashedCapabilityIdRule) if err != nil { return nil, err } @@ -650,32 +650,32 @@ func (it *CapabilityRegistryCapabilityDeprecatedIterator) Close() error { } type CapabilityRegistryCapabilityDeprecated struct { - CapabilityId [32]byte - Raw types.Log + HashedCapabilityId [32]byte + Raw types.Log } -func (_CapabilityRegistry *CapabilityRegistryFilterer) FilterCapabilityDeprecated(opts *bind.FilterOpts, capabilityId [][32]byte) (*CapabilityRegistryCapabilityDeprecatedIterator, error) { +func (_CapabilityRegistry *CapabilityRegistryFilterer) FilterCapabilityDeprecated(opts *bind.FilterOpts, hashedCapabilityId [][32]byte) (*CapabilityRegistryCapabilityDeprecatedIterator, error) { - var capabilityIdRule []interface{} - for _, capabilityIdItem := range capabilityId { - capabilityIdRule = append(capabilityIdRule, capabilityIdItem) + var hashedCapabilityIdRule []interface{} + for _, hashedCapabilityIdItem := range hashedCapabilityId { + hashedCapabilityIdRule = append(hashedCapabilityIdRule, hashedCapabilityIdItem) } - logs, sub, err := _CapabilityRegistry.contract.FilterLogs(opts, "CapabilityDeprecated", capabilityIdRule) + logs, sub, err := _CapabilityRegistry.contract.FilterLogs(opts, "CapabilityDeprecated", hashedCapabilityIdRule) if err != nil { return nil, err } return &CapabilityRegistryCapabilityDeprecatedIterator{contract: _CapabilityRegistry.contract, event: "CapabilityDeprecated", logs: logs, sub: sub}, nil } -func (_CapabilityRegistry *CapabilityRegistryFilterer) WatchCapabilityDeprecated(opts *bind.WatchOpts, sink chan<- *CapabilityRegistryCapabilityDeprecated, capabilityId [][32]byte) (event.Subscription, error) { +func (_CapabilityRegistry *CapabilityRegistryFilterer) WatchCapabilityDeprecated(opts *bind.WatchOpts, sink chan<- *CapabilityRegistryCapabilityDeprecated, hashedCapabilityId [][32]byte) (event.Subscription, error) { - var capabilityIdRule []interface{} - for _, capabilityIdItem := range capabilityId { - capabilityIdRule = append(capabilityIdRule, capabilityIdItem) + var hashedCapabilityIdRule []interface{} + for _, hashedCapabilityIdItem := range hashedCapabilityId { + hashedCapabilityIdRule = append(hashedCapabilityIdRule, hashedCapabilityIdItem) } - logs, sub, err := _CapabilityRegistry.contract.WatchLogs(opts, "CapabilityDeprecated", capabilityIdRule) + logs, sub, err := _CapabilityRegistry.contract.WatchLogs(opts, "CapabilityDeprecated", hashedCapabilityIdRule) if err != nil { return nil, err } @@ -1544,15 +1544,15 @@ func (_CapabilityRegistry *CapabilityRegistry) Address() common.Address { type CapabilityRegistryInterface interface { GetCapabilities(opts *bind.CallOpts) ([]CapabilityRegistryCapability, error) - GetCapability(opts *bind.CallOpts, capabilityID [32]byte) (CapabilityRegistryCapability, error) + GetCapability(opts *bind.CallOpts, hashedId [32]byte) (CapabilityRegistryCapability, error) - GetCapabilityID(opts *bind.CallOpts, capabilityType [32]byte, version [32]byte) ([32]byte, error) + GetHashedCapabilityId(opts *bind.CallOpts, labelledName [32]byte, version [32]byte) ([32]byte, error) GetNode(opts *bind.CallOpts, p2pId [32]byte) (CapabilityRegistryNode, error) GetNodeOperator(opts *bind.CallOpts, nodeOperatorId *big.Int) (CapabilityRegistryNodeOperator, error) - IsCapabilityDeprecated(opts *bind.CallOpts, capabilityId [32]byte) (bool, error) + IsCapabilityDeprecated(opts *bind.CallOpts, hashedCapabilityId [32]byte) (bool, error) Owner(opts *bind.CallOpts) (common.Address, error) @@ -1566,7 +1566,7 @@ type CapabilityRegistryInterface interface { AddNodes(opts *bind.TransactOpts, nodes []CapabilityRegistryNode) (*types.Transaction, error) - DeprecateCapability(opts *bind.TransactOpts, capabilityId [32]byte) (*types.Transaction, error) + DeprecateCapability(opts *bind.TransactOpts, hashedCapabilityId [32]byte) (*types.Transaction, error) RemoveNodeOperators(opts *bind.TransactOpts, nodeOperatorIds []*big.Int) (*types.Transaction, error) @@ -1574,15 +1574,15 @@ type CapabilityRegistryInterface interface { UpdateNodeOperators(opts *bind.TransactOpts, nodeOperatorIds []*big.Int, nodeOperators []CapabilityRegistryNodeOperator) (*types.Transaction, error) - FilterCapabilityAdded(opts *bind.FilterOpts, capabilityId [][32]byte) (*CapabilityRegistryCapabilityAddedIterator, error) + FilterCapabilityAdded(opts *bind.FilterOpts, hashedCapabilityId [][32]byte) (*CapabilityRegistryCapabilityAddedIterator, error) - WatchCapabilityAdded(opts *bind.WatchOpts, sink chan<- *CapabilityRegistryCapabilityAdded, capabilityId [][32]byte) (event.Subscription, error) + WatchCapabilityAdded(opts *bind.WatchOpts, sink chan<- *CapabilityRegistryCapabilityAdded, hashedCapabilityId [][32]byte) (event.Subscription, error) ParseCapabilityAdded(log types.Log) (*CapabilityRegistryCapabilityAdded, error) - FilterCapabilityDeprecated(opts *bind.FilterOpts, capabilityId [][32]byte) (*CapabilityRegistryCapabilityDeprecatedIterator, error) + FilterCapabilityDeprecated(opts *bind.FilterOpts, hashedCapabilityId [][32]byte) (*CapabilityRegistryCapabilityDeprecatedIterator, error) - WatchCapabilityDeprecated(opts *bind.WatchOpts, sink chan<- *CapabilityRegistryCapabilityDeprecated, capabilityId [][32]byte) (event.Subscription, error) + WatchCapabilityDeprecated(opts *bind.WatchOpts, sink chan<- *CapabilityRegistryCapabilityDeprecated, hashedCapabilityId [][32]byte) (event.Subscription, error) ParseCapabilityDeprecated(log types.Log) (*CapabilityRegistryCapabilityDeprecated, error) diff --git a/core/gethwrappers/keystone/generation/generated-wrapper-dependency-versions-do-not-edit.txt b/core/gethwrappers/keystone/generation/generated-wrapper-dependency-versions-do-not-edit.txt index 3e0110cdee6..182c8da3f7e 100644 --- a/core/gethwrappers/keystone/generation/generated-wrapper-dependency-versions-do-not-edit.txt +++ b/core/gethwrappers/keystone/generation/generated-wrapper-dependency-versions-do-not-edit.txt @@ -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 b7d748b585d7cf1cf91e268b609613f77a8390d119e03d724b49c25fd2ea75e7 +keystone_capability_registry: ../../../contracts/solc/v0.8.19/CapabilityRegistry/CapabilityRegistry.abi ../../../contracts/solc/v0.8.19/CapabilityRegistry/CapabilityRegistry.bin aeb366351d69f320c610419a3e09a991bd6ea75690778835eb8f6421d1277f44 ocr3_capability: ../../../contracts/solc/v0.8.19/OCR3Capability/OCR3Capability.abi ../../../contracts/solc/v0.8.19/OCR3Capability/OCR3Capability.bin 9dcbdf55bd5729ba266148da3f17733eb592c871c2108ccca546618628fd9ad2 diff --git a/core/services/workflows/engine.go b/core/services/workflows/engine.go index 9629e845336..e405102e123 100644 --- a/core/services/workflows/engine.go +++ b/core/services/workflows/engine.go @@ -78,7 +78,7 @@ func (e *Engine) resolveWorkflowCapabilities(ctx context.Context) error { // triggersInitialized := true for _, t := range e.workflow.triggers { - tg, err := e.registry.GetTrigger(ctx, t.Type) + tg, err := e.registry.GetTrigger(ctx, t.ID) if err != nil { e.logger.Errorf("failed to get trigger capability: %s", err) // we don't immediately return here, since we want to retry all triggers @@ -123,16 +123,16 @@ func (e *Engine) initializeCapability(ctx context.Context, s *step) error { return nil } - cp, err := e.registry.Get(ctx, s.Type) + cp, err := e.registry.Get(ctx, s.ID) if err != nil { - return fmt.Errorf("failed to get capability with ref %s: %s", s.Type, err) + return fmt.Errorf("failed to get capability with ref %s: %s", s.ID, err) } // We configure actions, consensus and targets here, and // they all satisfy the `CallbackCapability` interface cc, ok := cp.(capabilities.CallbackCapability) if !ok { - return fmt.Errorf("could not coerce capability %s to CallbackCapability", s.Type) + return fmt.Errorf("could not coerce capability %s to CallbackCapability", s.ID) } if s.config == nil { @@ -275,7 +275,7 @@ func (e *Engine) registerTrigger(ctx context.Context, t *triggerCapability) erro } eventsCh, err := t.trigger.RegisterTrigger(ctx, triggerRegRequest) if err != nil { - return fmt.Errorf("failed to instantiate trigger %s, %s", t.Type, err) + return fmt.Errorf("failed to instantiate trigger %s, %s", t.ID, err) } go func() { diff --git a/core/services/workflows/engine_test.go b/core/services/workflows/engine_test.go index 3896f840ee8..ff4c5682129 100644 --- a/core/services/workflows/engine_test.go +++ b/core/services/workflows/engine_test.go @@ -19,7 +19,7 @@ import ( const hardcodedWorkflow = ` triggers: - - type: "mercury-trigger" + - id: "mercury-trigger" config: feedIds: - "0x1111111111111111111100000000000000000000000000000000000000000000" @@ -27,7 +27,7 @@ triggers: - "0x3333333333333333333300000000000000000000000000000000000000000000" consensus: - - type: "offchain_reporting" + - id: "offchain_reporting" ref: "evm_median" inputs: observations: @@ -49,14 +49,14 @@ consensus: abi: "mercury_reports bytes[]" targets: - - type: "write_polygon-testnet-mumbai" + - id: "write_polygon-testnet-mumbai" inputs: report: "$(evm_median.outputs.report)" config: address: "0x3F3554832c636721F1fD1822Ccca0354576741Ef" params: ["$(report)"] abi: "receive(report bytes)" - - type: "write_ethereum-testnet-sepolia" + - id: "write_ethereum-testnet-sepolia" inputs: report: "$(evm_median.outputs.report)" config: @@ -215,7 +215,7 @@ func TestEngineWithHardcodedWorkflow(t *testing.T) { const ( simpleWorkflow = ` triggers: - - type: "mercury-trigger" + - id: "mercury-trigger" config: feedlist: - "0x1111111111111111111100000000000000000000000000000000000000000000" # ETHUSD @@ -223,7 +223,7 @@ triggers: - "0x3333333333333333333300000000000000000000000000000000000000000000" # BTCUSD consensus: - - type: "offchain_reporting" + - id: "offchain_reporting" ref: "evm_median" inputs: observations: @@ -245,7 +245,7 @@ consensus: abi: "mercury_reports bytes[]" targets: - - type: "write_polygon-testnet-mumbai" + - id: "write_polygon-testnet-mumbai" inputs: report: "$(evm_median.outputs.report)" config: @@ -368,7 +368,7 @@ func TestEngine_ErrorsTheWorkflowIfAStepErrors(t *testing.T) { const ( multiStepWorkflow = ` triggers: - - type: "mercury-trigger" + - id: "mercury-trigger" config: feedlist: - "0x1111111111111111111100000000000000000000000000000000000000000000" # ETHUSD @@ -376,14 +376,14 @@ triggers: - "0x3333333333333333333300000000000000000000000000000000000000000000" # BTCUSD actions: - - type: "read_chain_action" + - id: "read_chain_action" ref: "read_chain_action" inputs: action: - "$(trigger.outputs)" consensus: - - type: "offchain_reporting" + - id: "offchain_reporting" ref: "evm_median" inputs: observations: @@ -406,7 +406,7 @@ consensus: abi: "mercury_reports bytes[]" targets: - - type: "write_polygon-testnet-mumbai" + - id: "write_polygon-testnet-mumbai" inputs: report: "$(evm_median.outputs.report)" config: diff --git a/core/services/workflows/models.go b/core/services/workflows/models.go index 92abf36d2c0..cd167403089 100644 --- a/core/services/workflows/models.go +++ b/core/services/workflows/models.go @@ -19,8 +19,7 @@ type stepRequest struct { // // Within the workflow spec, they are called "Capability Properties". type stepDefinition struct { - // TODO: Rename this, type here refers to the capability ID, not its type. - Type string `json:"type" jsonschema:"required"` + ID string `json:"id" jsonschema:"required"` Ref string `json:"ref,omitempty" jsonschema:"pattern=^[a-z0-9_]+$"` Inputs map[string]any `json:"inputs,omitempty"` Config map[string]any `json:"config" jsonschema:"required"` @@ -160,7 +159,7 @@ func Parse(yamlWorkflow string) (*workflow, error) { // To handle this, we default the `Ref` to the type, but ideally we // should find a better long-term way to handle this. if s.Ref == "" { - s.Ref = s.Type + s.Ref = s.ID } innerErr := g.AddVertex(&step{stepDefinition: s}) diff --git a/core/services/workflows/models_test.go b/core/services/workflows/models_test.go index 232e91eaaa8..0964b13d277 100644 --- a/core/services/workflows/models_test.go +++ b/core/services/workflows/models_test.go @@ -19,23 +19,23 @@ func TestParse_Graph(t *testing.T) { name: "basic example", yaml: ` triggers: - - type: "a-trigger" + - id: "a-trigger" actions: - - type: "an-action" + - id: "an-action" ref: "an-action" inputs: trigger_output: $(trigger.outputs) consensus: - - type: "a-consensus" + - id: "a-consensus" ref: "a-consensus" inputs: trigger_output: $(trigger.outputs) an-action_output: $(an-action.outputs) targets: - - type: "a-target" + - id: "a-target" ref: "a-target" inputs: consensus_output: $(a-consensus.outputs) @@ -58,28 +58,28 @@ targets: name: "circular relationship", yaml: ` triggers: - - type: "a-trigger" + - id: "a-trigger" actions: - - type: "an-action" + - id: "an-action" ref: "an-action" inputs: trigger_output: $(trigger.outputs) output: $(a-second-action.outputs) - - type: "a-second-action" + - id: "a-second-action" ref: "a-second-action" inputs: output: $(an-action.outputs) consensus: - - type: "a-consensus" + - id: "a-consensus" ref: "a-consensus" inputs: trigger_output: $(trigger.outputs) an-action_output: $(an-action.outputs) targets: - - type: "a-target" + - id: "a-target" ref: "a-target" inputs: consensus_output: $(a-consensus.outputs) @@ -90,32 +90,32 @@ targets: name: "indirect circular relationship", yaml: ` triggers: - - type: "a-trigger" + - id: "a-trigger" actions: - - type: "an-action" + - id: "an-action" ref: "an-action" inputs: trigger_output: $(trigger.outputs) action_output: $(a-third-action.outputs) - - type: "a-second-action" + - id: "a-second-action" ref: "a-second-action" inputs: output: $(an-action.outputs) - - type: "a-third-action" + - id: "a-third-action" ref: "a-third-action" inputs: output: $(a-second-action.outputs) consensus: - - type: "a-consensus" + - id: "a-consensus" ref: "a-consensus" inputs: trigger_output: $(trigger.outputs) an-action_output: $(an-action.outputs) targets: - - type: "a-target" + - id: "a-target" ref: "a-target" inputs: consensus_output: $(a-consensus.outputs) @@ -126,23 +126,23 @@ targets: name: "relationship doesn't exist", yaml: ` triggers: - - type: "a-trigger" + - id: "a-trigger" actions: - - type: "an-action" + - id: "an-action" ref: "an-action" inputs: trigger_output: $(trigger.outputs) action_output: $(missing-action.outputs) consensus: - - type: "a-consensus" + - id: "a-consensus" ref: "a-consensus" inputs: an-action_output: $(an-action.outputs) targets: - - type: "a-target" + - id: "a-target" ref: "a-target" inputs: consensus_output: $(a-consensus.outputs) @@ -153,23 +153,23 @@ targets: name: "two trigger nodes", yaml: ` triggers: - - type: "a-trigger" - - type: "a-second-trigger" + - id: "a-trigger" + - id: "a-second-trigger" actions: - - type: "an-action" + - id: "an-action" ref: "an-action" inputs: trigger_output: $(trigger.outputs) consensus: - - type: "a-consensus" + - id: "a-consensus" ref: "a-consensus" inputs: an-action_output: $(an-action.outputs) targets: - - type: "a-target" + - id: "a-target" ref: "a-target" inputs: consensus_output: $(a-consensus.outputs) @@ -191,21 +191,21 @@ targets: name: "non-trigger step with no dependent refs", yaml: ` triggers: - - type: "a-trigger" - - type: "a-second-trigger" + - id: "a-trigger" + - id: "a-second-trigger" actions: - - type: "an-action" + - id: "an-action" ref: "an-action" inputs: hello: "world" consensus: - - type: "a-consensus" + - id: "a-consensus" ref: "a-consensus" inputs: trigger_output: $(trigger.outputs) action_output: $(an-action.outputs) targets: - - type: "a-target" + - id: "a-target" ref: "a-target" inputs: consensus_output: $(a-consensus.outputs) diff --git a/core/services/workflows/models_yaml.go b/core/services/workflows/models_yaml.go index 280a895f1b8..5ed7941f84a 100644 --- a/core/services/workflows/models_yaml.go +++ b/core/services/workflows/models_yaml.go @@ -166,17 +166,19 @@ func (m mapping) MarshalJSON() ([]byte, error) { // It allows for multiple ways of defining a step, which we later // convert to a single representation, `stepDefinition`. type stepDefinitionYaml struct { - // A universally unique name for a capability will be defined under the “type” property. The uniqueness will, eventually, be enforced in the Capability Registry . Semver must be used to specify the version of the Capability at the end of the type field. Capability versions must be immutable. + // A universally unique name for a capability will be defined under the “id” property. The uniqueness will, eventually, be enforced in the Capability Registry. + // + // Semver must be used to specify the version of the Capability at the end of the id field. Capability versions must be immutable. // // Initially, we will require major versions. This will ease upgrades early on while we develop the infrastructure. // // Eventually, we might support minor version and specific version pins. This will allow workflow authors to have flexibility when selecting the version, and node operators will be able to determine when they should update their capabilities. // - // There are two ways to specify a type - using a string as a fully qualified ID or a structured table. When using a table, labels are ordered alphanumerically and joined into a string following a + // There are two ways to specify an id - using a string as a fully qualified ID or a structured table. When using a table, labels are ordered alphanumerically and joined into a string following a // {name}:{label1_key}_{label1_value}:{label2_key}_{label2_value}@{version} // pattern. // - // The “type” supports [a-z0-9_-:] characters followed by an @ and [semver regex] at the end. + // The “id” supports [a-z0-9_-:] characters followed by an @ and [semver regex] at the end. // // Validation must throw an error if: // @@ -184,11 +186,11 @@ type stepDefinitionYaml struct { // (For Keystone only.) More specific than a major version is specified. // // Example (string) - // type: read_chain:chain_ethereum:network_mainnet@1 + // id: read_chain:chain_ethereum:network_mainnet@1 // // Example (table) // - // type: + // id: // name: read_chain // version: 1 // labels: @@ -196,7 +198,7 @@ type stepDefinitionYaml struct { // network: mainnet // // [semver regex]: https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string - Type stepDefinitionType `json:"type" jsonschema:"required"` + ID stepDefinitionID `json:"id" jsonschema:"required"` // Actions and Consensus capabilities have a required “ref” property that must be unique within a Workflow file (not universally) This property enables referencing outputs and is required because Actions and Consensus always need to be referenced in the following phases. Triggers can optionally specify if they need to be referenced. // @@ -213,7 +215,7 @@ type stepDefinitionYaml struct { // Capabilities can specify an additional optional ”inputs” property. It allows specifying a dependency on the result of one or more other capabilities. These are always runtime values that cannot be provided upfront. It takes a map of the argument name internal to the capability and an explicit reference to the values. // - // References are specified using the [type].[ref].[path_to_value] pattern. + // References are specified using the [id].[ref].[path_to_value] pattern. // // The interpolation of “inputs” is allowed // @@ -231,7 +233,7 @@ type stepDefinitionYaml struct { // // Example // targets: - // - type: write_polygon_mainnet@1 + // - id: write_polygon_mainnet@1 // inputs: // report: // - consensus.evm_median.outputs.report @@ -248,66 +250,66 @@ type stepDefinitionYaml struct { func (s stepDefinitionYaml) toStepDefinition() stepDefinition { return stepDefinition{ Ref: s.Ref, - Type: s.Type.String(), + ID: s.ID.String(), Inputs: s.Inputs, Config: s.Config, } } -// stepDefinitionType represents both the string and table representations of the "type" field in a stepDefinition. -type stepDefinitionType struct { - typeStr string - typeTable *stepDefinitionTableType +// stepDefinitionID represents both the string and table representations of the "id" field in a stepDefinition. +type stepDefinitionID struct { + idStr string + idTable *stepDefinitionTableID } -func (s stepDefinitionType) String() string { - if s.typeStr != "" { - return s.typeStr +func (s stepDefinitionID) String() string { + if s.idStr != "" { + return s.idStr } - return s.typeTable.String() + return s.idTable.String() } -func (s *stepDefinitionType) UnmarshalJSON(data []byte) error { +func (s *stepDefinitionID) UnmarshalJSON(data []byte) error { // Unmarshal the JSON data into a map to determine if it's a string or a table var m string err := json.Unmarshal(data, &m) if err == nil { - s.typeStr = m + s.idStr = m return nil } - // If the JSON data is a table, unmarshal it into a stepDefinitionTableType - var table stepDefinitionTableType + // If the JSON data is a table, unmarshal it into a stepDefinitionTableID + var table stepDefinitionTableID err = json.Unmarshal(data, &table) if err != nil { return err } - s.typeTable = &table + s.idTable = &table return nil } -func (s *stepDefinitionType) MarshalJSON() ([]byte, error) { - if s.typeStr != "" { - return json.Marshal(s.typeStr) +func (s *stepDefinitionID) MarshalJSON() ([]byte, error) { + if s.idStr != "" { + return json.Marshal(s.idStr) } - return json.Marshal(s.typeTable) + return json.Marshal(s.idTable) } -// JSONSchema returns the JSON schema for a stepDefinitionType. +// JSONSchema returns the JSON schema for a stepDefinitionID. // // The schema is a oneOf schema that allows either a string or a table. -func (stepDefinitionType) JSONSchema() *jsonschema.Schema { +func (stepDefinitionID) JSONSchema() *jsonschema.Schema { reflector := jsonschema.Reflector{DoNotReference: true, ExpandedStruct: true} - tableSchema := reflector.Reflect(&stepDefinitionTableType{}) + tableSchema := reflector.Reflect(&stepDefinitionTableID{}) stringSchema := &jsonschema.Schema{ - Type: "string", + ID: "string", Pattern: "^[a-z0-9_\\-:]+@(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$", } return &jsonschema.Schema{ - Title: "type", + Title: "id", OneOf: []*jsonschema.Schema{ stringSchema, tableSchema, @@ -315,21 +317,21 @@ func (stepDefinitionType) JSONSchema() *jsonschema.Schema { } } -// stepDefinitionTableType is the structured representation of a stepDefinitionType. -type stepDefinitionTableType struct { +// stepDefinitionTableID is the structured representation of a stepDefinitionID. +type stepDefinitionTableID struct { Name string `json:"name"` Version string `json:"version" jsonschema:"pattern=(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$"` Labels map[string]string `json:"labels"` } -// String returns the string representation of a stepDefinitionTableType. +// String returns the string representation of a stepDefinitionTableID. // // It follows the format: // // {name}:{label1_key}_{label1_value}:{label2_key}_{label2_value}@{version} // // where labels are ordered alphanumerically. -func (s stepDefinitionTableType) String() string { +func (s stepDefinitionTableID) String() string { labels := make([]string, 0, len(s.Labels)) for k, v := range s.Labels { labels = append(labels, fmt.Sprintf("%s_%s", k, v)) diff --git a/core/services/workflows/models_yaml_test.go b/core/services/workflows/models_yaml_test.go index 2732f1b44c7..efcdaf6f332 100644 --- a/core/services/workflows/models_yaml_test.go +++ b/core/services/workflows/models_yaml_test.go @@ -116,7 +116,7 @@ func TestWorkflowSpecMarshalling(t *testing.T) { } }) - t.Run("Table and string capability type", func(t *testing.T) { + t.Run("Table and string capability id", func(t *testing.T) { workflowBytes := fixtureReader("workflow_2") spec := workflowSpecYaml{} diff --git a/core/services/workflows/testdata/fixtures/workflows/marshalling/workflow_1.yaml b/core/services/workflows/testdata/fixtures/workflows/marshalling/workflow_1.yaml index cbd33f4a90e..9a9870af875 100644 --- a/core/services/workflows/testdata/fixtures/workflows/marshalling/workflow_1.yaml +++ b/core/services/workflows/testdata/fixtures/workflows/marshalling/workflow_1.yaml @@ -1,5 +1,5 @@ triggers: - - type: mercury-trigger@1 + - id: mercury-trigger@1 ref: report_data config: boolean_coercion: @@ -54,7 +54,7 @@ # no actions consensus: - - type: offchain_reporting@1 + - id: offchain_reporting@1 inputs: observations: - triggers.report_data.outputs @@ -76,7 +76,7 @@ abi: "mercury_reports bytes[]" targets: - - type: write_polygon_mainnet@1 + - id: write_polygon_mainnet@1 inputs: report: - consensus.evm_median.outputs.report diff --git a/core/services/workflows/testdata/fixtures/workflows/marshalling/workflow_2.yaml b/core/services/workflows/testdata/fixtures/workflows/marshalling/workflow_2.yaml index 50a598d0bc9..be40a91daa0 100644 --- a/core/services/workflows/testdata/fixtures/workflows/marshalling/workflow_2.yaml +++ b/core/services/workflows/testdata/fixtures/workflows/marshalling/workflow_2.yaml @@ -1,12 +1,12 @@ triggers: - - type: on_mercury_report@1 + - id: on_mercury_report@1 ref: report_data config: {} # no actions consensus: - - type: + - id: name: trigger_test version: "2" labels: @@ -19,7 +19,7 @@ - triggers.report_data.outputs targets: - - type: write_polygon_mainnet@1 + - id: write_polygon_mainnet@1 config: {} inputs: report: diff --git a/core/services/workflows/testdata/fixtures/workflows/marshalling/workflow_2_spec.json b/core/services/workflows/testdata/fixtures/workflows/marshalling/workflow_2_spec.json index f4024e24267..000fa469218 100644 --- a/core/services/workflows/testdata/fixtures/workflows/marshalling/workflow_2_spec.json +++ b/core/services/workflows/testdata/fixtures/workflows/marshalling/workflow_2_spec.json @@ -1,14 +1,14 @@ { "triggers": [ { - "type": "on_mercury_report@1", + "id": "on_mercury_report@1", "ref": "report_data", "config": {} } ], "consensus": [ { - "type": "trigger_test:aaShouldBeFirst_true:chain_ethereum:network_mainnet@2", + "id": "trigger_test:aaShouldBeFirst_true:chain_ethereum:network_mainnet@2", "inputs": { "observations": [ "triggers.report_data.outputs" @@ -19,7 +19,7 @@ ], "targets": [ { - "type": "write_polygon_mainnet@1", + "id": "write_polygon_mainnet@1", "inputs": { "report": [ "consensus.evm_median.outputs.report" @@ -28,4 +28,4 @@ "config": {} } ] -} +} \ No newline at end of file diff --git a/core/services/workflows/testdata/fixtures/workflows/references/failing_1.yaml b/core/services/workflows/testdata/fixtures/workflows/references/failing_1.yaml index 67d6890c47b..b3c984e9892 100644 --- a/core/services/workflows/testdata/fixtures/workflows/references/failing_1.yaml +++ b/core/services/workflows/testdata/fixtures/workflows/references/failing_1.yaml @@ -1,14 +1,14 @@ triggers: -- type: trigger_test@1 +- id: trigger_test@1 config: {} consensus: - - type: offchain_reporting@1 + - id: offchain_reporting@1 ref: offchain_reporting=1 config: {} targets: - - type: write_polygon_mainnet@1 + - id: write_polygon_mainnet@1 ref: write_polygon_mainnet_1 config: {} diff --git a/core/services/workflows/testdata/fixtures/workflows/references/passing_1.yaml b/core/services/workflows/testdata/fixtures/workflows/references/passing_1.yaml index f8c7d20136e..cb2f424e981 100644 --- a/core/services/workflows/testdata/fixtures/workflows/references/passing_1.yaml +++ b/core/services/workflows/testdata/fixtures/workflows/references/passing_1.yaml @@ -1,14 +1,14 @@ triggers: -- type: trigger_test@1 +- id: trigger_test@1 config: {} consensus: - - type: offchain_reporting@1 + - id: offchain_reporting@1 ref: offchain_reporting_1 config: {} targets: - - type: write_polygon_mainnet@1 + - id: write_polygon_mainnet@1 ref: write_polygon_mainnet_1 config: {} diff --git a/core/services/workflows/testdata/fixtures/workflows/versioning/failing_1.yaml b/core/services/workflows/testdata/fixtures/workflows/versioning/failing_1.yaml index b45676388c5..2e41eeb9898 100644 --- a/core/services/workflows/testdata/fixtures/workflows/versioning/failing_1.yaml +++ b/core/services/workflows/testdata/fixtures/workflows/versioning/failing_1.yaml @@ -1,15 +1,15 @@ # Should fail since version is more specific than major triggers: - - type: trigger_test@1.0 + - id: trigger_test@1.0 config: {} consensus: - - type: offchain_reporting@1 + - id: offchain_reporting@1 ref: offchain_reporting_1 config: {} targets: - - type: write_polygon_mainnet@1 + - id: write_polygon_mainnet@1 ref: write_polygon_mainnet_1 config: {} diff --git a/core/services/workflows/testdata/fixtures/workflows/versioning/failing_2.yaml b/core/services/workflows/testdata/fixtures/workflows/versioning/failing_2.yaml index c2a1872b4cf..36cd5b68b6b 100644 --- a/core/services/workflows/testdata/fixtures/workflows/versioning/failing_2.yaml +++ b/core/services/workflows/testdata/fixtures/workflows/versioning/failing_2.yaml @@ -1,16 +1,16 @@ # Should fail since version is more specific than major triggers: - - type: trigger_test@1.0.0 + - id: trigger_test@1.0.0 config: {} consensus: - - type: offchain_reporting@1 + - id: offchain_reporting@1 ref: offchain_reporting_1 config: {} targets: - - type: write_polygon_mainnet@1 + - id: write_polygon_mainnet@1 ref: write_polygon_mainnet_1 config: {} diff --git a/core/services/workflows/testdata/fixtures/workflows/versioning/passing_1.yaml b/core/services/workflows/testdata/fixtures/workflows/versioning/passing_1.yaml index 83bdcc610ef..4579c2899b9 100644 --- a/core/services/workflows/testdata/fixtures/workflows/versioning/passing_1.yaml +++ b/core/services/workflows/testdata/fixtures/workflows/versioning/passing_1.yaml @@ -1,14 +1,14 @@ triggers: - - type: trigger_test@1 + - id: trigger_test@1 config: {} consensus: - - type: offchain_reporting@1-beta.1 + - id: offchain_reporting@1-beta.1 ref: offchain_reporting_1 config: {} targets: - - type: write_polygon_mainnet@1-alpha+sha246er3 + - id: write_polygon_mainnet@1-alpha+sha246er3 ref: write_polygon_mainnet_1 config: {} diff --git a/core/services/workflows/testdata/fixtures/workflows/workflow_schema.json b/core/services/workflows/testdata/fixtures/workflows/workflow_schema.json index 83ecd42ecb9..7f257f7798d 100644 --- a/core/services/workflows/testdata/fixtures/workflows/workflow_schema.json +++ b/core/services/workflows/testdata/fixtures/workflows/workflow_schema.json @@ -6,15 +6,15 @@ "mapping": { "type": "object" }, - "stepDefinitionType": { + "stepDefinitionID": { "oneOf": [ { - "type": "string", + "$id": "string", "pattern": "^[a-z0-9_\\-:]+@(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$" }, { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/smartcontractkit/chainlink/v2/core/services/workflows/step-definition-table-type", + "$id": "https://github.com/smartcontractkit/chainlink/v2/core/services/workflows/step-definition-table-id", "properties": { "name": { "type": "string" @@ -39,12 +39,12 @@ ] } ], - "title": "type" + "title": "id" }, "stepDefinitionYaml": { "properties": { - "type": { - "$ref": "#/$defs/stepDefinitionType" + "id": { + "$ref": "#/$defs/stepDefinitionID" }, "ref": { "type": "string", @@ -60,7 +60,7 @@ "additionalProperties": false, "type": "object", "required": [ - "type", + "id", "config" ] }, @@ -100,4 +100,4 @@ ] } } -} +} \ No newline at end of file diff --git a/core/web/jobs_controller_test.go b/core/web/jobs_controller_test.go index bade8fe293b..0146038d91b 100644 --- a/core/web/jobs_controller_test.go +++ b/core/web/jobs_controller_test.go @@ -397,7 +397,7 @@ func TestJobController_Create_HappyPath(t *testing.T) { owner := "00000000000000000000000000000000000000aa" workflow := ` triggers: - - type: "mercury-trigger" + - id: "mercury-trigger" config: feedIds: - "0x1111111111111111111100000000000000000000000000000000000000000000" @@ -405,7 +405,7 @@ triggers: - "0x3333333333333333333300000000000000000000000000000000000000000000" consensus: - - type: "offchain_reporting" + - id: "offchain_reporting" ref: "evm_median" inputs: observations: @@ -427,14 +427,14 @@ consensus: abi: "mercury_reports bytes[]" targets: - - type: "write_polygon-testnet-mumbai" + - id: "write_polygon-testnet-mumbai" inputs: report: "$(evm_median.outputs.report)" config: address: "0x3F3554832c636721F1fD1822Ccca0354576741Ef" params: ["$(report)"] abi: "receive(report bytes)" - - type: "write_ethereum-testnet-sepolia" + - id: "write_ethereum-testnet-sepolia" inputs: report: "$(evm_median.outputs.report)" config: