diff --git a/contracts/src/v0.8/ccip/interfaces/IRMNV2.sol b/contracts/src/v0.8/ccip/interfaces/IRMNV2.sol index 92179663f3e..6031b89d0f9 100644 --- a/contracts/src/v0.8/ccip/interfaces/IRMNV2.sol +++ b/contracts/src/v0.8/ccip/interfaces/IRMNV2.sol @@ -12,7 +12,7 @@ interface IRMNV2 { } /// @notice Verifies signatures of RMN nodes, on dest lane updates as provided in the CommitReport - /// @param offrampAddress is not inferred by msg.sender, in case the call is made through ARMProxy + /// @param offRampAddress is not inferred by msg.sender, in case the call is made through ARMProxy /// @param destLaneUpdates must be well formed, and is a representation of the CommitReport received from the oracles /// @param signatures must be sorted in ascending order by signer address /// @dev Will revert if verification fails @@ -22,10 +22,16 @@ interface IRMNV2 { Signature[] memory signatures ) external view; + /// @notice gets the current set of cursed subjects + /// @return subjects the list of cursed subjects + function getCursedSubjects() external view returns (bytes16[] memory subjects); + /// @notice If there is an active global or legacy curse, this function returns true. + /// @return bool true if there is an active global curse function isCursed() external view returns (bool); /// @notice If there is an active global curse, or an active curse for `subject`, this function returns true. /// @param subject To check whether a particular chain is cursed, set to bytes16(uint128(chainSelector)). + /// @return bool true if the profived subject is cured *or* if there is an active global curse function isCursed(bytes16 subject) external view returns (bool); } diff --git a/contracts/src/v0.8/ccip/rmn/RMNRemote.sol b/contracts/src/v0.8/ccip/rmn/RMNRemote.sol index 143eb46446f..3318bdef042 100644 --- a/contracts/src/v0.8/ccip/rmn/RMNRemote.sol +++ b/contracts/src/v0.8/ccip/rmn/RMNRemote.sol @@ -39,31 +39,31 @@ contract RMNRemote is OwnerIsCreator, ITypeAndVersion, IRMNV2 { /// @dev the configuration of an RMN signer struct Signer { - address onchainPublicKey; // ────╮ for signing reports - uint64 nodeIndex; // ────────────╯ maps to nodes in home chain config, should be strictly increasing + address onchainPublicKey; // ────╮ For signing reports + uint64 nodeIndex; // ────────────╯ Maps to nodes in home chain config, should be strictly increasing } /// @dev the contract config struct Config { - bytes32 rmnHomeContractConfigDigest; // digest of the RMNHome contract config - Signer[] signers; // list of signers - uint64 minSigners; // threshold for the number of signers required to verify a report + bytes32 rmnHomeContractConfigDigest; // Digest of the RMNHome contract config + Signer[] signers; // List of signers + uint64 minSigners; // Threshold for the number of signers required to verify a report } /// @dev the contract config + a version number struct VersionedConfig { - uint32 version; // for tracking the version of the config - Config config; // the config + uint32 version; // For tracking the version of the config + Config config; // The config } /// @dev the payload that RMN nodes sign struct Report { - uint256 destChainId; // to guard against chain selector misconfiguration - uint64 destChainSelector; // the chain selector of the destination chain - address rmnRemoteContractAddress; // the address of this contract - address offrampAddress; // the address of the offramp on the same chain as this contract - bytes32 rmnHomeContractConfigDigest; // the digest of the RMNHome contract config - Internal.MerkleRoot[] destLaneUpdates; // the dest lane updates + uint256 destChainId; // To guard against chain selector misconfiguration + uint64 destChainSelector; // The chain selector of the destination chain + address rmnRemoteContractAddress; // The address of this contract + address offrampAddress; // The address of the offramp on the same chain as this contract + bytes32 rmnHomeContractConfigDigest; // The digest of the RMNHome contract config + Internal.MerkleRoot[] destLaneUpdates; // The dest lane updates } // ================================================================ @@ -135,6 +135,9 @@ contract RMNRemote is OwnerIsCreator, ITypeAndVersion, IRMNV2 { // │ Config │ // ================================================================ + /// @notice Sets the configuration of the contract + /// @param newConfig the new configuration + /// @dev setting congig is atomic; we delete all pre-existing config and set everything from scratch function setConfig(Config calldata newConfig) external onlyOwner { // sanity checks { @@ -175,6 +178,8 @@ contract RMNRemote is OwnerIsCreator, ITypeAndVersion, IRMNV2 { emit ConfigSet(VersionedConfig({version: newConfigCount, config: newConfig})); } + /// @notice Returns the current configuration of the contract + a version number + /// @return versionedConfig the current configuration + version function getVersionedConfig() external view returns (VersionedConfig memory) { return VersionedConfig({version: s_configCount, config: s_config}); } @@ -189,12 +194,17 @@ contract RMNRemote is OwnerIsCreator, ITypeAndVersion, IRMNV2 { // │ Cursing │ // ================================================================ + /// @notice Curse a single subject + /// @param subject the subject to curse function curse(bytes16 subject) external { bytes16[] memory subjects = new bytes16[](1); subjects[0] = subject; curse(subjects); } + /// @notice Curse an array of subjects + /// @param subjects the subjects to curse + /// @dev reverts if any of the subjects are already cursed or if there is a duplicate function curse(bytes16[] memory subjects) public onlyOwner { for (uint256 i = 0; i < subjects.length; ++i) { bytes16 toCurseSubject = subjects[i]; @@ -207,12 +217,17 @@ contract RMNRemote is OwnerIsCreator, ITypeAndVersion, IRMNV2 { emit Cursed(subjects); } + /// @notice Uncurse a single subject + /// @param subject the subject to uncurse function uncurse(bytes16 subject) external { bytes16[] memory subjects = new bytes16[](1); subjects[0] = subject; uncurse(subjects); } + /// @notice Uncurse an array of subjects + /// @param subjects the subjects to uncurse + /// @dev reverts if any of the subjects are not cursed or if there is a duplicate function uncurse(bytes16[] memory subjects) public onlyOwner { for (uint256 i = 0; i < subjects.length; ++i) { bytes16 toUncurseSubject = subjects[i]; @@ -232,7 +247,8 @@ contract RMNRemote is OwnerIsCreator, ITypeAndVersion, IRMNV2 { emit Uncursed(subjects); } - function getCursedSubjects() external view returns (bytes16[] memory) { + /// @inheritdoc IRMNV2 + function getCursedSubjects() external view returns (bytes16[] memory subjects) { return s_cursedSubjectsSequence; }