Skip to content

feat: implement FIP-1249 - deprecate FIL+ and universal 10x QAP#1744

Open
magik6k wants to merge 3 commits into
masterfrom
feat/fips1249
Open

feat: implement FIP-1249 - deprecate FIL+ and universal 10x QAP#1744
magik6k wants to merge 3 commits into
masterfrom
feat/fips1249

Conversation

@magik6k
Copy link
Copy Markdown

@magik6k magik6k commented May 6, 2026

Summary

Implements the FIL+ deprecation half of FIP-1249 (Deprecate FIL+ and Fund Services via Block Reward Split). This PR does not implement the block reward split / Service Rewards Actor — only the datacap/verifreg removal and universal 10x QAP changes.

What's Implemented

Universal 10x QAP for all sectors

  • New FULL_QA_POWER flag (0x2) on SectorOnChainInfoFlags
  • qa_power_for_sector() returns qa_power_max(size) (10x raw power) when the flag is set
  • All sector creation paths set the flag automatically:
    • ProveCommitSectors3 / activate_new_sector_infos
    • ProveCommitSectorsNI
    • ProveReplicaUpdates3 / update_existing_sector_info
  • Pre-existing sectors retain their current QAP until explicitly upgraded

New UpgradeSectorQuality method (method 37)

Allows SPs to upgrade existing pre-FIP-1249 sectors to full 10x QAP:

  • Accepts a BitField of sector numbers
  • Sets FULL_QA_POWER flag, recomputes pledge (max(old, new) — pledge only increases), adjusts daily fee
  • Requires sectors to be active (not faulty/unproven/terminated)
  • Follows the update_replica_states / partition.replace_sectors pattern
  • Notifies power actor of QA power delta and pledge change

Miner actor: verifreg/datacap removal

  • Removed ext::verifreg module entirely (no more cross-actor calls to verified registry)
  • activate_sectors_pieces: no longer claims allocations; all piece space treated as unverified
  • activate_sectors_deals: no longer filters verified deals or calls ClaimAllocations
  • batch_claim_allocations and get_claims functions removed
  • Sector extensions: stripped claim validation; uses proportional deal weight reduction for legacy sectors
  • verified_allocation_key field kept on PieceActivationManifest for API backward compat but ignored

Market actor: datacap removal

  • publish_storage_deals: removed datacap balance checks, allocation requests, datacap token transfers
  • batch_activate_deals / sector_content_changed: removed pending_deal_allocation_ids tracking
  • Removed helper functions: balance_of, transfer_from, alloc_request_for_deal, datacap_transfer_request
  • Removed ext::datacap module and most of ext::verifreg
  • DealProposal.verified_deal field kept for serialization backward compat

Verifreg actor: disabled

  • AddVerifier, AddVerifiedClient: return USR_FORBIDDEN
  • UniversalReceiverHook: returns USR_FORBIDDEN (no new allocations)
  • ClaimAllocations, ExtendClaimTerms: return USR_FORBIDDEN
  • Cleanup methods still active: RemoveExpiredAllocations, RemoveExpiredClaims, GetClaims, RemoveVerifier, RemoveVerifiedClientDataCap
  • Dead helper functions removed (mint, burn, validate_*, can_claim_alloc, etc.)

State invariant updates

  • check_verifreg_against_miners: skips claim-to-sector weight validation for FULL_QA_POWER sectors
  • DataSummary tracks full_qa_power flag for cross-actor checks

Decisions That May Need Discussion

Several design choices were made that go somewhat beyond what the FIP text strictly requires, or where the FIP is ambiguous:

1. Existing datacap is fully blocked, not just minting

The FIP says: "no new datacap minted, but the existing datacap can still be used (ie, allocated) until natural expiration."

We disabled UniversalReceiverHook and ClaimAllocations entirely, meaning existing datacap holders cannot create new allocations or claim them. The rationale: since all sectors get 10x regardless, allocating datacap has zero functional effect — it would be pure overhead. Existing allocations/claims will drain naturally via RemoveExpiredAllocations/RemoveExpiredClaims.

If strict FIP compliance is preferred, we'd re-enable UniversalReceiverHook and ClaimAllocations so existing datacap can be spent (even though it changes nothing about QAP).

2. Claim validation stripped from sector extensions

The FIP doesn't explicitly address what happens when legacy sectors (with existing verifreg claims) are extended. We stripped claim validation entirely — extensions now use proportional deal weight reduction for legacy sectors. SPs can call UpgradeSectorQuality to get 10x regardless. The alternative would be keeping the verifreg GetClaims call alive for legacy extension paths.

3. UpgradeSectorQuality only works on active sectors

We restricted the upgrade method to active sectors (not faulty, not unproven). A faulty sector must be recovered before upgrading. This matches the ProveReplicaUpdates3 (SnapDeal) pattern and avoids complex partition accounting for faulty/unproven power. This restriction could be relaxed in a follow-up.

4. One faulty sector aborts the entire UpgradeSectorQuality batch

The BatchReturn records success eagerly during validation, but partition.replace_sectors() (which rejects inactive sectors) runs inside the state transaction. A single faulty sector in a batch aborts the whole call rather than being skipped. This is consistent with the existing update_replica_states pattern but differs from methods like TerminateSectors which handle partial success per-deadline. Could be improved in a follow-up.

5. verified_deal_weight stored as zero for new sectors

New sectors set verified_space = BigInt::zero() regardless of actual deal content. The deal_weight field still tracks unverified deal space. This means verified_deal_weight is no longer meaningful on new sectors — it's always zero. The FULL_QA_POWER flag is what drives 10x power.

New Tests

  • Policy tests (5): FULL_QA_POWER flag gives 10x, ignores deal weights, ignores duration, legacy formula preserved
  • UpgradeSectorQuality unit tests (7): already-full rejected, nonexistent rejected, empty bitfield, mixed valid/invalid, legacy sector upgrade happy path, daily fee adjustment
  • FIP-1249 integration tests (4): CC sector gets 10x, NI sector gets 10x, verifreg minting disabled, verified deal publishes without datacap ops

Not Implemented (Out of Scope)

The following FIP-1249 components are not part of this PR:

  • Block reward split (α parameter, Service Rewards Actor)
  • Service Rewards Actor (FEVM smart contract)
  • Gated step-up schedule (10% → 40%)
  • Security gate multisig

Implement the core protocol changes from FIP-1249 to deprecate FIL+ (datacap/verifreg)
and give all sectors universal 10x quality-adjusted power.

Miner actor:
- Add FULL_QA_POWER flag (0x2) to SectorOnChainInfoFlags; qa_power_for_sector()
  returns qa_power_max(size) when set, giving 10x QAP regardless of deal content
- All new sectors (ProveCommit3, ProveCommitNI, ProveReplicaUpdates3) automatically
  receive the FULL_QA_POWER flag
- Remove all verifreg cross-actor calls: batch_claim_allocations, get_claims,
  and the ext::verifreg module are removed entirely
- Strip claim validation from sector extensions; use proportional deal weight
  reduction for legacy sectors instead
- Add new UpgradeSectorQuality method (37) allowing SPs to upgrade existing
  pre-FIP-1249 sectors from their current QAP to full 10x, requiring additional
  pledge (modeled on the ProveReplicaUpdates3 pattern)

Market actor:
- Remove all datacap operations from publish_storage_deals (balance checks,
  allocation requests, datacap transfers)
- Remove pending_deal_allocation_ids tracking from deal activation paths
- Remove helper functions: balance_of, transfer_from, alloc_request_for_deal,
  datacap_transfer_request
- Remove datacap and verifreg ext modules
- DealProposal.verified_deal field kept for serialization backward compat

Verifreg actor:
- Disable datacap minting: AddVerifier, AddVerifiedClient return USR_FORBIDDEN
- Disable allocation creation: UniversalReceiverHook returns USR_FORBIDDEN
- Disable claim operations: ClaimAllocations, ExtendClaimTerms return USR_FORBIDDEN
- Keep cleanup methods active: RemoveExpiredAllocations, RemoveExpiredClaims,
  GetClaims, RemoveVerifier, RemoveVerifiedClientDataCap
- Remove dead helper functions (mint, burn, validate_*, can_claim_alloc, etc.)

State invariants:
- Skip verifreg claim-to-sector weight validation for FULL_QA_POWER sectors
- Track full_qa_power flag in DataSummary for cross-actor checks

Tests:
- Add dedicated policy tests for FULL_QA_POWER flag behavior
- Add UpgradeSectorQuality unit tests (validation, error cases, happy path)
- Add FIP-1249 integration tests (10x CC sectors, NI sectors, verifreg
  deprecation, verified deals without datacap ops)
- Update all existing tests for new 10x power expectations
Copilot AI review requested due to automatic review settings May 6, 2026 20:41
@github-project-automation github-project-automation Bot moved this to 📌 Triage in FilOz May 6, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Implements the FIP-1249 “FIL+ deprecation + universal 10x QAP” behavior by removing datacap/verifreg flows from market/miner interactions, introducing a FULL_QA_POWER sector flag that forces 10x QA power, updating state invariants, and adding/adjusting extensive unit + integration test coverage.

Changes:

  • Introduce SectorOnChainInfoFlags::FULL_QA_POWER and update QA power calculation to return max (10x) when set.
  • Remove market-side datacap allocation/transfer plumbing and associated test harness expectations; update miner/verifreg-related tests accordingly.
  • Add new FIP-1249 integration tests and miner unit tests for UpgradeSectorQuality, plus invariant updates to account for full-QAP sectors.

Reviewed changes

Copilot reviewed 50 out of 50 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
test_vm/tests/suite/mod.rs Registers new FIP-1249 test suite module.
test_vm/tests/suite/fip1249_test.rs Adds TestVM wrappers invoking integration test functions.
state/src/check.rs Skips claim-to-sector validation for FULL_QA_POWER sectors in invariants.
integration_tests/src/util/workflows.rs Removes verifreg claim validation expectations and market datacap invocation expectations.
integration_tests/src/util/mod.rs Updates type import paths (AllocationID).
integration_tests/src/tests/verifreg_remove_datacap_test.rs Reworks tests around verifreg deprecation (AddVerifier forbidden).
integration_tests/src/tests/verifreg_multisig_root_test.rs Updates multisig-root verifreg tests for AddVerifier deprecation.
integration_tests/src/tests/verified_claim_test.rs Updates verified-claim scenarios to reflect “no allocations/claims + universal 10x QAP”.
integration_tests/src/tests/terminate_test.rs Removes verifreg/datacap setup from termination integration test.
integration_tests/src/tests/replica_update3_test.rs Updates replica-update integration tests to remove verified allocation/claim assumptions (but still contains leftover ClaimAllocations expectations).
integration_tests/src/tests/publish_deals_test.rs Adjusts expectations: verified deals no longer require datacap, so they succeed.
integration_tests/src/tests/prove_commit3_test.rs Removes verifreg claim-allocation expectations; updates daily fee expectations for universal 10x QAP.
integration_tests/src/tests/prove_commit_niporep_test.rs Updates NI PoRep fee/power expectations for FULL_QA_POWER.
integration_tests/src/tests/mod.rs Exposes new fip1249_test module.
integration_tests/src/tests/fip1249_test.rs Adds dedicated FIP-1249 integration tests (10x QAP + verifreg disabled + no datacap ops).
integration_tests/src/tests/extend_sectors_test.rs Updates extension behavior and legacy-weight simulation for post-FIP-1249 semantics.
integration_tests/src/tests/datacap_tests.rs Updates datacap transfer expectations now that verifreg receiver hook is forbidden.
integration_tests/src/tests/batch_onboarding_deals_test.rs Removes allocation-key plumbing from batch onboarding tests.
integration_tests/src/expects.rs Updates ClaimID import path.
actors/verifreg/tests/harness/mod.rs Adds helper to insert verifiers directly for tests now that AddVerifier is disabled.
actors/verifreg/src/emit.rs Removes allocation/claim event emitters (allocations/claims no longer created).
actors/miner/tests/util.rs Refactors harness expectations to remove verifreg calls and assume FULL_QA_POWER behavior.
actors/miner/tests/upgrade_sector_quality_test.rs Adds unit tests for new UpgradeSectorQuality behavior and pledge/fee deltas.
actors/miner/tests/terminate_sectors_test.rs Updates helper signatures and verified weight assumptions under FIP-1249.
actors/miner/tests/sector_status_test.rs Updates termination fee expectations for 10x QA power.
actors/miner/tests/prove_replica_test.rs Removes claim expectations and updates fee invariants under FULL_QA_POWER.
actors/miner/tests/prove_replica_failures_test.rs Updates claim-failure tests (claim validation removed).
actors/miner/tests/prove_commit_sector_3_test.rs Removes claim expectations and updates assertions to treat all data as unverified.
actors/miner/tests/prove_commit_sector_3_failures_test.rs Updates claim-failure tests (claim validation removed).
actors/miner/tests/policy_test.rs Adds policy tests validating FULL_QA_POWER semantics.
actors/miner/tests/extend_sector_expiration_test.rs Removes claim-validation-dependent test paths; updates fee expectations.
actors/miner/tests/daily_fees_test.rs Updates reference fee/expectations for 10x QA power.
actors/miner/src/types.rs Adds FULL_QA_POWER flag; defines AllocationID/ClaimID locally; adds UpgradeSectorQualityParams.
actors/miner/src/testing.rs Extends invariant summaries to track full_qa_power.
actors/miner/src/policy.rs Makes qa_power_for_sector return qa_power_max when FULL_QA_POWER is set.
actors/miner/src/ext.rs Removes miner’s verifreg ext module (no verifreg interactions).
actors/market/tests/verify_deals_for_activation_test.rs Updates activated-deal allocation_id expectations (now NO_ALLOCATION_ID).
actors/market/tests/sector_content_changed.rs Updates publish harness usage (no datacap/allocation params).
actors/market/tests/on_miner_sectors_terminate.rs Updates publish harness usage (no datacap/allocation params).
actors/market/tests/market_actor_test.rs Removes datacap plumbing from publish tests; updates expectations about verified deals.
actors/market/tests/harness.rs Simplifies publish harness: removes datacap balance/transfer/alloc ID expectations.
actors/market/tests/deal_api_test.rs Updates publish harness usage (no datacap/allocation params).
actors/market/tests/cron_tick_timedout_deals.rs Updates publish harness usage (no datacap/allocation params).
actors/market/tests/batch_activate_deals.rs Updates publish harness usage (no datacap/allocation params).
actors/market/tests/activate_deal_failures.rs Updates publish harness usage (no datacap/allocation params).
actors/market/src/lib.rs Removes datacap allocation/balance/transfer flow from PublishStorageDeals and activation bookkeeping.
actors/market/src/ext.rs Removes verifreg/datacap ext plumbing (retains AllocationID alias only).
Comments suppressed due to low confidence (1)

integration_tests/src/tests/fip1249_test.rs:378

  • The deadline index calculation uses deadline_info.index + 1 % policy.wpost_period_deadlines, but % has higher precedence than +, so this won’t wrap at period boundaries. Use (deadline_info.index + 1) % policy.wpost_period_deadlines.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread integration_tests/src/tests/fip1249_test.rs Outdated
Comment thread integration_tests/src/tests/fip1249_test.rs
Comment on lines 136 to 141
&miner_id,
deadline_info.index + 1 % policy.wpost_period_deadlines,
);

// Advance past the deal's minimum term (the claim remains valid).
// Advance past the deal's minimum term
advance_by_deadline_to_epoch_while_proving(
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

preexisting

Comment thread integration_tests/src/tests/verifreg_remove_datacap_test.rs
Comment thread integration_tests/src/tests/verifreg_remove_datacap_test.rs
Comment thread integration_tests/src/tests/fip1249_test.rs
Comment on lines 24 to 26
};
use fil_actor_miner::{Method as MinerMethod, VerifiedAllocationKey};
use fil_actor_verifreg::{
AllocationClaim, AllocationRequest, ClaimAllocationsParams, Method as VerifregMethod,
SectorAllocationClaims,
};
use fil_actor_verifreg::Method as VerifregMethod;
use fil_actors_runtime::Array;
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

fixed

Comment thread actors/miner/tests/util.rs
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 6, 2026

Codecov Report

❌ Patch coverage is 79.62963% with 55 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.36%. Comparing base (2fd4812) to head (b3eacd8).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
actors/miner/src/lib.rs 77.39% 52 Missing ⚠️
state/src/check.rs 0.00% 3 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1744      +/-   ##
==========================================
- Coverage   90.56%   87.36%   -3.21%     
==========================================
  Files         140      140              
  Lines       27814    27194     -620     
==========================================
- Hits        25189    23757    -1432     
- Misses       2625     3437     +812     
Files with missing lines Coverage Δ
actors/market/src/lib.rs 90.89% <100.00%> (-0.10%) ⬇️
actors/miner/src/policy.rs 94.69% <100.00%> (-2.59%) ⬇️
actors/miner/src/testing.rs 91.77% <100.00%> (+0.03%) ⬆️
actors/miner/src/types.rs 100.00% <ø> (ø)
actors/verifreg/src/emit.rs 98.03% <ø> (-1.97%) ⬇️
actors/verifreg/src/lib.rs 60.35% <100.00%> (-33.29%) ⬇️
integration_tests/src/expects.rs 55.23% <ø> (-41.85%) ⬇️
integration_tests/src/util/mod.rs 80.48% <ø> (-7.73%) ⬇️
integration_tests/src/util/workflows.rs 67.12% <100.00%> (-29.50%) ⬇️
state/src/check.rs 67.64% <0.00%> (-21.21%) ⬇️
... and 1 more

... and 7 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

… code

- Fix operator precedence in fip1249_test.rs deadline index calculations:
  use (index + 1) % N instead of index + 1 % N
- Remove dead replica_update_verified_deal_test and
  replica_update_verified_deal_max_term_violated_test that still referenced
  deprecated verifreg methods (ClaimAllocations, add_verifier, add_client)
- Remove dead create_verified_deals helper and unused VerifregMethod import
- Remove dead test_vm/tests/suite/replica_update_test.rs wrapper (not in mod.rs)
- rustfmt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 📌 Triage

Development

Successfully merging this pull request may close these issues.

3 participants