Skip to content

Conversation

@akaladarshi
Copy link
Collaborator

@akaladarshi akaladarshi commented Aug 11, 2025

Summary of changes

Changes introduced in this pull request:

  • Adds support for the miner actor in state decode params API

Reference issue to close (if applicable)

Closes: #5722

Other information and links

File Name Method Name Method Number
filecoin_miner_statedecodeparams_1755027105570743.rpcsnap.json.zst Constructor 1
filecoin_miner_statedecodeparams_1755027105571288.rpcsnap.json ControlAddresses 2
filecoin_miner_statedecodeparams_1755027105571367.rpcsnap.json ChangeWorkerAddress 3
filecoin_miner_statedecodeparams_1755027105571436.rpcsnap.json ChangePeerID 4
filecoin_miner_statedecodeparams_1755027105571495.rpcsnap.json SubmitWindowedPoSt 5
filecoin_miner_statedecodeparams_1755027105571571.rpcsnap.json ExtendSectorExpiration 8
filecoin_miner_statedecodeparams_1755027105571639.rpcsnap.json TerminateSectors 9
filecoin_miner_statedecodeparams_1755027105571696.rpcsnap.json DeclareFaults 10
filecoin_miner_statedecodeparams_1755027105571760.rpcsnap.json DeclareFaultsRecovered 11
filecoin_miner_statedecodeparams_1755027105571826.rpcsnap.json OnDeferredCronEvent 12
filecoin_miner_statedecodeparams_1755027105571884.rpcsnap.json CheckSectorProven 13
filecoin_miner_statedecodeparams_1755027105571946.rpcsnap.json ApplyRewards 14
filecoin_miner_statedecodeparams_1755027105572003.rpcsnap.json ReportConsensusFault 15
filecoin_miner_statedecodeparams_1755027105572064.rpcsnap.json WithdrawBalance 16
filecoin_miner_statedecodeparams_1755027105572123.rpcsnap.json InternalSectorSetupForPreseal 17
filecoin_miner_statedecodeparams_1755027105572183.rpcsnap.json ChangeMultiaddrs 18
filecoin_miner_statedecodeparams_1755027105572243.rpcsnap.json CompactPartitions 19
filecoin_miner_statedecodeparams_1755027105572301.rpcsnap.json.zst CompactSectorNumbers 20
filecoin_miner_statedecodeparams_1755027105572370.rpcsnap.json.zst ConfirmChangeWorkerAddress 21
filecoin__miner_statedecodeparams_1755027105572425.rpcsnap.json.zst RepayDebt 22
filecoin_miner_statedecodeparams_1755027105572483.rpcsnap.json.zst ChangeOwnerAddress 23
filecoin_miner_statedecodeparams_1755027105572538.rpcsnap.json.zst DisputeWindowedPoSt 24
filecoin_miner_statedecodeparams_1755027105572592.rpcsnap.json.zst ProveCommitAggregate 26
filecoin_miner_statedecodeparams_1755027105572651.rpcsnap.json.zst ProveReplicaUpdates 27
filecoin_miner_statedecodeparams_1755027105572713.rpcsnap.json.zst PreCommitSectorBatch2 28
filecoin_miner_statedecodeparams_1755027105572769.rpcsnap.json.zst ChangeBeneficiary 30
filecoin_miner_statedecodeparams_1755027105572829.rpcsnap.json.zst GetBeneficiary 31
filecoin_miner_statedecodeparams_1755027105572883.rpcsnap.json.zst ExtendSectorExpiration2 32
filecoin_miner_statedecodeparams_1755027105572938.rpcsnap.json.zst ProveCommitSectors3 34
filecoin_miner_statedecodeparams_1755027105573001.rpcsnap.json.zst ProveReplicaUpdates3 35
filecoin_miner_statedecodeparams_1755027105573060.rpcsnap.json.zst ProveCommitSectorsNI 36
filecoin_miner_statedecodeparams_1755027105573120.rpcsnap.json ChangeWorkerAddressExported 3302309124
filecoin_miner_statedecodeparams_1755027105573181.rpcsnap.json ChangePeerIDExported 1236548004
filecoin_miner_statedecodeparams_1755027105573241.rpcsnap.json WithdrawBalanceExported 2280458852
filecoin_miner_statedecodeparams_1755027105573296.rpcsnap.json.zst ChangeMultiaddrsExported 1063480576
filecoin_miner_statedecodeparams_1755027105573353.rpcsnap.json ConfirmChangeWorkerAddressExported 2354970453
filecoin_miner_statedecodeparams_1755027105573459.rpcsnap.json RepayDebtExported 3665352697
filecoin_miner_statedecodeparams_1755027105573531.rpcsnap.json.zst ChangeOwnerAddressExported 1010589339
filecoin_miner_statedecodeparams_1755027105573598.rpcsnap.json ChangeBeneficiaryExported 1570634796
filecoin_miner_statedecodeparams_1755027105573661.rpcsnap.json GetOwnerExported 3275365574
filecoin_miner_statedecodeparams_1755027105573724.rpcsnap.json IsControllingAddressExported 348244887
filecoin_miner_statedecodeparams_1755027105573789.rpcsnap.json GetSectorSizeExported 3858292296
filecoin_miner_statedecodeparams_1755027105573850.rpcsnap.json GetAvailableBalanceExported 4026106874
filecoin_miner_statedecodeparams_1755027105573918.rpcsnap.json GetVestingFundsExported 1726876304
filecoin_miner_statedecodeparams_1755027105573989.rpcsnap.json GetPeerIDExported 2812875329
filecoin_miner_statedecodeparams_1755027105574051.rpcsnap.json GetMultiaddrsExported 1332909407

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

  • New Features

    • Expanded Miner actor method surface across versions 8–16 with additional exported getters and new parameterized operations.
  • Refactor

    • Reworked miner method registration into version-aware per-version wiring and consolidated miner parameter modules.
  • Tests

    • Added comprehensive miner state-decode parameter tests covering many miner methods and added numerous snapshot fixtures.
  • Chores

    • Removed legacy Lotus JSON conversion layer for several miner parameter types.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 11, 2025

Walkthrough

Removed two Lotus-JSON miner param modules and replaced macro-based miner RPC registration with explicit per-version (v8–v16) registration; consolidated Lotus JSON miner params into a new module; added extensive Miner StateDecodeParams test generation and corresponding snapshot entries.

Changes

Cohort / File(s) Summary
Removed Lotus JSON miner param modules
src/lotus_json/actor_states/methods/miner_change_worker_params.rs, src/lotus_json/actor_states/methods/miner_constructor_params.rs
Deleted Lotus-JSON structs, macros, and HasLotusJson impls for Miner constructor and change-worker params across v8–v16.
Lotus JSON module reorg
src/lotus_json/actor_states/methods/mod.rs
Removed miner_change_worker_params and miner_constructor_params module declarations and added miner_actor_params.
RPC registry: Miner actor refactor
src/rpc/registry/actors/miner.rs
Replaced a single macro with per-version registration helpers and macros; added per-version registration functions (v8–v16) and expanded registered miner methods (many parameterized and Exported variants). Public API unchanged.
StateDecode tests: miner suite added
src/tool/subcommands/api_cmd/api_compare_tests.rs
Added miner_actor_state_decode_params_tests building extensive miner parameter payloads (many methods, exported and non-exported) and integrated it into state_decode_params_api_tests.
Test snapshots extended
src/tool/subcommands/api_cmd/test_snapshots.txt
Inserted numerous filecoin_miner_statedecodeparams_*.rpcsnap.json.zst snapshot entries for the new miner tests.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Client
  participant RPC as "JSON-RPC Server"
  participant Reg as "MethodRegistry (v8..v16)"
  participant Codec as "Lotus JSON Codec"
  participant Handler as "StateDecode Handler"

  Client->>RPC: Filecoin.StateDecodeParams(method=Miner, version)
  RPC->>Reg: Lookup miner method handler for version
  alt handler found (per-version)
    Reg-->>RPC: Return handler + param type
    RPC->>Codec: Decode raw params -> versioned struct
    Codec-->>RPC: Decoded params
    RPC->>Handler: Invoke decode handler with params
    Handler-->>RPC: Decoded representation
    RPC-->>Client: Return decoded result
  else handler missing
    Reg-->>RPC: No handler
    RPC-->>Client: Error (unsupported method/version)
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Assessment against linked issues

Objective Addressed Explanation
Support Miner actor in Filecoin.StateDecodeParams across v8–v16 (#5722)
Implement Constructor and ChangeWorkerAddress decoding (#5722)
Implement broad set of Miner non-exported methods checklist (#5722)
Implement Exported Miner methods and v15/v16-specific capabilities (#5722) Diff shows many Exported methods and v15/v16 additions, but full parity with checklist (e.g., InternalSectorSetupForPreseal) cannot be confirmed from this diff alone.

Possibly related PRs

Suggested reviewers

  • sudo-shashank
  • LesnyRumcajs
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch akaladarshi/add-miner-actor-state-decode-param

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@akaladarshi akaladarshi marked this pull request as ready for review August 12, 2025 20:45
@akaladarshi akaladarshi requested a review from a team as a code owner August 12, 2025 20:45
@akaladarshi akaladarshi requested review from hanabi1224 and sudo-shashank and removed request for a team August 12, 2025 20:45
@akaladarshi akaladarshi added the RPC requires calibnet RPC checks to run on CI label Aug 12, 2025
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: 5

🧹 Nitpick comments (4)
src/tool/subcommands/api_cmd/test_snapshots.txt (1)

164-210: Snapshot list growth looks fine; consider ordering and dedup for stability.

The added miner StateDecodeParams snapshots are OK. For long-term maintainability and stable diffs across runs, consider:

  • Keeping this list lexicographically ordered (or grouped by API) to minimize churn in future additions.
  • Verifying there are no duplicate filenames.
src/tool/subcommands/api_cmd/api_compare_tests.rs (2)

2125-2131: Duplicate LockBalance test entry.

StateDecodeParams for Multisig LockBalance is added twice in a row. It will be de-duplicated at runtime, but we should remove the redundancy.

Apply this diff to remove the duplicate:

-        RpcTest::identity(StateDecodeParams::request((
-            Address::new_id(18101), // https://calibration.filscan.io/en/address/t018101/,
-            fil_actor_multisig_state::v16::Method::LockBalance as u64,
-            to_vec(&multisig_lock_bal_params)?,
-            tipset.key().into(),
-        ))?),

2150-2700: Comprehensive Miner decode coverage; minor realism nitpicks only.

The breadth of v16 Miner methods (including exported) covered here is excellent for catching regressions in param decoding. A few minor nits you can consider later:

  • Some sizes (e.g., PaddedPieceSize 12/23) are not realistic in the protocol. Decode paths don’t validate semantics, so it’s fine; optional to switch to canonical sizes to aid future readers.
  • Several Cid::default() placeholders are acceptable for decode-only tests; if decode ever adds structural validation, swap to well-formed CIDs.
src/rpc/registry/actors/miner.rs (1)

258-261: Minor naming consistency nit: register_miner_versions_14.

Function name suggests multiple versions, but handles only v14. Consider renaming to register_miner_version_14 for clarity. No functional impact.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6b53690 and b4fcb0e.

📒 Files selected for processing (6)
  • src/lotus_json/actor_states/methods/miner_change_worker_params.rs (0 hunks)
  • src/lotus_json/actor_states/methods/miner_constructor_params.rs (0 hunks)
  • src/lotus_json/actor_states/methods/mod.rs (1 hunks)
  • src/rpc/registry/actors/miner.rs (1 hunks)
  • src/tool/subcommands/api_cmd/api_compare_tests.rs (4 hunks)
  • src/tool/subcommands/api_cmd/test_snapshots.txt (1 hunks)
💤 Files with no reviewable changes (2)
  • src/lotus_json/actor_states/methods/miner_change_worker_params.rs
  • src/lotus_json/actor_states/methods/miner_constructor_params.rs
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/rpc/registry/actors/miner.rs (4)
src/rpc/registry/actors/init.rs (1)
  • register_actor_methods (42-55)
src/rpc/registry/actors/power.rs (1)
  • register_actor_methods (117-130)
src/rpc/registry/actors/system.rs (1)
  • register_actor_methods (22-35)
src/shim/actors/builtin/market/mod.rs (1)
  • empty (744-752)
⏰ 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). (9)
  • GitHub Check: Build Ubuntu
  • GitHub Check: cargo-publish-dry-run
  • GitHub Check: Build MacOS
  • GitHub Check: All lint checks
  • GitHub Check: tests
  • GitHub Check: tests-release
  • GitHub Check: Build forest binaries on Linux AMD64
  • GitHub Check: Analyze (go)
  • GitHub Check: Analyze (rust)
🔇 Additional comments (3)
src/lotus_json/actor_states/methods/mod.rs (1)

10-10: Consolidation to miner_actor module looks good.

Replacing the split miner-specific modules with a single miner_actor module improves discoverability and reduces scattering.

src/tool/subcommands/api_cmd/api_compare_tests.rs (2)

51-53: Correct imports for parameter (de)serialization.

Bringing in BytesDe, RawBytes, and to_vec is appropriate for building realistic Miner params payloads.


2145-2146: Good factoring of Miner decode tests into a dedicated helper.

Delegating miner-related decode tests to miner_actor_state_decode_params_tests keeps state_decode_params_api_tests focused and more maintainable.

@akaladarshi akaladarshi force-pushed the akaladarshi/add-miner-actor-state-decode-param branch from abe3c09 to f423560 Compare August 13, 2025 10:50
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: 0

🧹 Nitpick comments (3)
src/tool/subcommands/api_cmd/api_compare_tests.rs (3)

2338-2341: Clarify that multiaddr bytes are intentionally arbitrary

new_multi_addrs: vec![BytesDe(vec![1, 2, 3])] is fine for decode-only tests, but the bytes aren’t a real multiaddr which could confuse future readers. Consider a brief inline comment to document intent.

Apply this diff to add a short note:

-    let miner_change_multiaddrs_params = fil_actor_miner_state::v16::ChangeMultiaddrsParams {
-        new_multi_addrs: vec![BytesDe(vec![1, 2, 3])],
-    };
+    let miner_change_multiaddrs_params = fil_actor_miner_state::v16::ChangeMultiaddrsParams {
+        // Arbitrary bytes (not a real multiaddr); sufficient for exercising decode paths.
+        new_multi_addrs: vec![BytesDe(vec![1, 2, 3])],
+    };

2369-2375: Use BitField::default() instead of from_bytes(&[])

BitField::from_bytes(&[])? risks a parse error if the encoding rules change and adds an unnecessary fallible path. For an empty set, Default::default() is clearer and infallible.

Apply this diff:

-    let miner_extend_sector_expiration_params =
-        fil_actor_miner_state::v16::ExtendSectorExpirationParams {
-            extensions: vec![fil_actor_miner_state::v16::ExpirationExtension {
-                deadline: 12,
-                partition: 123,
-                sectors: BitField::from_bytes(&[])?,
-                new_expiration: 1000,
-            }],
-        };
+    let miner_extend_sector_expiration_params =
+        fil_actor_miner_state::v16::ExtendSectorExpirationParams {
+            extensions: vec![fil_actor_miner_state::v16::ExpirationExtension {
+                deadline: 12,
+                partition: 123,
+                sectors: BitField::default(),
+                new_expiration: 1000,
+            }],
+        };

2569-2869: Reduce duplication with a tiny helper macro

The repeated boilerplate for building RpcTest::identity(StateDecodeParams::request((MINER_ADDRESS, method as u64, params, tipset.key().into()))) makes the test long and harder to maintain. A small macro can reduce noise and the chance of copy-paste mistakes.

Apply this diff to introduce a macro and show representative replacements; follow the same pattern for the rest:

 use fil_actor_miner_state::v16::Method;
-    Ok(vec![
+    macro_rules! miner_req {
+        ($m:expr, $p:expr) => {
+            RpcTest::identity(StateDecodeParams::request((
+                MINER_ADDRESS,
+                $m as u64,
+                $p,
+                tipset.key().into(),
+            ))?)
+        };
+    }
+    Ok(vec![
-        RpcTest::identity(StateDecodeParams::request((
-            MINER_ADDRESS,
-            Method::ControlAddresses as u64,
-            vec![],
-            tipset.key().into(),
-        ))?),
+        miner_req!(Method::ControlAddresses, vec![]),
 
-        RpcTest::identity(StateDecodeParams::request((
-            MINER_ADDRESS,
-            Method::ChangeWorkerAddress as u64,
-            to_vec(&miner_change_worker_params)?,
-            tipset.key().into(),
-        ))?),
+        miner_req!(Method::ChangeWorkerAddress, to_vec(&miner_change_worker_params)?),
 
-        RpcTest::identity(StateDecodeParams::request((
-            MINER_ADDRESS,
-            Method::ProveCommitAggregate as u64,
-            to_vec(&miner_prove_commit_aggregate_params)?,
-            tipset.key().into(),
-        ))?),
+        miner_req!(Method::ProveCommitAggregate, to_vec(&miner_prove_commit_aggregate_params)?),
 
-        RpcTest::identity(StateDecodeParams::request((
-            MINER_ADDRESS,
-            Method::GetVestingFundsExported as u64,
-            vec![],
-            tipset.key().into(),
-        ))?),
+        miner_req!(Method::GetVestingFundsExported, vec![]),
     ])

This cuts hundreds of repeated tokens and keeps the method/param matrix easy to scan.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f423560 and 761998c.

📒 Files selected for processing (3)
  • src/lotus_json/actor_states/methods/mod.rs (1 hunks)
  • src/tool/subcommands/api_cmd/api_compare_tests.rs (4 hunks)
  • src/tool/subcommands/api_cmd/test_snapshots.txt (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/lotus_json/actor_states/methods/mod.rs
  • src/tool/subcommands/api_cmd/test_snapshots.txt
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/tool/subcommands/api_cmd/api_compare_tests.rs (1)
src/rpc/methods/f3/types.rs (1)
  • fvm_ipld_encoding (365-365)
⏰ 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). (9)
  • GitHub Check: All lint checks
  • GitHub Check: cargo-publish-dry-run
  • GitHub Check: Build MacOS
  • GitHub Check: Build Ubuntu
  • GitHub Check: Build forest binaries on Linux AMD64
  • GitHub Check: tests
  • GitHub Check: tests-release
  • GitHub Check: Analyze (rust)
  • GitHub Check: Analyze (go)
🔇 Additional comments (4)
src/tool/subcommands/api_cmd/api_compare_tests.rs (4)

51-53: Imports align with v16 miner params usage

Bringing BytesDe, RawBytes, and Randomness into scope is correct and matches the v16 Miner params you construct below.


107-108: Doc grammar tweak looks good

Minor nit fixed; no action needed.


2145-2146: Good: Miner state decode tests are now wired into the suite

Extending the test vector with miner_actor_state_decode_params_tests(tipset) ensures the new coverage is exercised alongside existing decode tests.


2319-2327: Version alignment for miner actor params verified

  • No imports from fil_actor_miner_state::v8–v15 were found in api_compare_tests.rs around lines 2319–2327 or 2550–2563.
  • The Method enum is correctly imported from fil_actor_miner_state::v16.

All referenced miner constructor and internal-sector parameters are aligned with v16.

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

🧹 Nitpick comments (1)
src/tool/subcommands/api_cmd/api_compare_tests.rs (1)

2341-2891: Reduce duplication and future-proof across actor versions.

The test coverage is excellent, but the function is very long, highly repetitive, and hardwired to v16 types. Two improvements:

  • Extract a tiny helper to encode params (and to build tests for no-params methods) to cut duplication/noise.
  • Allow running the same suite across actor versions (v8–v16) where shapes match, gated by the tipset’s actor code. This better aligns with the PR objective “API compatibility across V8–V16”.

Example refactor directions:

  • Introduce a local encode helper: fn encode<T: Serialize>(t: &T) -> anyhow::Result<Vec<u8>> { to_vec(t).map_err(Into::into) }.
  • Build a small macro or a helper that takes (method: u64, params: Vec<u8>) -> RpcTest to avoid repeating the StateDecodeParams::request boilerplate.
  • Optionally, add a version switch: detect miner actor code CID at tipset and map to a version module (v8…v16) to construct version-correct param structs.

Happy to draft the concrete refactor if you want to pursue this now.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these settings in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 761998c and e9f5533.

📒 Files selected for processing (3)
  • src/lotus_json/actor_states/methods/mod.rs (1 hunks)
  • src/tool/subcommands/api_cmd/api_compare_tests.rs (4 hunks)
  • src/tool/subcommands/api_cmd/test_snapshots.txt (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/tool/subcommands/api_cmd/test_snapshots.txt
  • src/lotus_json/actor_states/methods/mod.rs
⏰ 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). (9)
  • GitHub Check: cargo-publish-dry-run
  • GitHub Check: Build Ubuntu
  • GitHub Check: All lint checks
  • GitHub Check: Build MacOS
  • GitHub Check: tests
  • GitHub Check: Build forest binaries on Linux AMD64
  • GitHub Check: tests-release
  • GitHub Check: Analyze (go)
  • GitHub Check: Analyze (rust)
🔇 Additional comments (5)
src/tool/subcommands/api_cmd/api_compare_tests.rs (5)

51-52: Good, necessary imports for new miner decode payloads.

BytesDe, RawBytes, to_vec, and Randomness are all used in the new Miner params tests. Clean and scoped additions.


107-108: Nit: comment wording tweak is fine.

Minor docstring punctuation change; no functional impact.


2167-2167: Wiring miner decode-params tests into the suite is correct.

This ensures the new Miner coverage runs as part of state_decode_params_api_tests. No ordering hazards; returns Result and uses ? with the surrounding anyhow::Result, so errors will surface appropriately.


2360-2363: Correct type for multiaddrs: using BytesDe is appropriate.

ChangeMultiaddrsParams expects raw multiaddresses; wrapping as Vec<BytesDe> is the right shape for CBOR encoding/decoding.


2386-2387: Use 32-byte randomness to avoid decode divergence across implementations.

While StateDecodeParams “decoding” doesn’t validate length, Go’s abi.Randomness is commonly used as 32-byte randomness and some decoders may assume that length. Using a 3-byte vector risks subtle differences. Prefer a 32-byte payload.

Apply this change to make the input canonical:

-        chain_commit_epoch: 0,
-        chain_commit_rand: Randomness(vec![1, 22, 43]),
+        chain_commit_epoch: 0,
+        chain_commit_rand: Randomness([0u8; 32].to_vec()),

If you want to keep a non-zero value, you can seed with a repeated byte:

-        chain_commit_rand: Randomness(vec![1, 22, 43]),
+        chain_commit_rand: Randomness(vec![0xAB; 32]),

Would you like me to scan the codebase for other non-32-byte Randomness constructions and propose consistent fixes?

akaladarshi and others added 2 commits August 18, 2025 17:38
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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: 0

🧹 Nitpick comments (3)
src/tool/subcommands/api_cmd/api_compare_tests.rs (3)

2147-2152: Duplicate multisig LockBalance decode test — remove one copy.

There are two identical StateDecodeParams tests for Multisig LockBalance back-to-back. The second is redundant.

Apply this diff to remove the duplicate:

-        RpcTest::identity(StateDecodeParams::request((
-            Address::new_id(18101), // https://calibration.filscan.io/en/address/t018101/,
-            fil_actor_multisig_state::v16::Method::LockBalance as u64,
-            to_vec(&multisig_lock_bal_params)?,
-            tipset.key().into(),
-        ))?),

2386-2387: Use 32-byte randomness for realism (optional).

Randomness is typically 32 bytes. Using a fixed-length buffer avoids surprising renderings across nodes.

Apply this diff:

-        chain_commit_rand: Randomness(vec![1, 22, 43]),
+        chain_commit_rand: Randomness(vec![0; 32]), // 32-byte randomness

2519-2522: Prefer canonical piece sizes for PaddedPieceSize (optional).

Values 23 and 12 are not typical piece sizes (normally multiples of 128). While decoding doesn’t validate semantics, using canonical sizes improves fidelity.

Example tweak:

-                    size: fvm_shared4::piece::PaddedPieceSize(23),
+                    size: fvm_shared4::piece::PaddedPieceSize(2048),
-                    size: fvm_shared4::piece::PaddedPieceSize(12),
+                    size: fvm_shared4::piece::PaddedPieceSize(256),

Also applies to: 2541-2544

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between e9f5533 and e966e6a.

📒 Files selected for processing (1)
  • src/tool/subcommands/api_cmd/api_compare_tests.rs (4 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/tool/subcommands/api_cmd/api_compare_tests.rs (2)
src/rpc/methods/f3/types.rs (1)
  • fvm_ipld_encoding (365-365)
src/rpc/methods/eth.rs (1)
  • fvm_ipld_encoding (2212-2212)
⏰ 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). (9)
  • GitHub Check: All lint checks
  • GitHub Check: cargo-publish-dry-run
  • GitHub Check: Build Ubuntu
  • GitHub Check: Build MacOS
  • GitHub Check: tests-release
  • GitHub Check: tests
  • GitHub Check: Build forest binaries on Linux AMD64
  • GitHub Check: Analyze (rust)
  • GitHub Check: Analyze (go)
🔇 Additional comments (5)
src/tool/subcommands/api_cmd/api_compare_tests.rs (5)

51-52: Imports look correct for new payload construction.

Adding BytesDe, RawBytes, and to_vec plus Randomness is appropriate for building/encoding the new Miner params. No concerns.


107-108: Minor docstring punctuation fix LGTM.

The comma reads better and matches the other enum variants’ phrasing.


2167-2168: Good extraction of Miner state-decode tests.

Extending the top-level vector via miner_actor_state_decode_params_tests(tipset)? keeps state_decode_params_api_tests focused and maintainable.


2341-2891: Comprehensive Miner StateDecodeParams coverage is solid.

This adds broad coverage across constructor, mutation, PoSt, replication, and exported query methods. Structure and param construction are consistent with other actors’ tests.


2391-2397: Nice: empty BitField is now Default::default().

Thanks for avoiding BitField::from_bytes(&[]) here. Using Default::default() prevents invalid RLE+ at test construction and aligns with patterns elsewhere.

Also applies to: 2400-2405, 2408-2413

@akaladarshi akaladarshi enabled auto-merge August 18, 2025 14:11
@akaladarshi akaladarshi marked this pull request as ready for review September 2, 2025 09:46
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: 0

♻️ Duplicate comments (1)
src/tool/subcommands/api_cmd/api_compare_tests.rs (1)

2412-2416: Good: empty BitFields use Default instead of from_bytes(&[])

Thanks for avoiding BitField::from_bytes(&[]); Default::default() (or BitField::new()) is correct for an empty RLE+. This addresses the earlier concern raised in past review.

Also applies to: 2420-2425, 2471-2474, 2476-2480, 2488-2491

🧹 Nitpick comments (7)
src/tool/subcommands/api_cmd/api_compare_tests.rs (7)

2380-2383: Use a valid multiaddr byte sequence to avoid edge-case decoding quirks

Using [1,2,3] as a multiaddr payload is unlikely to represent a valid multiaddr. Prefer bytes from a real multiaddr (e.g., /ip4/127.0.0.1/tcp/1234) to reduce the chance of implementation-specific handling differences.


2399-2407: Randomness length: use 32 bytes to match common expectations

Many components expect 32-byte randomness. Using a short Vec may still decode but risks divergence. Recommend zero-padding to 32 bytes.

-        chain_commit_rand: Randomness(vec![1, 22, 43]),
+        chain_commit_rand: Randomness(vec![0; 32]),

2536-2545: Use valid padded piece sizes

PaddedPieceSize(23) is not a typical valid value and could trigger validation in some stacks. Prefer standard sizes (e.g., 2048, 4096).

-                    size: fvm_shared4::piece::PaddedPieceSize(23),
+                    size: fvm_shared4::piece::PaddedPieceSize(2048),

2560-2566: Likewise: prefer a standard piece size

Use a conventional piece size to avoid accidental rejections during decoding/printing.

-                    size: fvm_shared4::piece::PaddedPieceSize(12),
+                    size: fvm_shared4::piece::PaddedPieceSize(1024),

2611-2619: Version coupling: v16-only Method enum may fail if MINER_ADDRESS isn’t v16

These tests hard-bind to fil_actor_miner_state::v16::Method. If MINER_ADDRESS at the snapshot tipsets is not v16 (PR promises V8–V16), some method numbers/param shapes may not match and the test will fail early rather than validating decode parity.

Consider either:

  • Detecting the miner actor version at runtime (via StateReadState code CID) and choosing the corresponding vX::Method and param types, or
  • Pinning the snapshots to tipsets where MINER_ADDRESS is known to be v16 and documenting this invariant.

2619-2626: Minor: misleading inline comment

“Methods without parameters” precedes a block where only the first call (ControlAddresses) has empty params; subsequent calls include params. Move the comment above the single no-param call to avoid confusion.

-        // Methods without parameters
-        RpcTest::identity(StateDecodeParams::request((
+        // Methods without parameters
+        RpcTest::identity(StateDecodeParams::request((
             MINER_ADDRESS,
             Method::ControlAddresses as u64,
             vec![],
             tipset.key().into(),
         ))?),
+        // Methods with parameters

2361-2370: Reduce boilerplate with a helper to build decode tests

The function is long and repetitive. A tiny helper reduces noise and future churn.

@@
-fn miner_actor_state_decode_params_tests(tipset: &Tipset) -> anyhow::Result<Vec<RpcTest>> {
+fn miner_actor_state_decode_params_tests(tipset: &Tipset) -> anyhow::Result<Vec<RpcTest>> {
+    use fil_actor_miner_state::v16::Method;
+    let mk = |m: Method, p: Vec<u8>| -> anyhow::Result<RpcTest> {
+        Ok(RpcTest::identity(StateDecodeParams::request((
+            MINER_ADDRESS,
+            m as u64,
+            p,
+            tipset.key().into(),
+        ))?))
+    };
@@
-        RpcTest::identity(StateDecodeParams::request((
-            MINER_ADDRESS,
-            Method::Constructor as u64,
-            to_vec(&miner_constructor_params)?,
-            tipset.key().into(),
-        ))?),
+        mk(Method::Constructor, to_vec(&miner_constructor_params)?)?,
@@
-        RpcTest::identity(StateDecodeParams::request((
-            MINER_ADDRESS,
-            Method::ControlAddresses as u64,
-            vec![],
-            tipset.key().into(),
-        ))?),
+        mk(Method::ControlAddresses, vec![])?,
@@
-        RpcTest::identity(StateDecodeParams::request((
-            MINER_ADDRESS,
-            Method::ChangeWorkerAddress as u64,
-            to_vec(&miner_change_worker_params)?,
-            tipset.key().into(),
-        ))?),
+        mk(Method::ChangeWorkerAddress, to_vec(&miner_change_worker_params)?)?,
 /* …apply mk to the remaining calls… */

Also applies to: 2613-2910

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 251ffcb and e40b8b6.

📒 Files selected for processing (4)
  • src/lotus_json/actor_states/methods/mod.rs (1 hunks)
  • src/rpc/registry/actors/miner.rs (1 hunks)
  • src/tool/subcommands/api_cmd/api_compare_tests.rs (2 hunks)
  • src/tool/subcommands/api_cmd/test_snapshots.txt (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/tool/subcommands/api_cmd/test_snapshots.txt
  • src/lotus_json/actor_states/methods/mod.rs
  • src/rpc/registry/actors/miner.rs
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-18T12:25:29.183Z
Learnt from: akaladarshi
PR: ChainSafe/forest#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/tool/subcommands/api_cmd/api_compare_tests.rs
🧬 Code graph analysis (1)
src/tool/subcommands/api_cmd/api_compare_tests.rs (3)
src/rpc/methods/f3/types.rs (1)
  • fvm_ipld_encoding (366-366)
src/rpc/methods/eth.rs (1)
  • fvm_ipld_encoding (2216-2216)
src/shim/econ.rs (1)
  • from_atto (106-108)
⏰ 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). (8)
  • GitHub Check: cargo-publish-dry-run
  • GitHub Check: Build MacOS
  • GitHub Check: Build Ubuntu
  • GitHub Check: All lint checks
  • GitHub Check: tests-release
  • GitHub Check: tests
  • GitHub Check: Analyze (go)
  • GitHub Check: Analyze (rust)
🔇 Additional comments (1)
src/tool/subcommands/api_cmd/api_compare_tests.rs (1)

51-53: LGTM: encoding imports and Randomness

BytesDe/RawBytes/to_vec and Randomness imports are appropriate for the new miner decode tests.

sudo-shashank
sudo-shashank previously approved these changes Sep 2, 2025
hanabi1224
hanabi1224 previously approved these changes Sep 2, 2025
@akaladarshi akaladarshi added this pull request to the merge queue Sep 2, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Sep 2, 2025
@akaladarshi akaladarshi dismissed stale reviews from hanabi1224 and sudo-shashank via 43590f4 September 2, 2025 14:14
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

♻️ Duplicate comments (1)
src/tool/subcommands/api_cmd/api_compare_tests.rs (1)

2368-2918: Miner StateDecodeParams coverage added — add cross-version checks for ChangeOwnerAddress (v8–v10 vs v11+)

Solid, exhaustive param construction for v16. One gap: for ChangeOwnerAddress and ChangeOwnerAddressExported, v8–v10 expect a bare Address, while v11+ use ChangeOwnerAddressParams (as noted in learnings). Current tests only encode v16::ChangeOwnerAddressParams, so we may miss regressions in older versions.

Use this to confirm test coverage and registry wiring for v8–v10:

#!/bin/bash
# 1) Do we exercise v8–v10 miner param types anywhere?
rg -nP 'fil_actor_miner_state::v(8|9|10)::' -C2

# 2) Check miner registry wires ChangeOwnerAddress/Exported per version
rg -nP 'ChangeOwnerAddress(?:Exported)?' src/rpc/registry/actors/miner.rs -n -C3

# 3) Check tests only use v16 ChangeOwnerAddressParams
rg -n 'ChangeOwnerAddress' src/tool/subcommands/api_cmd/api_compare_tests.rs -n -C3

If missing, consider adding a small branch that, when run against snapshots from epochs where the miner actor code CID maps to v8–v10, encodes a bare Address for these two methods. I can help draft that if desired.

Additionally, a couple of small nits to reduce noise and improve realism:

  • Prefer RawBytes::default() over RawBytes::new(vec![]) in a few places.
  • Consider using a fixed 32-byte Randomness for chain_commit_rand (closer to production drand size), though not required for decode-only tests.

Apply within this block:

-        chain_commit_rand: Randomness(vec![1, 22, 43]),
+        chain_commit_rand: Randomness(vec![0u8; 32]),
@@
-            aggregate_proof: RawBytes::new(vec![]),
+            aggregate_proof: RawBytes::default(),
@@
-                replica_proof: RawBytes::new(vec![]),
+                replica_proof: RawBytes::default(),
@@
-            sector_proofs: vec![RawBytes::new(vec![])],
-            aggregate_proof: RawBytes::new(vec![]),
+            sector_proofs: vec![RawBytes::default()],
+            aggregate_proof: RawBytes::default(),
@@
-            sector_proofs: vec![RawBytes::new(vec![])],
-            aggregate_proof: RawBytes::new(vec![]),
+            sector_proofs: vec![RawBytes::default()],
+            aggregate_proof: RawBytes::default(),
@@
-            aggregate_proof: RawBytes::new(vec![23, 2, 23]),
+            aggregate_proof: RawBytes::from(vec![23, 2, 23]),

Lastly, nice job switching all empty BitFields to Default::default(); that addresses the prior RLE+ empty encoding issue flagged earlier.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between e40b8b6 and 43590f4.

📒 Files selected for processing (2)
  • src/tool/subcommands/api_cmd/api_compare_tests.rs (2 hunks)
  • src/tool/subcommands/api_cmd/test_snapshots.txt (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: akaladarshi
PR: ChainSafe/forest#5923
File: src/rpc/registry/actors/miner.rs:221-223
Timestamp: 2025-09-02T10:05:34.323Z
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.
📚 Learning: 2025-08-18T12:25:29.183Z
Learnt from: akaladarshi
PR: ChainSafe/forest#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/tool/subcommands/api_cmd/api_compare_tests.rs
🧬 Code graph analysis (1)
src/tool/subcommands/api_cmd/api_compare_tests.rs (2)
src/rpc/methods/f3/types.rs (1)
  • fvm_ipld_encoding (366-366)
src/rpc/methods/eth.rs (1)
  • fvm_ipld_encoding (2216-2216)
⏰ 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). (9)
  • GitHub Check: Build forest binaries on Linux AMD64
  • GitHub Check: Build MacOS
  • GitHub Check: cargo-publish-dry-run
  • GitHub Check: Build Ubuntu
  • GitHub Check: All lint checks
  • GitHub Check: tests-release
  • GitHub Check: tests
  • GitHub Check: Analyze (go)
  • GitHub Check: Analyze (rust)
🔇 Additional comments (1)
src/tool/subcommands/api_cmd/api_compare_tests.rs (1)

51-52: Good: using fvm_ipld_encoding::to_vec with BytesDe/RawBytes + Randomness import

These imports match how other actors’ params are encoded and decoded and align with Lotus JSON expectations. LGTM.

Comment on lines +206 to +252
filecoin_miner_statedecodeparams_1755027105572938.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105574122.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105572592.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105571946.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105572651.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105573459.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105572243.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105571696.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105571495.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105573001.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105573661.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105571571.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105573918.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105572064.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105572883.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105573850.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105572769.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105574051.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105572713.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105572370.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105570743.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105573531.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105572301.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105573598.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105571436.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105573060.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105573181.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105572123.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105572829.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105571639.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105573296.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105572425.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105573241.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105572483.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105573120.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105571826.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105571367.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105571884.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105573789.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105572003.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105571288.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105573724.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105572183.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105572538.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105573353.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105571760.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105573989.rpcsnap.json.zst
Copy link
Contributor

@coderabbitai coderabbitai bot Sep 2, 2025

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

47 miner StateDecodeParams snapshots inserted — verify presence and monotonic ordering

The placement between the last verified_reg and the first ethaccount entry looks consistent (timestamps ascend). Please verify all 47 files are present in the repo and there are no duplicates/missing entries.

Run:


🏁 Script executed:

#!/bin/bash
# Count lines listed in the manifest
listed=$(rg -n '^filecoin_miner_statedecodeparams_.*\.rpcsnap\.json\.zst$' src/tool/subcommands/api_cmd/test_snapshots.txt | wc -l)
echo "Listed miner snapshots: $listed (expect 47)"

# Ensure files exist somewhere in the repo (paths may vary)
found=$(fd -a 'filecoin_miner_statedecodeparams_*.rpcsnap.json.zst' | wc -l)
echo "Files found in repo: $found"

# Show any duplicates in the manifest by filename
rg '^filecoin_miner_statedecodeparams_.*\.rpcsnap\.json\.zst$' src/tool/subcommands/api_cmd/test_snapshots.txt \
  | awk '{print $1}' | sort | uniq -d

Length of output: 510


Missing miner StateDecodeParams snapshots
The manifest at src/tool/subcommands/api_cmd/test_snapshots.txt lists 47 .rpcsnap.json.zst files, but none were found in the repository. Add the missing snapshot files under the correct path or update the manifest entries.

🤖 Prompt for AI Agents
In src/tool/subcommands/api_cmd/test_snapshots.txt around lines 206-252 the
manifest lists 47 filecoin_miner_statedecodeparams_*.rpcsnap.json.zst snapshot
entries that are missing from the repository; either add the corresponding
.rpcsnap.json.zst files under src/tool/subcommands/api_cmd (or the correct
snapshots directory) with the exact filenames listed, or remove/update the
manifest entries to reflect only files that actually exist (and commit the
changes). Ensure paths and filenames match exactly and run the test/snapshot
verification to confirm the manifest and repo are in sync.

Copy link
Collaborator Author

@akaladarshi akaladarshi Sep 2, 2025

Choose a reason for hiding this comment

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

All the .rpcsnap.json.zst files are downloaded from the DO(Digital Ocean) bucket not present in the repository

Copy link
Contributor

Choose a reason for hiding this comment

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

@akaladarshi Thank you for the clarification! That makes perfect sense. The manifest file serves as an index of available snapshots stored externally in the DigitalOcean bucket, which is downloaded on-demand rather than being committed to the repository. This is a smart approach to keep the repository size manageable while still maintaining a comprehensive test dataset.

The addition of 47 miner StateDecodeParams snapshots to the manifest looks good and properly integrates the new miner actor support with the existing test infrastructure.


✏️ Learnings added
Learnt from: akaladarshi
PR: ChainSafe/forest#5923
File: src/tool/subcommands/api_cmd/test_snapshots.txt:206-252
Timestamp: 2025-09-02T14:23:53.766Z
Learning: In the Forest project, .rpcsnap.json.zst snapshot files listed in src/tool/subcommands/api_cmd/test_snapshots.txt are not stored in the repository itself but are downloaded from a DigitalOcean (DO) bucket when needed. The manifest file serves as an index/catalog of available snapshots.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: akaladarshi
PR: ChainSafe/forest#5923
File: src/rpc/registry/actors/miner.rs:221-223
Timestamp: 2025-09-02T10:05:34.323Z
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.

@akaladarshi akaladarshi added this pull request to the merge queue Sep 2, 2025
Merged via the queue into main with commit 6ae1408 Sep 2, 2025
44 checks passed
@akaladarshi akaladarshi deleted the akaladarshi/add-miner-actor-state-decode-param branch September 2, 2025 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

RPC requires calibnet RPC checks to run on CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for the Miner actor state in Filecoin.StateDecodeParams API

4 participants