Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIP-0100: whole feature branch #1630

Merged
merged 18 commits into from
Mar 14, 2025
Merged

FIP-0100: whole feature branch #1630

merged 18 commits into from
Mar 14, 2025

Conversation

rvagg
Copy link
Member

@rvagg rvagg commented Feb 19, 2025

Ongoing work in feat/fip-0100

@rvagg
Copy link
Member Author

rvagg commented Mar 12, 2025

I'd like to disable the merge queue to get this one in with the commits intact so we can preserve the pieces of work separately, along with a clear line of provenance.

@rvagg rvagg marked this pull request as ready for review March 14, 2025 10:32
Copy link
Member

@Stebalien Stebalien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already reviewed commit by commit.

rvagg and others added 18 commits March 14, 2025 13:35
Just type changes and tests for their serialization forms so far.

* `Deadline`
  - Add `total_power: PowerPair`
  - Add `daily_fee: TokenAmount`
* `SectorOnChainInfo`
  - Add `daily_fee: TokenAmount` as an optional field
  - Tests that it can load both 15 and 16 field forms but always saves 16 field form
* `ExpirationSet`
  - Add `fee_deduction: TokenAmount` as an optional field
  - Tests that it can load both 5 and 6 field forms but always save 6 field form

Closes: #1613
Closes: #1614
Closes: #1615
* Adds a `daily_proof_fee(policy: &Policy, circulating_supply: TokenAmount)` for the miner actor
* Adds `DAILY_FEE_CIRCULATING_SUPPLY_MULTIPLIER_NUM` and `DAILY_FEE_CIRCULATING_SUPPLY_MULTIPLIER_DENOM` for a 7.4e-15 multiplier as per the FIP: https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0100.md#per-sector-fee-added

Added a test to sanity check, it also ~matches what was given as a current-day estimate [here](filecoin-project/FIPs#1105 (comment)).

Closes: #1612
* fip-0100: initial pass at daily_fee accounting

* fip-0100: handle sector termination and expiration

* fip-0100: update total power and record a TODO

1. We need to add to the total power when adding sectors, and deduct
when deleting partitions.
2. We're going to need to figure out some way to handle fees when we
compact partitions.

* update the daily fee when faulting/recovering

I'm using a negative delta in the recover case because that's what we do
elsewhere in that function, but I'm not super happy about it.

* fip-0100: remove fees when removing faulty sectors from the expiration queue

* fip-0100: make clippy happy, fix bad arg order in ExpirationQueue#remove

* fip-0100: account for fee adjustment for fault reschedules

* fip-0100: add invariant for fees

* fip-0100: more invariants, handle partition removal/compaction cases

* fip-0100: document return values

* fip-0100: account for power changes when extending/snapping sectors

* fip-0100: add state invariant for live deadline power

* fip-0100: handle unproven power on termination

* fip-0100: handle remaining todos

* fip-0100: rename total_power to live_power

To match our other power variable names.

---------

Co-authored-by: Steven Allen <[email protected]>
* fip-0100: move compact_partitions logic into deadline
* fip-0100: remove sectors in AMT not state
* fip-0100: Deadline::add_sectors flag to optionally accumulate fees
If we snap/extend across multiple deadlines (which appears to be
untested), we would have summed up the power from all proceeding deadlines.
When, on extension, we encounter a legacy sector with a zero fee, update it based on the current circulating supply.

fixes #1634
now needs explicit instructions on how much total burn, pledge change and
power change it should expect
* test: correctly handle cron vesting in tests

1. In the test harness, check if we should vest every epoch. The queue
should already be quantized.
2. Correctly handle the fact that we vest at the _end_ of an epoch in
the cron vesting test.

* feat: refactor vesting funds into a head and a tail

This lets us efficiently take fees from vesting funds without
loading/storing this object each time. It also lets us check if there
are funds to vest without having to load any additional state, because
the "next" batch of vesting funds are always stored in the root state object.

If FIP-0100 passes, we'll likely want this change as we'll otherwise
read/write the vesting funds queue on every deadline for every miner.

fixes #1594

* doc: explain deadline alignment

* review: simplify test
* fip-0100: QAP multiplier for daily_fee

7.4e-15 per 32GiB QAP -> 2.1536e-25 per byte QAP

Closes: #1637

* fip-0100: more daily_fee inspection in integration tests

* fip-0100: properly handle fee adjustment for extensions & updates

* fip-0100: use u128 & BigInt in policy, remove scaling from fee calculation

* fip-0100: remove fee eqn scaling entirely

* fip-0100: address review

* fip-0100: add fixed reference fee amount to test

To ensure that the numbers we're getting are within expected range—all other
tests work on relative amounts.
* PRE_COMMIT_SECTOR_BATCH_MAX_SIZE
* PROVE_REPLICA_UPDATES_MAX_SIZE
* DECLARATIONS_MAX
* fip-0100: reduce daily_fee to 5.56e-15 / 32GiB

Ref: filecoin-project/FIPs#1105 (comment)

* fip-0100: add grace period for legacy sector extensions
@Stebalien Stebalien merged commit 1cc9c2b into master Mar 14, 2025
11 checks passed
@Stebalien Stebalien deleted the feat/fip-0100 branch March 14, 2025 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ☑️ Done (Archive)
Status: 🎉 Done
Development

Successfully merging this pull request may close these issues.

3 participants