Skip to content

feat(scripts): include ribasushi-rpc-checks - #7477

Draft
EclesioMeloJunior wants to merge 4 commits into
mainfrom
forest-rpc-checks
Draft

feat(scripts): include ribasushi-rpc-checks#7477
EclesioMeloJunior wants to merge 4 commits into
mainfrom
forest-rpc-checks

Conversation

@EclesioMeloJunior

@EclesioMeloJunior EclesioMeloJunior commented Aug 11, 2026

Copy link
Copy Markdown
Member

Summary of changes

Changes introduced in this pull request:

  • Add scripts/ribasushi-rpc-checks/docker-compose.yaml it contains 3 services:
    • snapshot download: fetch forest-archive.chainsafe.dev and download based on DAYS_AGO env var (default 2 days ago)
    • forest backfill and offline server: depends on sucessfull snapshot download and it pulls ghcr.io/chainsafe/forest and run forest-tool api serve --index-backfill-epochs where the amount of epochs to backfill is based on EPOCHS env var (default 1000 epochs)
    • forest-rpc-checks: depends of forest step health check (it only expose the RPC port once backfill finishes sucessfully) and it pulls ghcr.io/chainsafe/forest-rpc-checks:latest to exec the check_rpc.rb agains the ribasushi external dataset

Reference issue to close (if applicable)

Closes #7270

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

  • This pull request is based on an issue that a maintainer has accepted (see Before Opening a Pull Request).
  • 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
    • Added a Docker Compose setup for automated RPC checks.
    • Added snapshot discovery, download, and extraction support.
    • Added a Forest service with snapshot backfill and health monitoring.
    • Added automated Ruby checks that run once the service is ready.
    • Enabled validation against external Ribasushi datasets to improve RPC compatibility coverage.
  • Documentation
    • Added changelog documentation for the external RPC checks tooling.

@EclesioMeloJunior
EclesioMeloJunior requested a review from a team as a code owner August 11, 2026 15:13
@EclesioMeloJunior
EclesioMeloJunior requested review from LesnyRumcajs and sudo-shashank and removed request for a team August 11, 2026 15:13
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

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: b626492a-9f5f-4bb2-bf73-727ba5e912ad

📥 Commits

Reviewing files that changed from the base of the PR and between 39db12b and 23532b3.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • scripts/tests/ribasushi-rpc-checks/docker-compose.yaml
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • filecoin-project/lotus (manual)
🚧 Files skipped from review as they are similar to previous changes (2)
  • CHANGELOG.md
  • scripts/tests/ribasushi-rpc-checks/docker-compose.yaml

Walkthrough

The PR adds a Docker Compose workflow for RPC checks. It prepares a chain snapshot, starts Forest with backfill settings and health checks, then runs Ruby RPC checks over the calculated height range.

Changes

RPC checks workflow

Layer / File(s) Summary
Snapshot preparation
scripts/tests/ribasushi-rpc-checks/docker-compose.yaml
The snapshot service validates inputs, selects and downloads a dated chain snapshot, extracts its height, and writes SNAPSHOT, START, END, and BACKFILL variables.
Forest startup and health
scripts/tests/ribasushi-rpc-checks/docker-compose.yaml
The Forest service mounts the snapshot, starts with backfill arguments, exposes RPC access, and checks health with forest-cli chain head.
RPC validation execution
scripts/tests/ribasushi-rpc-checks/docker-compose.yaml, CHANGELOG.md
The rpc-checks service waits for healthy Forest startup and runs check_rpc.rb over the generated height range. The changelog records the external dataset validation workflow.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant SnapshotService
  participant Forest
  participant RPCChecks
  SnapshotService->>SnapshotService: Select and prepare snapshot
  SnapshotService->>Forest: Provide snapshot and backfill settings
  Forest-->>RPCChecks: Report healthy status
  RPCChecks->>Forest: Run RPC checks for START to END
Loading

Possibly related issues

  • #7293: The Compose workflow adds the Dockerized Ribasushi dataset RPC checks described by the issue.

Suggested labels: RPC

Suggested reviewers: lesnyrumcajs, sudo-shashank

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Linked Issues check ❓ Inconclusive The changes add external Ribasushi dataset validation, but the provided context does not confirm integration with a CI workflow. Provide evidence that the Docker Compose checks run in the intended CI, nightly, or sync-check workflow.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the addition of Ribasushi RPC checks under scripts.
Out of Scope Changes check ✅ Passed The Docker Compose configuration and changelog entry directly support the external dataset validation objective.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch forest-rpc-checks
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch forest-rpc-checks

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

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 4

🧹 Nitpick comments (1)
scripts/tests/ribasushi-rpc-checks/docker-compose.yaml (1)

39-39: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Pin the Forest and RPC-checks images.

The :latest tags can change between CI runs. Different binaries can then run without a source change, including an incompatible Forest and checker pair. Pin both images to tested release references or immutable digests. Docker documents digests as immutable while tags can be changed. (docs.docker.com)

Also applies to: 61-61

🤖 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 `@scripts/tests/ribasushi-rpc-checks/docker-compose.yaml` at line 39, Replace
the mutable :latest tags for both the Forest image and the RPC-checks image in
the Docker Compose configuration with tested release references or immutable
digests, keeping the Forest/checker versions compatible.
🤖 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 `@scripts/tests/ribasushi-rpc-checks/docker-compose.yaml`:
- Around line 1-73: Format the docker-compose YAML with Prettier using its write
mode, then rerun the YAML lint job to confirm no formatting differences remain.
- Around line 21-27: Validate DAYS_AGO, EPOCHS, and the extracted head as
non-negative integers before performing arithmetic; reject malformed values and
EPOCHS=0. In the range-building logic, require EPOCHS to be at least 1 and no
greater than head, aborting with a clear error when the constraints fail.
- Around line 54-58: Extend the startup grace period for the forest healthcheck
by adding a start_period or increasing retries so failed checks remain tolerated
through the maximum EPOCHS index backfill duration. Keep the existing test,
interval, timeout, and service_healthy dependency behavior unchanged.
- Around line 22-23: Update the snapshot retrieval commands in the Docker
Compose script: add connection and overall timeouts plus retries to both curl
calls, and download archive content to a temporary file before atomically moving
it to the final path. Ensure interrupted downloads cannot leave a final file
that later passes the existing -f check.

---

Nitpick comments:
In `@scripts/tests/ribasushi-rpc-checks/docker-compose.yaml`:
- Line 39: Replace the mutable :latest tags for both the Forest image and the
RPC-checks image in the Docker Compose configuration with tested release
references or immutable digests, keeping the Forest/checker versions compatible.
🪄 Autofix

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: d345d1e0-310d-40bd-a2e9-f5fd3b3ae22c

📥 Commits

Reviewing files that changed from the base of the PR and between f6ebc6a and 2087ba4.

📒 Files selected for processing (1)
  • scripts/tests/ribasushi-rpc-checks/docker-compose.yaml
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • filecoin-project/lotus (manual)

Comment thread scripts/tests/ribasushi-rpc-checks/docker-compose.yaml
Comment thread scripts/tests/ribasushi-rpc-checks/docker-compose.yaml
Comment thread scripts/tests/ribasushi-rpc-checks/docker-compose.yaml Outdated
Comment thread scripts/tests/ribasushi-rpc-checks/docker-compose.yaml Outdated

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1

🤖 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 `@CHANGELOG.md`:
- Around line 40-41: Update the CHANGELOG entry for the ribasushi RPC checks to
reference issue `#7270` instead of PR `#7477`, using the corresponding issue link
while preserving the existing description.
🪄 Autofix

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: 5bdcbcfa-ca4f-4b25-97f1-08b5d397f574

📥 Commits

Reviewing files that changed from the base of the PR and between 2087ba4 and 39db12b.

📒 Files selected for processing (1)
  • CHANGELOG.md
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • filecoin-project/lotus (manual)

Comment thread CHANGELOG.md Outdated
@codecov

codecov Bot commented Aug 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.21%. Comparing base (0b42ef6) to head (23532b3).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files

see 7 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f6ebc6a...23532b3. 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.

@LesnyRumcajs LesnyRumcajs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please read the linked issue. Something is missing.


# only downloads if the snapshot is not present
[ -f "/snapshots/$$file" ] ||
curl -sSfL --connect-timeout 10 --retry 3 -o "/snapshots/$$file" "$$url"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

cURL is pretty bad at downloading large files such as snapshots - a better option would be to use aria2c with, e.g., -x5 set.

- |
apk add --no-cache curl jq >/dev/null

# validates DAYS_AGO and EPOCHS

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

pretty complex on its own - best to put it into a dedicated bash script so that shellcheck linter can nicely check it. It's also pretty obscure unreadable bash (not your fault, it's just bash) with regexes, so plenty of comments are needed to assert the logic is sound.

[ "$$EPOCHS" -ge 1 ] || { echo "EPOCHS must be at least 1"; exit 1; }

day=$$(date -u -d "@$$(( $$(date -u +%s) - DAYS_AGO * 86400 ))" +%F)
url=$$(curl -sSf --connect-timeout 10 --retry 3 \

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

unless a flag is obvious, e.g., rm -rf, I recommend using full versions of the params, e.g., --silent instead of -s. Then a reader doesn't need a PhD in cURL to parse the file.


# The RPC port opens only after the backfill finishes, so "healthy" means ready.
forest:
image: ghcr.io/chainsafe/forest:latest

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Re-think your options. Hint: latest is a bad option - why?

https://docs.forest.chainsafe.io/knowledge_base/docker_tips#tags

- |
. /snapshots/env
exec forest-tool api serve "/snapshots/$$SNAPSHOT" --chain "$$CHAIN" \
--port 2345 --height 0 --index-backfill-epochs "$$BACKFILL"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why --height 0?

FOREST_RPC_URL: forest:2345/rpc/v1
volumes:
- ./snapshots:/snapshots:ro
entrypoint: ["/bin/sh", "-euc"]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can you just use the image directly?

Comment on lines +63 to +67
healthcheck:
test: ["CMD", "forest-cli", "chain", "head"]
interval: 15s
timeout: 10s
retries: 480

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

So... potentially 20h for the probe to fail?

@LesnyRumcajs
LesnyRumcajs marked this pull request as draft August 12, 2026 07:49
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.

Integrate external dataset validation in CI

2 participants