-
Notifications
You must be signed in to change notification settings - Fork 182
feat: add support for miner actor in state decode params API #5923
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add support for miner actor in state decode params API #5923
Conversation
WalkthroughRemoved 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
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
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Assessment against linked issues
Possibly related PRs
Suggested reviewers
✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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.
StateDecodeParamsfor 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_14for clarity. No functional impact.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 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 tominer_actormodule looks good.Replacing the split miner-specific modules with a single
miner_actormodule 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_testskeepsstate_decode_params_api_testsfocused and more maintainable.
abe3c09 to
f423560
Compare
There was a problem hiding this 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 arbitrarynew_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 macroThe 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
📒 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 usageBringing BytesDe, RawBytes, and Randomness into scope is correct and matches the v16 Miner params you construct below.
107-108: Doc grammar tweak looks goodMinor nit fixed; no action needed.
2145-2146: Good: Miner state decode tests are now wired into the suiteExtending 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–v15were found inapi_compare_tests.rsaround lines 2319–2327 or 2550–2563.- The
Methodenum is correctly imported fromfil_actor_miner_state::v16.All referenced miner constructor and internal-sector parameters are aligned with v16.
There was a problem hiding this 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
encodehelper: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>) -> RpcTestto avoid repeating theStateDecodeParams::requestboilerplate.- Optionally, add a version switch: detect miner actor code CID at
tipsetand 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.
📒 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, andRandomnessare 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; returnsResultand uses?with the surroundinganyhow::Result, so errors will surface appropriately.
2360-2363: Correct type for multiaddrs: usingBytesDeis appropriate.
ChangeMultiaddrsParamsexpects raw multiaddresses; wrapping asVec<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.Randomnessis 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
Randomnessconstructions and propose consistent fixes?
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this 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.
📒 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
There was a problem hiding this 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 quirksUsing [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 expectationsMany 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 sizesPaddedPieceSize(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 sizeUse 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 v16These 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 testsThe 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.
📒 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 RandomnessBytesDe/RawBytes/to_vec and Randomness imports are appropriate for the new miner decode tests.
43590f4
There was a problem hiding this 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 -C3If 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.
📒 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 importThese imports match how other actors’ params are encoded and decoded and align with Lotus JSON expectations. LGTM.
| 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 |
There was a problem hiding this comment.
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 -dLength 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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
Summary of changes
Changes introduced in this pull request:
Reference issue to close (if applicable)
Closes: #5722
Other information and links
Change checklist
Summary by CodeRabbit
New Features
Refactor
Tests
Chores