Add mirage migrate command#865
Merged
Merged
Conversation
dmytrotkk
requested changes
Jun 17, 2025
| error_exit(f'Extra parameters: {extra_params}') | ||
|
|
||
| params = to_lower_keys(params) | ||
| user_config = user_config_type(**params) |
Collaborator
There was a problem hiding this comment.
maybe let's rename to user_config_class and get_user_config_class to avoid confusion?
| contract_alias_or_address = user_config.manager_contracts | ||
| endpoint = user_config.endpoint | ||
|
|
||
| validate_alias_or_address(contract_alias_or_address, ContractType.MANAGER, endpoint) |
Collaborator
There was a problem hiding this comment.
probably should be removed for node type mirage
| def migrate_from_boot( | ||
| env_filepath: str, | ||
| ) -> None: | ||
| logger.info('Node update started') |
| print_node_cmd_error() | ||
| return | ||
| else: | ||
| logger.info('Mirgration from boot to mirage completed successfully') |
Collaborator
There was a problem hiding this comment.
typo -> Mirgration + should it be printed to the user too?
| docker_cleanup() | ||
|
|
||
| update_meta( | ||
| meta_manager.update_meta( |
Collaborator
There was a problem hiding this comment.
why we're using CliMetaManager and not MirageCliMetaManager for migrate mirage boot and init mirage boot?
| self, | ||
| version: str, | ||
| config_stream: str, | ||
| docker_lvmpy_stream: Optional[str], |
Collaborator
There was a problem hiding this comment.
should be marked as optional in the parent class or marked as required in this class:
Argument of type "str | None" cannot be assigned to parameter "docker_lvmpy_stream" of type "str" in function "__init__"
Type "str | None" is not assignable to type "str"
"None" is not assignable to "str"Pylance[reportArgumentType](https://github.com/microsoft/pylance-release/blob/main/docs/diagnostics/reportArgumentType.md)
(parameter) docker_lvmpy_stream: str | None
dmytrotkk
requested changes
Jun 17, 2025
| def validate_user_config(user_config: BaseUserConfig) -> None: | ||
| validate_env_type(env_type=user_config.env_type) | ||
|
|
||
| if isinstance(user_config, MirageUserConfig): |
Collaborator
There was a problem hiding this comment.
let's remove redundant check for mirage
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.
This pull request introduces several enhancements and refactors to the
node_cliproject, focusing on improving configuration management, adding a new migration command, and replacing older environment-based configuration handling with a more structured user configuration system. The changes also include updates to dependencies and some minor code cleanups.New Features:
migratecommand: Introduced a new CLI command to migrate from a boot node to a regular Mirage node. This includes themigrate_from_bootfunction and its integration into the CLI (node_cli/cli/mirage_node.py,node_cli/core/mirage_node.py). [1] [2]Configuration Refactor:
env.pywithuser.py: The old environment-based configuration system (env.py) was removed and replaced with a more structured and type-safe user configuration system (user.py). This includes the introduction of configuration classes likeBaseUserConfig,MirageUserConfig, andSkaleUserConfig. Functions such asget_validated_env_configwere replaced withget_validated_user_config. [1] [2]env.pywere updated to use the newuser.pymodule across multiple files. [1] [2] [3] [4]Code Refactoring:
get_meta_infowithCliMetaManager: Refactored the code to useCliMetaManagerfor retrieving metadata instead of the olderget_meta_infofunction. [1] [2] [3]validate_env_alias_or_addresstovalidate_alias_or_address: Simplified function naming for better readability and consistency.Cleanup:
env.py: Deleted the now-obsoleteenv.pyfile, along with its associated logic for environment variable management.These changes collectively improve the maintainability, readability, and extensibility of the
node_clicodebase.