Skip to content

Python cleanup#2

Draft
b0a7 wants to merge 9 commits intomjkeating:mainfrom
b0a7:python_cleanup
Draft

Python cleanup#2
b0a7 wants to merge 9 commits intomjkeating:mainfrom
b0a7:python_cleanup

Conversation

@b0a7
Copy link

@b0a7 b0a7 commented Mar 5, 2026

This PR represents a major architectural overhaul of the EthPillar deployment engine. By moving from monolithic installation scripts to a modular, service-oriented architecture, maintainability is significantly improved while hardening the system with a comprehensive test suite.

Duplication Reduction & Efficiency
The core achievement of this refactor is the centralization of systemd service generation.

Centralized Logic: Consolidated service generation for 13+ unique client roles (Execution, Consensus, and Tooling) into a single service_generators.py

Boilerplate Elimination: Removed hundreds of lines of redundant template strings across individual client installers.
Estimated LoC Impact: Reduced the footprint of individual installer modules like lodestar.py and teku.py by approximately 40%, stripping away hardcoded systemd templates in favor of shared, reusable generator functions.

Modularity & Maintainability
Dedicated Client Modules: Each Ethereum client now has its own isolated logic module (e.g., besu.py, nimbus.py), making it easier to add new clients or update existing ones without touching the core orchestration.

Type Safety & Documentation: Implemented full PEP 484 type hints and comprehensive Google-style docstrings across the deploy/ package to improve IDE support and developer onboarding.

Shared Utilities: Extracted system-level operations (architecture detection, JWT management, and service file writing) into a robust common.py utility layer.

Testing & Reliability
Introduced a two-tier testing strategy to ensure zero regressions:

Golden-String Unit Tests: test_service_generators.py verifies that every CLI flag and systemd parameter is generated exactly as expected for various networks (Mainnet, Ephemery, etc.).

Integration Tests: Added a new orchestration test suite to verify the end-to-end installation flow and user/directory permission handling.

Edge Case Coverage: Added explicit tests for complex configurations like MEV-Boost relay handling and custom Ephemery chainspecs.

Backwards Compatibility
Systemd Preservation: Maintained exact parity with legacy systemd service file locations and naming conventions (e.g., /etc/systemd/system/execution.service).

Path Consistency: Retained all original data directory structures (/var/lib/...) and binary paths (/usr/local/bin/...).

Environment Parity: The network_override and fee_parameters logic ensures that existing custom scripts using the EthPillar core will continue to function without modification.

Tests: All pytest suites passing.
Linting: Type hints verified for Optional safety.

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