Add Initial Mirage Node Type Support with Dedicated Configuration and Refined Init Checks#851
Merged
Conversation
Implements the foundational structure for the Mirage node type within the node-cli, including the build system integration and the core `mirage boot` commands.
Changes include:
- Added a new 'mirage' build type to `scripts/build.sh` and related scripts to generate the `skale-*-mirage` binary.
- Created new CLI files `node_cli/cli/mirage_boot.py` and `node_cli/cli/mirage_node.py`.
- Added the `mirage boot` command group with subcommands:
- `init`: Implements logic to run the `mirage-boot` service from `docker-compose-mirage.yml`, ensuring `SKALE_NETWORK_TYPE=mirage` is set.
- `register`: Reuses existing core registration logic.
- `signature`: Reuses existing core signature logic.
- `migrate`: Implements logic to switch from mirage boot to mirage main.
- Integrated the base `mirage` command group and existing `logs`, `wallet`, `ssl` groups into `main.py` for the `mirage` build type.
- Updated `README.md` with installation instructions for the `mirage` binary.
Completes the implementation of the `mirage node` command namespace by adding functionality for signature retrieval, backup, and restore operations. Changes include: - Implemented `mirage node signature` command, reusing the core `get_node_signature` function. - Implemented `mirage node backup` command, reusing the core `backup` function. - Added `restore_mirage` function to `node_cli/operations/base.py` to handle Mirage-specific restoration logic. - Implemented `mirage node restore` command, utilizing the new `restore_mirage` function. - Updated `node_cli/operations/base.py` functions (`turn_off`, `update_sync`) to use `NodeTypes` enum for better clarity (refactor). - Fixed datetime formatting and typo in `node_cli/core/node.py`. - Removed placeholder file `node_cli/operations/mirage_boot.py` as logic is integrated elsewhere. Placeholders remain for `mirage node init` and `mirage node register`.
dmytrotkk
requested changes
Apr 20, 2025
…ng. Removed some unused options from mirage commands.
…need to investigate pre-commit in future.
Build broke because info.py need NodeType from core.node, but core.node need env.py, and env.py need NodeType from core.node. Make circle. Bad. Move NodeType to utils/node_types.py. Update imports in core.node, configs.env, generate_info.sh. No more circle. Build work now.
…tions and fixed pre-commit hook
…t have value equal to 'disabled'
…_` prefixes for mirage node
…moving default values.
… required by new node types
badrogger
requested changes
May 6, 2025
Removed pass statements
dmytrotkk
requested changes
May 7, 2025
- Updated static param loading to be NodeType-aware. - Normalized ENV_TYPEs for Mirage. - Bypassed resource allocation for Mirage init/restore. - Updated is_node_inited to use nginx.conf.
dmytrotkk
requested changes
May 13, 2025
dmytrotkk
approved these changes
May 13, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The SKALE ecosystem requires support for a new node type, "Mirage," which operates differently from the standard SKALE node.
node-clineeds to be adapted to manage this new node type, including building a specific binary, providing dedicated CLI commands, handling Mirage-specific static parameters, and ensuring core functionalities correctly differentiate behavior, particularly around initialization and resource management.Solution
This pull request introduces foundational and refined support for the Mirage node type within
node-cli.It establishes a distinct build target for Mirage, introduces Mirage-specific CLI commands and core logic, and significantly refactors shared components to be node-type aware, especially in configuration handling and initialization.
Key Changes Overview:
Mirage Build Target & CLI Structure:
miragebinary.mirage boot,mirage node) for the Mirage build type.NodeType-Aware Architecture & Configuration Handling:
NodeTypeenum (REGULAR,SYNC,MIRAGE) to drive conditional logic throughout the codebase (node management, operations, Docker utilities, Nginx).mirage_static_params.yamlfor Mirage-specific static configurations, allowing Mirage nodes to use standardENV_TYPEs (e.g.,mainnet,devnet) while sourcing distinct parameters. Core configuration loading (get_static_params) is nowNodeType-aware.Refined Initialization and Resource Management:
is_node_inited) to rely on the presence ofnginx.conf, a common artifact for all initialized node types.Testing & Documentation:
ENV_TYPEvalidation, and initialization checks.README.mdto include instructions for themiragebinary, its commands, and its use of standardENV_TYPEs with the new static parameter approach.Benefits
mirage_static_params.yaml), simplifying management and avoiding bloat in the commonstatic_params.yaml.NodeTypefor clearer control flow. Shared components like initialization checks and host requirement validation are now more universally applicable or correctly specialized.skale-adminchanges and the dedicateddocker-compose-mirage.yml.miragebinary and its updated configuration paradigm.Testing Done
NodeTypeparameter and verify behavior across types.Reviewer Instructions
NodeType.mirage_static_params.yamland theNodeType-aware changes toget_static_params.ENV_TYPEvalidation for Mirage.is_node_initedlogic and its impact on relevant decorators and commands.tests/conftest.pyfor both static parameter files.core_checks_test.py,configs_env_validate_test.py, and Mirage-specific tests correctly reflect the new configuration and initialization logic.README.mdupdates, especially regardingENV_TYPEusage for Mirage and any mention of static parameters.