LST/LSD/LRT : From Zero to Hero
1. Liquid Staking Definition
Liquid staking allows users to stake tokens and simultaneously use them in the DeFi ecosystem. This is made possible by wrapping the staked tokens and providing users with a wrapped token that is a claim on the underlying collateral. The wrapped tokens can be transferred and generate yield.
source : https://defillama.com/lsd
In comparison to traditional staking which often locks assets, rendering them illiquid and unusable in other DeFi applications until unstaked. Liquid staking allows staked assets to remain liquid. Users receive derivative tokens representing their staked assets, which can be used across the DeFi ecosystem for lending, borrowing, or trading, enhancing capital efficiency without sacrificing participation in network security
2. LST/LSD/LRT Differences
Liquid Staking Tokens (LSTs) usually represents tokens from another chain or another layer (WETH,WBTC) that can be traded, used as collateral in a POS chain
Liquid Staking Derivatives (LSD) might refer to financial instruments or derivatives products built on top of Liquid Staking solutions. By using derivatives, investors can gain exposure to the staking benefits without directly participating in staking themselves. (stETH,rETH,BETH etc). They represent the locked value + rewards.
Liquid Restaking Tokens (LRTs) are tokens that arise from the EigenLayer restaking primitive, that encompass an ETH or ETH LST and the corresponding staking and restaking rewards.
** in reality LST and LSD can be referred to the same concept of a token representing it’s locked value + rewards
3. Liquid Re-Staking and EigenLayer
Eigenlayer has taken the market by storm in the past few weeks, possibly fuelled by the liquid staking derivatives (LSDs) narrative that made people go high. Moreover it allows blockchains and protocols to leverage on Ethereum’s strong security through ETH re-staking.
Eigenlayer is an infrastructure that allows for staked ETH(LSD tokens) to be re-staked to other middleware/blockchain/protocol within the same core infrastructure. This allows the leveraging of Ethereum’s existing strong security and trust layer.
What are the problems EigenLayer is trying to solve?
To have a better understanding as to what the current problem is, we will be using the following analogy (source) :
Ethereum: Shopping mall
dApps and Middleware: Shops
Consensus Mechanism: Lifts
Trust Network: Concrete floor
Imagine Ethereum as a shopping mall. Makes sense because it is a smart contract platform that allows the building of decentralized applications (dApps). In this shopping mall, we need shops. These shops refer to the middleware that Ethereum uses, such as oracles and message exchange mechanisms. In addition, there are also dApps that are being built on the layer.
But instead of having a central lift in the shopping mall that everybody can use to access the shops, the shops have to build their own individual lifts for users to get to them. In addition, instead of being able to use Ethereum’s building contractor that has built sturdy floors and walls, the shops have to find their own contractors to build the architecture around them.
With this mechanism there is a lot of problems :
Difficulty and cost inefficiency in establishing security
Misalignment of Protocol Interest
Lack of trust in other protocols (or fragmented trust)
How EigenLayer is solving them ?
Eigenlayer is a middleware built on Ethereum, and is commoditizing Ethereum’s trust network, allowing new chains or protocols to leverage on this highly secure decentralized trust.
Stakers that have staked their $ETH to secure the Ethereum network can take their staked $ETH and re-stake it to other chains or protocols.
As mentioned by the founder, Eigenlayer was built on Ethereum as it is the largest programmable decentralized trust network. Eigenlayer works to unbundle this trust network, allowing components of it to be delegated to other purposes.
Eigenlayer describes itself as an infrastructure layer, allowing protocols to built on it in a totally free way regarding all it offers
How does it work ?
In EigenLayer, there are three main agents: Stakers, Operators, and AVS developers :
A. Stakers
Stakers have 3 possibilites to enter EigenLayer :
You want to stake your eths (32 at least) : Native Restaking
For this step you need to create an EigenPod using
EigenPodManager.sol
and then set your ethereum validator’swithdrawCredential
to it. You must operate an Ethereum Validator node in order to participate in Native Restaking.You want to stake Re-staking LP Token (not functional for now)
You want to stake your staked eths (LSTs) : Liquid Re-Staking :
A method where Liquid Staking Token (LST) holders restake by transferring their tokens into the EigenLayer smart contracts
B. Operators
On the other side, peoples are running node operators who enable ETH stakers to delegate their staked asset (whether in the form of native ETH or LSTs).
A node operator then opt-in to provide a range of services to AVSs, enhancing the overall security and functionality of their networks. Keep in mind that you don’t need a specific amount of restaked tokens to become an operator.
Most Operators will opt-in to receive token delegations sourced from other Restakers within the network, or Operators can choose to self-delegate by allocating their own restaked token balance. Operators then choose to support various services operating on EigenLayer (AVSs)
⇒ To become an operator you need to call registerAsOperator
on DelegationManager.sol
The operator is relying on the AVS developer to accurately code the client software and an on-chain slashing condition.
C. Actively Validated Services (AVSs)
An AVS is basically an infrastructure service or a collection of services or middleware software that is built on top of EigenLayer.
They utilize EigenLayer protocol to integrate with Ethereum's security mechanisms, enabling enhanced validation for blockchain applications without their own consensus mechanisms.
Examples of AVSs are fast finality layers, data availability layers (EigenDA), virtual machines, keeper networks, oracle networks, bridges(Omni), threshold cryptography schemes, AI inference/training systems, and trusted execution environment committees
⇒ To register as an AVS you need to set the task you want to fulfil ( the one for which an operator will choose to delegate it’s shares to your AVS), frequency at which you want to fulfil it, define slashing conditions (conditions in which an operator should be considered in violation of AVs validation semantics) and set it up with EigenLayer team through this form
Conclusion :
A. Pros of Eigenlayer
Increased security for protocols
Improved capital efficiency
value alignment
High degree of flexibility
B. Cons of EigenLayer :
Single point of failure
Systemic risk pertaining to security
Abuse of control by protocols
Slashing risk + withdrawal delay
📔 LSD/RLT Audit Cheat Sheet 📔
When auditing an LSD/LRT protocol , look for these points and try to explain them to gain an overview of it :
Types of Fees based and their calculations.
Rewards mechanism for staked tokens
Powers of the owner
Will the contract hold ETH?
What tokens the contract will hold? How these tokens are handled ?
How many decimals for computing the TVL ?
Vulnerable Spots to look for
[ ] Reward Withdraw Mechanism :
[ ] Check if any user is able to withdraw more than its reward + staked amount
[ ] Check for Overflow/underflow in the amount calculation
[ ] Check if certain parameters can have a negative impact on rewards during calculation
[ ] Does instant withdrawals are allowed ⇒ 🔴 (protocols should use queued withdrawals)
[ ] Withdrawal queue not taking into account available tokens
[ ] Does a value of an LSD is cached during deposit/withdraw ?
[ ] stEth,rETH,cbETH,srfxETH integration and reference article
[ ] Fee Logic :
[ ] no single user can bypass fees
[ ] only admin alter fee settings
[ ] threshold for maximum fees
[ ] LP Token’s Minting/Burning Mechanism
[ ] burn should reverse state changes made by a mint function
[ ] user receives appropriate amount of tokens during first stake
[ ] Rounding Errors are not possible
[ ] division after multiplication
[ ] Staking Duration is well calculated
[ ] Users cannot redeem before the staking duration ended
[ ] Duration cannot be exploited to get more rewards
[ ] Price Manipulations Checks
[ ] External Calls and Token Handling is OK
[ ] EigenLayer specific :
[ ] Reward accounting from an external protocol incorrectly done
[ ] If price oracle is computed there should be a slippage check
[ ] Accounting of Eth Balance within EigenPods (mostly regarding partial and full exits)
[ ]
thirdPartyTransfersForbidden
enabled on EigenLayer (DelegationManage.sol
) : Example on Sherlock Rio Contest[ ] Validator ETH stolen due to a lack of verification withdrawal credentials
[ ] Check update of EigenLayer and it’s integration with current protocol
[ ] Others
[ ] Re-entrancy
[ ] Re-entrancy with other protocol integration [1 rocketPool ,2 Curve]
[ ] Admin Role DOS
[ ] Chainlink FallBack not implemented leading to discrepancies of the price
[ ] Malicious or compromised admin of certain LSTs could manipulate the price
[ ] Incorrect pricing of Tellor due to user using back old values
[ ] Flash action allowing an attacker to steal rewards [1,2
[ ] LP or LSD Tokens price computed via spot reserves/balances ? balanceOf() used
[ ] Compound Auditing tips : https://blog.pessimistic.io/compound-v2-defi-integration-specifications-b13f74781b4f
[ ] Curve V1 Integration Tips : https://blog.pessimistic.io/curvev1-integration-tips-a49af7b4b46a
[ ] Convex integration tips : https://blog.pessimistic.io/convex-finance-defi-integration-tips-1bacfe73d3ce
[ ] AaveV3 integration tips : https://blog.pessimistic.io/aave-v3-defi-integration-specifications-9e9ef9405be0
[ ] Curve External Pool : https://github.com/sherlock-audit/2023-06-tokemak-judging/issues/862
[ ] AAVE Checklist : https://gist.github.com/aviggiano/4c21d79fff3437f3799da1e44e425e06
[ ] Balancer V1 Integration Tips ⇒ Bad Example [1,2,3]
Source :
https://defihacklabs.substack.com/p/solidity-security-lesson-3-guidelines
https://medium.com/@InceptionLRT/liquid-staking-tokens-and-liquid-restaking-tokens-what-are-the-differences-61669f4f4de2#:~:text=In the LRT case%2C the,are safer products than LRTs.
https://www.datawallet.com/crypto/what-are-actively-validated-services-avs
https://github.com/Layr-Labs/eigenlayer-contracts/blob/v0.2.1-goerli-m2/docs
https://github.com/Decurity/audit-checklists/blob/master/lsd.md