Skip to content

Enable strict json check in api compare#6970

Open
sudo-shashank wants to merge 26 commits intomainfrom
shashank/enable-strict-json-api
Open

Enable strict json check in api compare#6970
sudo-shashank wants to merge 26 commits intomainfrom
shashank/enable-strict-json-api

Conversation

@sudo-shashank
Copy link
Copy Markdown
Contributor

@sudo-shashank sudo-shashank commented Apr 28, 2026

Summary of changes

Changes introduced in this pull request:

  • Set FOREST_STRICT_JSON=1 for all api compare check.

  • Fix the unknown field error found in the below methods:

    • Filecoin.ChainGetBlockMessages
    • Filecoin.ChainGetMessagesInTipset
    • Filecoin.ChainGetParentMessages
    • Filecoin.MpoolPending
    • Filecoin.StateCall
    • Filecoin.StateGetNetworkParams
    • Filecoin.StateReplay
    • Filecoin.StateCompute
    • Filecoin.Version
  • Updated Filecoin.StateCall, Filecoin.StateReplay and Filecoin.StateCompute test snapshots because ExecutionTrace now includes Logs and IpldOps, which earlier snapshots did not capture.

  • Updated Filecoin.StateGetNetworkParams test snapshot because NetworkParams now includes GenesisTimestamp.

Reference issue to close (if applicable)

Closes #5635

Other information and links

Change checklist

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

Outside contributions

  • I have read and agree to the CONTRIBUTING document.
  • I have read and agree to the AI Policy document. I understand that failure to comply with the guidelines will lead to rejection of the pull request.

Summary by CodeRabbit

  • New Features

    • Messages include an optional CID and use Base64 params (default null).
    • Execution traces now include Logs and IPLD operation arrays; new IPLD trace types added.
    • NetworkParams now requires GenesisTimestamp; PublicVersion requires Agent.
    • ForkUpgradeParams now requires UpgradeFireHorseHeight.
  • Refactor

    • RPCs return Message directly instead of a flattened wrapper.
  • Tests / Other

    • API-compare tightened and test snapshots updated; test env tightened.

@sudo-shashank sudo-shashank added the RPC requires calibnet RPC checks to run on CI label Apr 28, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 28, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 17d31c6a-988a-4aee-a7a7-4be8d12b6a48

📥 Commits

Reviewing files that changed from the base of the PR and between 9152064 and 6bcc649.

📒 Files selected for processing (3)
  • src/rpc/methods/chain.rs
  • src/rpc/methods/eth.rs
  • src/rpc/methods/state.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/rpc/methods/state.rs

Walkthrough

Replace FlattenedApiMessage with Message across OpenRPC and Rust surfaces; add CID to Message and make Params Base64String default to null. Extend ExecutionTrace with IpldOps and Logs; add NetworkParams.GenesisTimestamp, PublicVersion.Agent, ForkUpgradeParams.UpgradeFireHorseHeight; enable FOREST_STRICT_JSON for api-compare tests.

Changes

Schema & Runtime shape → wiring → tests

Layer / File(s) Summary
OpenRPC schema (Data Shape)
docs/openrpc-specs/v0.json, docs/openrpc-specs/v1.json
Swap method result schemas from FlattenedApiMessageMessage. Remove FlattenedApiMessage and Nullable_Base64String. Add Message.CID (Nullable_Cid) and change Message.Params to Base64String with default: null. Add TraceIpld / TraceIpldOp. Add ExecutionTrace.IpldOps and Logs. Add required NetworkParams.GenesisTimestamp. Add PublicVersion.Agent. Add required ForkUpgradeParams.UpgradeFireHorseHeight.
Core types & JSON surface (Data Shape → Core Impl)
src/rpc/methods/state/types.rs, src/lotus_json/message.rs, src/lotus_json/signed_message.rs
Introduce TraceIpldOp enum and TraceIpld struct; extend ExecutionTrace with logs: Vec<String> and ipld_ops: Vec<TraceIpld> (serde defaults, skip when empty). MessageLotusJson.params changed from Option<RawBytes>RawBytes with serde default; add optional cid: Option<Cid> serialized as CID. Update SignedMessage snapshot to include nested CID.
RPC surface & wiring (Integration)
src/rpc/methods/chain.rs, src/rpc/methods/gas.rs, src/rpc/methods/common.rs, src/rpc/methods/state.rs
Remove FlattenedApiMessage type and Lotus JSON glue. ChainGetMessage and GasEstimateMessageGas now return Message directly; handlers stop computing/returning separate CID wrapper. Add PublicVersion.agent and populate with "forest". Add NetworkParams.genesis_timestamp and wire from chain store. Add ForkUpgradeParams.upgrade_fire_horse_height mapped from ChainConfig FireHorse height.
Trace population logic (Core behavior)
src/state_manager/utils.rs, src/rpc/methods/eth.rs
During structured execution-trace parsing, collect ExecutionEvent::Log into logs and convert ExecutionEvent::Ipld into TraceIpld entries; initialize empty vectors and include them in returned ExecutionTrace. Test fixture create_execution_trace updated to include empty logs/ipld_ops.
Call sites & tooling (Wiring → Integration tests)
src/tool/subcommands/api_cmd/api_compare_tests.rs, src/tool/subcommands/api_cmd/stateful_tests.rs, src/wallet/subcommands/wallet_cmd.rs, src/tool/subcommands/api_cmd/test_snapshots.txt
Adjust tests and tooling to handle unwrapped Message return values (remove .message unwraps). Update EIP-1559 signing flow to pass unsigned_msg directly. Wallet send/gas-estimate flow uses returned Message. Update test snapshot artifact references.
Test runner config (Tests)
scripts/tests/api_compare/docker-compose.yml
Enable FOREST_STRICT_JSON=1 for api-compare services to enforce strict JSON validation.

Sequence Diagram(s)

(omitted)

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • ChainSafe/forest#6028: Modifies ForkUpgradeParams / NetworkParams upgrade-height fields—overlaps with this PR's ForkUpgradeParams/NetworkParams changes.
  • ChainSafe/forest#6412: Related changes to execution-tracing (ipld_ops/logs) and trace test helpers.
  • ChainSafe/forest#6926: Related to enabling strict JSON validation and api-compare test wiring (FOREST_STRICT_JSON).

Suggested reviewers

  • LesnyRumcajs
  • akaladarshi
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 73.68% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'Enable strict json check in api compare' accurately summarizes the main change: enabling stricter JSON deserialization (FOREST_STRICT_JSON=1) for API comparison tests.
Linked Issues check ✅ Passed The PR comprehensively addresses issue #5635 by enabling strict JSON deserialization (FOREST_STRICT_JSON=1), fixing unknown-field errors across 9 RPC methods, and updating affected test snapshots.
Out of Scope Changes check ✅ Passed All changes directly support the PR objective of enabling strict JSON validation: schema updates reflect new RPC fields (CID, Logs, IpldOps, Agent, GenesisTimestamp), RPC implementations populate these fields, and snapshots are updated accordingly.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch shashank/enable-strict-json-api
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch shashank/enable-strict-json-api

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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

@sudo-shashank sudo-shashank changed the title Enable strict json check Enable strict json check in api compare Apr 28, 2026
Copy link
Copy Markdown
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.

Caution

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

⚠️ Outside diff range comments (1)
src/rpc/methods/state.rs (1)

3234-3284: ⚠️ Potential issue | 🟠 Major

upgrade_xx_height should be config-driven, not hardcoded.

Line 3284 hardcodes a sentinel epoch, so StateGetNetworkParams can diverge from the actual network config once that upgrade is scheduled (or on custom networks). Please source this value from ChainConfig (with an explicit fallback policy if needed) rather than embedding a literal.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/rpc/methods/state.rs` around lines 3234 - 3284, The code currently
hardcodes upgrade_xx_height to 999_999_999_999_999 in TryFrom<&ChainConfig> for
ForkUpgradeParams; instead, read the value from ChainConfig (use the existing
height lookup helper get_height or an explicit ChainConfig field for the XX
upgrade) and assign that to upgrade_xx_height, with a clear fallback policy
(e.g., use get_height(XX)? or fallback to
config.some_optional_xx_height.unwrap_or(default_epoch)) so
StateGetNetworkParams stays in sync with the network config. Locate this change
in the try_from implementation that constructs ForkUpgradeParams and replace the
literal with the config-driven lookup and fallback.
🧹 Nitpick comments (2)
src/lotus_json/message.rs (1)

120-120: Optional readability tweak for intentionally ignored CID.

Consider using an explicit ignored binding name and short comment for parity with signed_message.rs.

Suggested tiny cleanup
-            cid: _,
+            cid: _ignored_cid, // CID is derived from message fields; input CID is not used
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/lotus_json/message.rs` at line 120, The ignored CID field in message.rs
is currently written as cid: _, which is less explicit; update the pattern to
use an explicit ignored binding like cid: _cid and add a short comment (e.g., //
intentionally ignored) to match the style used in signed_message.rs so the
intent is clear when reading the Message destructuring.
src/rpc/methods/state/types.rs (1)

204-213: Consider adding a short struct-level note explaining why logs/ipld_ops are excluded from equality.

The code is fine as-is; this would just make intent easier to retain for future changes around API-compare behavior.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/rpc/methods/state/types.rs` around lines 204 - 213, Add a short doc
comment on the ExecutionTrace struct explaining why logs and ipld_ops are
intentionally excluded from the PartialEq implementation: they are
implementation-dependent and not part of API-level equality comparison. Update
the struct-level comment for ExecutionTrace (referencing fields logs and
ipld_ops and the PartialEq impl) to state this intent so future maintainers
understand why eq ignores those fields.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@src/rpc/methods/state.rs`:
- Around line 3234-3284: The code currently hardcodes upgrade_xx_height to
999_999_999_999_999 in TryFrom<&ChainConfig> for ForkUpgradeParams; instead,
read the value from ChainConfig (use the existing height lookup helper
get_height or an explicit ChainConfig field for the XX upgrade) and assign that
to upgrade_xx_height, with a clear fallback policy (e.g., use get_height(XX)? or
fallback to config.some_optional_xx_height.unwrap_or(default_epoch)) so
StateGetNetworkParams stays in sync with the network config. Locate this change
in the try_from implementation that constructs ForkUpgradeParams and replace the
literal with the config-driven lookup and fallback.

---

Nitpick comments:
In `@src/lotus_json/message.rs`:
- Line 120: The ignored CID field in message.rs is currently written as cid: _,
which is less explicit; update the pattern to use an explicit ignored binding
like cid: _cid and add a short comment (e.g., // intentionally ignored) to match
the style used in signed_message.rs so the intent is clear when reading the
Message destructuring.

In `@src/rpc/methods/state/types.rs`:
- Around line 204-213: Add a short doc comment on the ExecutionTrace struct
explaining why logs and ipld_ops are intentionally excluded from the PartialEq
implementation: they are implementation-dependent and not part of API-level
equality comparison. Update the struct-level comment for ExecutionTrace
(referencing fields logs and ipld_ops and the PartialEq impl) to state this
intent so future maintainers understand why eq ignores those fields.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 1d5006cd-50f9-4bf8-9882-73c9293697ea

📥 Commits

Reviewing files that changed from the base of the PR and between 65c39a0 and e15b409.

⛔ Files ignored due to path filters (2)
  • src/rpc/snapshots/forest__rpc__tests__rpc__v0.snap is excluded by !**/*.snap
  • src/rpc/snapshots/forest__rpc__tests__rpc__v1.snap is excluded by !**/*.snap
📒 Files selected for processing (11)
  • docs/openrpc-specs/v0.json
  • docs/openrpc-specs/v1.json
  • scripts/tests/api_compare/docker-compose.yml
  • src/lotus_json/message.rs
  • src/lotus_json/signed_message.rs
  • src/rpc/methods/common.rs
  • src/rpc/methods/eth.rs
  • src/rpc/methods/state.rs
  • src/rpc/methods/state/types.rs
  • src/state_manager/utils.rs
  • src/tool/subcommands/api_cmd/test_snapshots.txt

@sudo-shashank sudo-shashank marked this pull request as ready for review April 28, 2026 02:15
@sudo-shashank sudo-shashank requested a review from a team as a code owner April 28, 2026 02:15
@sudo-shashank sudo-shashank requested review from LesnyRumcajs and akaladarshi and removed request for a team April 28, 2026 02:15
Comment thread docs/openrpc-specs/v1.json Outdated
Copy link
Copy Markdown
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.

Caution

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

⚠️ Outside diff range comments (1)
docs/openrpc-specs/v0.json (1)

10151-10189: ⚠️ Potential issue | 🟠 Major

Remove or make UpgradeXxHeight optional in the OpenRPC schema.

Lotus's StateGetNetworkParams returns UpgradeFireHorseHeight in ForkUpgradeParams, not UpgradeXxHeight. Forest's implementation hardcodes upgrade_xx_height to 999_999_999_999_999, but marking it as required in the OpenRPC schema will cause strict validation failures against Lotus responses, which omit this field entirely. Either remove UpgradeXxHeight from the schema or mark it as non-required to maintain compatibility.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/openrpc-specs/v0.json` around lines 10151 - 10189, The OpenRPC schema
currently lists UpgradeXxHeight as a required property in the ForkUpgradeParams
object which conflicts with Lotus's StateGetNetworkParams (which returns
UpgradeFireHorseHeight and omits UpgradeXxHeight) and forces strict validation
failures; update the schema by either removing UpgradeXxHeight from the
ForkUpgradeParams required array or moving UpgradeXxHeight out of the "required"
list (making it optional) so responses that omit upgrade_xx_height (Forest
hardcodes it but Lotus omits it) validate correctly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@docs/openrpc-specs/v0.json`:
- Around line 10151-10189: The OpenRPC schema currently lists UpgradeXxHeight as
a required property in the ForkUpgradeParams object which conflicts with Lotus's
StateGetNetworkParams (which returns UpgradeFireHorseHeight and omits
UpgradeXxHeight) and forces strict validation failures; update the schema by
either removing UpgradeXxHeight from the ForkUpgradeParams required array or
moving UpgradeXxHeight out of the "required" list (making it optional) so
responses that omit upgrade_xx_height (Forest hardcodes it but Lotus omits it)
validate correctly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 17b75584-731e-4e12-b601-7db4e794ecda

📥 Commits

Reviewing files that changed from the base of the PR and between e15b409 and 0869652.

⛔ Files ignored due to path filters (2)
  • src/rpc/snapshots/forest__rpc__tests__rpc__v0.snap is excluded by !**/*.snap
  • src/rpc/snapshots/forest__rpc__tests__rpc__v1.snap is excluded by !**/*.snap
📒 Files selected for processing (8)
  • docs/openrpc-specs/v0.json
  • docs/openrpc-specs/v1.json
  • src/lotus_json/message.rs
  • src/rpc/methods/chain.rs
  • src/rpc/methods/gas.rs
  • src/tool/subcommands/api_cmd/api_compare_tests.rs
  • src/tool/subcommands/api_cmd/stateful_tests.rs
  • src/wallet/subcommands/wallet_cmd.rs
✅ Files skipped from review due to trivial changes (1)
  • src/tool/subcommands/api_cmd/api_compare_tests.rs

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 29, 2026

Codecov Report

❌ Patch coverage is 89.36170% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.23%. Comparing base (8f2b32b) to head (c95e115).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/state_manager/utils.rs 78.57% 3 Missing ⚠️
src/rpc/methods/state.rs 50.00% 0 Missing and 1 partial ⚠️
src/wallet/subcommands/wallet_cmd.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
src/lotus_json/message.rs 100.00% <100.00%> (ø)
src/lotus_json/signed_message.rs 92.45% <100.00%> (+0.45%) ⬆️
src/rpc/methods/chain.rs 56.03% <100.00%> (-0.05%) ⬇️
src/rpc/methods/common.rs 61.53% <100.00%> (+1.01%) ⬆️
src/rpc/methods/eth.rs 65.28% <100.00%> (+0.02%) ⬆️
src/rpc/methods/gas.rs 86.55% <100.00%> (-0.04%) ⬇️
src/rpc/methods/state/types.rs 100.00% <100.00%> (ø)
src/rpc/methods/state.rs 44.75% <50.00%> (+<0.01%) ⬆️
src/wallet/subcommands/wallet_cmd.rs 25.45% <0.00%> (ø)
src/state_manager/utils.rs 79.90% <78.57%> (+0.10%) ⬆️

... and 5 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

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

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Member

@LesnyRumcajs LesnyRumcajs left a comment

Choose a reason for hiding this comment

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

Why the do the snap files change?

Comment thread src/rpc/methods/state.rs Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

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

⚠️ Outside diff range comments (1)
docs/openrpc-specs/v1.json (1)

10758-10779: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Mark Params as required in the Message schema, or clarify that it is always emitted.

The serializer in src/lotus_json/message.rs always emits the Params field (as null when empty), confirmed by the test snapshot showing "Params": null. The #[serde(default)] attribute enables deserialization when Params is missing, but does not suppress serialization. The current OpenRPC schema marks Params as optional (not in the required list) with default: null, which may mislead generated clients into thinking the field can be omitted from responses. Either mark Params as required in the schema to match the serialization contract, or add explicit documentation that this field is always present in responses despite being optional on input.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/openrpc-specs/v1.json` around lines 10758 - 10779, The Message schema
currently omits "Params" from the required list while the serializer in
src/lotus_json/message.rs always emits Params (null when empty); update the
OpenRPC spec to reflect runtime behavior by adding "Params" to the Message
schema's required array (so "required": ["To","From","Params"]) or alternatively
add a clear note to the Message schema description explaining that Params is
always serialized (may be null) despite being optional for input; reference the
Message schema and the Params property and ensure the change aligns with serde
behavior (#[serde(default)]) described in the comment.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/openrpc-specs/v0.json`:
- Line 435: The spec reuses the generic "Message" schema for both requests and
responses but the response needs an extra CID field, which unintentionally
documents CID as a valid request property; create a separate response schema
(e.g., "MessageResponse" or "MessageWithCID") that extends or copies "Message"
and adds the CID property, update all response $ref occurrences that currently
point to "#/components/schemas/Message" (including places tied to
Filecoin.StateCall and Filecoin.MpoolPushMessage) to reference the new response
schema, and leave input/request references using the original "Message" schema
unchanged.

---

Outside diff comments:
In `@docs/openrpc-specs/v1.json`:
- Around line 10758-10779: The Message schema currently omits "Params" from the
required list while the serializer in src/lotus_json/message.rs always emits
Params (null when empty); update the OpenRPC spec to reflect runtime behavior by
adding "Params" to the Message schema's required array (so "required":
["To","From","Params"]) or alternatively add a clear note to the Message schema
description explaining that Params is always serialized (may be null) despite
being optional for input; reference the Message schema and the Params property
and ensure the change aligns with serde behavior (#[serde(default)]) described
in the comment.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: e12933e1-96e7-4fb1-baa8-d46cf53baf31

📥 Commits

Reviewing files that changed from the base of the PR and between b49052a and cce0f0d.

⛔ Files ignored due to path filters (2)
  • src/rpc/snapshots/forest__rpc__tests__rpc__v0.snap is excluded by !**/*.snap
  • src/rpc/snapshots/forest__rpc__tests__rpc__v1.snap is excluded by !**/*.snap
📒 Files selected for processing (6)
  • docs/openrpc-specs/v0.json
  • docs/openrpc-specs/v1.json
  • src/rpc/methods/common.rs
  • src/rpc/methods/state.rs
  • src/rpc/methods/state/types.rs
  • src/state_manager/utils.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/rpc/methods/state.rs

Comment thread docs/openrpc-specs/v0.json
@sudo-shashank sudo-shashank marked this pull request as ready for review May 5, 2026 17:29
Copy link
Copy Markdown
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.

🧹 Nitpick comments (1)
docs/openrpc-specs/v1.json (1)

9773-9785: ⚡ Quick win

Pin the Lotus reference links to a tag or commit.

These new descriptions point at Lotus master, so the references will drift away from the exact API shape this spec is documenting. Please pin them to the Lotus tag/commit used by api-compare instead. (github.com)

Also applies to: 11217-11221, 11795-11797

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/openrpc-specs/v1.json` around lines 9773 - 9785, Update the Lotus links
in the OpenRPC JSON schema descriptions so they point to the exact tag or commit
used by api-compare instead of master: replace the master URLs referenced in the
"IpldOps" schema (description pointing to execresult.go) and the "Logs" schema
with the pinned tag/commit URL (and do the same for the other occurrences noted
in the file). Locate the description strings for the "IpldOps" and "Logs"
components in docs/openrpc-specs/v1.json and substitute the GitHub master links
with the corresponding repo URL that includes the specific tag or commit SHA
used by api-compare; ensure the text and angle-bracket format remain unchanged
except for the URL.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@docs/openrpc-specs/v1.json`:
- Around line 9773-9785: Update the Lotus links in the OpenRPC JSON schema
descriptions so they point to the exact tag or commit used by api-compare
instead of master: replace the master URLs referenced in the "IpldOps" schema
(description pointing to execresult.go) and the "Logs" schema with the pinned
tag/commit URL (and do the same for the other occurrences noted in the file).
Locate the description strings for the "IpldOps" and "Logs" components in
docs/openrpc-specs/v1.json and substitute the GitHub master links with the
corresponding repo URL that includes the specific tag or commit SHA used by
api-compare; ensure the text and angle-bracket format remain unchanged except
for the URL.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 2ab9053e-be3d-4921-994b-bf25acd3f07f

📥 Commits

Reviewing files that changed from the base of the PR and between b49052a and cce0f0d.

⛔ Files ignored due to path filters (2)
  • src/rpc/snapshots/forest__rpc__tests__rpc__v0.snap is excluded by !**/*.snap
  • src/rpc/snapshots/forest__rpc__tests__rpc__v1.snap is excluded by !**/*.snap
📒 Files selected for processing (6)
  • docs/openrpc-specs/v0.json
  • docs/openrpc-specs/v1.json
  • src/rpc/methods/common.rs
  • src/rpc/methods/state.rs
  • src/rpc/methods/state/types.rs
  • src/state_manager/utils.rs

Copy link
Copy Markdown
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.

♻️ Duplicate comments (1)
docs/openrpc-specs/v0.json (1)

10342-10399: ⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Split request and response message schemas.

Message now includes CID (Line 10345), but the same schema is used for request params across methods (for example Line 2574, Line 3130). That broadens the request contract even though the immediate need is response compatibility (Line 435, Line 2283).

💡 Minimal direction
 "Message": {
   "type": "object",
   "properties": {
-    "CID": { "$ref": "#/components/schemas/Nullable_Cid" },
     ...
   }
 },
+"MessageWithCid": {
+  "allOf": [
+    { "$ref": "#/components/schemas/Message" },
+    {
+      "type": "object",
+      "properties": {
+        "CID": { "$ref": "#/components/schemas/Nullable_Cid" }
+      }
+    }
+  ]
+}

Then use MessageWithCid only in response schemas that need it.

Also applies to: 435-435, 2283-2283

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/openrpc-specs/v0.json` around lines 10342 - 10399, The current "Message"
schema includes "CID", widening request parameter contracts; create a new schema
"MessageWithCid" that duplicates the existing "Message" properties but includes
the "CID" property (and same required fields), then update only response schemas
that need the CID to reference "#/components/schemas/MessageWithCid" while
leaving all request param references pointing to "#/components/schemas/Message"
(e.g., replace usages used in method responses such as the ones flagged) so
request contracts remain unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In `@docs/openrpc-specs/v0.json`:
- Around line 10342-10399: The current "Message" schema includes "CID", widening
request parameter contracts; create a new schema "MessageWithCid" that
duplicates the existing "Message" properties but includes the "CID" property
(and same required fields), then update only response schemas that need the CID
to reference "#/components/schemas/MessageWithCid" while leaving all request
param references pointing to "#/components/schemas/Message" (e.g., replace
usages used in method responses such as the ones flagged) so request contracts
remain unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: f2adc734-5525-4de2-b85d-54ee5f380532

📥 Commits

Reviewing files that changed from the base of the PR and between b49052a and a29c1b5.

⛔ Files ignored due to path filters (2)
  • src/rpc/snapshots/forest__rpc__tests__rpc__v0.snap is excluded by !**/*.snap
  • src/rpc/snapshots/forest__rpc__tests__rpc__v1.snap is excluded by !**/*.snap
📒 Files selected for processing (7)
  • docs/openrpc-specs/v0.json
  • docs/openrpc-specs/v1.json
  • src/rpc/methods/common.rs
  • src/rpc/methods/state.rs
  • src/rpc/methods/state/types.rs
  • src/state_manager/utils.rs
  • src/tool/subcommands/api_cmd/test_snapshots.txt
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/rpc/methods/state/types.rs
  • src/tool/subcommands/api_cmd/test_snapshots.txt

@sudo-shashank sudo-shashank requested a review from LesnyRumcajs May 5, 2026 21:12
Copy link
Copy Markdown
Collaborator

@akaladarshi akaladarshi left a comment

Choose a reason for hiding this comment

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

@sudo-shashank Can you please add the ref link using the latest version of lotus instead of using the master branch, because master is subjected to change.

@akaladarshi
Copy link
Copy Markdown
Collaborator

@sudo-shashank Can you please add the ref link using the latest version of lotus instead of using the master branch, because master is subjected to change.

@sudo-shashank What I mean by latest version was something like this : <https://github.com/filecoin-project/lotus/blob/v1.35.1/chain/store/index.go#L52> instead of a commit or branch

Copy link
Copy Markdown
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.

♻️ Duplicate comments (1)
docs/openrpc-specs/v0.json (1)

10342-10399: 🛠️ Refactor suggestion | 🟠 Major

Split request and response message schemas.

Adding CID to the shared Message schema fixes response-side strict JSON, but this same schema is also referenced by request params like Filecoin.StateCall (Lines 3126-3131), Filecoin.GasEstimateMessageGas (Lines 2244-2248), Filecoin.MpoolPushMessage (Lines 2570-2575), and Filecoin.WalletSignMessage (Lines 5703-5708). That silently documents CID as valid input even though this PR only needs it on responses. Please keep Message for request bodies and introduce a response-only variant for the CID-carrying shape.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/openrpc-specs/v0.json` around lines 10342 - 10399, The shared "Message"
schema currently includes "CID" which incorrectly documents CID as valid for
request params; revert the request shape by keeping "Message" without "CID" and
introduce a new response-only schema (e.g., "MessageWithCID" or
"MessageResponse") that adds the "CID" property. Update all response references
that must carry CID to point to the new schema and leave the request references
(such as Filecoin.StateCall, Filecoin.GasEstimateMessageGas,
Filecoin.MpoolPushMessage, Filecoin.WalletSignMessage) referencing the original
"Message" schema so CID is no longer allowed in request bodies. Ensure the new
schema reuses the same properties as "Message" plus the "CID" $ref to avoid
duplication.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In `@docs/openrpc-specs/v0.json`:
- Around line 10342-10399: The shared "Message" schema currently includes "CID"
which incorrectly documents CID as valid for request params; revert the request
shape by keeping "Message" without "CID" and introduce a new response-only
schema (e.g., "MessageWithCID" or "MessageResponse") that adds the "CID"
property. Update all response references that must carry CID to point to the new
schema and leave the request references (such as Filecoin.StateCall,
Filecoin.GasEstimateMessageGas, Filecoin.MpoolPushMessage,
Filecoin.WalletSignMessage) referencing the original "Message" schema so CID is
no longer allowed in request bodies. Ensure the new schema reuses the same
properties as "Message" plus the "CID" $ref to avoid duplication.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 68cbbdff-9b1c-4b70-88e7-62aa8ea43a5f

📥 Commits

Reviewing files that changed from the base of the PR and between a29c1b5 and 9152064.

⛔ Files ignored due to path filters (2)
  • src/rpc/snapshots/forest__rpc__tests__rpc__v0.snap is excluded by !**/*.snap
  • src/rpc/snapshots/forest__rpc__tests__rpc__v1.snap is excluded by !**/*.snap
📒 Files selected for processing (5)
  • docs/openrpc-specs/v0.json
  • docs/openrpc-specs/v1.json
  • src/rpc/methods/common.rs
  • src/rpc/methods/state.rs
  • src/rpc/methods/state/types.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/rpc/methods/state/types.rs

@sudo-shashank
Copy link
Copy Markdown
Contributor Author

sudo-shashank commented May 6, 2026

@sudo-shashank Can you please add the ref link using the latest version of lotus instead of using the master branch, because master is subjected to change.

@sudo-shashank What I mean by latest version was something like this : <https://github.com/filecoin-project/lotus/blob/v1.35.1/chain/store/index.go#L52> instead of a commit or branch

@akaladarshi latest commit or v1.35.1 works here

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.

Deny unknown fields on RPC response deserialization

3 participants