FIP-0118: f02/reward actor changes - #1774
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ 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
🚀 New features to boost your workflow:
|
89c762d to
0a086d2
Compare
|
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. |
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.
0129fc5 to
9c9f541
Compare
There was a problem hiding this comment.
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.
fce8ae5 to
72ff2ad
Compare
|
Another change dealing with filecoin-project/FIPs#1272 (comment); just some limit tweaks for hardening. |
* 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
* 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
48c8993 to
5bf8be5
Compare
|
matching go-state-types filecoin-project/go-state-types#462 |
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.