Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude/agents/py-architect.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ Follow this systematic approach:
2. **Identify** - Find code smells, duplication, unclear intent, type gaps
3. **Preserve** - Ensure tests exist before making changes
4. **Transform** - Make small, incremental improvements
5. **Verify** - Confirm tests pass, types check (`uvx tox -e typecheck`), lints clean (`uv run ruff check`)
5. **Verify** - Confirm tests pass, types check (`just typecheck`), lints clean (`just lint`)

## Quality Bar

Expand Down
10 changes: 5 additions & 5 deletions .claude/rules/workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ uv run fill --fork=lstar --clean -n auto --scheme=prod # Generate test vectors
## Code Quality

```bash
uv run ruff format # Format code
uv run ruff check --fix # Lint and fix
uvx tox -e typecheck # Type check
uvx tox -e all-checks # All quality checks
uvx tox # Everything (checks + tests + docs)
just format # Format code
just fix # Auto-fix lint, formatting, and markdown
just typecheck # Type check
just check # All quality checks (lint, format, typecheck, spell, mdformat, lock)
just # List all available recipes
```

## Common Tasks
Expand Down
3 changes: 2 additions & 1 deletion .claude/skills/checks/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Run the complete quality check suite.
## Command

```bash
uvx tox -e all-checks
just check
```

## What It Runs
Expand All @@ -20,6 +20,7 @@ uvx tox -e all-checks
3. `ty check` - Type checking
4. `codespell` - Spell checking
5. `mdformat` - Markdown formatting
6. `uv lock --check` - Lockfile drift

## When to Use

Expand Down
9 changes: 5 additions & 4 deletions .claude/skills/fill/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,22 @@ Run the test filler to generate consensus layer test fixtures.
## Default Usage

```bash
uvx tox -e fill
uv run fill --fork=Lstar --clean -n auto
```

## Options

Pass additional arguments after `--`:

- `/fill -- --scheme=prod` - Use production signature scheme (slower)
- `/fill -- --fork=Electra` - Generate for Electra fork
- `/fill -- --fork=<other>` - Generate for a different fork
- `/fill -- path/to/test.py` - Generate fixtures for specific test file

## What It Does

Runs `fill --fork=Devnet --clean -n auto` via tox, which:

1. Discovers tests in `tests/consensus/`
2. Executes spec tests to generate fixtures
3. Outputs JSON fixtures to `fixtures/consensus/`

The `just fill-ci` recipe wraps the same command for CI; contributors should
invoke `uv run fill` directly so flags like `--fork` and `--clean` stay visible.
2 changes: 1 addition & 1 deletion .claude/skills/fix/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Automatically fix linting and formatting issues.
## Command

```bash
uvx tox -e fix
just fix
```

## What It Fixes
Expand Down
4 changes: 2 additions & 2 deletions .claude/skills/review/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ A concise checklist distilled from CLAUDE.md for reviewing leanSpec code.
## Before Committing

```bash
uvx tox -e fix # Auto-fix formatting
uvx tox -e all-checks # Verify all checks pass
just fix # Auto-fix lint, formatting, and markdown
just check # Verify all checks pass
```
2 changes: 1 addition & 1 deletion .claude/skills/test/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Run pytest unit tests.
## Default

```bash
uvx tox -e pytest
just test
```

## Options
Expand Down
20 changes: 10 additions & 10 deletions .claude/skills/workflows/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ Common developer workflows and commands for working in leanSpec.

```bash
# Single test file
uvx tox -e pytest -- tests/lean_spec/subspecs/networking/discovery/test_transport.py -v
just test tests/lean_spec/subspecs/networking/discovery/test_transport.py -v

# Single test class or method
uvx tox -e pytest -- -k "TestDiscoveryTransport::test_start" -v
just test -k "TestDiscoveryTransport::test_start" -v

# With print output visible
uvx tox -e pytest -- -s -k "test_name"
just test -s -k "test_name"
```

## Resolving Type Errors
Expand All @@ -26,10 +26,10 @@ The project uses two type checkers. Run them separately to isolate issues:

```bash
# Full type check (ty — the primary checker used in CI)
uvx tox -e typecheck
just typecheck

# Lint check (ruff — catches style and import issues)
uvx tox -e lint
just lint
```

Common type error patterns:
Expand All @@ -43,7 +43,7 @@ After running tests, coverage reports are generated:

```bash
# View coverage in terminal
uvx tox -e pytest
just test-cov

# Open HTML report
open htmlcov/index.html
Expand All @@ -54,14 +54,14 @@ open htmlcov/index.html
Interop tests are excluded from the default test run. Run them explicitly:

```bash
uv run pytest tests/interop/ -v
just interop
```

## Spell Check Failures

```bash
# Run spell check
uvx tox -e spellcheck
just spellcheck

# Add legitimate words to the ignore list
echo "newword" >> .codespell-ignore-words.txt
Expand All @@ -71,11 +71,11 @@ echo "newword" >> .codespell-ignore-words.txt

```bash
# Check markdown formatting (docs only)
uvx tox -e mdformat
just mdformat
```

## Common Pitfalls

- **Tests pass locally but CI fails**: CI runs checks across Python 3.12, 3.13, and 3.14. Ensure no version-specific syntax is used.
- **`ruff format` changes after `ruff check --fix`**: Always run format after fix — the fixer doesn't guarantee formatting compliance.
- **Import ordering issues**: Run `uvx tox -e fix` to auto-sort imports.
- **Import ordering issues**: Run `just fix` to auto-sort imports.
4 changes: 2 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
## ✅ Checklist
<!-- Please check off all required items. For those that don't apply remove them accordingly. -->

- [ ] Ran `tox` checks to avoid unnecessary CI fails:
- [ ] Ran local quality checks to avoid unnecessary CI fails:
```console
uvx tox
just check
```
- [ ] Considered adding appropriate tests for the changes.
- [ ] Considered updating the online docs in the [./docs/](/leanEthereum/leanSpec/tree/main/docs/) directory.
47 changes: 31 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,13 @@ jobs:
enable-cache: true
cache-dependency-glob: "pyproject.toml"

- name: Run all quality checks via tox
run: uvx tox -e all-checks
- name: Install just
uses: taiki-e/install-action@v2
with:
tool: just

- name: Run all quality checks
run: just check

test:
name: Tests - Python ${{ matrix.python-version }} on ${{ matrix.os }}
Expand All @@ -63,8 +68,13 @@ jobs:
enable-cache: true
cache-dependency-glob: "pyproject.toml"

- name: Run tests via tox
run: uvx tox -e pytest
- name: Install just
uses: taiki-e/install-action@v2
with:
tool: just

- name: Run tests
run: just test

coverage-gate:
name: Coverage gate - Python 3.12
Expand All @@ -84,8 +94,13 @@ jobs:
enable-cache: true
cache-dependency-glob: "pyproject.toml"

- name: Install just
uses: taiki-e/install-action@v2
with:
tool: just

- name: Run tests with coverage gate
run: uvx tox -e pytest-cov-gate
run: just test-cov-gate

fill-tests:
name: Fill test fixtures - Python 3.14
Expand All @@ -105,11 +120,13 @@ jobs:
enable-cache: true
cache-dependency-glob: "pyproject.toml"

- name: Sync dependencies
run: uv sync --no-progress
- name: Install just
uses: taiki-e/install-action@v2
with:
tool: just

- name: Fill test fixtures
run: uv run fill --fork=Lstar --clean -n auto
run: just fill-ci

interop-tests:
name: Interop tests - Multi-node consensus
Expand All @@ -130,14 +147,12 @@ jobs:
enable-cache: true
cache-dependency-glob: "pyproject.toml"

- name: Install just
uses: taiki-e/install-action@v2
with:
tool: just

- name: Run interop tests
run: |
uv run pytest tests/interop/ \
-v \
--no-cov \
--timeout=120 \
-x \
--tb=short \
--log-cli-level=INFO
run: just interop
env:
LEAN_ENV: test
8 changes: 5 additions & 3 deletions .github/workflows/prod-vectors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ jobs:
enable-cache: true
cache-dependency-glob: "pyproject.toml"

- name: Sync dependencies
run: uv sync --no-progress
- name: Install just
uses: taiki-e/install-action@v2
with:
tool: just

- name: Restore prod key cache
id: key-cache
Expand All @@ -87,7 +89,7 @@ jobs:
key: prod-keys-${{ hashFiles('src/lean_spec/subspecs/xmss/**', 'src/lean_spec/subspecs/poseidon2/**') }}

- name: Fill production test fixtures
run: uv run fill --fork=Lstar --scheme prod --clean -n auto
run: just fill-ci --scheme=prod

- name: Bundle keys with fixtures
run: |
Expand Down
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ subspecifications that the Lean Ethereum protocol relies on.
- Use Pydantic models for validation
- Keep specs simple, readable, and clear
- Repository is `leanSpec` not `lean-spec`
- **Always run linter checks before finishing**: Run `uvx tox -e all-checks` at the end of any code changes to ensure all linting, formatting, type checking, and spell checking passes.
- **Always run linter checks before finishing**: Run `just check` at the end of any code changes to ensure all linting, formatting, type checking, and spell checking passes.
- **CRITICAL - NO BACKWARD COMPATIBILITY**: This is a STRICT requirement. NEVER add backward compatibility code under any circumstances. This means:
- NO legacy constants (like `KEY_TYPE_ED25519 = KeyType.ED25519`)
- NO wrapper functions that delegate to new classes
Expand Down
9 changes: 5 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
1. Fork and clone the repository
2. Install dependencies: `uv sync`
3. Make your changes
4. Run checks: `uvx tox -e all-checks`
5. Run tests: `uvx tox -e pytest`
6. Submit a pull request
4. Install `just`: `uv tool install just-bin`
5. Run checks: `just check`
6. Run tests: `just test`
7. Submit a pull request

## Pull Request Guidelines

Expand All @@ -22,7 +23,7 @@
- **Type hints**: Required for all functions and methods
- **Docstrings**: Use Google style for public APIs
- **Line length**: 100 characters (enforced by ruff)
- **Formatting**: Run `uvx tox -e fix` to auto-format
- **Formatting**: Run `just fix` to auto-format

## Adding New Subspecifications

Expand Down
Loading
Loading