Skip to content

Conversation

Reinis-FRP
Copy link
Collaborator

@Reinis-FRP Reinis-FRP commented Jul 31, 2025

This should be merged after #6 resolving for any conflicts and also adding supportsInterface implementation to the new DisabledAddressWhitelist contract.

Signed-off-by: Reinis Martinsons <reinis@umaproject.org>
Signed-off-by: Reinis Martinsons <reinis@umaproject.org>
Signed-off-by: Reinis Martinsons <reinis@umaproject.org>
Signed-off-by: Reinis Martinsons <reinis@umaproject.org>
@Reinis-FRP Reinis-FRP requested a review from Copilot July 31, 2025 10:32
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements interface validation using ERC165 for whitelist contracts to ensure type safety. The changes add ERC165 support to the whitelist interface hierarchy and validate that contracts implement the expected interface before assignment.

  • Added ERC165 interface checking to validate whitelist contract compatibility
  • Modified whitelist interfaces and implementations to inherit from IERC165 and support interface detection
  • Updated validation logic to use ERC165Checker instead of simple zero address checks

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
ManagedOptimisticOracleV2.sol Added ERC165 interface validation for whitelist assignments and removed zero address checks for internal setters
AddressWhitelistInterface.sol Extended interface to inherit from IERC165 for ERC165 support
DisableableAddressWhitelist.sol Implemented supportsInterface method to support ERC165 interface detection
AddressWhitelist.sol Added ERC165 inheritance and implemented supportsInterface method

@Reinis-FRP Reinis-FRP marked this pull request as ready for review July 31, 2025 10:46
Signed-off-by: Reinis Martinsons <reinis@umaproject.org>
Copy link
Collaborator

@grasphoper grasphoper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks right, but hard to meaningfully give approval before we merge master into it (as e.g. DisableableWhitelistInterface got removed)

Signed-off-by: Reinis Martinsons <reinis@umaproject.org>
Signed-off-by: Reinis Martinsons <reinis@umaproject.org>
// Zero address is allowed to disable the custom proposer whitelist.
if (whitelist != address(0)) {
require(
ERC165Checker.supportsInterface(whitelist, type(AddressWhitelistInterface).interfaceId),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: maybe this could go in a internal view function "_validateWhitelist" given that we check this in different places.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed, great suggestion, added in 7bb517c

Copy link
Collaborator

@md0x md0x left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just an small suggestion

Signed-off-by: Reinis Martinsons <reinis@umaproject.org>
@Reinis-FRP Reinis-FRP merged commit f2b5a2c into master Aug 1, 2025
2 checks passed
@Reinis-FRP Reinis-FRP deleted the reinis-frp/l03-whitelist-check-erc165 branch August 1, 2025 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants