# Discussion - Changing the Termination Fees **Authors**: {Shyam, Vik, Tom} @ CryptoEconLab ## Summary - The present termination fee structure was designed in the context of 6 month sectors. The principle that it follows is to cap the termination fee to half the lifetime earnings of a 180 day sector. Since then, the network has onboarded many sectors with durations up to even 1 year and 1.5 years, meaning that such sectors also pay only 90 days worth of block rewards as a penalty. Thus, the current structured is rendered outdated, more so with [FIP-052](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0052.md) - It can be argued that under the current fee strcuture, incentives to maintain sectors may become ineffective due to decreasing block rewards, and decreasing pledge costs. This can potentially affect the power stability of the network. - This opens up the question of whether the present termination fee structure should be revised. - An example of such a change could be to (1) remove the `weighting_factor` in the termination fees calculation, which is currently set to `1/2`, and, (2) scale the `TERMINATION_LIFETIME_CAP` with sector duration commitment according to a function $f(x) = 2(1-e^{-x})$. Such a change can potentially lead to fewer terminations in the network, while still making sure that the penalty-to-reward ratio for SPs continues to be > 1. ## 1. Context ### 1.1 Existing Termination Fee Structure Definitions: - $TF$: The termination fee. - $BR(t_1,t_2)$: The block rewards aggregated over the time between $t_1$ and $t_2$. - $t$: The current epoch. - $t_0$: The activation epoch. - $t_u$: The upgrade epoch(or the epoch in which the sector's commited capacity was upgraded). - $w$: The weighting factor on current block rewards, currently set to a value of $0.5$. - $TLC$: `TERMINATION_LIFETIME_CAP` , i.e the maximum number of daily block rewards penalized from the sector’s start epoch forward, currently set to a value of $140$ ([code](https://github.com/filecoin-project/builtin-actors/blob/b7ad2c55363c363f61275ca45ef255e28f305254/actors/miner/src/monies.rs)). Currently, the termination fee is implemented as follows: \begin{align} TF := & SP(t) + B(t) \\ SP(t) := & \max \{ BR(t_u,t_u+ 2880 \times 20), BR(t_0, t_0 +2880 \times 20) \}\\ B(t) := & w \times (BR(t_0, t_0 +2880) \times \min \{\frac{t - t_0}{2880}, TLC \} + BR(t_u,t_u+ 2880) \times \min \{\frac{t - t_u}{2880}, TLC - \min \{\frac{t - t_0}{2880}, TLC \} \}), \end{align} The current value for $w$ was set to `1/2` after the community arrived at consensus on what an acceptable value would be. <!-- The present value was to act as a concession for risk averse storage providers. Note, this meant that sectors with duration between 6 months and 1.5 years would have the *same* termination fee structure. --> The $TLC$ was set to `140 days` keeping in mind that the maximum sector duration at the time was 6 months. Therefore, with the combined values of the 2 parameters, according to the current fee structure, the maximum penalty that an SP would be charged for terminations would be $(20 + 140)/2 = 90$ days worth of block rewards. This is equivalent to the block rewards that an SP with a 6-month sector would earn for half the lifetime of their sector. More context on the present termination fee design can be found in this [report](https://medium.com/block-science/exploring-the-filecoin-termination-fee-9351fd40340e). ### 1.2 Importance of Termination Fees The current fee structure strikes a delicate balance between making sure that there is availability of storage in the network while being sure that the storage provided to the network is reliable, by, to the maximum extent possibly, ensuring that power contributed by faulty sectors is taken out of the network. This is achieved by differentiating between active terminations and passive terminations (read more [here](https://spec.filecoin.io/systems/filecoin_mining/sector/sector-faults/#:~:text=In%20an%20active%20termination%2C%20the,client%20and%20penalizes%20the%20miner.)). It occupies a very important role in the protocol's cryptoeconomics, and thus its design requires careful attention. ## 2. Effectiveness of incentives to maintain reliable storage There might be several reasons for which SPs might actively choose to terminate their sectors. In this section we wish to specifically look into 2 motivating factors - 1. **Decreasing Block Rewards** because of which an SP might find it more profitable to terminate their sectors and sell their hardware equipment. 2. **Decreasing Initial Pledges** because of which an SP might take advantage of the pledge difference by terminating and resealing their sectors soon after. In the subsequent text we seek to formalize a metric that can be used to measure the incentives for an SP to terminate their sector by looking at their returns from choosing to terminate their sector v.s keeping it active for its committed duration. All this is done in the context of the current termination fee policy. ### 2.1 Effectiveness of incentives to maintain reliable storage: Decreasing Block Rewards An SP may terminate their sector and resell it in order to earn a rebate equivalent to the “salvage value” of the previously committed hardware and the previously committed pledge. One motivation to do so can come from decreasing block rewards. The alternative is for the SP to not terminate their sector. The incentive to maintain reliable storage is defined as the ratio of the ROI if the SP decides to terminate their sector ($ROI_{Terminate}$) to the ROI if the SP decides to not terminate their sector ($ROI_{NoTerminate}$), and a ROI ratio greater than one implies a rational incentive to terminate, conditional on current network state. We compute this ROI ratio for the case when an SP terminates their sector that was sealed **1.5 years** prior to the decision date and sells all their equipment, to that when an SP maintains their sector for their committed lifetime. We further assume that the salvage value of the SP's hardware equipment is 0.5 times that of its initial value 1.5 years prior. ![](https://hackmd.io/_uploads/HJ3ZCXMOn.png) ![](https://hackmd.io/_uploads/BJDIRQfO3.png) *Fig 1. Incentives for individual SPs to terminate sectors sealed 1.5 years prior to selected decision dates for hardware salvage value, at current termination fee parameters and different exchange rates* We can observe from the above image an incentive to reseal for most decision dates given the current policy. ### 2.2 Effectiveness of incentives to maintain reliable storage: Decreasing Initial Pledge An SP may terminate their sector to release the initial pledge which was locked in the network as a collateral when the sector was initially sealed. Then, the SP can choose to reonboard their sector to the network by paying as a deposit, the value of the initial pledge at the time of reseal. The difference in the values of the initial pledge can be exploited when the pledge decreases over time, as this difference is pocketed as a profit by the SP. The alternative is for the SP to not terminate their sector. The definition of the incentives to maintain reliable storage remains the same - the ratio of $ROI_{Terminate}/ROI_{NoTerminate}$, and a value greater than one implies a rational incentive to terminate to take advanatge of the pledge difference. In our analysis, we compute this ROI ratio for the case when an SP terminates their sector that was sealed **1.5 years** prior to the decision date and reonboards it with a new initial pledge, to that when an SP maintains their sector for their committed lifetime. ![](https://hackmd.io/_uploads/B1UbeVMdh.png) *Fig 2. Incentives for individual SPs to terminate and reonboard sectors sealed 1.5 years prior to selected decision dates, at current termination fee parameters.* We can observe from the above image an incentive to reseal for most decision dates given the current policy. ### 2.3 Model Limitations and Caveats While we believe our approach is useful in informing policy changes, we also acknowledge the following shortcomings in our ROI modelling: - The model makes certain assumptions on the harware value of the sector. While the assumptions are well informed, they are not neccesarily a 100% accurate. - Conclusions are sensitive to the FIL/USD exchange rate which is time varying. - The model is also sensitive to the FIL+ rate which is also time varying. - The model isolates a specific number of decision dates in order to abstract away complexities. While this gives us a good enough picture to open up this discussion, it might not be the complete picture. ## 3. Changing the Termination Fee Structure Given that the current fee structure can incentivize SPs to leave the network, we should consider meaningfully changing the structure in order to prevent this. While there are many policy changes that can be adopted, each one of them needs to be throughly invetigated and simulated. As a first step, it is neccesary to discuss what a change to the fee structure could look like, for which we can use the following prompts to guide the conversation: 1. Should the policy differentiate between longer sectors vs shorter sectors? 2. Should the policy differentiate between deal sectors vs CC sectors? 3. Should the policy change with the duration remaining before the sector expires? ### 3.1 Tradeoffs Some principles to keep in mind while designing the termination fee parameters are that: * The termination fee needs to be high enough in order to incentivize maintaining the reliability of storage as the unambiguous rational choice. * The termination fee should be low enough so that in case the operating costs of SPs overly exceed their rewards from the network, they always have an out. This would allow SPs to commit their resources to the network without hesitation, and allow the onboarding rate to remain unaffected. To address the first point, we can revisit the effectiveness of incentives to maintain reliable storage, for the new policy. A shift in the curves below the 1-mark line is considered a positive step in this direction. The addess the second point, we make sure that for the parameters we choose, the ratio of maximum lifetime rewards of a sector to the maximum termination fee payable by a sector is always greater than 1 for all durations. Thus, the process can be thought of as a exercise in constrained optimization, where we wish to maximize the incentives to maintain reliable storage while ensuring the penalty-to-reward ratio for an SP is always greater than 1. ## 4. Example of a possible change An example of a new termination fee strcuture is described below 1. Remove the parameter $w$, the `weighting_factor` which is currently set to `1/2`. This was a concession given to SPs when the network was first designed, but the network conditions has changed a lot since genesis. 2. Scaling the `TERMINATION_LIFETIME_CAP` with duration according to a function $f(x) = 2(1-e^{-x})$. Thus, the expression for the Termination Fee would now instead become: \begin{align} TF := & SP(t) + B(t) \\ SP(t) := & \max \{ BR(t_u,t_u+ 2880 \times 20), BR(t_0, t_0 +2880 \times 20) \}\\ B(t) := & 2f(SectorDuration) \times \max \{ BR(t_u,t_u+ 2880), BR(t_0, t_0 +2880) \} \times \min \{\frac{t - t_0}{2880}, 140\}, \end{align} Where, - $TF$: The termination fee. - $BR(t_1,t_2)$: The block rewards aggregated over the time between $t_1$ and $t_2$. - $t$: The current epoch. - $t_0$: The activation epoch. - $t_u$: The upgrade epoch(or the epoch in which the sector's commited capacity was upgraded). - $SectorDuration$: The duration (in years) that the sector has been active. - $f(x) = 2(1-e^{-x})$ Fig.4 below summarizes the impact of these proposed changes on the termination fee structures for sectors of varying durations. ![](https://i.imgur.com/zxMlNv7.png) *Fig 3. Termination Fee Policy (old vs new) as a function of sector duration.* Such a policy would ensure that the termination fee dynamically changes with the sector duration, while ensuring that the maximum termination fee that any sector can pay would be capped at `300 days` worth of block rewards. Examples: * Under the propsed structure, a sector with a commitment of 180 days would need to pay in termination fees: $$ 20BR + (140 \times 2f(SectorDuration))BR$$ Where $BR$ is the expected daily block rewards, $w$ the weighting factor, and $SectorDuration$ the sector duration in years. This would be $$ 20BR + (140 \times 2 \times 0.39)BR \approx 130BR$$ This is the approximately the same as how much a 6 month sector would need to pay in termination fees under the current policy. * Similarly, a sector with a commitment of 1.5 years would need to pay in termination fees: $$ 20BR + (140 \times 2 \times 0.77)BR \approx 237BR$$ We now revisit the effectiveness of incentives to maintain reliable storage and additionally look at the penalty-to-reward ratio for this policy change. We also use a causal intervention model to model how the daily fraction of raw-byte power terminating is expected to change on implementing the new policy. Please note that this is just one example of a possible change. This structure should further iterated on to consider structural features such as - Differentiating between deal sectors vs CC sectors - Scaling appropriately with the duration of the sector left before expiration - Adding modifications to avoid penalising one-off errors before considering possible parameterisations. ### 4.1 Effectiveness of incentives to maintain reliable storage #### 4.1.1 Effectiveness of incentives to maintain reliable storage: Decreasing Block Rewards Fig. 4 below shows the ROI ratios between terminating sectors for their salvage value and maintaining sectors for their committed lifetime for the old vs proposed policy. ![](https://hackmd.io/_uploads/BJJbfNMO2.png) *Fig 4. Incentives for individual SPs to terminate sectors sealed 1.5 years prior to selected decision dates for hardware salvage value, old policy vs proposed policy.* It is clear from the above figures the ratio of the ROI from termination for salvage value to the ROI from maintaining the sector reduces as the policy adopts higher values of the `weighting_factor`. This indicates a stronger incentive to maintain reliable storage and is a point in favour of setting the parameter to the highest feasible value. #### 4.1.2 Effectiveness of incentives to maintain reliable storage: Decreasing Initial Pledges Fig. 5 below shows the ROI ratios between terminating and reonboarding sectors with a new initial pledge versus extending and maintaining sectors for their committed lifetime, for the old vs proposed policy.* ![](https://hackmd.io/_uploads/H1XjM4zO3.png) *Fig 5. Incentives for individual SPs to terminate and reonboard sectors sealed 1.5 years prior to selected decision dates, old policy vs proposed policy.* Once again the figures suggests that the ratio of the ROI from termination for reonboarding to the ROI from maintaining the sector reduces as the policy adopts higher values of the `weighting_factor`. This once again indicates a weaker incentive to terminate and is another point in favour of setting the parameter to the highest feasible value. ### 4.2 Comparing the penatly-to-reward ratios for different policy parameters Fig. 6 below shows the ratio of lifetime rewards, to maximum termination fees for sector of durations 0.5,1,1.5, and 3.5 years, for the old vs new policy. ![](https://hackmd.io/_uploads/SyC344Gd3.png) *Fig 6. penalty-to-reward ratio for various sector durations, old policy vs new policy* Thus, it is very clear that the maximum value that the `weighting_factor` can take while ensuring that maximum termination fee that a sector pays, does not exceed its lifetime earnings, 2. ### 4.3 Effect of the new policy on Daily Network Terminations We built a statistical model that seeks to represent causal relationships between the daily terminating fraction and possible inflencuing factors such as the termination fees, filecoin price and other unpredictable exogenous factors such as changing legal regulations which cannot be effectively captured using historical data. We then used this model to simulate counterfactuals for the expected upper and lower bounds of the daily fraction of RBP terminating by changing the termination fee values to what it would be under our proposed policy. This approach can help us emperically analyze the effect any change would have on daily terminations. The results, summarized in Figure 7 below, suggests that the daily fraction of raw-byte power terminating decreases by a factor of 100 when we make the changes mentioned ![](https://hackmd.io/_uploads/SyjkSEMuh.png) *Fig 7. Estimated impact of the proposed termination fee parameters on the fraction of raw byte power terminating in comparision to the present parameters.* *Note*: The estimated impact of the termination fee to the fraction of raw byte power terminating are conditional on model assumptions — see notebooks in References. The models necessarily give a highly simplified perspective that does not account for all factors that play a role in affecting the amount of terminations in the network. Nonetheless, this approach can be used to suggest policy changes. ## 5. Conclusion In this document we present an argument as to why the termination fee structure needs to be updated, given that it provides SPs with a rational incentive to terminate their sectors. We open up a discussion on what a possible change to the termination fee structure could look like and also provide an example of one possible change. We also present a methodology that can be used to evaluate the effectiveness of any proposed policy by continuing our previous example. ## Appendix and Source Code * [Timeseries Forecast Modeling](https://github.com/protocol/CryptoEconLab/tree/termination_fees/notebooks/termination_fees/Timeseries_Forecast_Model) * [Causal Intervention Modeling](https://github.com/protocol/CryptoEconLab/tree/termination_fees/notebooks/termination_fees/Casual_Intervention_Model) * [Rational Storage Provider Termination Model](https://github.com/protocol/CryptoEconLab/tree/termination_fees/notebooks/termination_fees/Rational_SP_Termination_Model)