-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add getCapabilities to the CapabilityRegistry #13031
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"chainlink": patch | ||
--- | ||
|
||
#internal |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@chainlink/contracts": patch | ||
--- | ||
|
||
#internal |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.19; | ||
|
||
import {BaseTest} from "./BaseTest.t.sol"; | ||
import {CapabilityRegistry} from "../CapabilityRegistry.sol"; | ||
|
||
contract CapabilityRegistry_GetCapabilitiesTest is BaseTest { | ||
function test_ReturnsCapabilities() public { | ||
s_capabilityRegistry.addCapability(s_basicCapability); | ||
s_capabilityRegistry.addCapability(s_capabilityWithConfigurationContract); | ||
|
||
CapabilityRegistry.Capability[] memory capabilities = s_capabilityRegistry.getCapabilities(); | ||
|
||
assertEq(capabilities.length, 2); | ||
|
||
assertEq(capabilities[0].capabilityType, "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].version, "1.0.2"); | ||
assertEq( | ||
uint256(capabilities[1].responseType), | ||
uint256(CapabilityRegistry.CapabilityResponseType.OBSERVATION_IDENTICAL) | ||
); | ||
assertEq(capabilities[1].configurationContract, address(s_capabilityConfigurationContract)); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,8 @@ contract CapabilityConfigurationContract is ICapabilityConfiguration, ERC165 { | |
function getCapabilityConfiguration(uint256 donId) external view returns (bytes memory configuration) { | ||
return s_donConfiguration[donId]; | ||
} | ||
|
||
function supportsInterface(bytes4 interfaceId) public pure override returns (bool) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see this used anywhere, why is it needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is called by consumers/callers of this contract. My guess is the capability registry will call this prior to adding a particular configuration contract address to check that it supports the interface. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is used here: https://github.com/smartcontractkit/chainlink/pull/13031/files#diff-d94c1796b3544ef8780af7e16b5361c8fb9e4d63f492faeda6a3362a8363f51bR180-R182 (previous implementation and test weren't working as expected). |
||
return interfaceId == this.getCapabilityConfiguration.selector; | ||
} | ||
} |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
GETH_VERSION: 1.13.8 | ||
forwarder: ../../../contracts/solc/v0.8.19/KeystoneForwarder/KeystoneForwarder.abi ../../../contracts/solc/v0.8.19/KeystoneForwarder/KeystoneForwarder.bin b4c900aae9e022f01abbac7993d41f93912247613ac6270b0c4da4ef6f2016e3 | ||
keystone_capability_registry: ../../../contracts/solc/v0.8.19/CapabilityRegistry/CapabilityRegistry.abi ../../../contracts/solc/v0.8.19/CapabilityRegistry/CapabilityRegistry.bin 5f801185084a6d6bcc08e0a37574d80f5092bc0dcd40808e9e04804064db0a56 | ||
keystone_capability_registry: ../../../contracts/solc/v0.8.19/CapabilityRegistry/CapabilityRegistry.abi ../../../contracts/solc/v0.8.19/CapabilityRegistry/CapabilityRegistry.bin ae9e077854854fa066746eaa354324c7dac2a13bc38b81a66c856fddfc3b79bf | ||
ocr3_capability: ../../../contracts/solc/v0.8.19/OCR3Capability/OCR3Capability.abi ../../../contracts/solc/v0.8.19/OCR3Capability/OCR3Capability.bin 9dcbdf55bd5729ba266148da3f17733eb592c871c2108ccca546618628fd9ad2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: file name inconsistent with the name of the test and the other file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 will fix it in a follow-up to avoid merge conflict.