-
Notifications
You must be signed in to change notification settings - Fork 182
Add support for market actor in StateDecodeParams API
#5933
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
Conversation
WalkthroughAdds Lotus JSON (de)serialization types for Market actor params (v8–v17), a PaddedPieceSize JSON wrapper and test macro, registers Market actor RPC methods across versions, extends API decode-params tests and snapshots for Market methods, and adds a RegisteredSealProof::invalid() shim constructor. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Client as Client
participant RPC as RPC Layer
participant MR as MethodRegistry
participant Reg as Market Registry
participant LJ as LotusJson Conversions
participant State as Versioned State (v8–v17)
Client->>RPC: send method request (cid, version, params JSON)
RPC->>MR: dispatch(cid, version, method)
MR->>Reg: route to market.register_actor_methods
Reg->>LJ: JSON -> versioned params (v8..v17)
LJ-->>Reg: typed params
Reg->>State: invoke versioned handler with params
State-->>Reg: typed result
Reg->>LJ: result -> JSON
LJ-->>Reg: JSON result
Reg-->>MR: return response
MR-->>RPC: forward response
RPC-->>Client: JSON response
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60–90 minutes Possibly related PRs
Suggested reviewers
Pre-merge checks (2 passed, 1 warning)❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing Touches
🧪 Generate unit tests
Comment |
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: 4
🧹 Nitpick comments (15)
src/shim/sector.rs (1)
138-142: Make invalid() a const (and consider crate-private).Const enables usage in statics and avoids runtime cost. If this is only for internals/tests, prefer
pub(crate)to reduce accidental use.-impl RegisteredSealProof { - pub fn invalid() -> Self { - RegisteredSealProof(RegisteredSealProofV4::Invalid(0)) - } -} +impl RegisteredSealProof { + pub const fn invalid() -> Self { + RegisteredSealProof(RegisteredSealProofV4::Invalid(0)) + } +}src/rpc/registry/methods_reg.rs (1)
97-97: Add Market to the supported-actors test to prevent regressions.Extend the test matrix so we catch gaps if future refactors miss Market method registration.
let supported_actors = vec![ BuiltinActor::Account, BuiltinActor::Miner, BuiltinActor::EVM, BuiltinActor::Cron, BuiltinActor::DataCap, + BuiltinActor::Market, ];src/lotus_json/padded_piece_size.rs (2)
7-10: Consider marking the wrapper as serde-transparent.Add #[serde(transparent)] to guarantee newtype passthrough semantics and avoid any accidental nesting if serde derives change in the future.
-#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, JsonSchema)] +#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, JsonSchema)] +#[serde(transparent)] pub struct PaddedPieceSizeLotusJson(#[schemars(with = "u64")] PaddedPieceSize);
14-17: Add minimal snapshots to lock in JSON as a plain number.Right now snapshots() returns an empty vec. Add at least one sample (e.g., 2048) to catch regressions in encoding/decoding.
#[cfg(test)] fn snapshots() -> Vec<(serde_json::Value, Self)> { - vec![] + vec![ + (json!(0u64), PaddedPieceSize(0)), + (json!(2048u64), PaddedPieceSize(2048)), + ] }src/rpc/registry/actors/market.rs (1)
177-190: Dispatch covers v8–v16; consider logging for unknown versions.Match arms look correct. Optionally log a trace on the default branch to aid debugging when encountering unexpected versions.
- _ => {} + _ => { + tracing::trace!(version, "market: no methods registered for unknown actor version"); + }src/lotus_json/actor_states/methods/miner_actor_params.rs (2)
3713-3741: Optional: add snapshots for PieceChange to validate CID/size/payload.Providing at least one non-empty example will guard against regressions in PaddedPieceSize mapping and RawBytes handling.
#[cfg(test)] fn snapshots() -> Vec<(serde_json::Value, Self)> { - vec![ - ] + let cid = Cid::try_from("bafy2bzacedu6q2cpk2t7c6gk7m2wkfpfb4v6qzjvkg3gq6m7k6c3r5h7lxy").unwrap(); + vec![( + json!({ + "Data": "bafy2bzacedu6q2cpk2t7c6gk7m2wkfpfb4v6qzjvkg3gq6m7k6c3r5h7lxy", + "Size": 2048, + "Payload": "AQID" + }), + Self { + data: cid, + size: fvm_shared4::piece::PaddedPieceSize(2048).into(), + payload: RawBytes::new(vec![1,2,3]), + }, + )] }
3766-3790: Optional: add snapshots for SectorChanges/SectorContentChangedParams.One end-to-end example (with a single added PieceChange) would exercise nested mappings and the new PaddedPieceSize LotusJson wrapper.
src/tool/subcommands/api_cmd/api_compare_tests.rs (3)
3432-3434: Rename misleading var: it’s used by both AddBalanceExported and GetBalanceExported.
market_actor_get_balance_exported_paramsholds a generic Address and is used for AddBalanceExported too. Rename to avoid confusion.- let market_actor_get_balance_exported_params = Address::new_id(1000); + let market_actor_address_param = Address::new_id(1000); @@ - to_vec(&market_actor_get_balance_exported_params)?, + to_vec(&market_actor_address_param)?, @@ - to_vec(&market_actor_get_balance_exported_params)?, + to_vec(&market_actor_address_param)?,Also applies to: 3508-3512, 3526-3530
3330-3373: Minor: prefer u64 literals for atto amounts to avoid implicit narrowing.
TokenAmount::from_atto(10u8)works but reads odd. Use10u64for clarity/consistency across the file.
3471-3494: Document the TODOs with upstream issue links in code comments.You already reference go-state-types issues—add a brief rationale inline so future readers know why tests are gated.
Also applies to: 3496-3506
src/lotus_json/actor_states/methods/miner_change_worker_params.rs (1)
76-88: Schema/serde consistency: payload uses RawBytes here (vs Vec in market).Assuming miner PieceChange truly uses RawBytes (and market’s ext uses Vec), this divergence is correct. If intentional, consider a brief comment to prevent future “deduplicate” attempts.
src/lotus_json/actor_states/methods/market_actor_params.rs (4)
674-689: Lotus field naming: DealIDs vs DealIds.You’ve correctly used DealIDs here (and DealIds elsewhere where Lotus uses that spelling). Add a short comment noting Lotus’ inconsistency to avoid “fixing” it later.
1450-1454: BitField snapshot is inconsistent with constructed value.Snapshot JSON shows
[0]but the constructedBitField::new()is empty. Align them to avoid brittle tests.- serde_json::json!([0]), - Self { deal_ids: BitField::new() } + serde_json::json!([]), + Self { deal_ids: BitField::new() }Or, if you want
[0]in JSON, set the bit:+ let mut bf = BitField::new(); + bf.set(0); - Self { deal_ids: BitField::new() } + Self { deal_ids: bf }Also applies to: 1463-1481
301-327: Signature type per version looks right; add a unit snapshot for BLS too.You cover Secp256k1; consider adding a BLS snapshot to catch cross-version serde differences early.
Also applies to: 328-405
1300-1336: Nit: Consistent JSON keys for SectorDataSpec and ComputeDataCommitmentParams.You intentionally use “DealIds” here (PascalCase) vs “DealIDs” elsewhere. Add inline comments to document Lotus API expectations to deter accidental renames.
Also applies to: 1354-1398
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (11)
src/lotus_json/actor_states/methods/market_actor_params.rs(1 hunks)src/lotus_json/actor_states/methods/miner_actor_params.rs(3 hunks)src/lotus_json/actor_states/methods/miner_change_worker_params.rs(1 hunks)src/lotus_json/actor_states/methods/mod.rs(1 hunks)src/lotus_json/mod.rs(2 hunks)src/lotus_json/padded_piece_size.rs(1 hunks)src/rpc/registry/actors/market.rs(1 hunks)src/rpc/registry/actors/mod.rs(1 hunks)src/rpc/registry/methods_reg.rs(2 hunks)src/shim/sector.rs(1 hunks)src/tool/subcommands/api_cmd/api_compare_tests.rs(2 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: akaladarshi
PR: ChainSafe/forest#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.
📚 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/lotus_json/actor_states/methods/market_actor_params.rssrc/lotus_json/actor_states/methods/miner_change_worker_params.rssrc/lotus_json/actor_states/methods/miner_actor_params.rs
📚 Learning: 2025-09-02T10:05:34.350Z
Learnt from: akaladarshi
PR: ChainSafe/forest#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/actor_states/methods/miner_change_worker_params.rssrc/lotus_json/actor_states/methods/miner_actor_params.rs
📚 Learning: 2025-08-14T06:46:08.056Z
Learnt from: akaladarshi
PR: ChainSafe/forest#5923
File: src/rpc/registry/actors/miner.rs:0-0
Timestamp: 2025-08-14T06:46:08.056Z
Learning: ProveCommitSectors3 method is available in fil_actor_miner_state::v13 and should be mapped to ProveCommitSectors3Params, not ProveCommitSectorParams.
Applied to files:
src/lotus_json/actor_states/methods/miner_actor_params.rs
🧬 Code graph analysis (5)
src/rpc/registry/methods_reg.rs (1)
src/rpc/registry/actors/market.rs (1)
register_actor_methods(177-190)
src/lotus_json/padded_piece_size.rs (1)
src/lotus_json/mod.rs (17)
snapshots(147-147)snapshots(566-568)snapshots(580-582)snapshots(597-599)snapshots(621-623)serde_json(301-301)serde_json(325-325)into_lotus_json(148-148)into_lotus_json(569-571)into_lotus_json(583-585)into_lotus_json(600-606)into_lotus_json(624-631)from_lotus_json(149-149)from_lotus_json(572-574)from_lotus_json(586-591)from_lotus_json(607-613)from_lotus_json(632-639)
src/tool/subcommands/api_cmd/api_compare_tests.rs (4)
src/shim/address.rs (3)
default(122-124)new_id(142-144)new_bls(150-152)src/shim/econ.rs (1)
from_atto(106-108)src/shim/crypto.rs (1)
new_bls(77-82)src/blocks/tipset.rs (4)
new(242-260)new(494-511)key(336-339)key(530-533)
src/lotus_json/actor_states/methods/market_actor_params.rs (4)
src/shim/address.rs (1)
new_id(142-144)src/lotus_json/mod.rs (17)
snapshots(147-147)snapshots(566-568)snapshots(580-582)snapshots(597-599)snapshots(621-623)serde_json(301-301)serde_json(325-325)into_lotus_json(148-148)into_lotus_json(569-571)into_lotus_json(583-585)into_lotus_json(600-606)into_lotus_json(624-631)from_lotus_json(149-149)from_lotus_json(572-574)from_lotus_json(586-591)from_lotus_json(607-613)from_lotus_json(632-639)src/shim/econ.rs (1)
from_atto(106-108)src/shim/sector.rs (13)
from(108-110)from(191-197)from(212-214)from(255-257)from(261-264)from(268-271)from(275-277)from(281-284)from(288-291)from(379-384)invalid(139-141)new(170-180)new(362-367)
src/lotus_json/mod.rs (11)
src/rpc/methods/chain.rs (1)
assert_all_snapshots(1101-1101)src/blocks/tipset.rs (1)
assert_all_snapshots(689-689)src/lotus_json/ipld.rs (1)
assert_all_snapshots(274-274)src/lotus_json/allocation.rs (1)
assert_all_snapshots(87-87)src/lotus_json/bit_field.rs (1)
assert_all_snapshots(41-41)src/lotus_json/miner_info.rs (1)
assert_all_snapshots(158-158)src/lotus_json/receipt.rs (1)
assert_all_snapshots(90-90)src/lotus_json/power_claim.rs (1)
assert_all_snapshots(55-55)src/lotus_json/beneficiary_term.rs (1)
assert_all_snapshots(58-58)src/lotus_json/pending_beneficiary_change.rs (1)
assert_all_snapshots(70-70)src/lotus_json/raw_bytes.rs (1)
assert_all_snapshots(9-9)
⏰ 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: Build Ubuntu
- GitHub Check: Build MacOS
- GitHub Check: cargo-publish-dry-run
- GitHub Check: tests
- GitHub Check: tests-release
- GitHub Check: Build forest binaries on Linux AMD64
- GitHub Check: All lint checks
🔇 Additional comments (8)
src/rpc/registry/methods_reg.rs (1)
77-79: LGTM: market module import.This wires Market actor into the registry surface.
src/rpc/registry/actors/mod.rs (1)
11-11: LGTM: expose Market actor registry module.Module presence matches usage in the central registry.
src/lotus_json/actor_states/methods/mod.rs (1)
14-14: LGTM: include market_actor_params.This is the right place to stage Market param Lotus JSON bridges.
src/lotus_json/mod.rs (1)
234-234: No duplicate HasLotusJson impl for PaddedPieceSize. Only oneimpl HasLotusJson for PaddedPieceSizeexists insrc/lotus_json/padded_piece_size.rs, so there’s no conflicting implementation.src/rpc/registry/actors/market.rs (1)
111-126: LGTM: v8–v9 basic method coverage is complete.AddBalance, WithdrawBalance, PublishStorageDeals, VerifyDealsForActivation, OnMinerSectorsTerminate, plus Constructor/CronTick registration looks correct for pre-exported eras.
src/lotus_json/actor_states/methods/miner_actor_params.rs (1)
3699-3711: LGTM: PieceChange Lotus JSON wiring aligns with existing conventions.Fields use LotusJson for Cid, PaddedPieceSize, and RawBytes; conversions are consistent.
src/tool/subcommands/api_cmd/api_compare_tests.rs (1)
1905-1905: Good call: wire Market actor decode-params tests into the suite.This expands coverage meaningfully and stays consistent with the existing pattern.
src/lotus_json/actor_states/methods/market_actor_params.rs (1)
582-673: Alias resolution suggestion not applicable: noGetDeal*Paramstypes exist in the codebase.Likely an incorrect or invalid review comment.
src/lotus_json/actor_states/methods/miner_change_worker_params.rs
Outdated
Show resolved
Hide resolved
bbc1579 to
02b1560
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: 7
🧹 Nitpick comments (3)
src/tool/subcommands/api_cmd/api_compare_tests.rs (2)
3330-3373: Helper builders: OK; minor nit on tiny TokenAmount literalsUsing TokenAmount::from_atto(10u8) works but is a bit odd next to other u64 literals. Consider u64 for consistency.
- fvm_shared4::econ::TokenAmount::from_atto(10u8), + fvm_shared4::econ::TokenAmount::from_atto(10u64),
3597-3602: BitField setup for SettleDealPaymentsExportedUsing a BitField with bit 42 set is fine. Consider adding another case with multiple ranges to catch encoding edge cases later.
src/lotus_json/actor_states/methods/market_actor_params.rs (1)
1517-1579: SectorContentChangedParams mappingsThe ext::miner wrapper looks consistent. Consider adding a non-empty snapshot with multiple PieceChange entries later to harden coverage.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/lotus_json/actor_states/methods/market_actor_params.rs(1 hunks)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#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.
📚 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/lotus_json/actor_states/methods/market_actor_params.rs
🧬 Code graph analysis (2)
src/tool/subcommands/api_cmd/api_compare_tests.rs (4)
src/shim/address.rs (3)
default(122-124)new_id(142-144)new_bls(150-152)src/shim/econ.rs (1)
from_atto(106-108)src/shim/crypto.rs (1)
new_bls(77-82)src/blocks/tipset.rs (4)
new(242-260)new(494-511)key(336-339)key(530-533)
src/lotus_json/actor_states/methods/market_actor_params.rs (3)
src/shim/address.rs (1)
new_id(142-144)src/lotus_json/mod.rs (17)
snapshots(147-147)snapshots(566-568)snapshots(580-582)snapshots(597-599)snapshots(621-623)serde_json(301-301)serde_json(325-325)into_lotus_json(148-148)into_lotus_json(569-571)into_lotus_json(583-585)into_lotus_json(600-606)into_lotus_json(624-631)from_lotus_json(149-149)from_lotus_json(572-574)from_lotus_json(586-591)from_lotus_json(607-613)from_lotus_json(632-639)src/shim/sector.rs (13)
from(108-110)from(191-197)from(212-214)from(255-257)from(261-264)from(268-271)from(275-277)from(281-284)from(288-291)from(379-384)invalid(139-141)new(170-180)new(362-367)
⏰ 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: Build forest binaries on Linux AMD64
- GitHub Check: tests
- GitHub Check: tests-release
- GitHub Check: Snapshot export checks v2 with F3 data
- GitHub Check: Snapshot export checks
- GitHub Check: Calibnet no discovery checks
- GitHub Check: Calibnet check
🔇 Additional comments (8)
src/tool/subcommands/api_cmd/test_snapshots.txt (1)
93-113: Remove local snapshot file presence check — entries are manifest-only
Snapshot files listed in test_snapshots.txt aren’t committed to the repo but are fetched from the DigitalOcean bucket via the manifest; no need to verify local file existence.Likely an incorrect or invalid review comment.
src/tool/subcommands/api_cmd/api_compare_tests.rs (3)
1903-1906: Wire-up of market decode tests is correctHooking market_actor_state_decode_params_tests into state_decode_params_api_tests broadens coverage as intended. LGTM.
3513-3524: AddBalanceExported params use Address — correct for FRC-42 exportPassing Address for AddBalanceExported matches Lotus’ exported signature. LGTM.
3531-3566: Deal-query exported methods reuse DealQueryParams — good reuseReusing DealQueryParams across all GetDeal*Exported variants is correct and keeps the tests lean. LGTM.
src/lotus_json/actor_states/methods/market_actor_params.rs (4)
173-187: DealProposalLotusJson mappings look correctPieceCID rename, PaddedPieceSize wrapper, and TokenAmount fields align with Lotus expectations. LGTM.
115-121: Label untagged enum is correct and version-agnosticThe untagged String/Bytes representation matches Lotus. Good choice.
690-830: SectorDeals cross-version handling is careful and sensibleDefaulting absent sector_type/number appropriately and using RegisteredSealProof::invalid() for missing values is pragmatic across v8–v16. LGTM.
1581-1608: Snapshot coverage is comprehensiveGreat breadth across v8–v16, including exported methods. This should catch most regressions.
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 (3)
src/rpc/registry/actors/market.rs (3)
4-4: Alias the macro to avoid name confusion with the local fn of the same identifier.Having both a macro and a function named
register_actor_methodsin scope is legal but easy to misread. Alias the macro and invoke the alias throughout this module.Apply:
-use crate::rpc::registry::methods_reg::{MethodRegistry, register_actor_methods}; +use crate::rpc::registry::methods_reg::{MethodRegistry, register_actor_methods as register_methods};Then replace all invocations:
- register_actor_methods!( + register_methods!((Repeat for all occurrences in this file.)
89-109: Slight import clarity tweak for nestedext::minerpath.Split the nested import to make the scope explicit and reduce chances of future merge conflicts.
- use $market_state_version::{ - GetDealSectorParams, Method, SettleDealPaymentsParams, - ext::miner::SectorContentChangedParams, - }; + use $market_state_version::{GetDealSectorParams, Method, SettleDealPaymentsParams}; + use $market_state_version::ext::miner::SectorContentChangedParams;
177-191: Log on unknown/unsupported version to aid diagnostics.A silent no-op on
_ => {}can hide misconfigurations. Emit a low-level log.- _ => {} + _ => { + tracing::debug!(%version, actor_code = %cid, "Market actor version not handled; no method registrations performed"); + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/lotus_json/actor_states/methods/market_actor_params.rs(1 hunks)src/rpc/registry/actors/market.rs(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- src/lotus_json/actor_states/methods/market_actor_params.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). (7)
- GitHub Check: All lint checks
- GitHub Check: tests
- GitHub Check: cargo-publish-dry-run
- GitHub Check: tests-release
- GitHub Check: Build Ubuntu
- GitHub Check: Build MacOS
- GitHub Check: Build forest binaries on Linux AMD64
🔇 Additional comments (5)
src/rpc/registry/actors/market.rs (5)
9-41: Basic methods set looks correct and clearly grouped.Constructor/CronTick registered as empty; core params wired per version module. No issues spotted.
43-87: Exported methods v10+: solid mapping; param types look right.Notably,
GetBalanceExportedtakingAddressmatches expectations; others reuse the corresponding params. Good.
111-126: v8–v9 additions LGTM.
ActivateDealsandComputeDataCommitmentare registered alongside basics for these versions. Looks consistent.
128-145: v10–v11 set is consistent with v8–v9 plus exported block.No concerns.
161-175: Double-check v13+ method surface for any lingeringComputeDataCommitmentvariant.If
ComputeDataCommitmentpersists beyond v12, add it here as well; otherwise current set is fine.Patch if needed:
- use $market_state_version::{BatchActivateDealsParams, Method}; + use $market_state_version::{BatchActivateDealsParams, ComputeDataCommitmentParams, Method}; register_actor_methods!( $registry, $code_cid, - [(Method::BatchActivateDeals, BatchActivateDealsParams),] + [ + (Method::BatchActivateDeals, BatchActivateDealsParams), + (Method::ComputeDataCommitment, ComputeDataCommitmentParams), + ] );
81c1f4b to
15083d0
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
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/actor_states/methods/market_actor_params.rs (1)
1566-1593: Add missing HasLotusJson impls for all GetDeal*Params
Thetest_snapshots!calls at the end of market_actor_params.rs reference these types, but there are no correspondingimpl HasLotusJson for fil_actor_market_state::vX::GetDeal…Params. You must add conversion implementations (e.g. via a new macro or explicitimpl HasLotusJsonblocks) for each of:
- GetDealActivationParams
- GetDealClientCollateralParams
- GetDealClientParams
- GetDealDataCommitmentParams
- GetDealLabelParams
- GetDealProviderCollateralParams
- GetDealProviderParams
- GetDealTermParams
- GetDealTotalPriceParams
- GetDealVerifiedParams
- GetDealSectorParams
♻️ Duplicate comments (2)
src/lotus_json/actor_states/methods/market_actor_params.rs (2)
14-18: Fix: bring serde_json::json! into scope (compilation blocker).Unqualified
json!is used in several snapshots but the macro isn’t imported. Add the import (or fully-qualify each call).Apply at the top of the file:
use schemars::JsonSchema; use serde::{Deserialize, Serialize}; +use serde_json::json; use std::fmt::Debug;Also applies to: 81-85, 422-447, 504-526, 586-610
1424-1431: Empty BitField snapshot should be [] (not [0]).
[0]encodes bit 0 set; an empty BitField should serialize to an empty array.- ( - serde_json::json!([0]), - Self { deal_ids: BitField::new() } - ), + ( + serde_json::json!([]), + Self { deal_ids: BitField::new() } + ),
🧹 Nitpick comments (1)
src/lotus_json/actor_states/methods/market_actor_params.rs (1)
411-491: Optional: deduplicate PublishStorageDeals snapshots.The V2/V3/V4 snapshot blocks share most JSON; only the signature type differs. Consider extracting a tiny helper to build the common JSON/value pair to reduce duplication and future drift.
I can propose a small local function under
#[cfg(test)]returning the shared tuple, parameterized by the signature.Also applies to: 493-573, 575-655
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/lotus_json/actor_states/methods/market_actor_params.rs(1 hunks)src/rpc/registry/actors/market.rs(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- src/rpc/registry/actors/market.rs
🧰 Additional context used
🧠 Learnings (3)
📚 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/lotus_json/actor_states/methods/market_actor_params.rs
📚 Learning: 2025-09-02T08:44:08.346Z
Learnt from: akaladarshi
PR: ChainSafe/forest#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/actor_states/methods/market_actor_params.rs
📚 Learning: 2025-09-02T08:46:04.937Z
Learnt from: akaladarshi
PR: ChainSafe/forest#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/actor_states/methods/market_actor_params.rs
🧬 Code graph analysis (1)
src/lotus_json/actor_states/methods/market_actor_params.rs (5)
src/shim/address.rs (1)
new_id(142-144)src/lotus_json/mod.rs (17)
snapshots(147-147)snapshots(566-568)snapshots(580-582)snapshots(597-599)snapshots(621-623)serde_json(301-301)serde_json(325-325)into_lotus_json(148-148)into_lotus_json(569-571)into_lotus_json(583-585)into_lotus_json(600-606)into_lotus_json(624-631)from_lotus_json(149-149)from_lotus_json(572-574)from_lotus_json(586-591)from_lotus_json(607-613)from_lotus_json(632-639)src/lotus_json/actor_states/methods/miner_actor_params.rs (33)
snapshots(797-811)snapshots(1152-1186)snapshots(1279-1290)snapshots(1403-1417)snapshots(1532-1546)snapshots(1679-1691)snapshots(1752-1762)snapshots(2005-2041)snapshots(2566-2578)snapshots(3085-3106)snapshots(3277-3301)into_lotus_json(813-819)into_lotus_json(1188-1207)into_lotus_json(1292-1297)into_lotus_json(1419-1425)into_lotus_json(1548-1554)into_lotus_json(1693-1701)into_lotus_json(1764-1771)into_lotus_json(2043-2062)into_lotus_json(2580-2588)into_lotus_json(3108-3124)into_lotus_json(3303-3316)from_lotus_json(821-827)from_lotus_json(1209-1231)from_lotus_json(1299-1304)from_lotus_json(1427-1433)from_lotus_json(1556-1562)from_lotus_json(1703-1708)from_lotus_json(1773-1777)from_lotus_json(2064-2083)from_lotus_json(2590-2595)from_lotus_json(3126-3139)from_lotus_json(3318-3328)src/shim/econ.rs (1)
from_atto(106-108)src/shim/sector.rs (13)
from(108-110)from(191-197)from(212-214)from(255-257)from(261-264)from(268-271)from(275-277)from(281-284)from(288-291)from(379-384)invalid(139-141)new(170-180)new(362-367)
⏰ 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: Build forest binaries on Linux AMD64
- GitHub Check: Build Ubuntu
- GitHub Check: Build MacOS
- GitHub Check: cargo-publish-dry-run
- GitHub Check: tests
- GitHub Check: All lint checks
- GitHub Check: tests-release
🔇 Additional comments (7)
src/lotus_json/actor_states/methods/market_actor_params.rs (7)
20-29: WithdrawBalance params mapping looks correct.Field rename to “ProviderOrClientAddress” and TokenAmount mapping match Lotus JSON.
31-37: Tuple newtype for AddBalance is appropriate.Lotus expects a bare address; tuple struct keeps encoding minimal.
111-116: Label untagged enum matches Lotus (string-or-bytes) behavior.Good use of
#[serde(untagged)].
152-181: DealProposal Lotus JSON shape LGTM.
- Correct “PieceCID” rename.
- PaddedPieceSize and TokenAmount conversions are wired properly.
657-672: SectorDealsLotusJson keys align with Lotus.Optional SectorNumber/SectorType with DealIDs rename is correct.
718-761: Defaulting SectorType to invalid() on deserialize—confirm intent.For v9–v12,
from_lotus_jsonusesunwrap_or(RegisteredSealProof::invalid()). Verify that “missing SectorType” should round-trip toInvalid(0)rather than error.Would you prefer to treat missing SectorType as an error for these versions?
1183-1233: BitField JSON form in snapshots—confirm consistency across modules.Here, V13
OnMinerSectorsTerminateParamssnapshot encodesSectorsas[1, 1], while miner actor snapshots sometimes use a base64 string. Ensure the crate’sLotusJson<BitField>intentionally supports both and that tests reflect the canonical form you want to enforce.If you want a single canonical encoding across snapshots, I can generate a patch to standardize them.
Summary of changes
Changes introduced in this pull request:
StateDecodeParamstests for market actorReference issue to close (if applicable)
Closes: #5723
Other information and links
Change checklist
Summary by CodeRabbit
New Features
Tests