BlockScience Team
      • 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
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners 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
    • 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 Help
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
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners 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
    # Reviewing Termination Fee ###### tags: `filecoin-pl` `Protocol Review` :::info Up to date by December 2022 ::: *Date: 15 December 2022* *Speaker: Danilo Lessa Bernardineli (BlockScience)* *[Recording Link](https://drive.google.com/file/d/1cZZ1mTylCJvb_saViw6SuGHEdb93hbYr/view?usp=share_link)* ## What is **According to the [Filecoin Spec](https://spec.filecoin.io/)**, the Sector Termination Fee is an dynamical fee that can be paid - pro-actively by the miner - due to fault termination, which happens when the sector is faulty for more than `42 consecutive days` The **proposed** initial form as per section 4.7.1 of the is as it follows: `Sector Termination Fee = max(Earned Rewards, 90d of Sector Rewards)` Also, it is important to pinpoint the form of Sector Fault Fee, which are made of two: - Sector Fault Fee, which is defined as 2.14 BR of an sector - Sector Fault Detection Fee, which is defined as 1.5 BR of an sector. Those interact with the Storage Pledge as it's value is defined as being at **minimum** 7 days worth of Fault Fees and 1 Sector Detection Fee. The sum of those gives an total of 16.48 BR of an sector. ___ The **Code Implementation** for the **Fee Calculation** is given by the `actors/builtin/miner/monies.go::PledgePenaltyForTermination` function on the `specs-actors` repo. [(link)](https://github.com/filecoin-project/specs-actors/blob/d8d9867f68a3c299295efdc6d1b3421c9b63df57/actors/builtin/miner/monies.go#L117), which can be simplified into: - `Sector Termination Fee = max(Sector Penalization, Base Termination Fee)` - `Sector Penalization = 3.5 days of Sector Expected Rewards` - `Base Termination Fee = Sector Storage Pledge + (expectedReward) / (2 * Days)` - `expectedReward = dayReward * cappedSectorAge + replacedDayReward * relevantReplacedAge` - `cappedSectorAge = min(sectorAge, 140 Days)`: - `replacedDayReward `: the day reward of the sector being replaced in a capacity upgrade - `relevantReplacedAge`: the age of the sector being reaplced in a capacity upgrade **Assuming no Capacity Upgrades**, the Code Implementation gives the following form: - `Sector Termination Fee = max(Sector Penalization, Base Termination Fee)` - `Sector Penalization = 3.5 days of Sector Daily Expected Rewards on the Termination Time` - `Base Termination Fee = Sector Storage Pledge + min(0.5 * Sector Days, 70 Days) * Sector Daily Expected Rewards on the Activation Time` - Alternatively, `Base Termination Fee = Sector Storage Pledge + Half of Earned Rewards, with an ceiling on 70 days worth of expected rewards` ___ The **Code Implementation** for the penalty processing is given by the `actors/builtin/miner/miner_actor.go::processEarlyTerminations` function on the `specs-actors` repo [(link)](https://github.com/filecoin-project/specs-actors/blob/3c87d38a4829460c92a084465521f649d7613796/actors/builtin/miner/miner_actor.go#L2406), and the Maximum Faulty period is located at `actors/builtin/miner/policy.go::FaultMaxAge`, which is set as of now to 42 days. ___ ## Pitfalls - The Termination Fee is not properly documented on the spec, and there are divergences vs what's actually on the code. - There were some updates on the Network without changes on the Storage Pledge requirements (eg. consecutive faults are now 6w rather than 2w). This can make the Termination Fee comparatively cheap vs repairing the sector if onboarding costs are relatively low. - The Termination Fee have multiple dependences on the network state at the `Activation Time`. This can be an tricky situation, as for an fixed QAP, we can expect the Sector Storage Pledge and Expected Day Rewards for a sector being onboarded / upgraded to go down over time. - The Termination CAN depend on the Sector Expected Rewards on the Termination Time (3.5d of the current expected s-BR), however we should expect it be an extreme event, as it would require `3.5d of current BR > 20d of activation BR + at most 70d of expected earnt rewards`. For an old sector, we can assume `3.5d of current daily BR > 90d of activation daily BR`, which means that the current daily BR should be ~25x bigger than the activation daily BR. - There's an risk on that case that the Miner will not have enough collateral for paying the Termination Fee - Although we expect the Termination Fee to be payable for new sectors, the risk of the miner not having enough to pay it increases as the sector gets older. This is because the expected rewards at activation time tends to be higher than the actual rewards as time goes on. ## Historical Context The termination fee was initially proposed in the [Slash the World document](https://docs.google.com/document/d/1m9NU-NfaFqg8SdwMm9hf-1wzPHnFC-9PJSub8ho9R2E/edit#) around April 2020, and its form was being defined as: - `TerminationFee[t] := max(StoragePledge[t], BaseTerminationFee[t])` - `BaseTerminationFee[t] := InitialPledge * (1 + min[Sector Age, 180 Days] / 20 days)` - Or eq.: `BaseTerminationFee[t] := InitialPledge * (1 + min[Sector Age / 20 Days, 9 Days])` One limiting factor back then was associated with how much data was acessible. Computing the Locked Rewards associated an Sector was not trivial technically, so the formulation did require assuming how much collateral the miner would have. Also, Termination Fee would be triggered when the sector is in the faulted state for "14 consecutive proving periods" rather than the current `42 consecutive days`. Note that those are way higher than the slack that the Storage Pledge provides (20 days worth of Block Reward) ![Termination Fee per Sector Definition on the Slash the World document](https://hackmd.io/_uploads/SJZvWS8dj.png) ![](https://hackmd.io/_uploads/HywS1_D_s.png) ___ A modelling concern initially was related to the rationality of recovering sectors in cause of faults - [FilSim Planning Doc, May 2020](https://docs.google.com/document/d/1NXOXFrGiwgtIhW6iGZAxOPyNV0S16hvuD9UinyqdDpk/edit#heading=h.zgzhwh14lhe0). On the time between the design, testnet and mainnet, the Fee form did change a couple of times, namely: - `TerminationFee[t] := max(SectorPenalization[t], BaseTerminationFee[t])` - Before Testnet: - `BaseTerminationFee[t] = InitialPledge + BlockReward(t_start) * min[Sector Age, 180 days]` - `SectorPenalization: 5 days of Sector BR at Penalty Time` - Testnet Recommendations: - `BaseTerminationFee[t] = BlockReward(t_start) * (20 + min[Sector Age, 70 days])` - `SectorPenalization: 5 days of Sector BR at Penalty Time` - Mainnet Recommendations - `BaseTerminationFee[t] = BlockReward(t_start) * (20 + min[0.5 * Sector Age, 70 days])` - `SectorPenalization: 3.5 days of Sector BR at Penalty Time` It's possible that the introduction of the `0.5x` multipler on the `Sector Age` was one of the concessions in response to the pushbacks associated with the introduction of an `30% Target Locked Supply`. [FIL Cryptoecon Recommendations](https://docs.google.com/spreadsheets/d/1whGnDKztmjsQvuVQILtkJx3t0N0tDNta2TPwCAKHnWk/edit#gid=0) ![](https://hackmd.io/_uploads/HkSHGB8ds.png) ___ In Sep 2021, there was an [network update](https://github.com/filecoin-project/community/discussions/74#discussioncomment-1398542) through [FIP-0026](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0026.md) that increased the Faulty Period in order to be terminated from 14 days to 42 days. Upgrading the Termination Fee was considered during FIP 17/FIP 17, and some discussion back then can be found at the [Qualitative Analysis, FIP 17/FIP 19](/t69zej6-Td6OfKW_WgUbkQ), [Meso Research Plan for Termination Fee](/uhwH00C1SB6u_W3Ar-TIdw) and the [Termination fee governance surface and functional form](/bZr6bPMXQa-Vm3867SdTgg) documents

    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