Skip to content

feat: add whitelisted proposer OO #4841

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

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open

Conversation

mrice32
Copy link
Member

@mrice32 mrice32 commented Jul 10, 2025

No description provided.

Signed-off-by: Matt Rice <matthewcrice32@gmail.com>
Comment on lines 4 to 22
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

import "../../data-verification-mechanism/interfaces/StoreInterface.sol";
import "../../data-verification-mechanism/interfaces/OracleAncillaryInterface.sol";
import "../../data-verification-mechanism/interfaces/FinderInterface.sol";
import "../../data-verification-mechanism/interfaces/IdentifierWhitelistInterface.sol";
import "../../data-verification-mechanism/implementation/Constants.sol";

import "../interfaces/OptimisticOracleV2Interface.sol";

import "../../common/implementation/Testable.sol";
import "../../common/implementation/Lockable.sol";
import "../../common/implementation/FixedPoint.sol";
import "../../common/implementation/AncillaryData.sol";
import "../../common/implementation/AddressWhitelist.sol";
Copy link
Contributor

Choose a reason for hiding this comment

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

These imports are not strictly required as we have them in the inherited OptimisticOracleV2

Copy link
Contributor

Choose a reason for hiding this comment

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

removed and replaced with named imports

Comment on lines 31 to 32
using SafeERC20 for IERC20;
using Address for address;
Copy link
Contributor

Choose a reason for hiding this comment

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

These are not directly used in the derived contract

Copy link
Contributor

Choose a reason for hiding this comment

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

removed

bytes memory ancillaryData,
address whitelist
) external nonReentrant() onlyOwner() {
customProposerWhitelists[_getId(requester, identifier, timestamp, ancillaryData)] = AddressWhitelistInterface(
Copy link
Contributor

Choose a reason for hiding this comment

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

It might make sense to also check if the given request state is State.Requested. This could help the caller be better assured that the applied whitelist would in fact be effective. Otherwise they could be under impression that the whitelist was set, but in fact the proposal has been already made against the default whitelist.

Copy link
Contributor

Choose a reason for hiding this comment

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

this no longer applies as we want the manager being able to set these before the request has be made

* @notice Sets the requester whitelist.
* @param whitelist address of the whitelist to set.
*/
function ownerSetRequesterWhitelist(address whitelist) external nonReentrant() onlyOwner() {
Copy link
Contributor

Choose a reason for hiding this comment

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

for the sake of completeness, shall we also have similar function for setting the default proposer whitelist?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, this was my mistake. Good call!

) public override returns (uint256 totalBond) {
AddressWhitelistInterface whitelist =
customProposerWhitelists[_getId(requester, identifier, timestamp, ancillaryData)];
if (address(whitelist) == address(0)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

we should allow for a request to have no whitelist so it can be proposed by anyone.

Copy link
Contributor

Choose a reason for hiding this comment

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

added AllowAllList contract that always returns true when checking the address. so admin or manager can set whitelist to this AllowAllList contract if disabling the whitelist restrictions is desired.

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>
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>
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>
Signed-off-by: Reinis Martinsons <reinis@umaproject.org>
Signed-off-by: Reinis Martinsons <reinis@umaproject.org>
@Reinis-FRP Reinis-FRP marked this pull request as ready for review July 16, 2025 12:19
@Reinis-FRP Reinis-FRP requested a review from pumpedlunch July 16, 2025 12:20
require(_getState(requester, identifier, timestamp, ancillaryData) == State.Requested, "setBond: Requested");
_validateBond(bond);
Request storage request = _getRequest(requester, identifier, timestamp, ancillaryData);
request.requestSettings.bond = bond;
Copy link
Contributor

@md0x md0x Jul 16, 2025

Choose a reason for hiding this comment

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

Just confirming - it looks like the request sender can still call setBond directly on the OOv2 and bypass the onlyRequestManager restriction. That might be acceptable but is this behavior intentded? Same for liveness.

* @param whitelist address of the whitelist to set.
*/
function _setDefaultProposerWhitelist(address whitelist) internal {
defaultProposerWhitelist = AddressWhitelistInterface(whitelist);
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we require whitelist != zeroAddress?

* @param ancillaryData ancillary data of the price being requested.
* @return AddressWhitelistInterface the custom proposer whitelist for the request or zero address if not set.
*/
function getCustomProposerWhitelist(
Copy link
Contributor

Choose a reason for hiding this comment

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

we should also extend this to have a function recursing the effective whitelist array and boolean on whether the whitelist is enabled.

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.

4 participants