Skip to content

metrics: anchor pq sig aggregate building time at interval 2 start#784

Open
ch4r10t33r wants to merge 3 commits into
leanEthereum:mainfrom
ch4r10t33r:fix/pq-sig-aggregated-building-time
Open

metrics: anchor pq sig aggregate building time at interval 2 start#784
ch4r10t33r wants to merge 3 commits into
leanEthereum:mainfrom
ch4r10t33r:fix/pq-sig-aggregated-building-time

Conversation

@ch4r10t33r
Copy link
Copy Markdown
Collaborator

Summary

  • Register lean_pq_sig_aggregated_signatures_building_time_seconds (plus related PQ production counters) in the leanSpec metrics registry with leanMetrics-aligned buckets and help text.
  • Measure building time from the start of aggregation interval 2 through STARK proof completion (TypeOneMultiSignature.aggregate), including select/fill prep — not just the xmss prove call.
  • Wire observation on the aggregator-duty path (tick_intervalaggregate); extend the /metrics API fixture contract and add registry + interval-2 integration tests.

Test plan

  • uv run pytest tests/lean_spec/subspecs/metrics/test_registry.py --no-cov
  • uv run pytest tests/lean_spec/forks/lstar/forkchoice/test_store_attestations.py::test_interval_2_records_pq_sig_building_time_metric --no-cov

Record lean_pq_sig_aggregated_signatures_building_time_seconds from the
beginning of the aggregation slot interval through STARK proof completion,
not just the xmss aggregate call. Expose related PQ production counters and
extend the /metrics API fixture contract.
@ch4r10t33r ch4r10t33r marked this pull request as draft May 27, 2026 15:38
Resolve conflicts in:
- packages/testing/.../api_endpoint.py: combine pq-sig and aggregate-coverage entries in the /metrics fixture contract
- src/lean_spec/forks/lstar/spec.py: keep both math and time imports; preserve aggregation_interval_start plumbing alongside upstream's Interval arithmetic refactor
- src/lean_spec/subspecs/metrics/registry.py: keep PQ_SIG bucket constant alongside aggregate-coverage section constants
- tests/.../metrics/test_registry.py: merge pq-sig and coverage test cases
Previously the building-time clock was captured as time.perf_counter()
inside tick_interval, immediately before calling aggregate(). That
measures 'time since tick_interval fired' — not 'time since the
aggregation interval boundary'. Host scheduling lag would silently
under-report.

Anchor instead at the wall-clock interval-2 start derived from chain
config (genesis_time + store.time * MILLISECONDS_PER_INTERVAL). At
each STARK proof completion observe time.time() - interval_start,
clamped at 0 to guard against clock skew. aggregate() no longer needs
the perf_counter parameter from tick_interval.

Update the integration test to use a realistic genesis_time so the
recorded duration is bounded (< 60s), which would catch any future
regression that re-anchors against unix epoch.
@ch4r10t33r ch4r10t33r marked this pull request as ready for review May 27, 2026 16:50
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