Skip to content

Conversation

@LesnyRumcajs
Copy link
Member

@LesnyRumcajs LesnyRumcajs commented Sep 2, 2025

Summary of changes

Changes introduced in this pull request:

  • skeleton & base migration for NV27. This can be merged as-is, linked TODOs are to be resolved via dedicated issues.

Reference issue to close (if applicable)

Closes #5984

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

    • Added support for the Golden Week upgrade across networks and introduced Network Version 27.
    • Prepared NV27 state migration tooling (module added but migrations left disabled).
  • Tests

    • Expanded test coverage to include the Golden Week height.
  • Chores

    • Updated internal height schedules/configurations.
    • Removed Golden Week height from RPC fork-upgrade parameters.
  • Style

    • Added a placeholder for the Golden Week upgrade logo.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 2, 2025

Walkthrough

Adds NV27 (GoldenWeek) upgrade: new Height variant and NetworkVersion V27, network HEIGHT_INFOS entries, NV27 migration module and run_migration implementation, verifier/manifest loading and per-actor migrators, a placeholder logo hook, and commented-out migration wiring in global maps.

Changes

Cohort / File(s) Summary
Network height entries
src/networks/mainnet/mod.rs, src/networks/calibnet/mod.rs, src/networks/butterflynet/mod.rs, src/networks/devnet/mod.rs
Insert GoldenWeek height entry into HEIGHT_INFOS using bundle CID "v16.0.1" (main/calibnet/butter: i64::MAX; devnet: FOREST_GOLDEN_WEEK_HEIGHT). Add TODO comments.
Core height/version mapping
src/networks/mod.rs, src/shim/version.rs
Add Height::GoldenWeek, map it to NetworkVersion::V27, add NetworkVersion::V27 associated const, and update tests for REQUIRED_HEIGHTS.
RPC fork params
src/rpc/methods/state.rs
Remove upgrade_golden_week_height field and its initialization from ForkUpgradeParams (GoldenWeek fork height no longer exposed).
State migration wiring
src/state_migration/mod.rs
Add mod nv27; and TODOs; keep GoldenWeek migration entries commented out in per-network migration maps (no active activation).
NV27 migration implementation
src/state_migration/nv27/mod.rs, src/state_migration/nv27/migration.rs
Add NV27 migration module and run_migration; implement verifier/manifest loading, add_nv27_migrations to register per-actor nil/system migrators, and state-tree migration orchestration returning new root CID.
UI/logo hook
src/utils/misc/logo.rs
Add match arm for NetworkVersion::V27 calling new stub reveal_golden_week_upgrade() (unimplemented placeholder).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Operator
  participant ChainConfig
  participant Blockstore
  participant Verifier
  participant StateMigration
  participant StateTree

  Operator->>ChainConfig: lookup manifest CID at Height::GoldenWeek
  ChainConfig-->>Operator: manifest CID
  Operator->>Blockstore: fetch manifest by CID
  Blockstore-->>Operator: manifest bytes
  Operator->>Verifier: create & load manifest
  Verifier-->>Operator: verified manifest
  Operator->>StateMigration: init with verifier
  StateMigration->>StateTree: load state from root CID
  StateMigration->>StateMigration: register per-actor migrators (nil/system)
  StateMigration->>StateTree: perform migration for epoch
  StateTree-->>StateMigration: new state root CID
  StateMigration-->>Operator: return new state root CID
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Assessment against linked issues

Objective Addressed Explanation
Create NV27 skeleton with base migration wiring (#5984)

Assessment against linked issues: Out-of-scope changes

Code Change Explanation
Add V27 logo hook and unimplemented reveal_golden_week_upgrade() (src/utils/misc/logo.rs) UI/logo placeholder is unrelated to migration skeleton objective (#5984).
Removal of upgrade_golden_week_height from ForkUpgradeParams (src/rpc/methods/state.rs) Dropping the RPC field changes RPC surface and is not part of creating the NV27 migration skeleton in #5984.

Suggested reviewers

  • akaladarshi
  • hanabi1224
  • elmattic

📜 Recent 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 1220552 and 6fa3f18.

📒 Files selected for processing (1)
  • src/rpc/methods/state.rs (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/rpc/methods/state.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
  • GitHub Check: 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: tests-release
  • GitHub Check: All lint checks
  • GitHub Check: Analyze (rust)
  • GitHub Check: Analyze (go)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch nv27-skeleton

🪧 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 marked this pull request as ready for review September 3, 2025 13:20
@LesnyRumcajs LesnyRumcajs requested a review from a team as a code owner September 3, 2025 13:20
@LesnyRumcajs LesnyRumcajs requested review from akaladarshi and hanabi1224 and removed request for a team September 3, 2025 13:20
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: 5

🧹 Nitpick comments (5)
src/networks/butterflynet/mod.rs (1)

111-113: Butterfly GoldenWeek scaffold is consistent; verify bundle presence.

  • i64::MAX placeholder matches other networks’ use of max‐height.
  • Confirm the v16.0.1 bundle is published for Butterfly (or update once NV27 actors land).

Optionally extract the version into a constant to avoid repeating the literal:

- make_height!(GoldenWeek, i64::MAX, get_bundle_cid("v16.0.1")),
+ make_height!(GoldenWeek, i64::MAX, get_bundle_cid(GOLDEN_WEEK_BUNDLE)),
const GOLDEN_WEEK_BUNDLE: &str = "v16.0.1";
src/state_migration/nv27/mod.rs (1)

7-11: Drop unnecessary allow if possible.

#[allow(unused_imports)] around the re-export likely isn’t needed; remove unless CI lints require it.

-#[allow(unused_imports)]
 pub use migration::run_migration;
src/state_migration/nv27/migration.rs (3)

73-76: Drop the redundant existence check; add context to manifest load

blockstore.get(manifest_cid) is redundant since load_manifest will read/validate. Remove the extra IO and attach context on failure.

-    blockstore.get(new_manifest_cid)?.context(format!(
-        "manifest for network version NV27 not found in blockstore: {new_manifest_cid}"
-    ))?;
-
-    // Add migration specification verification
-    let verifier = Arc::new(Verifier::default());
-
-    let new_manifest = BuiltinActorManifest::load_manifest(blockstore, new_manifest_cid)?;
+    // Add migration specification verification
+    let verifier = Arc::new(Verifier::default());
+
+    let new_manifest = BuiltinActorManifest::load_manifest(blockstore, new_manifest_cid)
+        .with_context(|| format!("failed to load NV27 manifest {new_manifest_cid}"))?;

Also applies to: 80-80


65-72: Clarify errors by naming the height explicitly

Minor copy tweak to reduce ambiguity when debugging config: mention GoldenWeek alongside NV27.

-        .context("no height info for network version NV27")?
+        .context("no GoldenWeek (NV27) height info")?
         .bundle
         .as_ref()
-        .context("no bundle for network version NV27")?;
+        .context("no GoldenWeek (NV27) bundle")?;

24-52: Good scaffolding; consider adding a targeted test

Nice, minimal wiring that maps old→new codes and special-cases System. Consider a unit/integration test that asserts: (a) System actor uses the dedicated migrator, (b) all other builtins are registered with nil_migrator.

I can draft a small test harness that builds a fake manifest and inspects the migrator map if the API allows exposure, or run a dry-run migration against a tiny in-memory tree. Want me to open an issue and provide a test skeleton?

📜 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 576107b and 1220552.

📒 Files selected for processing (11)
  • src/networks/butterflynet/mod.rs (1 hunks)
  • src/networks/calibnet/mod.rs (1 hunks)
  • src/networks/devnet/mod.rs (1 hunks)
  • src/networks/mainnet/mod.rs (1 hunks)
  • src/networks/mod.rs (4 hunks)
  • src/rpc/methods/state.rs (2 hunks)
  • src/shim/version.rs (1 hunks)
  • src/state_migration/mod.rs (4 hunks)
  • src/state_migration/nv27/migration.rs (1 hunks)
  • src/state_migration/nv27/mod.rs (1 hunks)
  • src/utils/misc/logo.rs (2 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-08-08T12:10:45.218Z
Learnt from: hanabi1224
PR: ChainSafe/forest#5867
File: src/ipld/util.rs:553-558
Timestamp: 2025-08-08T12:10:45.218Z
Learning: Forest project targets Rust stable >=1.89; features stabilized in 1.88 like let-chains are acceptable in this codebase.

Applied to files:

  • src/networks/devnet/mod.rs
🧬 Code graph analysis (4)
src/state_migration/nv27/migration.rs (1)
src/shim/machine/manifest.rs (2)
  • load_v1_actor_list (132-160)
  • load_manifest (123-131)
src/state_migration/nv27/mod.rs (1)
src/state_migration/nv27/migration.rs (1)
  • run_migration (56-89)
src/state_migration/mod.rs (1)
src/state_migration/nv27/migration.rs (1)
  • run_migration (56-89)
src/shim/version.rs (1)
src/interpreter/vm.rs (1)
  • new (175-271)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
  • GitHub Check: Build forest binaries on Linux AMD64
  • GitHub Check: tests-release
  • GitHub Check: tests
  • GitHub Check: cargo-publish-dry-run
  • GitHub Check: Build MacOS
  • GitHub Check: All lint checks
  • GitHub Check: Build Ubuntu
  • GitHub Check: Analyze (rust)
  • GitHub Check: Analyze (go)
🔇 Additional comments (12)
src/networks/devnet/mod.rs (1)

167-172: GoldenWeek: confirm bundle version and introduce constant

  • Confirm that using "v16.0.1" for the NV27 scaffold is intentional and tracked under forest#5987.
  • To avoid hardcoded strings, add at the top of src/networks/devnet/mod.rs (near other constants):
    const GOLDEN_WEEK_BUNDLE: &str = "v16.0.1";
    and update the snippet to:
    -        make_height!(
    -            GoldenWeek,
    -            get_upgrade_height_from_env("FOREST_GOLDEN_WEEK_HEIGHT").unwrap_or(9999999999),
    -            get_bundle_cid("v16.0.1")
    -        ),
    +        make_height!(
    +            GoldenWeek,
    +            get_upgrade_height_from_env("FOREST_GOLDEN_WEEK_HEIGHT").unwrap_or(9999999999),
    +            get_bundle_cid(GOLDEN_WEEK_BUNDLE)
    +        ),
src/shim/version.rs (1)

69-70: Approve V27 addition

V27 constant addition is correct and minimal; mapping for Height::GoldenWeek ⇒ NetworkVersion::V27 in src/networks/mod.rs is present.

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

2962-2963: Regenerate OpenRPC schema and coordinate client updates

  • Confirmed addition of upgrade_golden_week_height to ForkUpgradeParams (struct, TryFrom<ChainConfig> impl) and its presence in openrpc.json.
  • Add a CI step to auto-regenerate OpenRPC specs upon schema changes and update downstream clients/OpenRPC docs accordingly.
src/networks/mainnet/mod.rs (1)

93-95: GoldenWeek bundle version is correct
v16.0.1 is defined in actors_bundle.rs and used consistently across all networks; retain the existing TODO for bumping when NV27 is finalized.

src/utils/misc/logo.rs (1)

34-35: Wire-up for NV27 looks correct.

Adding the V27 arm to route to the Golden Week logo path is consistent with prior versions.

src/networks/calibnet/mod.rs (1)

96-98: Calibnet v16.0.1 bundle metadata present — no action required.

src/networks/mod.rs (1)

174-175: New Height::GoldenWeek variant added.

Enum extension is straightforward and consistent with existing heights.

src/state_migration/mod.rs (1)

30-31: NV27 module registered; migrations intentionally disabled per-network.

This keeps NV27 dormant until ready, which is safe. Once you flip these on, the logo path will trigger; ensure the Golden Week logo function is non-panicking.

Also applies to: 50-52, 68-70, 74-76, 88-90

src/state_migration/nv27/mod.rs (2)

14-18: Confirm NV27 system state types (v16 -> v16) are correct.

Using v16 for both sides is likely a temporary stub (see TODO 5985). Please verify the intended source/target system state versions for NV27 before enabling.


20-21: System/verifier scaffolding LGTM.

Macros are correctly invoked for the NV27 module.

src/state_migration/nv27/migration.rs (2)

54-62: API surface looks right

Public run_migration signature and return type are consistent with prior upgrades and keep the caller’s responsibilities clear.


85-86: I’ll inspect the definition and variants of StateTreeVersion to confirm whether V5 is still correct for NV27.

hanabi1224
hanabi1224 previously approved these changes Sep 3, 2025
@akaladarshi
Copy link
Collaborator

@LesnyRumcajs Some tests are failing

@LesnyRumcajs
Copy link
Member Author

@LesnyRumcajs Some tests are failing

Oh yeah, I forgot to use my brain during conflict resolution. It should be fine now.

@LesnyRumcajs LesnyRumcajs added this pull request to the merge queue Sep 4, 2025
Merged via the queue into main with commit 7dc92b4 Sep 4, 2025
44 checks passed
@LesnyRumcajs LesnyRumcajs deleted the nv27-skeleton branch September 4, 2025 11:31
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.

[NV27] Skeleton with base migration

4 participants