Skip to content

fix(rpc): handle eth_config when no timestamp fork is active yet#86

Open
panos-xyz wants to merge 1 commit intomainfrom
fix/eth-config-no-timestamp-fork
Open

fix(rpc): handle eth_config when no timestamp fork is active yet#86
panos-xyz wants to merge 1 commit intomainfrom
fix/eth-config-no-timestamp-fork

Conversation

@panos-xyz
Copy link
Copy Markdown
Contributor

@panos-xyz panos-xyz commented Apr 8, 2026

Summary

  • eth_config returned error "no active timestamp fork found" when the chain is at block 0 (Bernoulli/Curie block-based fork era)
  • This caused morphnode to fail its startup readiness check and retry indefinitely, blocking sync from genesis
  • Fixed by falling back to latest_ts when no timestamp fork is active, so the response correctly reflects the current chain state (useZktrie: true, jadeForkTime set, next pointing to Morph203)

Root Cause

eth_config collects all timestamp-based fork activation timestamps and finds the latest one <= latest block timestamp. At genesis (block 0, timestamp ~0 or early), all timestamp forks (Morph203 @ 1747029600, Viridian, Emerald, Jade) are in the future, so rfind returns None → error.

Test Plan

  • cargo check -p morph-rpc passes
  • cargo build --release passes
  • Started mainnet node from genesis: morphnode no longer loops on "Waiting for geth to be ready" and begins syncing immediately
  • eth_config response at block 0 correctly returns useZktrie: true and jadeForkTime

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced fork timestamp selection to gracefully handle scenarios where no active timestamp fork exists. The system now falls back to the current block timestamp instead of failing, ensuring stable operation across all timestamp configurations.

When the chain is at block 0 (block-based fork era like Bernoulli/Curie),
no timestamp-based forks are active yet. The eth_config handler previously
returned an error "no active timestamp fork found", which caused morphnode
to fail its startup readiness check and loop forever.

Fall back to the current block's timestamp when no timestamp fork is
active. This produces a correct response (useZktrie=true, jadeForkTime
set, next fork pointing to Morph203) so morphnode can proceed.
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 8, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 55c679e5-e8d0-4fd4-ad9f-553b444082b6

📥 Commits

Reviewing files that changed from the base of the PR and between 7d75856 and 12fa914.

📒 Files selected for processing (1)
  • crates/rpc/src/eth_config.rs

📝 Walkthrough

Walkthrough

The change modifies fork timestamp selection logic in eth_config.rs. When no active timestamp fork exists, the code now falls back to using the latest timestamp instead of returning an error, allowing continued processing with the current block state timestamp.

Changes

Cohort / File(s) Summary
Fork Timestamp Fallback Logic
crates/rpc/src/eth_config.rs
Modified config_impl to fall back to latest_ts when no active timestamp fork is found, replacing previous error return. Added explanatory comment on block-based fork era behavior and expected useZktrie=true result for pre-Morph203.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested reviewers

  • chengwenxi
  • anylots

Poem

🐰 When forks fade and timestamps flee,
No error thrown, just fall back free!
The latest path is always there,
Like carrots hopping everywhere! 🥕

🚥 Pre-merge checks | ✅ 3
✅ 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 accurately describes the main change: handling the eth_config RPC response when no timestamp fork is active yet, which is the core fix for the startup readiness check issue.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/eth-config-no-timestamp-fork

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

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.

1 participant