SIP-310: Feature Flags (V3)

Author
StatusImplemented
TypeGovernance
NetworkEthereum & Optimism
ImplementorSunny Vempati (@sunnyvempati)
ReleaseTBD
ProposalLoading status...
Created2022-10-27

Simple Summary

This SIP proposes a "feature flag" mechanism to only allow certain addresses access to parts of the protocol.

Abstract

This functionality allows specific functions to be restricted with a feature flag such that only SCCP-specified addresses are able to call them. The flag may also be removed via SCCP, such that anyone can use the relevant functionality. Initially, feature flags will be implemented for the creation of pools and registration of markets.

Motivation

To reduce risk to the protocol, it would be advantageous for governance to decide which addresses are able to create pools and register markets. We anticipate governance will choose to remove these feature flags and other feature flags may be added in the future.

Technical Specification

Overview

Implementation involves the creation of a FeatureFlagModule in the core system and usage of this functionality in the createPool() and registerMarket() functions.

Rationale

To implement the ability for governance to control usage of thecreatePool() and registerMarket() functions, it is preferable to architect a generic solution, such that it could be reused for future features.

Generally, this approach increases the agility of the protocol when deploying new features. Rather than requiring SIPs, code changes, and deployments, early usage of features in production can be controlled via SCCP.

Technical Specification

The Feature Flag Module will implement the following interface:

interface IFeatureFlagModule {
    function setFeatureFlagAllowAll(bytes32 feature, bool allowAll) external;

    function addToFeatureFlagAllowlist(bytes32 feature, address permissioned) external;

    function removeFromFeatureFlagAllowlist(bytes32 feature, address permissioned) external;

    function getFeatureFlagAllowAll(bytes32 feature) external view returns (bool);

    function getFeatureFlagAllowlist(bytes32 feature) external view returns (address[] memory);

    function isFeatureAllowed(bytes32 feature, address addressToCheck) external view returns (bool);
}

A feature flag is by default "live" when a function calls ensureAccessToFeature. This means only addresses added to the feature flag are able to use the relevant function. You can turn off the feature flag entirely by setting allowAll to true which allows any address access to the feature.

A feature flag named createPool and registerMarket will be applied to the corresponding functions by calling the aforementioned ensureAccessToFeature function.

Test Cases

Relevant tests will be developed during implementation.

Configurable Values (Via SCCP)

  • Enable/disable the createPool flag
  • List of addresses associated with the createPool flag
  • Enable/disable the registerMarket flag
  • List of addresses associated with the registerMarket flag

Copyright and related rights waived via CC0.