Skip to content

Conversation

@hanabi1224
Copy link
Contributor

@hanabi1224 hanabi1224 commented Sep 5, 2025

Summary of changes

This PR updates F3 snapshot to speed up the F3 readiness check (forest-cli f3 ready). Hopefully, this is the last manual update before we switch to the rolling F3-aware v2 snapshots in CI tests

Changes introduced in this pull request:

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

  • Tests
    • Updated F3 calibration snapshot reference and certificate import check to the latest data, improving test reliability and alignment with the current network state.
    • Enhances consistency across environments and reduces potential test flakiness during initialization and snapshot import workflows.
    • No user-facing changes; runtime behavior unaffected.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 5, 2025

Walkthrough

Updated F3 snapshot reference and certificate instance IDs in scripts/tests/harness.sh: changed the F3 snapshot filename to f3_snap_calibnet_622579.bin and adjusted instance checks/messages from 550000 to 622000. No function signatures or public interfaces were modified.

Changes

Cohort / File(s) Summary
F3 snapshot and instance updates
scripts/tests/harness.sh
Updated snapshot download URL to f3_snap_calibnet_622579.bin in forest_download_and_import_snapshot_with_f3; changed F3 certificate import check and messages from instance 550000 to 622000 in forest_init_with_f3.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Suggested reviewers

  • sudo-shashank
  • LesnyRumcajs
  • akaladarshi
✨ 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/ci-update-f3-snap

🪧 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.

@hanabi1224 hanabi1224 marked this pull request as ready for review September 5, 2025 00:56
@hanabi1224 hanabi1224 requested a review from a team as a code owner September 5, 2025 00:56
@hanabi1224 hanabi1224 requested review from elmattic and sudo-shashank and removed request for a team September 5, 2025 00:56
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 (2)
scripts/tests/harness.sh (2)

30-47: Parameterize and verify the F3 snapshot; add checksum and retry hygiene.

Hardcoding the URL and instance invites silent drift. Let’s: (a) make the URL/instance overridable via env vars; (b) fail fast if the header’s instance doesn’t match what the test expects; (c) add basic retries/timeouts and an optional SHA256 to keep CI deterministic. This aligns with your “fail fast” preference from prior PRs.

Apply:

 function forest_download_and_import_snapshot_with_f3 {
   echo "Downloading v1 snapshot"
   aria2c -x5 https://forest-archive.chainsafe.dev/latest/calibnet/ -o v1.forest.car.zst
   echo "Inspecting v1 snapshot"
   $FOREST_TOOL_PATH archive info v1.forest.car.zst
   echo "Downloading F3 snapshot"
-  aria2c -x5 https://forest-snapshots.fra1.cdn.digitaloceanspaces.com/f3/f3_snap_calibnet_622579.bin -o f3.bin
+  # Allow overriding in CI: F3_SNAPSHOT_URL, F3_EXPECTED_CERT_INSTANCE, F3_SNAPSHOT_SHA256
+  : "${F3_SNAPSHOT_URL:=https://forest-snapshots.fra1.cdn.digitaloceanspaces.com/f3/f3_snap_calibnet_622579.bin}"
+  : "${F3_EXPECTED_CERT_INSTANCE:=622000}"
+  aria2c -x5 --timeout=30 --retry-wait=5 --max-tries=5 --conditional-get=true "$F3_SNAPSHOT_URL" -o f3.bin
+  if [ -n "${F3_SNAPSHOT_SHA256:-}" ]; then
+    echo "${F3_SNAPSHOT_SHA256}  f3.bin" | sha256sum -c -
+  fi
   echo "Inspecting F3 snapshot"
-  $FOREST_TOOL_PATH archive f3-header f3.bin
+  F3_HEADER=$($FOREST_TOOL_PATH archive f3-header f3.bin)
+  echo "$F3_HEADER"
+  # Fail fast if header instance doesn’t match the expected cert instance (prevents mixing incompatible assets).
+  F3_HEADER_INSTANCE=$(printf "%s\n" "$F3_HEADER" | grep -i 'instance' | awk '{print $NF}')
+  if [ -n "$F3_HEADER_INSTANCE" ] && [ -n "$F3_EXPECTED_CERT_INSTANCE" ] && [ "$F3_HEADER_INSTANCE" != "$F3_EXPECTED_CERT_INSTANCE" ]; then
+    echo "F3 header instance ($F3_HEADER_INSTANCE) != expected cert instance ($F3_EXPECTED_CERT_INSTANCE)"; exit 1
+  fi
   echo "Generating v2 snapshot"
   $FOREST_TOOL_PATH archive merge-f3 --v1 v1.forest.car.zst --f3 f3.bin --output v2.forest.car.zst
   echo "Inspecting v2 snapshot info"
   $FOREST_TOOL_PATH archive info v2.forest.car.zst
   echo "Inspecting v2 snapshot metadata"
   $FOREST_TOOL_PATH archive metadata v2.forest.car.zst
   echo "Importing the v2 snapshot"
   $FOREST_PATH --chain calibnet --encrypt-keystore false --halt-after-import --height=-200 --import-snapshot v2.forest.car.zst
 }

To verify now, run locally/CI with:

  • F3_SNAPSHOT_URL only (happy path).
  • With a mismatched F3_EXPECTED_CERT_INSTANCE to confirm it fails fast.

165-166: Make the certificate check robust and self-documenting.

Tie the hardcoded instance to the same F3_EXPECTED_CERT_INSTANCE used during download, and fail if missing. Also fix capitalization in the echo.

-  echo "ensure F3 certificate at instance 622000 has been imported"
-  $FOREST_CLI_PATH f3 c get 622000
+  echo "Ensure F3 certificate at instance ${F3_EXPECTED_CERT_INSTANCE:-622000} has been imported"
+  if ! $FOREST_CLI_PATH f3 c get "${F3_EXPECTED_CERT_INSTANCE:-622000}"; then
+    echo "F3 certificate ${F3_EXPECTED_CERT_INSTANCE:-622000} not found"; exit 1
+  fi
📜 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 7dc92b4 and a3a3915.

📒 Files selected for processing (1)
  • scripts/tests/harness.sh (2 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). (9)
  • GitHub Check: tests-release
  • GitHub Check: tests
  • GitHub Check: Build forest binaries on Linux AMD64
  • GitHub Check: All lint checks
  • GitHub Check: cargo-publish-dry-run
  • GitHub Check: Build MacOS
  • GitHub Check: Build Ubuntu
  • GitHub Check: Analyze (go)
  • GitHub Check: Analyze (rust)

@hanabi1224 hanabi1224 enabled auto-merge September 5, 2025 09:07
@hanabi1224 hanabi1224 added this pull request to the merge queue Sep 5, 2025
Merged via the queue into main with commit aa977cf Sep 5, 2025
49 checks passed
@hanabi1224 hanabi1224 deleted the hm/ci-update-f3-snap branch September 5, 2025 10:44
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.

4 participants