Skip to content

Async runtime (Phase 10) for chain/clock.py and networking #7

@pirapira

Description

@pirapira

Summary

Phase 10 of the development plan: implement async/await support for leanSpec's networking and node code. Currently, chain/clock.py imports asyncio at module level, blocking its import.

Current behavior

  • import asyncio raises ModuleNotFoundError
  • chain/clock.py cannot be imported (defines SlotClock with async methods)
  • All networking, sync, validator service, and API modules use async/await

Scope

Minimal async subset needed:

  • async def, await, async for, async with
  • asyncio.create_task, asyncio.gather, asyncio.sleep
  • asyncio.Queue, asyncio.Event
  • Basic event loop
  • Task cancellation

Impact

Blocks ~23 leanSpec files (~9,100 lines):

  • chain/clock.py, chain/service.py
  • subspecs/networking/ (discovery, gossipsub, reqresp)
  • subspecs/sync/ (checkpoint, head, backfill sync)
  • subspecs/validator/ (validator service)
  • subspecs/api/ (REST endpoints)
  • subspecs/node/ (full node orchestration)

Reference

  • PLAN.md Phase 10
  • references/leanSpec/src/lean_spec/subspecs/chain/clock.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions