Implementation of Chaos Labs Risk Oracles

Summary

This proposal seeks to integrate Chaos Labs’ Risk Oracle into the GMX protocol, to enhance the efficiency and accuracy of market parameter updates. The Risk Oracle will enable real-time and automated adjustments to market configurations, reducing manual intervention and improving the trading experience for users.

This potential integration continues GMX’s commitment to making the protocol as transparent and antifragile as possible, ensuring that the core functions of data truth, risk-based market parameters, and protocol upkeep continue to be performed by independent leaders in the space.

Motivation

Chaos Labs is the Risk Manager for GMX DAO and protocol, performing a range of economic and security risks, including providing specific market parameters for GMX V2. These parameters are currently offered based on periodic time-based reviews and in response to specific market or associated events that affect the risk profile of pools (ex., Significant changes in pool sizes, OI, or liquidity profile on external markets that Oracles reference). These recommendations are then manually updated and reviewed continuously per the process listed above. While effective, this process is time-consuming and introduces a latency in responding to market changes. This latency results in market parameters being more conservative than otherwise, as they must also cover a reasonable range of market conditions without further updating, and thus higher fees.

By integrating the Risk Oracle, over time more and more of the updating of parameters can be automated, ensuring that market parameters, including but not limited to price impact, max open interest, and others, are adjusted in real-time based on global data from CEXs. This integration will enhance the protocol’s competitiveness by improving execution costs with more precise risk parameters, reducing price manipulation risks, and minimizing the development workload.

Rationale

Integrating Chaos Labs’ Risk Oracle is a beneficial step forward for GMX as it means continuing to move towards a more automated and responsive risk management system. The Risk Oracle will offer the protocol:

Real-Time Updates: Implement real-time updates for critical parameters like price impact, which will lead to better execution costs for traders and more competitive pricing.

Automated Adjustments: Automatically update max open interest (OI) configurations, acting as an additional safeguard against price manipulation and pool imbalances.

Enhanced Market Stability: Dynamically adjust parameters based on real-time data from CEXs and DEXs to ensure the protocol remains resilient against sudden market changes.

Resilience: Further making the protocol more antifragile and less reliant on contributors for providing all updates, while still retaining mechanisms through Admins and the Security multisig as a fallback.

Specification

Risk Oracle Integration

Data Source: GMX will read risk parameter recommendations from the Chaos Labs’ Risk Oracle.

Parameter Updates: The Risk Oracle will feed data into the GMX protocol, where a Keeper will observe updates, validate them, and execute transactions to update on-chain market configurations.

Control Mechanism: The Keeper will not have direct control over the parameters. Instead, during transaction execution, the GMX contract will read values from the Risk Oracle and use them to update the markets.

Update Frequency

Real-Time Updates: Parameters, such as price impact, will be updated in real-time to ensure optimal trading conditions.

Periodic Updates: Parameters, such as max open interest, will be updated less frequently, potentially once per hour, to maintain market stability.

Validation and Safety:

The Keeper will automatically check updates within a predefined valid range to ensure the protocol’s safety and integrity.

Initial updates will use narrower ranges for extra security.

Implementation Process

  • Initially, the Oracles will have support for maximum open interest updates.
  • Followed by position price impact updates
  • In the future, the Chaos Labs Risk Oracles will also support updates for swap price impact, max pool size, funding rate, borrowing rate, and more.

Conclusion

Integrating Chaos Labs’ Risk Oracle into the GMX protocol will help GMX adapt to market changes quickly and efficiently by accessing real-time data from CEXs and DEXs. Automating key market updates will improve trading conditions and enhance protection against market manipulation.

7 Likes

This is going to be a fantastic development and will hopefully bring a day and night difference to trader UX, very much in favour.

My only question is over the points of failure related to the Chaos oracle. What happens in the event that the oracle is not reachable? Is the Chaos oracle decentralised?

3 Likes

also how is it insured that the automated use of the risk oracle by chaos labs is of sound updating?

2 Likes

In essence, GMX has a valid range of values that ChaosLabs Oracle parameters must fall within before any updates to the GMX Market configurations are allowed.

For example, if a value has an allowed range of [3,5], GMX Keepers will not update it if ChaosLabs reports a value outside this range. However, if the value falls within the range, it will be automatically updated.

YFI Aave Labs and many other DeFi protocols also use Risk Oracles in a similar way.

4 Likes

As a GMX delegate, I fully support this proposal.

We’ve received complaints about traders experiencing significant price impacts on various assets which essentially came down to not updating configurations in real-time as the market moves. Additionally, the lack of frequent updates, coupled with the need for a buffer to ensure market safety, has been a concern.

This proposal will make GMX more competitive in areas like price impact, swap price impacts, and open interest. By automatically integrating real-time market data from ChaosLab oracles, the protocol will become more robust, whether during periods of low volatility and volume or the opposite. GMX configurations will essentially behave like an orderbook as orderbook data from all big exchanges is being fed by these oracles, allowing us to give one of the best pricings in the DEX industry in terms of price impacts.

Big yes from me

3 Likes

This is an indispensable step for GMX to provide optimal trading costs in the market. At the same time, the Keeper’s automatic check of whether the risk params provided by ChaosLabs are within a reasonable range also ensures the security of risk params from GMX’s perspective, rather than completely separating the risk params. In summary, I believe the implementation details mentioned in the proposal are comprehensive and should bring significant improvements to GMX. I strongly support this deployment.

1 Like

d2.finance strongly looking forward to Risk Oracles

1 Like

The Vaultka team strongly supports this proposal. We foresee that implementing a risk oracle can further enhance protocol safety and ensure the protocol receives real-time updates in the volatile crypto market. This will reduce potential price manipulation risks and enhance the precision of risk parameters.

1 Like

Hey everyone, we’re incredibly excited about the Chaos Labs Risk Oracle and the benefits it can bring to GMX. We’re thrilled to see the community actively interested in the details. We’re happy to dive into the specifics below and are looking forward to joining an upcoming community call to provide more clarity.

Chaos Labs Risk Oracle Overview

The Chaos Labs Risk Oracle serves the purpose of automating the risk management process, which traditionally requires manual intervention. The integration will streamline updating critical parameters like max open interest and price impact, allowing the protocol to be more responsive to real-time market changes. Currently, Chaos Labs has constant monitoring and alerting configured to notify the team of market events, resulting in an automated parameter recommendations for the GMX protocol, which are then manually shared with and updated by the GMX team. The introduction of the Risk Oracle will not change this workflow, but will automate the process, ensuring quicker and more frequent updates with validated recommendations—all without sacrificing protocol safety and integrity.

Automation with Full Control for GMX

It is crucial to emphasize that Risk Oracles do not provide Chaos Labs direct control over the GMX contracts. Instead, our system will automatically publish risk parameter updates to the Risk Oracle contract. GMX’s Keeper will monitor the Oracle, validate these recommendations, and, upon meeting predetermined criteria, execute the updates to the on-chain contract configurations. This allows full control to remain with GMX, ensuring that every update is consistent with safety protocols and governance decisions.

Technical Details

To provide more insight into the technical workings of the Chaos Labs Risk Oracle, here’s an overview of the key steps involved in the process:

  1. Simulation & Analysis: The Chaos Labs Risk Engine continuously runs a range of simulations using data from various sources, including on-chain data, CEXs, DEXs, as well as other relevant market indicators.
  2. Risk Parameter Identification: Based on the simulation results, the Risk Engine identifies necessary updates to market risk parameters. These parameters could be anything from the maximum allowable open interest to price impact coefficients.
  3. Publishing to the Risk Oracle Contract: Once a parameter update is identified, Chaos Labs’ system automatically publishes this update to the Risk Oracle contract on-chain via the publishRiskParameterUpdate() function. At this point, we store metadata such as the new parameter values, a unique update ID, the relevant market, and other identification fields.
    • The Oracle’s contract function structure has been designed to be highly flexible, enabling it to support various data types and parameter complexities. This flexibility becomes crucial in maintaining accurate and real-time adjustments to GMX’s markets.
  4. Event Emission: Upon publishing, the contract emits a ParameterUpdated event, which signals that a new recommendation has been sent for validation. GMX’s Keeper, which listens for this event, takes over from here.
  5. Validation by GMX Keeper: GMX’s Keeper fetches the latest update details using the contract’s getLatestUpdateByParameterAndMarket() function. The Keeper then runs a validation check against predefined bounds and conditions set by GMX. Only if the new value falls within an acceptable range and meets other safety criteria does the Keeper push the update to the GMX contract’s configuration.
    • Because all parameters are validated by the Keeper before implementation, this ensures that no unauthorized or harmful changes are enacted, adhering strictly to GMX’s governance and security policies.
  6. Implementation: Once validated, the updated parameter is applied to the relevant market on-chain, ensuring that GMX remains optimally configured based on real-time market data.

Implementation Process

The implementation process will follow a phased approach, initially focusing on specific parameters like max long and short open interest, with subsequent support extended to more areas in the future, like price impact and others. These enhancements are aimed at facilitating more precise trading conditions by dynamically adjusting market parameters based on data from global markets.

Furthermore, it’s worth noting that we’ve already successfully implemented similar Risk Oracle solutions for other major DeFi protocols, including Aave. These oracles are currently operational, helping Aave to leverage real-time data to optimize various risk parameters across their extensive network of markets.

Community Questions

@Snipermonke01
My only question is over the points of failure related to the Chaos oracle. What happens in the event that the oracle is not reachable? Is the Chaos oracle decentralized?

  1. Oracle Availability: The Chaos Labs Risk Oracle architecture is designed with resiliency in mind. While the system is primarily centralized today, it is hosted in a highly reliable environment with redundancy and uptime guarantees. In the unlikely event that the Oracle is temporarily unreachable, the GMX contract remains unaffected as there is no automatic direct link that pushes changes. GMX’s Keeper will continue to function based on the last set of validated parameters. This ensures that market operations continue smoothly until the Oracle becomes reachable again. Note that we are working with the GMX team to design an an API endpoint that will allow the team to perform regular health checks on the oracle.
  2. Decentralization Plans: The current implementation of the Chaos Labs Risk Oracle isn’t fully decentralized, but we recognize the importance of decentralization and transparency, particularly in DeFi. Therefore, while the system is built and operated by Chaos Labs at the moment, we are committed to exploring potential pathways for further decentralization in the future, enabling more community-driven oversight and control.

@brawlaphant
Also how is it ensured that the automated use of the risk oracle by Chaos Labs is of sound updating?

  1. Controlled Validation Process: It’s important to clarify that while Chaos Labs automatically generates risk parameter recommendations, these updates are not directly applied to GMX’s on-chain parameters. Instead, the GMX Keeper has full control over validating the recommendations provided by the Chaos Labs Oracle. Each update is first checked against predefined bounds and conditions on both Chaos Labs and GMX’s side before being committed. This validation process ensures that only parameters which meet GMX’s stringent safety and operational standards are updated, safeguarding against any erroneous or unsound updates.
  2. Rigorous Internal Validation: Before the recommendations are even published by the Risk Oracle, our system at Chaos Labs undergoes rigorous internal validation. This involves a series of checks and simulations that ensure the recommendations are based on sound and up-to-date market data. The goal is to provide only the most accurate and reliable updates.

Conclusion

We believe that integrating the Chaos Labs Risk Oracle will significantly benefit GMX by enabling more agile and automated parameter adjustments, reducing the reaction time to market changes, and enhancing protocol resilience. We’re excited to work together to make GMX more responsive, competitive, and secure for all its users.

Please feel free to reply with any additional questions or concerns.

-The Chaos Labs Team

4 Likes

Thank you for the clarification, I am very strongly in favour of this proposal being implemented.

2 Likes

We strongly support this proposal.

1 Like

We support this proposal as it will enhance the risk management system.

However, we want to emphasize the importance of keeping GMX as decentralized as possible and minimizing any potential single points of failure.

To achieve this, we suggest:

  • Reducing the number of externally adjusted variables to minimize the risk of failure or attacks while also cutting costs.
  • Establishing a clear and robust backup plan in case Chaos Labs experiences a failure or comes under attack.
  • Limiting Chaos Labs’ role to parameter monitoring to ensure GMX does not become overly dependent on their services.
  • Maintaining transparent communication with the community regarding the oracle’s operations and performance.

In conclusion, we fully support this proposal and the significant improvements it brings to GMX. At the same time, we believe it’s essential to continue prioritizing decentralization and security to ensure the platform’s long-term success and resilience.

The Blueberry Team

1 Like

We support the proposal to implement Chaos Labs Risk Oracles. This solution provides an enhanced risk management framework that dynamically adjusts key factors such as open interest, price impact, and risk profiles, benefiting both traders and liquidity providers. Its goal is to prevent bad actors from exploiting price manipulation, maintain reliable price feeds, and continuously adapt based on market conditions.

Traditional oracles like Chainlink have previously faced challenges in resolving price discrepancies, as seen in the wstETH market disruption last month. This incident resulted in temporary market suspension and significant losses for liquidity providers due to discrepancies between Chainlink’s oracle and Uniswap V3 spot prices.

We encourage Chaos Labs to maintain transparency in how they run simulations, detail the reasons behind parameter adjustments, and regularly report on the factors influencing oracle changes.

Overall, this proposal strengthens the protocol’s resilience and introduces a more flexible, responsive approach to risk management that enhances the trading experience on GMX.

2 Likes