Skip to content

fix: add missing network epochs in Filecoin.StateGetNetworkParams#6028

Merged
LesnyRumcajs merged 1 commit intomainfrom
fix-stategetnetworkparams-test
Sep 3, 2025
Merged

fix: add missing network epochs in Filecoin.StateGetNetworkParams#6028
LesnyRumcajs merged 1 commit intomainfrom
fix-stategetnetworkparams-test

Conversation

@LesnyRumcajs
Copy link
Member

@LesnyRumcajs LesnyRumcajs commented Sep 3, 2025

Summary of changes

Changes introduced in this pull request:

  • fixed missing network epochs in the Filecoin.StateGetNetworkParams method.
  • this will be a recurring issue until we do more strict validations, e.g., via Deny unknown fields on RPC response deserialization #5635. At the moment, we don't check that responses are identical - we check that they deserialize to the same object; in case where a data structure has missing fields and response has additional ones, this won't be caught.

Reference issue to close (if applicable)

Closes

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

  • New Features
    • Network parameters now include Teep and Tock upgrade heights, visible when querying upgrade schedules.
  • Bug Fixes
    • Fixed missing Teep and Tock entries in network parameters responses to ensure accurate upgrade information.
  • Tests
    • Updated snapshots to reflect the revised network parameters response including Teep and Tock.
  • Documentation
    • Added changelog entry noting the inclusion of Teep and Tock upgrade heights in network parameters.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 3, 2025

Walkthrough

Adds Teep and Tock upgrade heights to ForkUpgradeParams and populates them from ChainConfig for StateGetNetworkParams. Updates a test snapshot reference and appends a changelog entry noting the fix.

Changes

Cohort / File(s) Summary
Changelog update
CHANGELOG.md
Added unreleased “Fixed” entry noting PR #6028 adds missing Teep and Tock network upgrade entries to Filecoin.StateGetNetworkParams.
State RPC: ForkUpgradeParams fields
src/rpc/methods/state.rs
Added fields upgrade_teep_height and upgrade_tock_height to ForkUpgradeParams; updated TryFrom<&ChainConfig> to populate from height_infos.
Test snapshot refresh
src/tool/subcommands/api_cmd/test_snapshots.txt
Replaced network params snapshot filename with a new .rpcsnap.json.zst; no logic changes.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant C as Client
    participant R as RPC: StateGetNetworkParams
    participant CFG as ChainConfig
    participant RESP as ForkUpgradeParams

    C->>R: Request network params
    R->>CFG: Read height_infos
    CFG-->>R: Upgrade heights (incl. Teep, Tock)
    R->>RESP: Build ForkUpgradeParams { ... , upgrade_teep_height, upgrade_tock_height }
    R-->>C: Return ForkUpgradeParams
    note over R,RESP: New fields included in response
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

RPC

Suggested reviewers

  • hanabi1224
  • sudo-shashank
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-stategetnetworkparams-test

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

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

Support

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

CodeRabbit Commands (Invoked using PR/Issue comments)

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

Other keywords and placeholders

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

CodeRabbit Configuration File (.coderabbit.yaml)

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

Status, Documentation and Community

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

@LesnyRumcajs LesnyRumcajs force-pushed the fix-stategetnetworkparams-test branch from 84a7fbe to db579c4 Compare September 3, 2025 09:08
@LesnyRumcajs LesnyRumcajs force-pushed the fix-stategetnetworkparams-test branch from db579c4 to 94224ef Compare September 3, 2025 09:10
@LesnyRumcajs LesnyRumcajs marked this pull request as ready for review September 3, 2025 09:11
@LesnyRumcajs LesnyRumcajs requested a review from a team as a code owner September 3, 2025 09:11
@LesnyRumcajs LesnyRumcajs requested review from elmattic and sudo-shashank and removed request for a team September 3, 2025 09:11
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/rpc/methods/state.rs (1)

3007-3009: Guard against missing heights across networks.

If any ChainConfig lacks Teep/Tock, StateGetNetworkParams will error. Confirm all supported networks define these heights (even as sentinel values) in height_infos. If there’s any network without them, consider documenting the requirement or mapping absent entries to a conventional sentinel (e.g., -1) to match existing practice for historical upgrades.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

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

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 0b0b262 and 94224ef.

📒 Files selected for processing (3)
  • CHANGELOG.md (1 hunks)
  • src/rpc/methods/state.rs (2 hunks)
  • src/tool/subcommands/api_cmd/test_snapshots.txt (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: LesnyRumcajs
PR: ChainSafe/forest#5907
File: src/rpc/methods/state.rs:523-570
Timestamp: 2025-08-06T15:44:33.467Z
Learning: LesnyRumcajs prefers to rely on BufWriter's Drop implementation for automatic flushing rather than explicit flush() calls in Forest codebase.
📚 Learning: 2025-09-02T14:23:53.766Z
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.

Applied to files:

  • src/tool/subcommands/api_cmd/test_snapshots.txt
⏰ 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 MacOS
  • GitHub Check: Build Ubuntu
  • GitHub Check: All lint checks
  • 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 (3)
CHANGELOG.md (1)

46-47: LGTM — concise and user-facing.

Entry clearly states the fix and points to the PR. No nits.

src/tool/subcommands/api_cmd/test_snapshots.txt (1)

87-87: Verify the new snapshot is available and includes Teep/Tock fields.

Since .rpcsnap files are fetched from the DO bucket at runtime, please confirm this artifact exists and that the payload contains UpgradeTeepHeight and UpgradeTockHeight under ForkUpgradeParams.

src/rpc/methods/state.rs (1)

2960-2962: Adding Teep/Tock to ForkUpgradeParams — looks correct.

Fields are appended consistently and will serialize as PascalCase for JSON/OpenRPC.

@LesnyRumcajs LesnyRumcajs added this pull request to the merge queue Sep 3, 2025
Merged via the queue into main with commit b398704 Sep 3, 2025
58 of 59 checks passed
@LesnyRumcajs LesnyRumcajs deleted the fix-stategetnetworkparams-test branch September 3, 2025 10:10
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.

3 participants