Marko
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee
  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # SSV analysis - Setting / Adjusting DAO Controlled parameters analysis [TOC] ## High level problem statement * The highest priority with setting dao-controlled parameters is that Liquidations take place when cluster is at risk of running out of funds. This is crucial, since under current system design, the SSV network contract could run out of funds and thus DAO or other operators may end up not being paid for their services. * to ensure liquidations take place they must always be profitable. the important word here is *always*. Here is a acompanying sheet to this document including all the calculations, charts and formulas. [Setting / Adjusting for DAO Controlled parameters calc - Google Sheets](https://docs.google.com/spreadsheets/d/1Qy_BWbPtTjvFGcYANCW0Tvue6-7JR8cuklZqrADijaY/edit#gid=0) ### Variables affecting cost of liquidation - gas amount -> `gasAmount` - gas price -> `gasPrice` - SSV/ETH price -> `SSVprice` #### Asumptions - Gas cost to liquidate a cluster is constant and never larger than 130_000 wei, I have used 140_000 wei in my calculations to be on the safe side. If this assumption holds true, the only variables that will change in time and need to be analyzed are `gasPrice` and `SSVprice`. ### gasPrice The main question is what is the minimum fee in a high fee environment that a liquidator can expect to pay to comfortably liquidate the account? It is important to note that we are looking NOT looking for a max `gasPrice` but for a `gasPrice` which can safely be paid for a liquidation tx that ensures that it is included in some time period $p$. In a practical example where $p=7 days$ this question is posed as: What is the min `gasPrice` a liquidator must pay that ensures that his tx will get included within any consecutive 7 days? Max amount of the 10th lowest percentile should be enough in theory. For this analysis I have used `gasPrice` $median$ value. I have used it because it is more practical, data for this are readily available and it leaves a room for error as this number will be always strictly higher than 10th lowest percentile since this is in effect 50th percentile value. Also I have not sampled all 7 day averages within the time series but used predefined periods and calculated medians. This number maybe a little lower than if maximal median of any 7 day period were taken, but since this is already a much weaker assumption than we need I believe this simplification makes sense. #### Max value I have used value $147$. The rational behind this is that it is the highest value for the past three years and it seemed to be the ceiling that was reached repeatedly. I have discounted the the overall max value that is 210 reach in 2020 defi summer. The reasoning behind this decision is that the gas environment has changed both qualitatively and quantitatively since then. EIP1559 was introduced which has an effect of smoothing out gas price removing extremes and ETH is couple orders of magnitudes more expensive which creates a large pressure against rising gas price. Also unlike in 2020 there are various scalability solutions already live ranging from other L1s to rollups which alleviate the pressure on gas price on mainnet to large extent. I think it is also reasonable to expect to gas price not overcome prior maxima due to EIP4844, further scalibity of ethereum. For more charts and exploration see [this sheet](https://docs.google.com/spreadsheets/d/1Qy_BWbPtTjvFGcYANCW0Tvue6-7JR8cuklZqrADijaY/edit#gid=1283833458) #### Data source `ETHEREUM_MEDIAN_GASPRICE`: glassnode, calculated by tradingview ![](https://i.imgur.com/X3mc4EI.png) https://www.tradingview.com/chart/?symbol=GLASSNODE%3AETH_MEDIANTXGASPRICE ### SSVprice Since Liquidation Collateral - $LC$ s in SSV token and tx fees are paid in ETH we must account for possible price drops of SSV relative to ETH. The question is: What is the minimal SSV/ETH price in relative terms that we can expect? To define it mathematically, by how many % can SSV/ETH drop in any given time period? If the maximal drop were to be 60% the $maxSsvPriceDrop$ variable which I will be using would be equal to $0.4$. The max one week price drop since late 2021 was no more than 20% as explored in [this table](https://docs.google.com/spreadsheets/d/1Qy_BWbPtTjvFGcYANCW0Tvue6-7JR8cuklZqrADijaY/edit#gid=337951645). However, it is reasonable to expect much larger drops, as we have seen other small tokens drop dramatically in time of stress. It is reasonable to expect the possibility of larger SSV price movements in the future once network goes live. The largest one week price movement was 73% in late November 2021. Thus I have used 80% possible price drop for calculations and set the $maxSsvPriceDrop$ value to $0.2$ It is important to be ultra conservative when setting this variable as this has the most pronounced effect on overall required $LC$ and runway settings. Also it can be expected that all stakers and staking apps will adjust to these parameters. Thus even though updating these parameters by the DAO within 7 days is reasonable to expect, it may not be reasonable to expect all stakers to adjust to them in time and avoid large scale liquidations, SSV price and network instability. ### Calculation There are in effect two variables which DAO sets based on which $LC$ is calculated. `minimumLiquidationCollateral` - a static absolute amount of SSV below which any account can be liquidated `liquidationThreshold` - an operational runway or a time period, for which a cluster needs to have funds, defined as: ```solidity uint64 liquidationThreshold = minimumBlocksBeforeLiquidation * (burnRate + networkFee) * cluster.validatorCount; ``` All calculation can be checked in the[ main sheet here](https://docs.google.com/spreadsheets/d/1Qy_BWbPtTjvFGcYANCW0Tvue6-7JR8cuklZqrADijaY/edit#gid=0) ### Edgecases - Static Fees I will use $burnRate$ instead of `liquidationThreshold` in this section when necessary to make the reasoning less confusing as `minimumLiquidationCollateral` are `liquidationThreshold` are somewhat similar terms. I will also use $LC$ and `minimumLiquidationCollateral` interchangeably. The main assumption is that there are 3 well defined special cases for which we need to be prepared. All other cases fall within these categories and are solved for if all these special cases are. 1. Cluster burn rate is smaller than $LC$ and approaching zero. - $burnRate<minimumLiquidationCollateral$, $burnRate_{lim \to 0}$ 2. Cluster burn rate is equal to minimum $LC$. - $burnRate=minimumLiquidationCollateral$ 3. Cluster burn rate is larger than $LC$ and approaching infinity. - $burnRate>minimumLiquidationCollateral$, $burnRate_{lim \to 0}$ $burnRate_{lim \to \infty}$ Let's explore why this is true: Liquidation can take place when either one or the other of these conditions are true. 1. Cluster burn rate is approaching zero. - $burnRate_{lim \to 0}$ In this case `liquidationThreshold` approaches zero, thus liquidation is always triggered by the `minimumLiquidationCollateral` value. In this case we need to make sure that `minimumLiquidationCollateral` is sufficient to liquidate a cluster under any circumstances. The good thing in our design is that `gasAmount` for liquidating a cluster is always constant. Thus the problem is reduced to setting large enough `minimumLiquidationCollateral` to account for max $gasPrice$ and $maxSsvPriceDrop$ specified above. 2. Cluster burn rate is equal to minimum $LC$. - $burnRate=minimumLiquidationCollateral$ This can be though of as the worst-possible-case or situation with the highest possible $burnRate$ when liquidation is still triggered by $LC$ or converesly the lowest possible $burnRate$ to trigger it. If $burnRate$ were to be any higher it would start approaching scenario 3. Thus we can say this is the worst possible case for both $burnRate$ and `minimumLiquidationCollateral`. Thus if the cluster is profitable to liquidate under it, it will be profitable to liquidate under all other cases. Also if the cluster is Liquidatable with triggering $burnRate$ condition and the $burnRate$ is set high enough to liquidate any cluster that triggers this condition it should hold true that all other cases are accounted for and fall under the scenario 3. The worst possible scenario: There is a sudden gas price increase and $maxSsvPriceDrop$ at the same time. In this case a cluster would be right at the border of its $minimumLiquidationCollateral$ when there is suddenly large gas spike and SSV price drop. I use in the calculation 7 day median values, thus the edge case is that cluster can be unprofitable to liquidate for up to 7 days if my assumptions hold. Thus the $minimumLiquidationCollateral$ must be set to include additional 7 day $burnRate$. From this then follows, that if there is a $minimumLiquidationCollateral$ which accounts for the $burnRate$ in this special case, thus for this additional 7 day period, it must account also for all other cases where $minimumLiquidationCollateral>burnRate$ since under all of these cases the $burnRate$ is strictly lower than in this edge case. 3. Cluster burn rate is larger than $LC$ and approaching infinity. - $burnRate>minimumLiquidationCollateral$, $burnRate_{lim \to \infty}$ In this case we disregard $minimumLiquidationCollateral$ as this is strictly lower than $burnRate$ in this case thus liquidations are always triggered by burn rate alone. Thus the problem is reduced to setting large enough $burnRate$ to account for max $gasPrice$ increase and $maxSsvPriceDrop$ specified above. If we divide 7day period needed for liquidations by SSV price drop we get 5 week runway. We need to add 1 week on top, to adjust for the possible max liquidation time of 7 days. ### Edgecases - Dynamic Fees #### Time period I am using 7 days time period for fee changes. The number is somewhat arbitrary, but there are few good reasons why I have chosen this as default: - Possibly the shortest time period within which it can be reasonably expected DAO to update these parameters. - 1 week period is the shortest time series with natural seasonality if we disregard 1 day. Seasonality is applicable for both gas and SSV price variables that we care about. Thus any sudden price drop is dampened by this seasonality. - Natural time period for humans to reason about. This is useful for stakers when calculating / adjusting their SSV collateral. **Assumption** **Network fee** Fees in ssv.network can be changed dynamically by operators or by DAO itself. The assumption here is that DAO would not increase its fees in times of high volatility or if there is a high volatility after network fee change, the DAO is ready to decrease the fee to the previous value. To make the system predictable and be able to have clear guidelines to setting DAO controlled variables it makes sense for it to self-limit the increases of network fee. Guideline for setting network fee: For the purposes of these calculations I have assumed that network fee would change once **every 7 days** at most and every change would be **less/equal to 10%** of previous fee. This can be changed of course but should be accounted for in the calculation as well. **Operator fee** I would suggest the parameters that control operator fee to be set accordingly: ```solidity uint64 updateOperatorFeeIncreaseLimit = 0.1 uint64 updateDeclareOperatorFeePeriod = 7 days ``` In human readable terms the fee change would take at least **7 days** to take effect and every change would be **less/equal to 10%** of previous fee. This can be changed of course but should be accounted for in the calculation as well. #### Fee change dynamics Operators can change fees only up to a limit set in % by the DAO. **The worst case** The worst case with regards to liquidations is when both increased Network fee and new Operator fees become active exactly when there is sudden large gas spike and SSV price drop. I use in calculation 7 day median values, thus the edge case is that a cluster can be unprofitable to liquidate for up to 7 days if my assumptions hold. In this edge case dynamic fees make the burn rate higher by the max % rate they could have been raised by. What this effectively means is that both `minimumLiquidationCollateral` and $burnRate$ must account for this worst case scenario. For the purposes of these calculations I have assumed that both operator fee and network fee would change once every 7 days at most and every change would be less/equal to 10% of previous fee. ### Recommendations #### Notifications Work with teams building notification services, to notify stakers of the operator fee change and recalculate cluster operational runway right after the new fee was declared. If notification services were to update the runaway only after the new fee takes effect clusters could be liquidated before stakers can replenish their collateral. #### Network fee For larger predictability and transparency I would suggest similar schema to changing network fee that is currently used for changing operator fee. resons: - removes some governance attacks - if an attacker took control of setting dao controlled parameters they could cause mass liquidations in the network. - easier cluster balance maintenance - cluster account monitoring bots can adjust to this new burn rate before it takes place. Also the mechanism is the same as with operator fee change, thus there is no additional code or logic required. If this cannot be implemented in the mainnet v1 version, DAO should have a clear protocol of communicating this fee change, so that stakers can adjust in time. Ideally a new event `declareNetworkFeeChange` would be added to the ssv network contract, so that stakers' bots can automatically listen to fee change declaration. Adding an event does neither change smart contract state or logic thus should be safe to implement even without additional audit. --------------------------------

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully