There's been a lot of discussion on Hyperliquid's margin design. I’ll address some flaws in the common arguments and explain Hyperliquid's first-principles based approach to improving the system. To my knowledge, this is the first such design in margining systems.
Perhaps other teams will find it useful for their own logic. Like good theories in physics, the best margining design is simple, canonical, explainable, and works in a wide variety of pathological scenarios.
1. The conclusion of some people has been that there needs to be a centralized force that detects and limits malicious behavior. This completely violates the purpose of defi and everything Hyperliquid stands for. This forces users back to a web2 world where the platform has the final say. True decentralized finance is worth it, even if it is 10x harder to build. Just a few years ago, no one believed DEX/CEX volumes would reach its ratio today. Hyperliquid is leading the charge here and has no intention to stop.
2. Some assume that copying approaches from CEXs will work in defi. The most common suggestion I've seen is per-address margin requirement fraction scaling with position size, as CEXs only offer higher leverage for smaller positions. However, this doesn't work to prevent manipulation attempts on a DEX because a sophisticated attacker can easily open positions on many accounts. Nonetheless, this will help somewhat reduce the impact of "organic whale" positions and is on the list of features to implement.
3. Another suggestion is to implement some features that severely limit usability of the platform in exchange for safety. For example, if unrealized pnl is not withdrawable, many attacks are not possible. Indeed, Hyperliquid pioneered isolated-only perps for illiquid assets which feature this safety mechanism. However, this change would have a crippling effect on funding arbitrage strategies, where unrealized pnl from Hyperliquid needs to be withdrawn to offset the loss on other venues. Real user needs are a top priority in system design.
4. There were also suggestions to innovate on design by having margin settings based on global parameters. However, liquidation prices need to be deterministic functions of price and position size. If global parameters such as open interest were added as inputs to margin requirements, users would lose confidence in the ability to use leverage at all.
So what's the answer? We all want defi, but a permissionless system must be robust to manipulation at all scales.
The answer lies in understanding the true problem with large positions: they are difficult to mark. The first order approximation of mark price times size breaks down when market impact approaches maintenance margin. It's impossible to accurately simulate market impact because book liquidity is a path-dependent function of time and actions of other participants. Without simulating market impact, it can be possible for liquidation to be a low-slippage way to exit at a price that is unfavorable to the liquidator.
Therefore, Hyperliquid's margining system update has the following desirable property: any liquidated position is either a loss relative to entry price, or at least a (20% - 2 * maintenance_margin_ratio / 3) = 18.3% loss relative to the last margin transfer out (using an example of 20x leverage). An organic 20x user who makes 100% return on equity after a 5% move will still be able to withdraw the majority of the pnl without closing the position. However, by introducing separate margin requirements between transfers and opening new positions, profitable manipulation attempts require moving the mark price almost 20%. This kind of attack is infeasible from a capital perspective.
Finally, I'd like to point out that the mark price problem also solves itself as market makers continue scaling up on Hyperliquid. It's quite possible that the trader yesterday could have lost money in aggregate. $1.8M pnl longing on Hyperliquid could have been more than offset when pushing the price on other venues, or using other accounts on Hyperliquid. HLP took over an undesirable position, losing $4M. The only market participants who definitely made money in aggregate are the market makers. With millions of dollars of pnl to be made in the span of minutes, it's becoming clear to sophisticated participants that Hyperliquid is one of the venues with the best flow. As liquidity improves, it will become more and more expensive to dislodge prices. So while the margining system improvements will go a long way, the allure of easy pnl attracting market makers will provide an independent source of robustness over time.
The future is decentralized.
Hyperliquid.