feat(rpc): add GET /lean/v0/config/spec#456
Conversation
🤖 Kimi Code ReviewFile: Critical: Hardcoded Fork Digest
Safety: Unchecked Type Cast
Maintenance Burden
Testing Gap
Minor: Unnecessary Allocation
Architecture Note File:
Automated review by Kimi (Moonshot AI) · kimi-k2.5 · custom prompt |
🤖 Codex Code Review
No consensus-path code was changed here, so I did not find issues in fork choice, attestation validation, STF, XMSS, or SSZ logic from this diff itself. I could not run the targeted Rust test in this sandbox because Automated review by OpenAI Codex · gpt-5.4 · custom prompt |
Greptile SummaryThis PR adds the
Confidence Score: 5/5Safe to merge — the change is additive, all constants come from compile-time definitions, and the unit test covers the full response shape. The handler is read-only and stateless, introduces no new mutable state or side effects, and the previously flagged constant duplication has been properly resolved by moving FORK_DIGEST to the shared types crate. No files require special attention.
|
| Filename | Overview |
|---|---|
| crates/common/types/src/constants.rs | New shared constants module; moves FORK_DIGEST out of the p2p crate so it can be imported by both the p2p and rpc crates without duplication. |
| crates/common/types/src/lib.rs | One-line addition registering the new constants module; no issues. |
| crates/net/p2p/src/gossipsub/messages.rs | Replaces the local FORK_DIGEST definition with a re-export from ethlambda_types::constants, resolving the previous synchronisation concern. |
| crates/net/rpc/src/lib.rs | Registers the new spec module and merges its routes into the API router; straightforward wiring. |
| crates/net/rpc/src/spec.rs | New GET /lean/v0/config/spec handler; all five constants (including HISTORICAL_ROOTS_LIMIT) are asserted in the unit test. No issues found. |
| docs/rpc.md | Adds the new endpoint to the route table and documents its response shape with example values; consistent with the implementation. |
Sequence Diagram
%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant Client
participant RPC as ethlambda-rpc
participant Types as ethlambda-types
participant Blockchain as ethlambda-blockchain
Client->>RPC: GET /lean/v0/config/spec
RPC->>Types: FORK_DIGEST (constants::FORK_DIGEST)
RPC->>Types: HISTORICAL_ROOTS_LIMIT (state::HISTORICAL_ROOTS_LIMIT)
RPC->>Blockchain: MILLISECONDS_PER_SLOT, INTERVALS_PER_SLOT, MILLISECONDS_PER_INTERVAL
RPC-->>Client: 200 OK JSON response with all 5 constants
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant Client
participant RPC as ethlambda-rpc
participant Types as ethlambda-types
participant Blockchain as ethlambda-blockchain
Client->>RPC: GET /lean/v0/config/spec
RPC->>Types: FORK_DIGEST (constants::FORK_DIGEST)
RPC->>Types: HISTORICAL_ROOTS_LIMIT (state::HISTORICAL_ROOTS_LIMIT)
RPC->>Blockchain: MILLISECONDS_PER_SLOT, INTERVALS_PER_SLOT, MILLISECONDS_PER_INTERVAL
RPC-->>Client: 200 OK JSON response with all 5 constants
Reviews (2): Last reviewed commit: "refactor(types): centralize FORK_DIGEST ..." | Re-trigger Greptile
🤖 Claude Code ReviewHere is the review: Review:
|
2df413e to
7221691
Compare
# Conflicts: # crates/net/rpc/src/lib.rs # docs/rpc.md
The dummy fork digest was duplicated as a private const in the p2p gossipsub topic builder and again in the new config/spec RPC handler, each with a comment warning the other must be kept in sync. Move it to ethlambda_types::constants::FORK_DIGEST so both re-use one definition.
🤖 Kimi Code ReviewOverall this is a clean refactoring and well-tested feature addition. No security vulnerabilities or consensus risks identified. Code Quality & Correctness
Rust Idioms
Testing
Documentation
Security
Recommendation Automated review by Kimi (Moonshot AI) · kimi-k2.5 · custom prompt |
🤖 Codex Code ReviewNo blocking findings. This PR is low risk: it centralizes Assumptions and gaps:
Change summary:
Automated review by OpenAI Codex · gpt-5.4 · custom prompt |
🤖 Claude Code ReviewNo route path conflicts, integration is clean. This is a small, well-scoped PR. Here's my review. Review:
|
|
Want your agent to iterate on Greptile's feedback? Try greploops. |
Adds the
GET /lean/v0/config/specendpoint, which exposes chain configuration parameters (slot duration, committee sizes, finality constants, etc.) as JSON.Allows external tools and cross-client integrations to discover runtime config without out-of-band coordination. Has unit tests and passed clippy.
Stacked on #454.