[ARC] Aave Protocol Plan for Shanghai Upgrade

Simple Summary

With the Shanghai upgrade coming, Gauntlet would like to kickstart the discussion around the potential actions the Aave community can take. At a high level, the Shanghai upgrade would enable staked Ether withdrawals and thus can have risk (and growth) implications for Aave markets. We are taking steps to proactively conduct analysis but wanted to welcome community feedback in the meantime. We also would welcome thoughts from the protocol’s contributors, including the technical contributors, as Gauntlet’s analysis will focus on the market risk rather than the smart contract risks.

Due to the potential complexity of the topic, we hope that the community will find this thread helpful in the coming weeks for efficiently organizing discussion.

Next Steps

Welcome thoughts from the community.


Hi @Pauljlei,

thanks for kicking off this topic.
If i understood it correct Shanghai will allow user/entities/protocols that are currently staking their ether to withdraw it.
What i imagine could happen is, that this will lead to some kind of “narrative/rush” to LSD, thus people are probably going to do two things:

  1. Look which protocol gives them the best yield/easiest access to stake their ETH in a LSD protocol
    Then look for opportunities where those LSD can be staked/used again to gain even more yield.
    This is where Aave could gain massive TVL for sETH and maybe other LSD assets.
    APY for lending and borrowing both could heavily swing, but probably go up.

  2. People are going to borrow ETH from Aave, then lock it in a LSD protocol and use the LSD again as collateral. And do the same steps again in a loop, maybe with other tools like Defisaver.
    This could potentially lead to heavy liquidations if the assets aren’t backed with enough collateral (additional collateral) if we see some kind of long squeeze.

Am i missing something else?


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 Aave as a whole. Note that there is still information required to make a final decision on any actions that Aave should take (namely the stETH redemption process), so this post will serve as a background on the Shanghai upgrade, as well as an initial analysis.

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.

As an 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 Aave, price feeds are completely 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.


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 delivering 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.

To get an idea of what discount levels could be significant, we present below a graph of the top 30 borrowers that are providing stETH as their collateral on mainnet Aave V2. Assuming that the borrowers will take no action to prevent liquidations and a relatively stable price for ETH, we can see the first liquidation occurs at a ~4% stETH price drop for ~$19million worth of stETH. The first significant liquidation happens at a ~15% price drop with ~$126million worth of stETH at risk (at that price). We consider a drop of this magnitude to be highly unlikely, pending communication from Lido regarding their unstaking implementation. Potentially the more likely scenario is that the discount in stETH/ETH will remain below 1%.

Aave V2 - Top 30 Borrowers (providing stETH as collateral): Borrow Aggregate Positions & Borrow Usages on January 24, 2023.


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

As we have discussed previously, we expect demand for stETH and other staking derivatives to grow since there is a clear path to redemption. With the launch of Aave v3 Ethereum this week - specifically with wstETH as an e-mode enabled asset, Gauntlet would like to highlight that there may be potentially increasing WETH utilization rates on v3 leading up to and post-Shanghai. E-mode enables wstETH to borrow WETH at 93% LT, compared to 83% LT with stETH on Aave v2, which greatly increases the profitability of deeper recursive WETH borrowing (i.e., supply wstETH, borrow WETH, convert to wstETH, and repeat).

Assuming WETH supply and borrows on v2 in its current state migrate over to v3 (thus keeping the same WETH utilization at 45%) and a stETH staking yield of 5%, this strategy yields ~11.5% APR on the initial deposit with an 83% LT, at 7 recursions (upper bounded ~ 14% for max recursions). On the other hand, this strategy at 93% LT yields ~15% at 7 recursions, and ~20% at 14 recursions (upper bounded at roughly 27%). The profitability of larger initial positions may be smaller due to borrow usage hitting the kink at 80%.

At 79% utilization, the difference in profitability for the strategies is less significant, conditioned on utilization not exceeding 80%. Recursive yield borrowing is profitable until the optimal utilization rate for WETH, which is set at 80% on Aave v3 Ethereum, upon which the yield turns highly negative.

We thus expect the WETH utilization rate to naturally grow from its current 45% to account for this recursive behavior. We don’t expect this to be likely to cause any issues but do want to call out this possible scenario.

Next steps

In order to finalize our analysis, we need insight into the following:

  • How will stETH redemptions work? Will there be idiosyncratic behavior for stETH redemptions relative to overall staked ETH?
    • This is essential to how we think about potential impacts on the quality of stETH collateral.
    • stETH is one of the largest collateral options on Aave v2, with $1.4B deposited and supporting $800M in borrows. On Aave v3 Ethereum, there are plans to launch with wstETH as one of the initial assets listed. If the redemption mechanism for stETH is not analogous to the overall mechanism for staked ETH withdrawal, then this could cause significant impact for users that supply stETH as collateral.
    • As always, unforeseen effects of the Shanghai upgrade, loss of faith in Lido stETH, or other tail events can significantly impact the quality of stETH collateral as well.

As of now, with the information we currently have on stETH redemptions, we do not recommend any changes to specifically handle the Shanghai upgrade. When we learn more about the specifics of stETH redemption plan, we will revisit this post if we observe additional risks. We welcome feedback from the community.


Gauntlet Additional Update

After reviewing Lido’s stETH withdrawal mechanism, we continue not to 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 within one day. 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 the data does not suggest 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 paths are for cbETH and rETH.