Skip to content

FIP-0118: f02/reward actor changes - #1774

Open
rvagg wants to merge 12 commits into
masterfrom
rvagg/fip0118/f02
Open

FIP-0118: f02/reward actor changes#1774
rvagg wants to merge 12 commits into
masterfrom
rvagg/fip0118/f02

Conversation

@rvagg

@rvagg rvagg commented Aug 3, 2026

Copy link
Copy Markdown
Member

Closes #1764

Based on https://github.com/filecoin-project/solstice/blob/main/docs/f02-design.md

I'm staging this as an incremental thing so I can do the first 3 here without actually changing existing reward actor mechanics. By the 4th we're breaking things and doing proper integration of the functionality. I'll be trying to keep these as separate commits, or possibly breaking them down further as things get more complex, so it's potentially easier to review.

  1. Install the reward and stream state schema, including the canonical post-actors-v2 baseline constant
  2. Implement the pure weight, distribution, claim, queue and stream-lifecycle mechanics
  3. Wire all eight FRC-0042 methods with authority checks, events, due-write handling and atomic persistence
  4. Cut over AwardBlockReward to pay consensus, accrue services, burn the exact residual and maintain total/burn/service invariants
  5. Add actor-level tests covering awards, burns, accrual, claims, queued transitions, recovery and state invariants
  6. Add portable TestVM integration covering real miner payments, f099 burns, claims and epoch transitions

@github-project-automation github-project-automation Bot moved this to 📌 Triage in FilOz Aug 3, 2026
@codecov-commenter

codecov-commenter commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.32004% with 86 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.28%. Comparing base (6094683) to head (5bf8be5).

Files with missing lines Patch % Lines
actors/reward/src/lib.rs 87.21% 68 Missing ⚠️
actors/reward/src/streams.rs 99.18% 8 Missing ⚠️
actors/reward/src/testing.rs 94.73% 5 Missing ⚠️
actors/reward/src/streams_test.rs 99.79% 3 Missing ⚠️
actors/reward/src/emit.rs 94.73% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1774      +/-   ##
==========================================
+ Coverage   90.55%   91.28%   +0.72%     
==========================================
  Files         140      143       +3     
  Lines       27814    30957    +3143     
==========================================
+ Hits        25186    28258    +3072     
- Misses       2628     2699      +71     
Files with missing lines Coverage Δ
actors/reward/src/logic.rs 100.00% <100.00%> (ø)
actors/reward/src/state.rs 88.75% <100.00%> (+6.93%) ⬆️
integration_tests/src/util/mod.rs 88.21% <100.00%> (ø)
state/src/check.rs 89.05% <100.00%> (+0.20%) ⬆️
test_vm/src/lib.rs 94.96% <100.00%> (+0.12%) ⬆️
actors/reward/src/emit.rs 94.73% <94.73%> (ø)
actors/reward/src/streams_test.rs 99.79% <99.79%> (ø)
actors/reward/src/testing.rs 95.68% <94.73%> (-4.32%) ⬇️
actors/reward/src/streams.rs 99.18% <99.18%> (ø)
actors/reward/src/lib.rs 87.45% <87.21%> (+2.97%) ⬆️

... and 1 file with indirect coverage changes

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

@rvagg
rvagg force-pushed the rvagg/fip0118/f02 branch from 89c762d to 0a086d2 Compare August 6, 2026 12:35
@rvagg

rvagg commented Aug 7, 2026

Copy link
Copy Markdown
Member Author

Updated my list and ticked most of them off; still need to do more comprehensive integration tests in here and probably a bunch of unit tests that I'd like to have. Along the way a bunch of design items have changed and minor details have come up. FIP updates corresponding to this are in filecoin-project/FIPs#1272 and f02 design doc in filecoin-project/solstice#18 will stay updated too.

@rvagg rvagg changed the title FIP-0118: f02/reward actor changes (WIP/Draft) FIP-0118: f02/reward actor changes Aug 10, 2026
@rvagg
rvagg marked this pull request as ready for review August 10, 2026 10:03
@rvagg
rvagg requested a review from ZenGround0 as a code owner August 10, 2026 10:03
Copilot AI lite review requested due to automatic review settings August 10, 2026 10:03
rvagg added 7 commits August 10, 2026 20:04
Implement fixed-point reward allocation, timelocked stream transitions,
pull-based claims, and exact burn and service accounting. Enforce queue,
lifecycle, state, and supply invariants with deterministic coverage.
Add the stream state machine and FRC-0042 interfaces, then split
block rewards across consensus, service accrual, and burn while
preserving exact supply accounting.

Closes #1764
AwardBlockReward is an implicit message, so any abort fails tipset
execution and a corruption bug would halt the chain. Untrusted weights
now pay nothing, moving no counters and leaving state untouched, with
the fresh gas reward and penalty still applied; there is deliberately
no fallback weight, since any constant could pay more than the current
schedule and reward inducing corruption. When only the liability is
uncomputable, the award pays the real consensus share under a ceiling
of min(STORAGE_MINING_ALLOCATION - total_minted_reward, balance - gas)
so minting cannot spend funds owed to claimants. A missing streams
block or store error still aborts.
@rvagg
rvagg force-pushed the rvagg/fip0118/f02 branch from 0129fc5 to 9c9f541 Compare August 10, 2026 10:04
@rjan90 rjan90 added this to Solstice Aug 10, 2026
@github-project-automation github-project-automation Bot moved this to Backlog in Solstice Aug 10, 2026
@rjan90 rjan90 moved this from Backlog to In progress in Solstice Aug 10, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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-0118 “f02/reward actor changes” by introducing stream-based reward splitting mechanics, wiring the new FRC-0042 method surface (with authority checks/events/persistence), updating reward actor state/invariants, and adding extensive unit + integration coverage via the portable TestVM.

Changes:

  • Adds new reward “streams” state machine (weights, distributions, deferred writes, accrual/claim lifecycle) and integrates it into AwardBlockReward.
  • Updates reward actor state schema/invariant checking and adjusts network stats plumbing for renamed totals.
  • Adds new serialization/unit tests and portable TestVM integration tests for awards, queued transitions, burns, and claims.

Reviewed changes

Copilot reviewed 21 out of 22 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test_vm/tests/suite/test_vm_test.rs Adds a sanity test asserting the singleton reward state contains the configured SWA identity.
test_vm/tests/suite/reward_f02_test.rs Adds TestVM suite wrappers for new reward f02 integration scenarios.
test_vm/tests/suite/mod.rs Registers the new reward f02 suite module.
test_vm/src/lib.rs Updates singleton reward state initialization to new schema and configures a test SWA identity.
state/src/check.rs Updates reward invariant checking call signature to include store/current epoch.
integration_tests/src/util/mod.rs Updates network stats extraction to use total_minted_reward.
integration_tests/src/tests/reward_f02_test.rs Adds integration tests covering award/claim flows and queued-write apply/drop behavior.
integration_tests/src/tests/mod.rs Exposes the new reward f02 integration tests module.
integration_tests/src/lib.rs Renames NetworkStats field to total_minted_reward.
Cargo.lock Updates transitive dependencies for the reward actor changes (new crates/macros).
actors/reward/tests/types_test.rs Adds CBOR wire-format/serialization conformance tests for new types/state.
actors/reward/tests/stream_actor_test.rs Adds extensive unit tests for stream mechanics, queues, awards, burns, and claims.
actors/reward/tests/reward_actor_test.rs Updates reward actor tests for new totals/streams state and adds invariant-focused coverage.
actors/reward/src/types.rs Introduces exported FRC-0042 parameter/return types for the reward actor.
actors/reward/src/testing.rs Expands reward invariant checks to cover streams/accounting and uses blockstore for streams root.
actors/reward/src/streams.rs Adds the stream engine implementation (weights, queues, accrual/claim/settlement, validation).
actors/reward/src/state.rs Updates reward actor on-chain state schema and constructor to install the streams root.
actors/reward/src/logic.rs Updates baseline constants and reward computation helpers; adds canonical baseline sample tests.
actors/reward/src/lib.rs Wires FRC-0042 exported methods and integrates stream allocation into AwardBlockReward.
actors/reward/src/emit.rs Adds event emission helpers for queued/applied/dropped writes and claim payouts.
actors/reward/Cargo.toml Adds new dependencies required by streams + FRC-0042 dispatch + CID/multihash helpers.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread test_vm/src/lib.rs

@LesnyRumcajs LesnyRumcajs left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Partial review

Comment thread actors/reward/src/streams.rs Outdated
Comment thread actors/reward/src/streams.rs Outdated
Comment thread actors/reward/src/streams.rs Outdated
Comment thread actors/reward/src/streams.rs
Comment thread actors/reward/src/streams.rs Outdated
Comment thread actors/reward/src/streams.rs Outdated
Comment thread actors/reward/src/streams.rs Outdated
Comment thread actors/reward/src/streams.rs Outdated
@rvagg
rvagg force-pushed the rvagg/fip0118/f02 branch from fce8ae5 to 72ff2ad Compare August 11, 2026 05:13
@rvagg

rvagg commented Aug 11, 2026

Copy link
Copy Markdown
Member Author

Another change dealing with filecoin-project/FIPs#1272 (comment); just some limit tweaks for hardening.

Comment thread actors/reward/src/streams.rs Outdated
Comment thread actors/reward/src/lib.rs Outdated
Comment thread actors/reward/src/lib.rs Outdated
Comment thread actors/reward/src/state.rs Outdated
Comment thread actors/reward/src/lib.rs
rvagg added a commit to filecoin-project/go-state-types that referenced this pull request Aug 12, 2026
* state representation
* msg param & return type representation
* migration
* golden test fixtures ported from rust for cbor representations

Ref: https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0118.md
Ref: filecoin-project/builtin-actors#1774
Closes: #460
rvagg added a commit to filecoin-project/go-state-types that referenced this pull request Aug 12, 2026
* state representation
* msg param & return type representation
* migration
* golden test fixtures ported from rust for cbor representations

Ref: https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0118.md
Ref: filecoin-project/builtin-actors#1774
Closes: #460
@rvagg
rvagg force-pushed the rvagg/fip0118/f02 branch from 48c8993 to 5bf8be5 Compare August 12, 2026 05:39
@rvagg

rvagg commented Aug 13, 2026

Copy link
Copy Markdown
Member Author

matching go-state-types filecoin-project/go-state-types#462

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 📌 Triage
Status: In review

Development

Successfully merging this pull request may close these issues.

[Solstice] f02 changes for reward split

6 participants