Skip to content

prometheus_client stub needed for forkchoice store #9

@pirapira

Description

@pirapira

Summary

subspecs/forkchoice/store.py imports from lean_spec.subspecs.metrics import registry as metrics, which imports prometheus_client (Counter, Gauge, Histogram, REGISTRY, generate_latest). This external dependency is not available.

Current behavior

  • ModuleNotFoundError: No module named 'prometheus_client'
  • Blocks importing the real forkchoice store module

Impact

  • subspecs/forkchoice/store.py (1,316 lines) — the LMD GHOST fork choice algorithm
  • The metrics module uses a null-object pattern (stubs before initialization), so metrics calls are effectively no-ops even in production

Possible approach

Add prometheus_client as a builtin stub module with no-op classes:

  • Counter, Gauge, Histogram — classes with labels(), inc(), dec(), set(), observe() as no-ops
  • REGISTRY — stub object
  • generate_latest — returns empty bytes

This matches the null-object pattern already used in the leanSpec metrics module.

Reference

  • references/leanSpec/src/lean_spec/subspecs/metrics/registry.py
  • references/leanSpec/src/lean_spec/subspecs/forkchoice/store.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions