Skip to content

feat(fip-0118): add reward actor changes - #462

Open
rvagg wants to merge 2 commits into
masterfrom
rvagg/fip0118
Open

feat(fip-0118): add reward actor changes#462
rvagg wants to merge 2 commits into
masterfrom
rvagg/fip0118

Conversation

@rvagg

@rvagg rvagg commented Aug 12, 2026

Copy link
Copy Markdown
Member
  • 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


Does not yet include miner actor changes

Copilot AI lite review requested due to automatic review settings August 12, 2026 05:28
@rvagg
rvagg requested a review from rjan90 as a code owner August 12, 2026 05:28
@rvagg
rvagg removed the request for review from rjan90 August 12, 2026 05:28
@github-project-automation github-project-automation Bot moved this to 📌 Triage in FilOz Aug 12, 2026
@rvagg rvagg self-assigned this Aug 12, 2026
@rvagg rvagg added this to Solstice Aug 12, 2026
@github-project-automation github-project-automation Bot moved this to Backlog in Solstice Aug 12, 2026
@rvagg rvagg removed this from FilOz Aug 12, 2026
@rvagg rvagg moved this from Backlog to In progress in Solstice Aug 12, 2026

Copilot AI left a comment

Copy link
Copy Markdown

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 reward actor stream accounting additions for builtin v19 in go-state-types, including new state/type representations, CBOR tuple encodings, invariants, and a v18→v19 migration path (with fixtures/tests aligned to the Rust actor serialization vectors).

Changes:

  • Added stream-related reward state/types (streams, distributions, pending writes, accruals) plus invariants/projection validation helpers.
  • Updated reward actor state to include stream/SWA fields and switched reward totals to canonical code constants (vs state fields).
  • Introduced a dedicated reward actor migrator configurable via RewardMigrationConfig, with tests and updated CBOR generator inputs.

Reviewed changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
builtin/v19/reward/streams.go Adds core stream/distribution/pending-write/accrual types and bounds.
builtin/v19/reward/stream_invariants.go Implements validation/projection rules mirroring the Rust reward streams logic and migration bootstrap validation.
builtin/v19/reward/reward_types.go Adds method param/return types for stream operations and improves docs on existing params/returns.
builtin/v19/reward/reward_types_test.go Ports Rust CBOR golden vectors and asserts method-number registration for new exported methods.
builtin/v19/reward/reward_state.go Extends reward state with minted/burn/explicit totals and stream/SWA roots; updates constructor to persist empty streams state.
builtin/v19/reward/reward_logic.go Moves reward totals to canonical code constants and updates reward computation to use them.
builtin/v19/reward/methods.go Registers new exported (FRC) stream-related methods on the reward actor.
builtin/v19/reward/invariants.go Extends invariants to validate stream/SWA state and explicit liabilities against balances/totals.
builtin/v19/reward/invariants_test.go Adds invariants test coverage for both valid state and corruption cases.
builtin/v19/reward/cbor_gen.go Regenerates CBOR tuple encoders/decoders for new state and method types.
builtin/v19/migration/top.go Plumbs a reward migration config into the v19 migration entrypoint and wires the reward migrator.
builtin/v19/migration/reward.go Adds the v18→v19 reward actor migration implementation (streams bootstrap + new fields).
builtin/v19/migration/reward_test.go Adds unit tests validating the reward migration and config rejection cases.
builtin/v19/gen/gen.go Updates CBOR codegen inputs to include new reward stream/state/method types.
Files not reviewed (1)
  • builtin/v19/reward/cbor_gen.go: Generated file

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

Comment thread builtin/v19/migration/reward.go
Comment thread builtin/v19/reward/reward_state.go Outdated
@codecov-commenter

codecov-commenter commented Aug 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 46.20513% with 1049 lines in your changes missing coverage. Please review.
✅ Project coverage is 4.37%. Comparing base (ce3be5c) to head (c3285ac).

Files with missing lines Patch % Lines
builtin/v19/reward/cbor_gen.go 37.22% 427 Missing and 374 partials ⚠️
builtin/v19/reward/stream_invariants.go 59.75% 151 Missing and 43 partials ⚠️
builtin/v19/gen/gen.go 0.00% 22 Missing ⚠️
builtin/v19/migration/top.go 0.00% 13 Missing ⚠️
builtin/v19/migration/reward.go 78.26% 7 Missing and 3 partials ⚠️
builtin/v19/reward/invariants.go 93.90% 3 Missing and 2 partials ⚠️
builtin/v19/reward/reward_state.go 84.61% 2 Missing and 2 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #462      +/-   ##
==========================================
+ Coverage    3.83%    4.37%   +0.54%     
==========================================
  Files         871      873       +2     
  Lines      172072   173948    +1876     
==========================================
+ Hits         6592     7616    +1024     
- Misses     162611   162974     +363     
- Partials     2869     3358     +489     
Files with missing lines Coverage Δ
builtin/v19/reward/reward_logic.go 77.14% <100.00%> (+77.14%) ⬆️
builtin/v19/reward/reward_state.go 83.67% <84.61%> (+83.67%) ⬆️
builtin/v19/reward/invariants.go 94.04% <93.90%> (+94.04%) ⬆️
builtin/v19/migration/reward.go 78.26% <78.26%> (ø)
builtin/v19/migration/top.go 0.00% <0.00%> (ø)
builtin/v19/gen/gen.go 0.00% <0.00%> (ø)
builtin/v19/reward/stream_invariants.go 59.75% <59.75%> (ø)
builtin/v19/reward/cbor_gen.go 36.17% <37.22%> (+36.17%) ⬆️

... and 3 files with indirect coverage changes

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

* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

[v19] Solstice changes

3 participants