Compound Protocol Plan for Shanghai Upgrade

Gauntlet Update

We wanted to provide initial commentary and analysis for the Shanghai upgrade.

What will be happening with the Shanghai Upgrade?

In March-April (depending on when the Shanghai Upgrade lands), validators can start to initiate withdrawals of their staked ETH on the beacon chain following the Shanghai upgrade. Since the launch of ETH staking and the beacon chain back in December 2020, staked ETH has been locked, pushing the chain from POW to POS. This intrinsic illiquidity helped create the rise of liquid staking derivatives (LSD), such as stETH, cbETH, and rETH, which has allowed this locked ETH to be more widely used throughout DeFi while providing a more inclusive avenue for people to acquire ETH interest and yield. In this post, Gauntlet will be detailing how the Shanghai upgrade and the resulting ETH unlocking could 1. affect stETH and 2. impact Compound as a whole.

What will ETH withdrawal look like?

Withdrawal of ETH is a two-tiered process. Validators looking to withdraw their full balance must first go through the exit queue before entering the withdrawal queue.

The speed at which the exit queue processes validators looking to withdraw, on a per epoch basis, is defined by the churn limit, which is the floor of (num validators) / churn quotient. Currently, there are 500k distinct validators, increasing at roughly 4000 per week, so the churn limit approximates to 7. That means 7 validators can go through the exit queue every epoch (32 blocks, ~6.5 minutes). At the current growth rate, the churn limit is expected to reach 8 at the Shanghai upgrade.

The withdrawal queue processes a maximum of 16 withdrawals per block, which results in a maximum of around ~115k withdrawals a day. This suggests the upper bound on the withdrawal queue will be around 5 days, given that there are 500k distinct validators. Slashed validators suffer a further lock-in period of 8192 epochs, which is around 36 days.

Validators looking to partially withdraw (for instance, withdraw staking rewards) must pass through the withdrawal queue only, with the same limits as described in the previous paragraph.

For example, imagine that 100k validators are looking to withdraw their staked ETH. The time to withdraw all of them will be 100k / 7 * 6.5 / 1440 (exit queue) + 5 (withdrawal queue) ~ 70 days.

We can also perform a rough upper bound estimate as to how much staked ETH is withdrawn per day. Looking at the distribution of validator’s ETH positions, we find that roughly ~250 (0.05%) of them have between 64 - 68 ETH, the rest have ≤ 37 ETH. If we assume that each validator is looking to withdraw their full ETH balance, then we can estimate 60K worth of ETH getting unlocked and withdrawn per day (~ 1770 validators leaving x 36), with possibly up to 80-90K ETH leaving the first day (due to validators that initially staked 64 ETH instead of 32 leaving and freeing up their excess locked ETH).

Of course, this does not take into account ETH recycling, where bespoke staked ETH is recycled into a staking derivative.

Oracle effects

stETH oracle:

On Compound, price feeds are entirely dependent on Chainlink Aggregators. There is not visibility on the exact sources of their data, but the stETH/ETH price feed is a “Verified Feed,” which means that it is built using many data sources and an extensive network of nodes.

The Chainlink oracle model has not had any exploits since the fall of 2020 (the attacks after that were mostly price manipulation attacks, which can arise in low-liquidity assets).

Price volatility can also affect the performance of these oracles, but volatility is something that we will refer to separately as it is the main driver for liquidations.

Overall, our analysis suggests the risk of manipulation or malfunction of the stETH/ETH price oracle is low.

Volatility

At the moment of writing this post, the discount for stETH/ETH is less than 1%. If the perception of the market about Lido turns negative (e.g., due to the perceived inability of them to deliver the underlying ETH), this discount could increase. Historically, this discount has reached values below 20%, but there seems to be significant buy interest above the 6% stETH/ETH discount level for the past year, with only brief deviations below in the second half of June 2022 on some exchanges (around the 3AC insolvency event). As the date for the Shanghai upgrade is approaching, we have seen the discount gradually reducing.

Liquidity

Assuming a smooth upgrade, we expect liquidity for staking derivatives to improve with the enablement of withdrawals rather than decrease as the risk and friction of converting one to the other decreases. Bespoke staked ETH will likely be recycled into staking derivatives as users maintain their exposure to ETH yield and interest. Currently, staking derivatives account for 33% of total staked ETH, with Lido stETH a large majority at 65% and cbETH at 15%, with both linearly growing. We imagine that this growth rate accelerates following Shanghai as demand for staking derivatives increases.

Possible implications for V3

There is a low amount of stETH deposited in Compound III ETH comet. Currently, only 6.7k stETH. There is much more cbETH, at 20k cbETH deposited. This is currently at the supply cap for cbETH. However, as of now, there is no documentation on the redemption path for cbETH, so it is difficult to extrapolate any risk considerations.

Gauntlet’s Recommendation

After reviewing Lido’s stETH withdrawal mechanism, we would not recommend any changes specifically to handle the Shanghai upgrade.

The stETH withdrawal mechanism does not allow for locked ETH to be ‘stuck’ in Lido’s contracts, and there will be an avenue to directly redeem stETH to ETH, roughly on the same schedule as the withdrawal queue. Any discount to the 1-1 stETH/ETH redemption rate will result from negative rebasing as the result of Lido validators getting slashed. No Lido validators have been previously slashed.

Withdrawal requests will be fulfilled primarily from the Lido buffer, which gradually accumulates ETH from deposits and rewards. Within the first week following Shanghai, Lido anticipates roughly 200k ETH will become available after partial withdrawals from validators with excess balance (redeeming rewards). The exact use of this buffer will be decided by the Lido community, but it seems likely that the funds will be used for redemptions and to support the stETH/ETH exchange rate on DEXs.

In most cases, if there is enough ETH in the Lido buffer, users will be able to redeem their stETH to ETH on demand. If there is not enough ETH in the buffer, then Lido will trigger sufficient validators to exit and fill the buffer. The expected time for users to redeem will be roughly 3-4 days, as determined by how long it takes for the validators to leave the exit queue.

If massive slashings have occurred, then stETH redemption will be paused for 18 days while negative rebasing accrues over all stETH holders. However, once all associated slashings have been processed, and all associated validators have exited the chain, withdrawals resume. The stETH withdrawal mechanism will prevent ‘griefing’ attacks from clogging up the queue and preventing less sophisticated stakers from redeeming stETH to ETH. Therefore, there will be roughly 18-36 days required in bunker mode to redeem stETH to ETH.

Again, it is worth noting that Lido validators have never been slashed so far. Only 230 validators have ever been slashed (Lido has 150k validators), and therefore we have no reason to believe that slashing of Lido validators is likely to happen at a rate that would significantly increase the stETH/ETH discount.

As of now, it is unclear what the redemption path is for cbETH, so we may follow up with additional analysis for cbETH should any additional risks come to light.