Probabilistic modeling of
vault depletion on bridges

0xbrainjar
Composable Finance
Published in
6 min readMar 1, 2022

--

Juan Pablo(1), Jesper Kristensen(1), and 0xbrainjar(2) — (1): Advanced Blockchain Research, (2): Composable Finance

As a recap, Mosaic Phase 2 is a transfer availability layer built with liquidity forecasting and rebalancing to ensure transfers go through. Previously, we discussed the statistical/machine learning basis for Mosaic’s liquidity forecasting model (the four-part series starting here). This article is the first part of a more data-based examination of rebalancing, looking at the initial statistical evidence on why rebalancing is needed to avoid vault depletion on bridges.

Liquidity pools on different networks enable cross-chain transfers in the “lock-and-release” bridge design; for example, when users bridge assets from Ethereum to Polygon, their assets are locked in the bridge’s vault on Ethereum, the lock gets relayed to Polygon. Users receive assets from the bridge’s vault on Polygon. The amount of assets in these vaults is thus crucial to the speed, fees, and even feasibility of cross-chain transfers. If the vault on a given chain is depleted, users’ funds won’t move to other chains, and the bridge runs the risk of getting depleted. The users’ funds are, of course, still safe — no money is or will be lost — however, the usage of the bridge in one of the two directions (Ethereum to Polygon and vice versa) will not be possible. Let us call this direction the “depleted” direction. Not until some users move funds in the non-depleted direction will the overall bridge function as expected.

Notably, “vault depletion” again does not imply lost funds; it simply means that the bridge is temporarily very imbalanced. By “very imbalanced,” we mean that the split of funds between the two sides is 90/10 or worse. We can then say that a “depletion” of one side happens when the balance is 100/0. To be sure, the bridge will never have a perfect balance of funds at 50/50 but ideally will hover around this ratio to not more than 60/40 most of the time.

This is the first of two articles exploring how specifically Mosaic from Composable Finance minimizes the risk of vault imbalance. This article examines the likelihood of vault depletion in two forms of liquidity movements in probabilistic models built from historical data.

Model set-up

We expanded the in-house liquidity simulation environment (LSE) to model vault imbalances by first setting up probabilistic models and then populating models with real historical transaction data.

Probabilistic modeling

For the probabilistic modelling, we represent the movement of liquidity in vaults as a random process, defined by two variables: the amount of time between transactions and the amount of money being transferred, which could be positive (money going into the vault) or negative (money going out of the vault). Given the liquidity at the start of the simulation and the movement of liquidity, we can then model remaining liquidity in a vault at any point in time.

Roughly speaking, there are two ways to model random quantities: the first is probabilistic, where we fit a distribution based on data and sample from that distribution; the second is through resampling, where we sample with replacement from a list of data. Applying these two ways of modeling to the two variables, we have four possible setups for the probabilistic model:

  1. Probabilistic in time and amount (P-P)
  2. Resampled in time and amount (R-R)
  3. Probabilistic in time, resampled in amount (P-R)
  4. Resampled in time, probabilistic in amount (R-R)

Data sources

We used data for outgoing transfers from Polygon to Ethereum, Arbitrum, and xDai that happened on the Hop protocol between June 2021 and February 2022, including around 340k transactions. The dataset included the time of each transaction, USD amount, type of token (USDC, ETH, etc.), and destination network.

With these data and the probabilistic models, we created a Monte Carlo simulation of liquidity movements to determine the risks of bridge imbalances in different scenarios. We consider an extreme case and a more likely scenario.

Case studies

Let’s start with the most extreme scenario. If there are only outgoing transfers, for a vault of $1M it takes between 1 and 4 days to get depleted with the majority of depletion events happening on day 3.

More realistically, cross-chain transfers go both ways. We, therefore, modeled a scenario where incoming transactions are just as likely as outgoing ones. In this two-way scenario, we are interested in two figures:

  1. The expected drawdown — how low does the liquidity in a vault drop to;
  2. Probability of depletion — i.e., a drawdown of 100%
  3. Time to depletion — how long it takes for a vault to be depleted, e.g. in the extreme out-only scenario, it takes 1–4 days.

Based on a starting liquidity of $4M for a vault, the results are as follows:

  1. Expected drawdown

The average drawdown is $1.6M across the four models, meaning that for a $4M vault, there is a risk of liquidity dropping in one side of the bridge (aka in one vault) by 40%. Based on the high end of the probability table to be conservative, it is very likely that a vault with at least $2.5M won’t be at risk of complete depletion. We will publish more on the capital efficiency side in the second article.

Expected drawdown under four probabilistic models, in ‘000 USD.

2. Probability of depletion

Across the four probabilistic models, the average likelihood of depletion for a $4M vault in an in-and-out scenario is 18%. This is somewhat concerning, especially given the assumption that transfers in are just likely as transfers out. This highlights the need for an intelligent rebalancing between vaults by the bridge operators, which we will further discuss in the next article.

Estimated probability of vault depletion under four probabilistic models.

3. Mean time to depletion

On average, it takes around 163 days for a vault to be depleted, so bridges require rebalancing at least twice a year for the data used here. We expect this to be much more frequent, but it provides an initial idea. For sure, more rebalancing is needed for lower slippage. This also does not assume large “whale” moves, but the assumption is that our active liquidity system, to be discussed more in the upcoming article, will step in and handle those.

Estimated time to depletion.

Summary

Given the common lock-and-release mechanism of cross-chain bridging, liquidity on the vaults is paramount to ensure that transfers can go through and vaults are not highly imbalanced or even depleted. We expanded our simulation environment using several probabilistic models and historical data from the Hop protocol. We simulated both the extreme case (money only transferring out of one side of the bridge to the other) and the more realistic case (money flowing in both directions across the bridge). In both cases, the risk of depletion cannot be overlooked — even for a $4M vault and the equal likelihood of money going in and out; there is around a one in five chance that the vault can be depleted. This illustrates the necessity of an intelligent rebalancing of assets between vaults for bridge operators.

--

--

0xbrainjar
Composable Finance

Composable Finance Founder & CEO. I write about R&D at Composable Finance. Physicist by training