{"id":44193369,"url":"https://github.com/leanethereum/leanspec","last_synced_at":"2026-05-31T01:00:48.021Z","repository":{"id":306986222,"uuid":"1027933394","full_name":"leanEthereum/leanSpec","owner":"leanEthereum","description":"Lean Ethereum protocol specifications and test vector generation framework.","archived":false,"fork":false,"pushed_at":"2026-05-27T22:06:08.000Z","size":11555,"stargazers_count":130,"open_issues_count":9,"forks_count":71,"subscribers_count":17,"default_branch":"main","last_synced_at":"2026-05-27T23:08:33.640Z","etag":null,"topics":["eth","ethereum","ethereum-testing","lean-ethereum","post-quantum-cryptography"],"latest_commit_sha":null,"homepage":"https://leanroadmap.org/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leanEthereum.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-07-28T18:53:01.000Z","updated_at":"2026-05-27T21:09:13.000Z","dependencies_parsed_at":"2025-08-22T22:20:30.165Z","dependency_job_id":"50a6adca-ad50-41f5-a517-0930a8bafef8","html_url":"https://github.com/leanEthereum/leanSpec","commit_stats":null,"previous_names":["leanethereum/leanspec"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/leanEthereum/leanSpec","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanEthereum%2FleanSpec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanEthereum%2FleanSpec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanEthereum%2FleanSpec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanEthereum%2FleanSpec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leanEthereum","download_url":"https://codeload.github.com/leanEthereum/leanSpec/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanEthereum%2FleanSpec/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33715211,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-30T02:00:06.278Z","response_time":92,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["eth","ethereum","ethereum-testing","lean-ethereum","post-quantum-cryptography"],"created_at":"2026-02-09T18:09:23.790Z","updated_at":"2026-05-31T01:00:47.975Z","avatar_url":"https://github.com/leanEthereum.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lean Ethereum Specifications\n\nThe Lean Ethereum protocol specifications and cryptographic subspecifications.\n\n\u003e **🐳 Running with Docker?** Skip the setup and jump to [DOCKER_QUICKSTART.md](DOCKER_QUICKSTART.md) for containerized deployment examples.\n\n## Quick Start\n\n**New to leanSpec?** Choose your path:\n- **Local development**: Follow the instructions below\n- **Docker deployment**: See [DOCKER_QUICKSTART.md](DOCKER_QUICKSTART.md) for running as a consensus node\n\n### Prerequisites\n\n#### Installing uv\n\n[uv](https://github.com/astral-sh/uv) is a fast Python package manager that handles dependencies and Python versions.\n\n```bash\ncurl -LsSf https://astral.sh/uv/install.sh | sh\n````\n\n#### Installing just\n\n[`just`](https://just.systems/) is the task runner used for common developer\nworkflows in this repository.\n\n```bash\n# Recommended cross-platform install\nuv tool install just-bin\n\n# Alternatives\nbrew install just\napt install just\n```\n\n#### Installing Python 3.12+\n\nThis project requires Python 3.12 or later and should be installed via `uv`:\n\n```bash\n# Install Python 3.12, or latest stable version\nuv python install 3.12\n```\n\n#### Installing Rust Nightly (Temporary)\n\n\u003e **Note:** This is a temporary requirement. In the future, the Rust bindings will be removed and all cryptographic primitives will be implemented directly in Python.\n\nThis project currently depends on `lean-multisig-py`, a Rust-based Python extension that requires Rust nightly to compile:\n\n```bash\n# Install rustup if not already installed\ncurl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh\n\n# Install and set nightly as default\nrustup install nightly\nrustup default nightly\n\n# Verify installation\nrustc --version  # Should show nightly version\n```\n\n### Setup\n\n```bash\n# Clone this repository\ngit clone https://github.com/leanEthereum/leanSpec leanSpec\ncd leanSpec\n\n# Install and sync project and dev dependencies, using `uv.lock` versions\nuv sync\n\n# See the available repo tasks\njust\n\n# Run tests to verify setup\njust test\n```\n\n### Project Structure\n\n```\n├── src/\n│   └── lean_spec/                      # Main specifications\n│      ├── __init__.py\n│      └── subspecs/                       # Sub-specifications\n│          ├── poseidon1/\n│          │   ├── __init__.py\n│          │   ├── permutation.py\n│          │   └── constants.py\n│          ├── ...\n│          └── ...\n├── tests/                              # Test suite\n|   ├── consensus/                      # Tests for consensus\n|   |   └── devnet/                     # Tests for devnet\n|   |       ├── fc/                     # Tests for fork-choice\n|   |       └── state_transition/       # Tests for stf\n│   └── lean_spec/                      # Tests for main specs\n│       └── subspecs/                   # Tests for subspecs\n├── docs/                               # Documentation\n└── pyproject.toml                      # Project configuration\n```\n\n### Workspace Commands\n\n```bash\n# Install package and dev dependencies or re-sync workspace\nuv sync\n```\n\n## Development Workflow\n\n### Running Tests\n\n```bash\n# Run the default test suite\njust test\n\n# Run all tests from workspace root without just\nuv run pytest\n\n# Run tests in parallel, utilizing all available CPU cores\nuv run pytest -n auto\n\n# Run tests in parallel, specifying number of workers (e.g., 4)\nuv run pytest -n 4\n\n# Skip slow tests (marked with @pytest.mark.slow)\nuv run pytest -m \"not slow\"\n\n# Fill test vectors from pytest specs.\n# Usage: uv run fill --clean --fork=Lstar [--scheme=\u003cscheme\u003e] [--output=\u003cdir\u003e]\n#   --clean  Overwrite existing fixtures\n#   --fork   Target fork (e.g., Lstar)\n#   --scheme XMSS signature scheme: \"test\" (default, fast) or \"prod\" (prod config, slower)\n#   --output Optional directory for filled fixtures\nuv run fill --clean --fork=Lstar\nuv run fill --clean --fork=Lstar --scheme=prod\n\n# Run API conformance tests against an external client implementation\n# Usage: uv run apitest \u003cserver-url\u003e [pytest-args]\nuv run apitest http://localhost:5052\n\n# Same API conformance test through the task runner\njust apitest http://localhost:5052\n```\n\n### Code Quality\n\n```bash\n# Run the full quality gate\njust check\n\n# Check code style and errors\njust lint\n\n# Auto-fix issues\njust fix\n\n# Format code\njust format\n\n# Type checking\njust typecheck\n```\n\n### Using just for Common Tasks\n\nRun `just` with no arguments to see the available recipes. `just` is the\nprimary command surface for contributors, while raw `uv run ...` commands remain\navailable when you want to invoke tools directly.\n\n```bash\n# List available tasks\njust\n\n# Run quality checks\njust check\n\n# Run tests\njust test\n\n# Build documentation\njust docs\n\n# Generate consensus fixtures\nuv run fill --fork=Lstar --clean -n auto\n```\n\n### Documentation\n\n```bash\n# Serve docs locally (with auto-reload)\nuv run mkdocs serve\n\n# Build docs\nuv run mkdocs build\n```\n\n## Writing Specifications\n\n### Example: Writing Tests\n\n```python\n# tests/test_new_types.py\nimport pytest\nfrom pydantic import ValidationError\nfrom lean_spec.types import Withdrawal  # Example Pydantic model\n\n\nTEST_ADDRESS = \"0x1234567890abcdef1234567890abcdef12345678\"\n\n\n# Parametrized test - test multiple inputs\n@pytest.mark.parametrize(\"amount\", [0, 1, 1000, 2**64 - 1])\ndef test_withdrawal_amount(amount):\n    withdrawal = Withdrawal(\n            index=0,\n            validator_index=1,\n            address=TEST_ADDRESS,\n            amount=amount,\n    )\n    assert withdrawal.amount == amount  # Check if amount is set correctly\n\n\n\n# Exception testing\ndef test_withdrawal_amount_above_uint64_max():\n    with pytest.raises(ValidationError) as e:\n        Withdrawal(\n            index=0,\n            validator_index=1,\n            address=TEST_ADDRESS,\n            amount=2**64,  # Exceeds uint64 max\n        )\n    assert \" amount \" in str(e.value)\n```\n\n## Guide to Python Tools\n\n- **Pydantic models**: Think of these as strongly-typed data structures that validate inputs automatically\n- **pytest**: Testing framework - just name test files `test_*.py` and functions `test_*`\n- **uv**: Fast Python package manager - like npm/yarn but for Python\n- **ruff**: Linter and formatter\n- **ty**: Type checker\n- **just**: Task runner for repository workflows such as checks, tests, docs, and fixture generation\n- **mkdocs**: Documentation generator - write docs in Markdown, serve them locally\n\n## Common Commands Reference\n\n| Task                                          | Command                                                |\n|-----------------------------------------------|--------------------------------------------------------|\n| Install and sync project and dev dependencies | `uv sync`                                              |\n| List repo tasks                               | `just`                                                 |\n| Run quality checks                            | `just check`                                           |\n| Run tests                                     | `just test`                                            |\n| Format code                                   | `just format`                                          |\n| Fix lint and formatting                       | `just fix`                                             |\n| Type check                                    | `just typecheck`                                       |\n| Build docs                                    | `just docs`                                            |\n| Serve docs                                    | `just docs-serve`                                      |\n| Generate consensus fixtures                   | `uv run fill --fork=Lstar --clean -n auto`             |\n| Test external client API conformance          | `just apitest http://localhost:5052`                   |\n| Run consensus node                            | `uv run python -m lean_spec --genesis config.yaml`     |\n| Build Docker test image                       | `docker build -t lean-spec:test .`                     |\n| Build Docker node image                       | `docker build --target node -t lean-spec:node .`       |\n| Run tests in Docker                           | `docker run --rm lean-spec:test`                       |\n| Run node in Docker                            | `docker run --rm lean-spec:node --genesis /app/data/config.yaml` |\n| Dev shell in Docker                           | `docker run --rm -it lean-spec:dev`                    |\n\n## Docker\n\n\u003e **🚀 Quick Start**: New to Docker? See [DOCKER_QUICKSTART.md](DOCKER_QUICKSTART.md) for:\n\u003e - Step-by-step deployment examples\n\u003e - Running as a validator node\n\u003e - Checkpoint sync configuration\n\u003e - Troubleshooting common issues\n\n### Building the Docker Image\n\n```bash\n# Build the test runtime image (default, for running tests)\ndocker build -t lean-spec:test .\n\n# Build the node image (for running as a consensus node)\ndocker build --target node -t lean-spec:node .\n\n# Build the development image (includes all dev tools)\ndocker build --target development -t lean-spec:dev .\n```\n\n### Running Tests with Docker\n\n```bash\n# Run tests (default command for 'test' target)\ndocker run --rm lean-spec:test\n\n# Run tests in parallel\ndocker run --rm lean-spec:test uv run pytest -n auto\n\n# Run the fill command directly\ndocker run --rm lean-spec:test uv run fill --clean --fork=Lstar\n```\n\n### Running a Consensus Node with Docker\n\nPass CLI arguments directly to the node:\n\n```bash\n# Basic node\ndocker run --rm \\\n  -v /path/to/genesis:/app/data:ro \\\n  -p 9000:9000 \\\n  lean-spec:node \\\n  --genesis /app/data/config.yaml\n\n# With bootnode\ndocker run --rm \\\n  -v /path/to/genesis:/app/data:ro \\\n  -p 9000:9000 \\\n  lean-spec:node \\\n  --genesis /app/data/config.yaml \\\n  --bootnode /ip4/127.0.0.1/tcp/9000\n```\n\nSee [DOCKER_QUICKSTART.md](DOCKER_QUICKSTART.md) for more examples including validator nodes, checkpoint sync, and troubleshooting.\n\n## Documentation\n\n- **[DOCKER_QUICKSTART.md](DOCKER_QUICKSTART.md)** - Complete Docker deployment guide with examples\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for more guidelines.\n\n## License\n\nMIT License - see LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleanethereum%2Fleanspec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleanethereum%2Fleanspec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleanethereum%2Fleanspec/lists"}