Maker

Maker Simulation Series: Introduction (Pt. 0)

Cover Image for Maker Simulation Series: Introduction (Pt. 0)

The history of MakerDAO goes almost as far back as the history of smart contracts and Ethereum. Founded in 2014, MakerDAO drove innovation with the launch of the Maker Protocol and has continued to grow in decentralization and functionality.

With growth comes growing pains. New features and protocol upgrades can be positive for an entire community but pose risks to the security of a protocol. To ensure proper growth, MakerDAO launched the Sustainable Ecosystem Scaling (SES) incubator to onboard new core protocol contributors and welcomed Chaos Labs to the program in Q4 2021.

As a member of the SES, Chaos Labs was tasked with exploring improvements to the MakerDAO dev ecosystem. To do so, Chaos Labs developed a simulation-based unified testing infrastructure. Our infrastructure aims to create an environment for MakerDAO to better:

  • Simulate, test and implement major technical upgrades
  • Communicate risks to both core units and the broader DAO community

Our involvement with MakerDAO began with interviewing critical stakeholders in MakerDAO to understand the ecosystem's needs best. We opted to start a proof of concept with the SAS (Sidestream Auction Services) team. Sidestream works on auction services for Maker. These auctions ensure that bad debt is sold promptly and helps Maker defend the DAI peg. SAS needs to simulate various liquidation scenarios that may not have happened yet or are very hard to reproduce. By identifying the pain points in a fast-growing protocol and creating solutions based on developer feedback, we've expanded our testing infrastructure into a composable tool for developing a wide range of protocol use cases.

Our MakerDAO Simulation Series will highlight how we have used simulations to benefit the Maker community. This includes our joint work with SAS and how you can use the Chaos Labs platform to enhance the testing of crucial protocol flows and infrastructure while granularly orchestrating on-chain state. This series presents four different protocol simulations:

  1. Black Thursday & Flip Auctions
  2. Flapper Surplus DAI Auctions
  3. Peg Stability Module
  4. Auction Price Curve & Keeper Gas Strategies

1) Black Thursday & Flip Auctions

In Maker, collateral Auctions are used to sell assets from vaults that have become undercollateralized to preserve the system's overall collateralization. We configured the specific testing environment through the Chaos Labs platform by manipulating oracle return values, adjusting wallet balances, and other simulated adjustments. Specifically, this simulation configures MakerDAO Price Oracle to mimic a Black Thursday price trajectory.

To simulate the pain of Black Thursday (ETH -43% in 14hrs), the simulation drops the price feed provided by the MakerDAO oracles by 1.2% every 100 blocks over 2500 blocks. Since Chaos Labs simulations run on a mainnet fork, the results provided actionable information on the performance of Flip auctions, mirroring one of the worst days in crypto history.

2) Flapper Surplus DAI Auctions

MakerDAO primarily earns DAI through accumulated stability fees. When this balance grows too large, the protocol will initiate Surplus Auctions to sell DAI for MKR and burn the received MKR.

In our simulation environment, we create a scenario in which the conditions of Surplus auctions are satisfied. It's important to note that Surplus Auctions have never happened on mainnet. Despite this, SAS can now test its application performance against this state by connecting to the Chaos cloud and private chain.

3) Peg Stability Module

MakerDAO's Peg Stability Module (PSM) allows users to swap collateral for DAI at a fixed rate rather than opening a vault and minting DAI against collateral.

Our simulation created three user groups: DAI buyers, arbitrageurs, and vault users, to mimic different actors in the market. We then saw how 1,000 iterations of interactions between these groups affected the protocol's collateral, liquidity, and revenue.

This simulation is timely as Maker recently reduced swap fees to zero. This has created an immediate arbitrage opportunity when DAI floats above the peg. Actors can execute zero-fee USDC -> DAI swaps and realize profits on decentralized exchanges like Curve. Additionally, zero fees incentivize swapping stables for DAI instead of collateralization and mint flow. In the absence of new collateral and the presence of rational agents, the simulation shows an increased dependency on USDC.

With a vital role in maintaining one of the core elements of the MakerDAO ecosystem, it is imperative to understand the ability of the PSM to withstand arbitrageurs and volatile markets. We test various swap fees and surface valuable analytics and insights.

4) Auction Price Curve & Keeper Gas Strategies

In the final simulation of our MakerDAO Simulation Series, we created a simulation to understand how Keepers with competing gas strategies impact the Auction Price Curve for liquidations.

When MakerDAO vaults are insufficiently collateralized, the vault becomes eligible for liquidation. This event triggers a Dutch auction to raise DAI to cover the outstanding debt. These auctions can be highly profitable for liquidation bots and other external users, particularly in times of high volatility. This simulation looked to find the best strategy for gas performance amid competition in liquidation auctions. Specifically, we analyzed which competing keeper's gas strategy was more effective: fixed gas cost for each bid or an adaptive gas cost strategy.

What's Next?

Over the coming days, we will publish a technical blog post and video for all four simulations listed above. Look out for these!

About Chaos Labs

Chaos Labs is a software company building a simulation platform to allow teams to efficiently test protocols and understand how they will react to adversarial market environments. The backbone of our technology is a cloud-based, agent- and scenario-based simulation platform that allows users to orchestrate blockchain state, test new features, and optimize risk parameter selection.

Our technology allows users to:

  • Orchestrate protocol/blockchain state
  • Generate wallets with behavioral attributes
  • Test protocol performance in chaotic market conditions
  • Optimize risk parameters

Our mission is to secure and optimize protocols through verifiable agent- and scenario-based simulations.

The Chaos Labs simulation platform is built to emulate a production environment. Each simulation runs on a mainnet fork with the chain's current state so that your simulations include up-to-date account balances and the latest contracts and code deployed across DeFi. You cannot look at your protocol in a silo when you're testing adversarial environments. You must ensure you understand how external factors such as cascading liquidations, oracle failures, variable gas fees, liquidity crises, and more will impact your protocol in various situations.