Skip to content

fix(ci): rpc parity test#6071

Merged
hanabi1224 merged 4 commits intomainfrom
hm/fix-rpc-parity-test
Sep 11, 2025
Merged

fix(ci): rpc parity test#6071
hanabi1224 merged 4 commits intomainfrom
hm/fix-rpc-parity-test

Conversation

@hanabi1224
Copy link
Copy Markdown
Contributor

@hanabi1224 hanabi1224 commented Sep 11, 2025

Summary of changes

To fix https://github.com/ChainSafe/forest/actions/runs/17642335761/job/50132589577?pr=6068#step:5:262

| Filecoin.StateReadState (66)                        | 61/66   | 61/66   | ⚠️  Mixed Results (CustomCheckFailed) |

Failure dump:

{
  "request": {
    "method_name": "Filecoin.StateReadState",
    "params": [
      "t410fbqoynu2oi2lxam43knqt6ordiowm2ywlml27z4i",
      [
        {
          "/": "bafy2bzacecdrw63hrpger553zsyj2whwyf57kblfl6dlyjao2idhqrcupy5d4"
        },
        {
          "/": "bafy2bzaced4ujqhfirb3fshi33szrwdh23w4gdmpra7ifws36a6q6vxzyirbk"
        }
      ]
    ]
  },
  "forest_response": {
    "Ok": {
      "Balance": "0",
      "Code": {
        "/": "bafk2bzacecj6erwjsemkinlja2nwq3bwjbr7jvhde4hbeljsbocl7msygujti"
      },
      "State": {
        "Bytecode": {
          "/": "bafk2bzacec5kwj6sqfhoehbp6m3mmg6634bvxhmyg6gfm5bryxu6vz6fabkn4"
        },
        "BytecodeHash": [
          199,
          80,
          91,
          60,
          118,
          199,
          50,
          70,
          67,
          11,
          129,
          231,
          223,
          126,
          88,
          75,
          151,
          90,
          75,
          168,
          124,
          112,
          132,
          25,
          127,
          198,
          74,
          169,
          254,
          59,
          223,
          250
        ],
        "ContractState": {
          "/": "bafy2bzacec2ljacfbkr2n7utne53n5rh27ja7wrxmdqyvccljei7lvoyxcqgy"
        },
        "Nonce": 1,
        "Tombstone": null
      }
    }
  },
  "lotus_response": {
    "Ok": {
      "Balance": "0",
      "Code": {
        "/": "bafk2bzacecj6erwjsemkinlja2nwq3bwjbr7jvhde4hbeljsbocl7msygujti"
      },
      "State": {
        "Bytecode": {
          "/": "bafk2bzacec5kwj6sqfhoehbp6m3mmg6634bvxhmyg6gfm5bryxu6vz6fabkn4"
        },
        "BytecodeHash": [
          199,
          80,
          91,
          60,
          118,
          199,
          50,
          70,
          67,
          11,
          129,
          231,
          223,
          126,
          88,
          75,
          151,
          90,
          75,
          168,
          124,
          112,
          132,
          25,
          127,
          198,
          74,
          169,
          254,
          59,
          223,
          250
        ],
        "ContractState": {
          "/": "bafy2bzacec2ljacfbkr2n7utne53n5rh27ja7wrxmdqyvccljei7lvoyxcqgy"
        },
        "Nonce": 1,
        "Tombstone": null,
        "TransientData": null
      }
    }
  }
}

Changes introduced in this pull request:

Reference issue to close (if applicable)

Closes #6067
Closes #6066

Other information and links

Change checklist

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

Summary by CodeRabbit

  • Bug Fixes

    • JSON output for EVM state now always includes the transient_data field (null when absent), producing a stable schema; consumers should handle nulls where they previously relied on absence.
  • Tests

    • One state-related Ethereum RPC test (eth_newBlockFilter) is now marked to be skipped/ignored due to a known issue (link provided in test).

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Sep 11, 2025

Walkthrough

EVMStateLotusJson’s transient_data serde attribute was changed to always serialize the field (it will be present as null when absent). Additionally, an RPC parity test case eth_newBlockFilter was marked to be ignored with a linked issue URL.

Changes

Cohort / File(s) Summary
EVM state JSON serde behavior
src/lotus_json/actor_states/evm_state.rs
Removed skip_serializing_if = "Option::is_none" from the transient_data field's serde attribute so the transient_data field is always serialized (null when absent). Type and other attributes unchanged.
RPC parity test skip
src/tool/subcommands/api_cmd/stateful_tests.rs
Marked the eth_new_block_filter test as ignored by adding .ignore("https://github.com/ChainSafe/forest/issues/6069") to its builder; formatting adjusted accordingly.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

Suggested reviewers

  • akaladarshi
  • sudo-shashank
  • elmattic

Pre-merge checks (3 passed, 2 warnings)

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Out of Scope Changes Check ⚠️ Warning While the EVMState serialization change is in scope, the added ignore on EthNewBlockFilter test in src/tool/subcommands/api_cmd/stateful_tests.rs appears unrelated to the linked StateReadState parity failures and therefore constitutes an out-of-scope test modification that changes test behavior without justification in the linked issues. Including unrelated test skips in the same PR can obscure the intent of the change and mask separate test stability issues. For these reasons the PR contains out-of-scope changes. Remove the unrelated test-ignore from this PR or split it into a separate PR with an explicit rationale, and ensure the StateReadState parity fix remains isolated so CI results clearly reflect the fix's effect.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "fix(ci): rpc parity test" is concise and directly reflects the PR's stated purpose of fixing an RPC parity test failure in CI; it relates to the main change (making Forest's JSON include TransientData:null to match Lotus). It is specific enough for history scanning and contains no noisy elements like file lists or emojis. Therefore the title passes the check.
Linked Issues Check ✅ Passed The PR's change to always serialize EVMStateLotusJson.transient_data (so it appears as null instead of being omitted) directly addresses the parity failure described in issues #6066 and #6067 where lotus_response included "TransientData": null while forest_response did not, so the code change meets the primary objective of aligning Forest's RPC output with Lotus. The additional test-ignore for eth_new_block_filter is not relevant to those linked issue reports but does not prevent the primary fix from satisfying the linked issues' intent. Based on the provided diffs and PR description, the coding change fulfills the linked issues' objective.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch hm/fix-rpc-parity-test

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

@hanabi1224 hanabi1224 added the RPC requires calibnet RPC checks to run on CI label Sep 11, 2025
@hanabi1224 hanabi1224 marked this pull request as ready for review September 11, 2025 11:43
@hanabi1224 hanabi1224 requested a review from a team as a code owner September 11, 2025 11:43
@hanabi1224 hanabi1224 requested review from akaladarshi and sudo-shashank and removed request for a team September 11, 2025 11:43
LesnyRumcajs
LesnyRumcajs previously approved these changes Sep 11, 2025
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: 2

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/evm_state.rs (1)

94-111: Bug: typo in Tombstone mapping (“orign” -> “origin”).

This will fail to compile or panic at runtime depending on the type; it must be fixed.

Apply:

-                                origin: lotus_entry.orign,
+                                origin: lotus_entry.origin,
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4b4411a and 280c21c.

📒 Files selected for processing (1)
  • src/lotus_json/actor_states/evm_state.rs (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 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.
Learnt from: hanabi1224
PR: ChainSafe/forest#5930
File: build.rs:64-77
Timestamp: 2025-08-13T09:43:20.301Z
Learning: hanabi1224 prefers hard compile-time errors in build scripts rather than runtime safeguards or collision detection, believing it's better to fail fast and fix root causes of issues like malformed snapshot names.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: tests
  • GitHub Check: tests-release
  • GitHub Check: Build forest binaries on Linux AMD64
  • GitHub Check: cargo-publish-dry-run
  • GitHub Check: Build Ubuntu
  • GitHub Check: Build MacOS
  • GitHub Check: All lint checks
🔇 Additional comments (3)
src/lotus_json/actor_states/evm_state.rs (3)

56-65: Snapshot includes TransientData: null — LGTM.

This aligns the expected JSON with Lotus for V16, matching our prior learning to prefer null over empty/omitted for parity-sensitive cases.


76-83: into_lotus_json correctly ensures “field-present” semantics for V16.

Using Option::from(state.transient_data) yields Some(None) when absent, so JSON emits null (and, with the ref above, remains omitted for other versions). Looks good.


26-26: Confirm version note.

Comment says “only available in evm actor state v16”. If V17 still includes this field, update the comment; if not, the skip_serializing_if change above is mandatory to avoid emitting an extraneous field for V17.

Comment on lines 24 to 26
#[schemars(with = "LotusJson<Option<TransientData>>")]
#[serde(with = "crate::lotus_json", skip_serializing_if = "Option::is_none")]
#[serde(with = "crate::lotus_json")]
pub transient_data: Option<Option<TransientData>>, // only available in evm actor state v16
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Don’t force TransientData on non-V16 states; keep skip_serializing_if to avoid regressions.

Without skip_serializing_if, Option::None serializes as null and the field is always present, which likely diverges from Lotus for versions where this field doesn’t exist. Keep the field omitted for non-V16 and explicitly include it (as null when absent) only for V16 via Some(None). This still fixes the parity failure while avoiding new ones.

Apply:

-    #[schemars(with = "LotusJson<Option<TransientData>>")]
-    #[serde(with = "crate::lotus_json")]
+    #[schemars(with = "LotusJson<Option<TransientData>>")]
+    #[serde(with = "crate::lotus_json", skip_serializing_if = "Option::is_none")]
     pub transient_data: Option<Option<TransientData>>, // only available in evm actor state v16
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#[schemars(with = "LotusJson<Option<TransientData>>")]
#[serde(with = "crate::lotus_json", skip_serializing_if = "Option::is_none")]
#[serde(with = "crate::lotus_json")]
pub transient_data: Option<Option<TransientData>>, // only available in evm actor state v16
#[schemars(with = "LotusJson<Option<TransientData>>")]
#[serde(with = "crate::lotus_json", skip_serializing_if = "Option::is_none")]
pub transient_data: Option<Option<TransientData>>, // only available in evm actor state v16
🤖 Prompt for AI Agents
In src/lotus_json/actor_states/evm_state.rs around lines 24 to 26, the transien
t_data field currently serializes Option::None as null which forces the field to
always appear; add serde's skip_serializing_if on the outer Option so the field
is omitted for non-v16 states (i.e. #[serde(skip_serializing_if =
"Option::is_none")]) while preserving the type Option<Option<TransientData>> so
you can still represent v16 explicitly as Some(None) (serializes as null) and
earlier versions as None (omitted). Ensure the serde attribute is applied
alongside the existing crate::lotus_json attribute and keep the schemars line
unchanged.

💡 Verification agent

🧩 Analysis chain

Quick repository checks to prevent parity regressions.

Run to verify no accidental inclusions and catch the typo elsewhere.

Also applies to: 35-47, 76-83, 94-111


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# 1) Ensure only V16 paths set transient_data to Some(...)
rg -n -C2 'transient_data:\s*Option::from\(' src | cat

# 2) Verify common_evm_state_fields leaves transient_data as None for non-V16
rg -n -C2 'common_evm_state_fields!\(state,\s*V(1[0-9])\)' src | cat

# 3) Search for the typo anywhere else
rg -n '\borign\b' -C2

# 4) Grep snapshots mentioning TransientData to ensure expectations are explicit
rg -nP '"transient_data"\s*:\s*null' -C2

Length of output: 616


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== evm_state.rs (first 300 lines) ==="
sed -n '1,300p' src/lotus_json/actor_states/evm_state.rs || true

echo
echo "=== All occurrences of 'transient_data' in src ==="
rg -n --hidden --no-ignore-vcs -C2 '\btransient_data\b' src || true

echo
echo "=== occurrences of 'transient_data: Option::from(' ==="
rg -n --hidden --no-ignore-vcs -C2 'transient_data:\s*Option::from\(' src || true

echo
echo "=== occurrences of 'Option::from(state.transient_data)' ==="
rg -n --hidden --no-ignore-vcs -C2 'Option::from\(state\.transient_data\)' src || true

echo
echo "=== occurrences of 'common_evm_state_fields!' ==="
rg -n --hidden --no-ignore-vcs -C2 'common_evm_state_fields!' src || true

echo
echo "=== Match arms 'State::V...' in evm_state.rs ==="
rg -n --hidden --no-ignore-vcs -C2 'State::V[0-9]+' src/lotus_json/actor_states/evm_state.rs || true

echo
echo "=== Search repo for typo 'orign' ==="
rg -n --hidden --no-ignore-vcs -C2 '\borign\b' || true

echo
echo "=== Search for JSON snapshots with '\"transient_data\": null' ==="
rg -n --hidden --no-ignore-vcs -C2 -P '"transient_data"\s*:\s*null' || true

Length of output: 12292


transient_data parity OK; rename tombstone 'orign' field

  • transient_data is only populated for State::V16 (src/lotus_json/actor_states/evm_state.rs:80); common_evm_state_fields defaults it to None for other versions (src/lotus_json/actor_states/evm_state.rs:44); snapshots/migrations reflect null/None.
  • Rename TombstoneLotusJson.pub orign → origin and update all uses: src/lotus_json/tombstone.rs (decl: line 12; mappings: lines 39, 47) and src/lotus_json/actor_states/evm_state.rs (use: line 106).
🤖 Prompt for AI Agents
In src/lotus_json/actor_states/evm_state.rs around lines 24 to 26 and referenced
uses at line 80, 44 and 106: transient_data parity is correct so leave the
Option<Option<TransientData>> as-is, but rename the TombstoneLotusJson field
from pub orign to pub origin and update all usages accordingly; specifically,
change the declaration in src/lotus_json/tombstone.rs (line ~12) to origin and
update the mapping keys/usages at lines ~39 and ~47, then update the use site in
src/lotus_json/actor_states/evm_state.rs (line ~106) to reference origin instead
of orign so all references compile and JSON mappings remain consistent.

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: 0

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

633-635: Temporarily skipping eth_newBlockFilter is fine; please surface the ignore reason in output and plan re-enable.

Good call linking to #6069. To aid triage in CI logs, print the ignore reason when a test is skipped.

Apply this diff to run_tests to include the reason:

-        if test.ignore.is_some() {
-            ignored += 1;
-            println!(
-                "test {} ... ignored",
-                if let Some(name) = test.name {
-                    name.to_string()
-                } else {
-                    format!("#{i}")
-                },
-            );
-            continue;
-        }
+        if let Some(reason) = test.ignore {
+            ignored += 1;
+            println!(
+                "test {} ... ignored ({reason})",
+                if let Some(name) = test.name {
+                    name.to_string()
+                } else {
+                    format!("#{i}")
+                },
+            );
+            continue;
+        }

Optional: gate the skip behind an env var (e.g., RUN_IGNORED=1) so local runs can still exercise the test while CI skips it. Want a patch for that?

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 280c21c and 38f7d87.

📒 Files selected for processing (1)
  • src/tool/subcommands/api_cmd/stateful_tests.rs (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: hanabi1224
PR: ChainSafe/forest#5930
File: build.rs:64-77
Timestamp: 2025-08-13T09:43:20.301Z
Learning: hanabi1224 prefers hard compile-time errors in build scripts rather than runtime safeguards or collision detection, believing it's better to fail fast and fix root causes of issues like malformed snapshot names.
⏰ 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). (21)
  • GitHub Check: State migrations
  • GitHub Check: Wallet tests
  • GitHub Check: Calibnet no discovery checks
  • GitHub Check: Calibnet eth mapping check
  • GitHub Check: Calibnet api test-stateful check
  • GitHub Check: Calibnet RPC checks
  • GitHub Check: Bootstrap checks - Forest
  • GitHub Check: Devnet checks
  • GitHub Check: Snapshot export checks v2 with F3 data
  • GitHub Check: Snapshot export checks
  • GitHub Check: Bootstrap checks - Lotus
  • GitHub Check: db-migration-checks
  • GitHub Check: Calibnet kademlia checks
  • GitHub Check: Calibnet check
  • GitHub Check: Calibnet stateless mode check
  • GitHub Check: Calibnet stateless RPC check
  • GitHub Check: Forest CLI checks
  • GitHub Check: Build forest binaries on Linux AMD64
  • GitHub Check: tests
  • GitHub Check: tests-release
  • GitHub Check: All lint checks

@hanabi1224
Copy link
Copy Markdown
Contributor Author

hanabi1224 commented Sep 11, 2025

Hey @akaladarshi any ideas on this?

More failures: https://github.com/ChainSafe/forest/actions/runs/17643479222/job/50136221369?pr=6071#step:5:224

| Filecoin.StateDecodeParams (740)                    | 105/740 | 105/740 | ⚠️  Mixed Results (Rejected) |

Failure dump:

{
  "request": {
    "method_name": "Filecoin.StateDecodeParams",
    "params": [
      "t00",
      1,
      null,
      [
        {
          "/": "bafy2bzacecdrw63hrpger553zsyj2whwyf57kblfl6dlyjao2idhqrcupy5d4"
        },
        {
          "/": "bafy2bzaced4ujqhfirb3fshi33szrwdh23w4gdmpra7ifws36a6q6vxzyirbk"
        }
      ]
    ]
  },
  "forest_response": {
    "Err": "ErrorObject { code: InternalError, message: \"No deserializer registered for actor type System (v17), method 1\", data: None }"
  },
  "lotus_response": {
    "Ok": {}
  }
}

@hanabi1224 hanabi1224 added this pull request to the merge queue Sep 11, 2025
@hanabi1224 hanabi1224 removed this pull request from the merge queue due to a manual request Sep 11, 2025
@hanabi1224 hanabi1224 removed the RPC requires calibnet RPC checks to run on CI label Sep 11, 2025
@hanabi1224 hanabi1224 added this pull request to the merge queue Sep 11, 2025
Merged via the queue into main with commit 274f644 Sep 11, 2025
61 of 62 checks passed
@hanabi1224 hanabi1224 deleted the hm/fix-rpc-parity-test branch September 11, 2025 13:38
Signor1 pushed a commit to Signor1/forest that referenced this pull request Sep 12, 2025
@coderabbitai coderabbitai Bot mentioned this pull request Sep 24, 2025
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[automated] RPC parity test failure @ 11/9/25 07:19 [automated] RPC parity test failure @ 11/9/25 00:38

3 participants