Skip to content

Conversation

@akaladarshi
Copy link
Collaborator

@akaladarshi akaladarshi commented Jan 7, 2026

Part of #6365

Summary of changes

Changes introduced in this pull request:

  • Add snapshot tests in the remaining actor params to increase code coverage:
    • reward_params.rs
    • power_params.rs
    • paych_params.rs
    • multisig_params.rs
    • market_params.rs
    • init_params.rs
    • evm_params.rs
    • eam_params.rs
    • cron_params.rs
    • verified_reg_params.rs

Reference issue to close (if applicable)

Closes

Other information and links

Change checklist

  • I have performed a self-review of my own code,
  • I have made corresponding changes to the documentation. All new code adheres to the team's documentation standards,
  • I have added tests that prove my fix is effective or that my feature works (if possible),
  • I have made sure the CHANGELOG is up-to-date. All user-facing changes should be reflected in this document.

Summary by CodeRabbit

  • Refactor
    • Reorganized JSON (de)serialization implementations across many actor parameter modules into per-version, module-scoped wrappers and unified snapshot tests for improved structure and testability.
  • Chore
    • Added equality (PartialEq) to a Lotus JSON parameter type to enable value comparisons.
  • Notes
    • No breaking changes to public APIs or external behavior.

✏️ Tip: You can customize this high-level summary in your review settings.

@akaladarshi akaladarshi requested a review from a team as a code owner January 7, 2026 05:24
@akaladarshi akaladarshi requested review from hanabi1224 and sudo-shashank and removed request for a team January 7, 2026 05:24
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 7, 2026

Walkthrough

Refactors HasLotusJson impls across lotus_json actor param files: moves per-version trait impls into private modules with a local type alias T, adds a few derives (e.g., PartialEq), and updates snapshot tests to use centralized helpers (assert_all_snapshots). Field mappings and Lotus JSON types remain functionally equivalent.

Changes

Cohort / File(s) Summary
Cron parameter refactoring
src/lotus_json/actors/params/cron_params.rs
Adds PartialEq derive to CronConstructorParamsLotusJson; moves HasLotusJson impls into per-version modules with local type T; snapshots now use assert_all_snapshots::<T>().
EAM parameter refactoring
src/lotus_json/actors/params/eam_params.rs
Wraps HasLotusJson impls for CreateParams, Create2Params, CreateExternalParams into per-version modules (impl_eam_*), introduces local T alias, and relocates snapshot tests to #[test] functions calling assert_all_snapshots::<T>().
EVM parameter refactoring
src/lotus_json/actors/params/evm_params.rs
Moves ConstructorParams, DelegateCallParams impls into scoped modules with T alias; replaces inline snapshots with assert_all_snapshots calls; adds modular test scaffolding (including GetStorageAtParams).
Init parameter refactoring
src/lotus_json/actors/params/init_params.rs
Relocates HasLotusJson impls for ConstructorParams, ExecParams, Exec4Params into per-version modules with T; snapshots use assert_all_snapshots::<T>(); preserves field mappings (e.g., subaddress -> sub_address).
Multisig parameter refactoring
src/lotus_json/actors/params/multisig_params.rs
Moves HasLotusJson impls for multiple multisig params (Constructor, Propose, TxnID, Add/Remove/SwapSigner, ChangeNumApprovalsThreshold, LockBalance) across v8–v17 into per-version modules with T; snapshots redirected to assert_all_snapshots::<T>().
Payment channel parameter refactoring
src/lotus_json/actors/params/paych_params.rs
Refactors ConstructorParams and UpdateChannelStateParams impls into per-version modules (impl_paych_*) with T alias; conversion logic preserved; snapshots migrated to assert_all_snapshots::<T>().
Power parameter refactoring
src/lotus_json/actors/params/power_params.rs
Moves HasLotusJson impls (CreateMiner, UpdateClaimedPower, EnrollCronEvent, UpdatePledgeTotal, MinerRawPower, MinerPower) into per-version modules with T; splits MinerPowerParams for v16/v17; snapshots use assert_all_snapshots::<T>().
Reward parameter refactoring
src/lotus_json/actors/params/reward_params.rs
Relocates HasLotusJson impls (constructor, award block reward, update-network KPI) into per-version modules with local T; preserves LotusJson types and moves snapshots to centralized helper.
Verified registry parameter refactoring
src/lotus_json/actors/params/verified_reg_params.rs
Moves HasLotusJson impls for many verifreg params into per-version modules with T alias; replaces inline snapshot vectors with assert_all_snapshots::<T>(); preserves public types and mappings.

Sequence Diagram(s)

(omitted — change is an internal refactor without new multi-component control flow)

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested labels

RPC

Suggested reviewers

  • hanabi1224
  • sudo-shashank
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 47.62% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'fix(test): JSON snapshot tests for rest of the actor params' accurately and specifically describes the main change—adding JSON snapshot tests for actor parameter modules.

✏️ Tip: You can configure your own custom Pre-merge Checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 195fc9a and 26b7e17.

📒 Files selected for processing (2)
  • src/lotus_json/actors/params/power_params.rs
  • src/lotus_json/actors/params/verified_reg_params.rs
🧰 Additional context used
🧠 Learnings (10)
📓 Common learnings
Learnt from: akaladarshi
Repo: ChainSafe/forest PR: 5896
File: src/lotus_json/actor_states/methods/verified_reg_actor.rs:133-137
Timestamp: 2025-08-18T12:25:29.183Z
Learning: In Lotus JSON for verified registry actor, the SectorAllocationClaimsLotusJson struct uses "SectorExpiry" as the field name for the expiry field, not "Expiry". The current code with #[serde(rename = "SectorExpiry")] is correct.
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 6381
File: src/lotus_json/actors/states/cron_state.rs:8-8
Timestamp: 2026-01-05T12:54:51.873Z
Learning: In the Forest codebase, CronStateLotusJson in src/lotus_json/actors/states/cron_state.rs derives only PartialEq (not Eq) because it contains Entry types that wrap external dependencies from fil_actor_cron_state, which don't implement Eq. This constraint from external dependencies prevents deriving Eq.
Learnt from: akaladarshi
Repo: ChainSafe/forest PR: 5996
File: src/lotus_json/actor_states/methods/paych_params.rs:269-277
Timestamp: 2025-09-02T08:46:04.937Z
Learning: In payment channel actor Lotus JSON serialization, empty merges should be serialized as `null` (not an empty array `[]`) to maintain compatibility with Lotus behavior.
Learnt from: akaladarshi
Repo: ChainSafe/forest PR: 6000
File: src/lotus_json/actors/params/init_params.rs:34-47
Timestamp: 2025-09-10T12:07:10.578Z
Learning: In Lotus JSON for init actor Exec4Params, the InitExec4ParamsLotusJson struct uses "sub_address" as the field name which serializes to "SubAddress" in JSON via PascalCase conversion. This correctly maps to the internal fil_actor_init_state subaddress field through the conversion methods, maintaining Lotus API compatibility.
Learnt from: akaladarshi
Repo: ChainSafe/forest PR: 5996
File: src/lotus_json/actor_states/methods/paych_params.rs:56-58
Timestamp: 2025-09-02T08:44:08.346Z
Learning: In Lotus JSON for payment channel SignedVoucher, the secret_pre_image field should use serde rename to "SecretHash" (not "SecretPreImage") for Lotus API compatibility, even though the internal struct field is named SecretPreimage. This matches the actual JSON format used by Lotus.
📚 Learning: 2025-08-18T12:25:29.183Z
Learnt from: akaladarshi
Repo: ChainSafe/forest PR: 5896
File: src/lotus_json/actor_states/methods/verified_reg_actor.rs:133-137
Timestamp: 2025-08-18T12:25:29.183Z
Learning: In Lotus JSON for verified registry actor, the SectorAllocationClaimsLotusJson struct uses "SectorExpiry" as the field name for the expiry field, not "Expiry". The current code with #[serde(rename = "SectorExpiry")] is correct.

Applied to files:

  • src/lotus_json/actors/params/verified_reg_params.rs
  • src/lotus_json/actors/params/power_params.rs
📚 Learning: 2025-09-10T12:07:10.578Z
Learnt from: akaladarshi
Repo: ChainSafe/forest PR: 6000
File: src/lotus_json/actors/params/init_params.rs:34-47
Timestamp: 2025-09-10T12:07:10.578Z
Learning: In Lotus JSON for init actor Exec4Params, the InitExec4ParamsLotusJson struct uses "sub_address" as the field name which serializes to "SubAddress" in JSON via PascalCase conversion. This correctly maps to the internal fil_actor_init_state subaddress field through the conversion methods, maintaining Lotus API compatibility.

Applied to files:

  • src/lotus_json/actors/params/verified_reg_params.rs
  • src/lotus_json/actors/params/power_params.rs
📚 Learning: 2026-01-05T12:54:40.850Z
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 6381
File: src/lotus_json/actors/states/cron_state.rs:8-8
Timestamp: 2026-01-05T12:54:40.850Z
Learning: In Rust code reviews, do not derive Eq for a struct if any field does not implement Eq (e.g., types from external dependencies). If a type like CronStateLotusJson includes fields wrapping external dependencies that lack Eq, derive PartialEq (or implement PartialEq manually) but avoid deriving Eq. This ensures comparisons compile and reflect actual equivalence semantics. When needed, consider implementing custom PartialEq (and possibly Eq) only after ensuring all fields (or wrappers) implement Eq, or keep PartialEq-only if full equality semantics cannot be expressed.

Applied to files:

  • src/lotus_json/actors/params/verified_reg_params.rs
  • src/lotus_json/actors/params/power_params.rs
📚 Learning: 2025-09-02T08:46:04.937Z
Learnt from: akaladarshi
Repo: ChainSafe/forest PR: 5996
File: src/lotus_json/actor_states/methods/paych_params.rs:269-277
Timestamp: 2025-09-02T08:46:04.937Z
Learning: In payment channel actor Lotus JSON serialization, empty merges should be serialized as `null` (not an empty array `[]`) to maintain compatibility with Lotus behavior.

Applied to files:

  • src/lotus_json/actors/params/verified_reg_params.rs
  • src/lotus_json/actors/params/power_params.rs
📚 Learning: 2026-01-05T12:56:13.802Z
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 6381
File: src/lotus_json/actors/states/evm_state.rs:41-44
Timestamp: 2026-01-05T12:56:13.802Z
Learning: In Rust codebases (e.g., Forest), do not add #[cfg(test)] to functions already annotated with #[test]. The #[test] attribute ensures the function is compiled only for tests, so a separate #[cfg(test)] is redundant and can be removed if present. Apply this check to all Rust files that contain #[test] functions.

Applied to files:

  • src/lotus_json/actors/params/verified_reg_params.rs
  • src/lotus_json/actors/params/power_params.rs
📚 Learning: 2025-09-02T10:05:34.350Z
Learnt from: akaladarshi
Repo: ChainSafe/forest PR: 5923
File: src/rpc/registry/actors/miner.rs:221-223
Timestamp: 2025-09-02T10:05:34.350Z
Learning: For miner actor ChangeOwnerAddress and ChangeOwnerAddressExported methods: versions 8-10 use bare Address as parameter type, while versions 11+ use ChangeOwnerAddressParams. This reflects the evolution of the Filecoin miner actor parameter structures across versions.

Applied to files:

  • src/lotus_json/actors/params/power_params.rs
📚 Learning: 2025-09-02T08:44:08.346Z
Learnt from: akaladarshi
Repo: ChainSafe/forest PR: 5996
File: src/lotus_json/actor_states/methods/paych_params.rs:56-58
Timestamp: 2025-09-02T08:44:08.346Z
Learning: In Lotus JSON for payment channel SignedVoucher, the secret_pre_image field should use serde rename to "SecretHash" (not "SecretPreImage") for Lotus API compatibility, even though the internal struct field is named SecretPreimage. This matches the actual JSON format used by Lotus.

Applied to files:

  • src/lotus_json/actors/params/power_params.rs
📚 Learning: 2026-01-05T13:02:14.604Z
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 6381
File: src/shim/actors/builtin/cron/mod.rs:47-47
Timestamp: 2026-01-05T13:02:14.604Z
Learning: The Entry enum in src/shim/actors/builtin/cron/mod.rs cannot derive Eq because it wraps external fil_actor_cron_state::vX::Entry types (v8-v17) that don't implement Eq. Only PartialEq can be derived for this enum due to this external dependency constraint.

Applied to files:

  • src/lotus_json/actors/params/power_params.rs
📚 Learning: 2025-09-11T16:03:14.328Z
Learnt from: akaladarshi
Repo: ChainSafe/forest PR: 6000
File: src/tool/subcommands/api_cmd/state_decode_params_tests/miner.rs:4-9
Timestamp: 2025-09-11T16:03:14.328Z
Learning: In the Forest codebase's state_decode_params_tests module, common imports like `to_vec`, `TokenAmount`, `Cid`, etc. are centralized in the mod.rs file and made available to submodules through `use super::*;`, eliminating the need for duplicate imports in individual test files.

Applied to files:

  • src/lotus_json/actors/params/power_params.rs
🧬 Code graph analysis (2)
src/lotus_json/actors/params/verified_reg_params.rs (3)
src/lotus_json/actors/params/power_params.rs (6)
  • snapshots (341-343)
  • snapshots (349-356)
  • snapshots (374-376)
  • snapshots (382-389)
  • lotus_json (342-342)
  • lotus_json (375-375)
src/lotus_json/mod.rs (8)
  • snapshots (147-147)
  • snapshots (581-583)
  • snapshots (595-597)
  • snapshots (612-614)
  • snapshots (636-638)
  • assert_all_snapshots (286-296)
  • serde_json (316-316)
  • serde_json (340-340)
src/shim/address.rs (1)
  • new_id (142-144)
src/lotus_json/actors/params/power_params.rs (2)
src/lotus_json/actors/params/evm_params.rs (3)
  • snapshots (161-168)
  • into_lotus_json (170-174)
  • from_lotus_json (176-179)
src/lotus_json/mod.rs (18)
  • snapshots (147-147)
  • snapshots (581-583)
  • snapshots (595-597)
  • snapshots (612-614)
  • snapshots (636-638)
  • assert_all_snapshots (286-296)
  • serde_json (316-316)
  • serde_json (340-340)
  • into_lotus_json (148-148)
  • into_lotus_json (584-586)
  • into_lotus_json (598-600)
  • into_lotus_json (615-621)
  • into_lotus_json (639-646)
  • from_lotus_json (149-149)
  • from_lotus_json (587-589)
  • from_lotus_json (601-606)
  • from_lotus_json (622-628)
  • from_lotus_json (647-654)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: Coverage
  • GitHub Check: tests-release
  • GitHub Check: cargo-publish-dry-run
  • GitHub Check: Build MacOS
  • GitHub Check: Build Ubuntu
  • GitHub Check: Build forest binaries on Linux AMD64
  • GitHub Check: All lint checks
🔇 Additional comments (3)
src/lotus_json/actors/params/verified_reg_params.rs (1)

269-1395: LGTM! Well-structured refactoring of HasLotusJson implementations.

The per-version module pattern with local type aliases (T) is clean and maintainable. All implementations correctly:

  • Define version-specific modules with consistent naming
  • Implement HasLotusJson trait with proper conversions
  • Delegate to centralized assert_all_snapshots::<T>() for test scaffolding
  • Maintain correct JSON field mappings for Lotus API compatibility

The snapshot test data is appropriate and type conversions are correct throughout.

src/lotus_json/actors/params/power_params.rs (2)

82-142: LGTM! The multiaddrs field issue has been resolved.

The previous mismatch between the JSON snapshot and the Rust value for the multiaddrs field has been properly addressed. The snapshot now includes valid base64-encoded multiaddr values that correctly decode to the corresponding BytesDe vectors in the test data.


149-401: LGTM! Consistent refactoring pattern throughout.

All parameter type implementations follow the same well-structured pattern:

  • Per-version modules with local type alias T
  • Proper HasLotusJson trait implementations
  • Centralized test scaffolding via assert_all_snapshots::<T>()
  • Correct type conversions and JSON field mappings

The snapshot test data is appropriate for each parameter type, and the refactoring improves code organization and maintainability.


Comment @coderabbitai help to get the list of available commands and usage tips.

@akaladarshi akaladarshi enabled auto-merge January 7, 2026 05:27
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/lotus_json/actors/params/verified_reg_params.rs (1)

556-586: Fix serde rename attribute for UniversalReceiverParams.type_ field.

The struct at line 251 has #[serde(rename = "Type_")] but should be #[serde(rename = "Type")]. The snapshot correctly expects the JSON field name to be "Type", which aligns with standard Lotus JSON naming conventions (as seen in other actor parameters like "SectorExpiry" and "SecretHash"). The current serde attribute will cause deserialization failures when Lotus sends the "Type" field.

Change line 251 from #[serde(rename = "Type_")] to #[serde(rename = "Type")].

🤖 Fix all issues with AI agents
In @src/lotus_json/actors/params/power_params.rs:
- Around line 94-113: The snapshot's JSON "Multiaddrs" contains base64 entries
"Ag==" and "Aw==" (which decode to byte vectors [2] and [3]) but the snapshots()
function's Self value sets multiaddrs: vec![]; make these consistent by updating
the Self value in snapshots() to multiaddrs: vec![vec![2], vec![3]] (or
alternatively change the JSON to an empty array) so the Multiaddrs field in the
JSON and the multiaddrs field in snapshots()/Self match.
🧹 Nitpick comments (1)
src/lotus_json/actors/params/paych_params.rs (1)

316-327: Consider using unwrap_or_default() for cleaner merges deserialization.

The current pattern at lines 316-323 can be simplified:

merges: lotus_json.sv.merges.unwrap_or_default().into_iter().map(|m| ...).collect()

However, this is a minor style suggestion and the current implementation is correct.

📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f3d46fb and 195fc9a.

📒 Files selected for processing (10)
  • src/lotus_json/actors/params/cron_params.rs
  • src/lotus_json/actors/params/eam_params.rs
  • src/lotus_json/actors/params/evm_params.rs
  • src/lotus_json/actors/params/init_params.rs
  • src/lotus_json/actors/params/market_params.rs
  • src/lotus_json/actors/params/multisig_params.rs
  • src/lotus_json/actors/params/paych_params.rs
  • src/lotus_json/actors/params/power_params.rs
  • src/lotus_json/actors/params/reward_params.rs
  • src/lotus_json/actors/params/verified_reg_params.rs
🧰 Additional context used
🧠 Learnings (10)
📓 Common learnings
Learnt from: akaladarshi
Repo: ChainSafe/forest PR: 5896
File: src/lotus_json/actor_states/methods/verified_reg_actor.rs:133-137
Timestamp: 2025-08-18T12:25:29.183Z
Learning: In Lotus JSON for verified registry actor, the SectorAllocationClaimsLotusJson struct uses "SectorExpiry" as the field name for the expiry field, not "Expiry". The current code with #[serde(rename = "SectorExpiry")] is correct.
Learnt from: akaladarshi
Repo: ChainSafe/forest PR: 5996
File: src/lotus_json/actor_states/methods/paych_params.rs:269-277
Timestamp: 2025-09-02T08:46:04.937Z
Learning: In payment channel actor Lotus JSON serialization, empty merges should be serialized as `null` (not an empty array `[]`) to maintain compatibility with Lotus behavior.
Learnt from: akaladarshi
Repo: ChainSafe/forest PR: 6000
File: src/lotus_json/actors/params/init_params.rs:34-47
Timestamp: 2025-09-10T12:07:10.578Z
Learning: In Lotus JSON for init actor Exec4Params, the InitExec4ParamsLotusJson struct uses "sub_address" as the field name which serializes to "SubAddress" in JSON via PascalCase conversion. This correctly maps to the internal fil_actor_init_state subaddress field through the conversion methods, maintaining Lotus API compatibility.
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 6381
File: src/lotus_json/actors/states/cron_state.rs:8-8
Timestamp: 2026-01-05T12:54:51.873Z
Learning: In the Forest codebase, CronStateLotusJson in src/lotus_json/actors/states/cron_state.rs derives only PartialEq (not Eq) because it contains Entry types that wrap external dependencies from fil_actor_cron_state, which don't implement Eq. This constraint from external dependencies prevents deriving Eq.
📚 Learning: 2025-08-18T12:25:29.183Z
Learnt from: akaladarshi
Repo: ChainSafe/forest PR: 5896
File: src/lotus_json/actor_states/methods/verified_reg_actor.rs:133-137
Timestamp: 2025-08-18T12:25:29.183Z
Learning: In Lotus JSON for verified registry actor, the SectorAllocationClaimsLotusJson struct uses "SectorExpiry" as the field name for the expiry field, not "Expiry". The current code with #[serde(rename = "SectorExpiry")] is correct.

Applied to files:

  • src/lotus_json/actors/params/verified_reg_params.rs
  • src/lotus_json/actors/params/evm_params.rs
  • src/lotus_json/actors/params/reward_params.rs
  • src/lotus_json/actors/params/cron_params.rs
  • src/lotus_json/actors/params/power_params.rs
  • src/lotus_json/actors/params/paych_params.rs
  • src/lotus_json/actors/params/init_params.rs
  • src/lotus_json/actors/params/multisig_params.rs
  • src/lotus_json/actors/params/eam_params.rs
📚 Learning: 2025-09-10T12:07:10.578Z
Learnt from: akaladarshi
Repo: ChainSafe/forest PR: 6000
File: src/lotus_json/actors/params/init_params.rs:34-47
Timestamp: 2025-09-10T12:07:10.578Z
Learning: In Lotus JSON for init actor Exec4Params, the InitExec4ParamsLotusJson struct uses "sub_address" as the field name which serializes to "SubAddress" in JSON via PascalCase conversion. This correctly maps to the internal fil_actor_init_state subaddress field through the conversion methods, maintaining Lotus API compatibility.

Applied to files:

  • src/lotus_json/actors/params/verified_reg_params.rs
  • src/lotus_json/actors/params/evm_params.rs
  • src/lotus_json/actors/params/reward_params.rs
  • src/lotus_json/actors/params/paych_params.rs
  • src/lotus_json/actors/params/init_params.rs
  • src/lotus_json/actors/params/multisig_params.rs
  • src/lotus_json/actors/params/eam_params.rs
📚 Learning: 2026-01-05T12:54:40.850Z
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 6381
File: src/lotus_json/actors/states/cron_state.rs:8-8
Timestamp: 2026-01-05T12:54:40.850Z
Learning: In Rust code reviews, do not derive Eq for a struct if any field does not implement Eq (e.g., types from external dependencies). If a type like CronStateLotusJson includes fields wrapping external dependencies that lack Eq, derive PartialEq (or implement PartialEq manually) but avoid deriving Eq. This ensures comparisons compile and reflect actual equivalence semantics. When needed, consider implementing custom PartialEq (and possibly Eq) only after ensuring all fields (or wrappers) implement Eq, or keep PartialEq-only if full equality semantics cannot be expressed.

Applied to files:

  • src/lotus_json/actors/params/verified_reg_params.rs
  • src/lotus_json/actors/params/evm_params.rs
  • src/lotus_json/actors/params/reward_params.rs
  • src/lotus_json/actors/params/cron_params.rs
  • src/lotus_json/actors/params/power_params.rs
  • src/lotus_json/actors/params/paych_params.rs
  • src/lotus_json/actors/params/init_params.rs
  • src/lotus_json/actors/params/multisig_params.rs
  • src/lotus_json/actors/params/eam_params.rs
📚 Learning: 2026-01-05T12:56:13.802Z
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 6381
File: src/lotus_json/actors/states/evm_state.rs:41-44
Timestamp: 2026-01-05T12:56:13.802Z
Learning: In Rust codebases (e.g., Forest), do not add #[cfg(test)] to functions already annotated with #[test]. The #[test] attribute ensures the function is compiled only for tests, so a separate #[cfg(test)] is redundant and can be removed if present. Apply this check to all Rust files that contain #[test] functions.

Applied to files:

  • src/lotus_json/actors/params/verified_reg_params.rs
  • src/lotus_json/actors/params/evm_params.rs
  • src/lotus_json/actors/params/reward_params.rs
  • src/lotus_json/actors/params/cron_params.rs
  • src/lotus_json/actors/params/power_params.rs
  • src/lotus_json/actors/params/paych_params.rs
  • src/lotus_json/actors/params/init_params.rs
  • src/lotus_json/actors/params/multisig_params.rs
  • src/lotus_json/actors/params/eam_params.rs
📚 Learning: 2025-09-11T16:03:14.328Z
Learnt from: akaladarshi
Repo: ChainSafe/forest PR: 6000
File: src/tool/subcommands/api_cmd/state_decode_params_tests/miner.rs:4-9
Timestamp: 2025-09-11T16:03:14.328Z
Learning: In the Forest codebase's state_decode_params_tests module, common imports like `to_vec`, `TokenAmount`, `Cid`, etc. are centralized in the mod.rs file and made available to submodules through `use super::*;`, eliminating the need for duplicate imports in individual test files.

Applied to files:

  • src/lotus_json/actors/params/evm_params.rs
  • src/lotus_json/actors/params/power_params.rs
  • src/lotus_json/actors/params/multisig_params.rs
  • src/lotus_json/actors/params/eam_params.rs
📚 Learning: 2026-01-05T13:02:14.604Z
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 6381
File: src/shim/actors/builtin/cron/mod.rs:47-47
Timestamp: 2026-01-05T13:02:14.604Z
Learning: The Entry enum in src/shim/actors/builtin/cron/mod.rs cannot derive Eq because it wraps external fil_actor_cron_state::vX::Entry types (v8-v17) that don't implement Eq. Only PartialEq can be derived for this enum due to this external dependency constraint.

Applied to files:

  • src/lotus_json/actors/params/cron_params.rs
  • src/lotus_json/actors/params/power_params.rs
📚 Learning: 2025-09-02T10:05:34.350Z
Learnt from: akaladarshi
Repo: ChainSafe/forest PR: 5923
File: src/rpc/registry/actors/miner.rs:221-223
Timestamp: 2025-09-02T10:05:34.350Z
Learning: For miner actor ChangeOwnerAddress and ChangeOwnerAddressExported methods: versions 8-10 use bare Address as parameter type, while versions 11+ use ChangeOwnerAddressParams. This reflects the evolution of the Filecoin miner actor parameter structures across versions.

Applied to files:

  • src/lotus_json/actors/params/power_params.rs
  • src/lotus_json/actors/params/paych_params.rs
  • src/lotus_json/actors/params/multisig_params.rs
📚 Learning: 2025-09-02T08:46:04.937Z
Learnt from: akaladarshi
Repo: ChainSafe/forest PR: 5996
File: src/lotus_json/actor_states/methods/paych_params.rs:269-277
Timestamp: 2025-09-02T08:46:04.937Z
Learning: In payment channel actor Lotus JSON serialization, empty merges should be serialized as `null` (not an empty array `[]`) to maintain compatibility with Lotus behavior.

Applied to files:

  • src/lotus_json/actors/params/paych_params.rs
  • src/lotus_json/actors/params/multisig_params.rs
  • src/lotus_json/actors/params/eam_params.rs
📚 Learning: 2025-09-02T08:44:08.346Z
Learnt from: akaladarshi
Repo: ChainSafe/forest PR: 5996
File: src/lotus_json/actor_states/methods/paych_params.rs:56-58
Timestamp: 2025-09-02T08:44:08.346Z
Learning: In Lotus JSON for payment channel SignedVoucher, the secret_pre_image field should use serde rename to "SecretHash" (not "SecretPreImage") for Lotus API compatibility, even though the internal struct field is named SecretPreimage. This matches the actual JSON format used by Lotus.

Applied to files:

  • src/lotus_json/actors/params/paych_params.rs
🧬 Code graph analysis (7)
src/lotus_json/actors/params/verified_reg_params.rs (2)
src/lotus_json/mod.rs (18)
  • snapshots (147-147)
  • snapshots (581-583)
  • snapshots (595-597)
  • snapshots (612-614)
  • snapshots (636-638)
  • assert_all_snapshots (286-296)
  • serde_json (316-316)
  • serde_json (340-340)
  • into_lotus_json (148-148)
  • into_lotus_json (584-586)
  • into_lotus_json (598-600)
  • into_lotus_json (615-621)
  • into_lotus_json (639-646)
  • from_lotus_json (149-149)
  • from_lotus_json (587-589)
  • from_lotus_json (601-606)
  • from_lotus_json (622-628)
  • from_lotus_json (647-654)
src/lotus_json/actors/params/miner_params.rs (19)
  • snapshots (844-858)
  • snapshots (1229-1262)
  • snapshots (1362-1373)
  • snapshots (1501-1514)
  • snapshots (1643-1656)
  • into_lotus_json (860-866)
  • into_lotus_json (1264-1283)
  • into_lotus_json (1375-1380)
  • into_lotus_json (1516-1522)
  • into_lotus_json (1658-1664)
  • into_lotus_json (1825-1833)
  • into_lotus_json (1902-1909)
  • from_lotus_json (868-874)
  • from_lotus_json (1285-1307)
  • from_lotus_json (1382-1387)
  • from_lotus_json (1524-1530)
  • from_lotus_json (1666-1672)
  • from_lotus_json (1835-1840)
  • from_lotus_json (1911-1915)
src/lotus_json/actors/params/evm_params.rs (1)
src/lotus_json/mod.rs (18)
  • snapshots (147-147)
  • snapshots (581-583)
  • snapshots (595-597)
  • snapshots (612-614)
  • snapshots (636-638)
  • assert_all_snapshots (286-296)
  • serde_json (316-316)
  • serde_json (340-340)
  • into_lotus_json (148-148)
  • into_lotus_json (584-586)
  • into_lotus_json (598-600)
  • into_lotus_json (615-621)
  • into_lotus_json (639-646)
  • from_lotus_json (149-149)
  • from_lotus_json (587-589)
  • from_lotus_json (601-606)
  • from_lotus_json (622-628)
  • from_lotus_json (647-654)
src/lotus_json/actors/params/reward_params.rs (1)
src/lotus_json/mod.rs (17)
  • snapshots (147-147)
  • snapshots (581-583)
  • snapshots (595-597)
  • snapshots (612-614)
  • assert_all_snapshots (286-296)
  • serde_json (316-316)
  • serde_json (340-340)
  • into_lotus_json (148-148)
  • into_lotus_json (584-586)
  • into_lotus_json (598-600)
  • into_lotus_json (615-621)
  • into_lotus_json (639-646)
  • from_lotus_json (149-149)
  • from_lotus_json (587-589)
  • from_lotus_json (601-606)
  • from_lotus_json (622-628)
  • from_lotus_json (647-654)
src/lotus_json/actors/params/cron_params.rs (2)
src/lotus_json/mod.rs (15)
  • snapshots (147-147)
  • snapshots (581-583)
  • snapshots (595-597)
  • snapshots (612-614)
  • assert_all_snapshots (286-296)
  • into_lotus_json (148-148)
  • into_lotus_json (584-586)
  • into_lotus_json (598-600)
  • into_lotus_json (615-621)
  • into_lotus_json (639-646)
  • from_lotus_json (149-149)
  • from_lotus_json (587-589)
  • from_lotus_json (601-606)
  • from_lotus_json (622-628)
  • from_lotus_json (647-654)
src/shim/address.rs (1)
  • new_id (142-144)
src/lotus_json/actors/params/power_params.rs (1)
src/lotus_json/mod.rs (13)
  • snapshots (147-147)
  • snapshots (581-583)
  • snapshots (595-597)
  • snapshots (612-614)
  • snapshots (636-638)
  • assert_all_snapshots (286-296)
  • serde_json (316-316)
  • serde_json (340-340)
  • into_lotus_json (148-148)
  • into_lotus_json (584-586)
  • into_lotus_json (598-600)
  • into_lotus_json (615-621)
  • into_lotus_json (639-646)
src/lotus_json/actors/params/multisig_params.rs (2)
src/lotus_json/mod.rs (12)
  • snapshots (147-147)
  • snapshots (581-583)
  • snapshots (595-597)
  • snapshots (612-614)
  • assert_all_snapshots (286-296)
  • serde_json (316-316)
  • serde_json (340-340)
  • into_lotus_json (148-148)
  • into_lotus_json (584-586)
  • into_lotus_json (598-600)
  • into_lotus_json (615-621)
  • into_lotus_json (639-646)
src/shim/address.rs (1)
  • new_id (142-144)
src/lotus_json/actors/params/eam_params.rs (2)
src/lotus_json/actors/params/evm_params.rs (3)
  • snapshots (161-168)
  • into_lotus_json (170-174)
  • from_lotus_json (176-179)
src/lotus_json/mod.rs (17)
  • snapshots (147-147)
  • snapshots (581-583)
  • snapshots (595-597)
  • snapshots (612-614)
  • assert_all_snapshots (286-296)
  • serde_json (316-316)
  • serde_json (340-340)
  • into_lotus_json (148-148)
  • into_lotus_json (584-586)
  • into_lotus_json (598-600)
  • into_lotus_json (615-621)
  • into_lotus_json (639-646)
  • from_lotus_json (149-149)
  • from_lotus_json (587-589)
  • from_lotus_json (601-606)
  • from_lotus_json (622-628)
  • from_lotus_json (647-654)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: tests-release
  • GitHub Check: cargo-publish-dry-run
  • GitHub Check: Build MacOS
  • GitHub Check: Build Ubuntu
  • GitHub Check: Build forest binaries on Linux AMD64
  • GitHub Check: All lint checks
  • GitHub Check: Coverage
🔇 Additional comments (40)
src/lotus_json/actors/params/evm_params.rs (3)

26-67: LGTM! Per-version module pattern correctly implemented for EVM ConstructorParams.

The module wrapping with local type alias T, the #[test] fn snapshots() calling assert_all_snapshots::<T>(), and the HasLotusJson implementation are all correctly structured. The snapshot test data and conversion logic look correct.


91-149: LGTM! Consistent pattern applied to DelegateCallParams.

The per-version module structure is correctly implemented with appropriate snapshot test data covering all fields (code, input, caller, value).


160-181: LGTM! GetStorageAtParams uses the test_snapshots! macro appropriately.

The snapshot data correctly tests a 32-byte storage key, and the test_snapshots! macro invocation at line 181 follows the established pattern for non-versioned types.

src/lotus_json/actors/params/verified_reg_params.rs (7)

269-310: LGTM! ConstructorParams module pattern correctly implemented.

The per-version module structure with local type alias T and centralized snapshot testing is correctly applied.


312-359: LGTM! VerifierParams implementation is correct.

The snapshot test data and conversion logic properly handle the address and allowance fields.


660-752: Verify the Signature field name consistency across V2/V3/V4.

The V2 snapshot at lines 684-687 uses "Signature" but V3/V4 snapshots at lines 777/870 use "VerifierSignature". The struct definitions at lines 61 and 84 show V2 doesn't have the rename while V3/V4 have #[serde(rename = "VerifierSignature")]. This appears correct but should be verified for Lotus API compatibility.


940-1049: LGTM! ClaimAllocationsParams v12+ correctly uses nested SectorAllocationClaims structure.

The snapshot correctly tests the nested structure with Sectors containing Claims arrays.


1051-1140: LGTM! ClaimAllocationsParams v11 uses the flat SectorAllocationClaim structure.

The v9-v11 flat structure is correctly handled separately from the v12+ nested structure. Based on learnings, the SectorExpiry field naming is correct.


1259-1299: LGTM! BytesParams v8 implementation is correctly isolated.

The v8-specific BytesParams for UseBytes/RestoreBytes methods is properly handled in its own module.


1383-1399: LGTM! Version ranges for macro invocations are correctly specified.

The version ranges align with the API evolution:

  • v8/v9 use V2 signature types
  • v10/v11 use V3 signature types
  • v12+ use V4 signature types
src/lotus_json/actors/params/reward_params.rs (4)

48-91: LGTM! RewardConstructorParams correctly handles optional power field.

The snapshot tests appropriately cover both null and non-null cases for the optional power field, and the BigIntDe wrapper is correctly used for version-specific serialization.


98-151: LGTM! AwardBlockRewardParams implementation is correct.

The conversion logic properly handles Address, TokenAmount, and win_count fields.


158-201: LGTM! UpdateNetworkKPIParams mirrors the ConstructorParams pattern.

Both optional BigInt fields (power and curr_realized_power) are handled consistently.


203-207: LGTM! Version ranges correctly specified.

ConstructorParams and UpdateNetworkKPIParams are available from v11+, while AwardBlockRewardParams is available from v8+.

src/lotus_json/actors/params/cron_params.rs (2)

10-16: LGTM! Added PartialEq derive for assert_all_snapshots compatibility.

The PartialEq derive is required because assert_all_snapshots<T> requires <T as HasLotusJson>::LotusJson: PartialEq + std::fmt::Debug. Based on learnings, Eq is intentionally not derived since the wrapped Entry types from external dependencies don't implement Eq.


22-89: LGTM! Cron ConstructorParams with version-aware Entry handling.

The from_lotus_json implementation at lines 70-81 correctly handles the case where the Entry variant might not match the expected version by falling back to field-by-field conversion. This ensures robustness when deserializing entries across versions.

src/lotus_json/actors/params/init_params.rs (4)

53-94: LGTM! InitConstructorParams implementation is correct.

Simple network_name field mapping is correctly implemented.


100-147: LGTM! InitExecParams correctly handles CID and RawBytes fields.

The snapshot test data uses base64-encoded bytes and CID format consistent with Lotus JSON.


153-204: LGTM! Exec4Params field mapping is correct.

The subaddress field (internal) maps to sub_address in LotusJson (lines 188, 196), which serializes to "SubAddress" via PascalCase. This maintains Lotus API compatibility as per learnings.


206-208: LGTM! Version ranges are correctly specified.

Exec4Params is only available from v10+ (EIP-4844 support), while ConstructorParams and ExecParams are available from v8+.

src/lotus_json/actors/params/paych_params.rs (4)

167-212: LGTM! ConstructorParams implementation is straightforward.

Simple from/to address mapping is correctly implemented.


219-334: LGTM! UpdateChannelStateParams V2 correctly handles all SignedVoucher fields.

Key Lotus compatibility features are correctly implemented:

  • Empty merges serialize as null (not []) at lines 286-293, per learnings
  • SecretHash field rename (line 57) is correct per learnings
  • Signature uses fvm_shared2 types appropriately

340-455: LGTM! UpdateChannelStateParams V3 follows the same pattern as V2.

The implementation correctly uses fvm_shared3 signature types while maintaining the same serialization logic.


461-576: LGTM! UpdateChannelStateParams V4 correctly uses fvm_shared4 types.

The implementation is consistent with V2/V3 while using the appropriate fvm_shared4 signature types for v12+ actor versions.

src/lotus_json/actors/params/eam_params.rs (4)

23-68: LGTM! EAMCreateParams implementation is correct.

The initcode field correctly converts between Vec<u8> and RawBytes, and the nonce field is passed through directly.


83-128: LGTM! EAMCreate2Params correctly handles the 32-byte salt array.

The salt field is a fixed-size [u8; 32] array that serializes as a JSON array of integers, which is the correct Lotus JSON format.


142-175: LGTM! CreateExternalParams is a simple newtype wrapper.

The tuple struct correctly wraps initcode bytes and the LotusJson representation is transparent base64-encoded bytes.


177-179: LGTM! All EAM params correctly start from v10.

The EAM (Ethereum Address Manager) actor was introduced in network version 18, which corresponds to actor version 10.

src/lotus_json/actors/params/power_params.rs (4)

142-191: LGTM!

The UpdateClaimedPowerParams implementation correctly maps raw_byte_delta and quality_adjusted_delta fields between the actor type and LotusJson representation.


194-243: LGTM!

The EnrollCronEventParams implementation correctly handles the event_epoch and payload fields with proper RawBytes handling.


338-402: LGTM!

The manual implementations for MinerPowerParams v16 and v17 are correctly structured with proper field mappings. Using explicit modules rather than a macro is appropriate since this param type only exists in v16+.


57-67: Verify whether the snapshot tests for these tuple structs actually pass.

UpdatePledgeTotalParamsLotusJson and MinerRawPowerParamsLotusJson are tuple structs that expect to serialize as objects ({"PledgeDelta": ...} and {"Miner": ...}) according to their snapshot tests. However, standard Rust serde behavior for single-field tuple structs is to serialize as just the inner value, not as an object.

UpdatePledgeTotalParamsLotusJson has a field-level #[serde(with = "crate::lotus_json")] attribute which applies custom serialization, but MinerRawPowerParamsLotusJson has no field-level serde attributes—only the struct-level #[serde(rename_all = "PascalCase")], which should not affect tuple field serialization. The struct-level rename_all attribute applies only to named fields.

The test framework (assert_one_snapshot) validates that serializing the LotusJson type produces the expected snapshot JSON. Confirm these tests pass and the serialization produces the expected object format, or refactor these structs to use named fields if object-format JSON is required.

src/lotus_json/actors/params/multisig_params.rs (8)

118-174: LGTM!

The ConstructorParams implementation correctly maps all fields (signers, num_approvals_threshold, unlock_duration, start_epoch) with proper Address conversions.


176-232: LGTM!

The ProposeParams implementation correctly handles the to, value, method, and params fields with appropriate type conversions for Address, TokenAmount, and RawBytes.


234-282: LGTM!

The TxnIDParams implementation correctly wraps/unwraps the version-specific TxnID type via fil_actor_multisig_state::[<v $version>]::TxnID(...).


284-332: LGTM!

The AddSignerParams implementation correctly maps the signer address and increase flag.


334-382: LGTM!

The RemoveSignerParams implementation correctly maps the signer address and decrease flag.


384-432: LGTM!

The SwapSignerParams implementation correctly maps the from and to addresses.


434-476: LGTM!

The ChangeNumApprovalsThresholdParams implementation correctly maps the new_threshold field.


478-530: LGTM!

The LockBalanceParams implementation correctly handles start_epoch, unlock_duration, and amount fields with proper TokenAmount conversion.

@codecov
Copy link

codecov bot commented Jan 7, 2026

Codecov Report

❌ Patch coverage is 97.26538% with 44 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.54%. Comparing base (f3d46fb) to head (26b7e17).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/lotus_json/actors/params/paych_params.rs 83.94% 44 Missing ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
src/lotus_json/actors/params/cron_params.rs 100.00% <100.00%> (+100.00%) ⬆️
src/lotus_json/actors/params/eam_params.rs 100.00% <100.00%> (+76.19%) ⬆️
src/lotus_json/actors/params/evm_params.rs 100.00% <100.00%> (+74.32%) ⬆️
src/lotus_json/actors/params/init_params.rs 100.00% <100.00%> (+91.13%) ⬆️
src/lotus_json/actors/params/market_params.rs 97.61% <ø> (+0.20%) ⬆️
src/lotus_json/actors/params/multisig_params.rs 100.00% <100.00%> (+75.24%) ⬆️
src/lotus_json/actors/params/power_params.rs 100.00% <100.00%> (+83.87%) ⬆️
src/lotus_json/actors/params/reward_params.rs 100.00% <100.00%> (+81.33%) ⬆️
...rc/lotus_json/actors/params/verified_reg_params.rs 97.58% <100.00%> (+85.88%) ⬆️
src/lotus_json/actors/params/paych_params.rs 84.61% <83.94%> (+75.49%) ⬆️

... and 7 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f3d46fb...26b7e17. Read the comment docs.

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

@akaladarshi akaladarshi added this pull request to the merge queue Jan 7, 2026
Merged via the queue into main with commit 73d7369 Jan 7, 2026
43 checks passed
@akaladarshi akaladarshi deleted the akaladarshi/add-snapshot-test-actor-params branch January 7, 2026 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants