-
Notifications
You must be signed in to change notification settings - Fork 6
feat(cmd/mitosisd): add Ethereum genesis file generation #70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
- Introduced a new file `eth_genesis.go` to handle Ethereum genesis file creation. - Implemented `GenerateEthereumGenesis` function to generate a genesis file based on Cosmos chain ID. - Updated `printInfo` struct to include Ethereum genesis path and chain ID. - Modified `InitCmd` to generate the Ethereum genesis file during initialization. This addition enhances the integration of Ethereum functionalities within the Mitosis chain, allowing for seamless genesis file generation.
- Introduced new test file `eth_genesis_test.go` to validate the functionality of Ethereum genesis file generation. - Implemented tests for `GetEthChainIDFromCosmosChainID` and `GenerateEthereumGenesis` functions, ensuring correct chain ID mapping and genesis file structure. - Added integration tests in `init_test.go` to verify the interaction between initialization commands and Ethereum genesis creation. These tests enhance the reliability of Ethereum integration within the Mitosis chain by ensuring proper functionality and error handling.
7f147c3 to
6fb667f
Compare
…file creation - Changed directory permissions from 0755 to 0750 in the `GenerateEthereumGenesis` function to enhance security by restricting access to the owner and group only. - This adjustment ensures that the generated directory for the Ethereum genesis file is more secure, aligning with best practices for file permissions.
- Added a rule to ignore temporary files in the `.golangci.yml` configuration to streamline linting processes. - Updated the `Makefile` to specify the directories for the linter command, ensuring comprehensive linting across the project. - Refactored test files and source code for consistent formatting, including whitespace adjustments and the introduction of a constant for the default funded address in `eth_genesis.go`. - Enhanced directory permission settings in `init_test.go` and `eth_genesis.go` to follow best practices for file security.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces Ethereum genesis file generation functionality to the Mitosis daemon initialization process. The changes enable automatic creation of Ethereum genesis files alongside Cosmos genesis files during chain initialization.
- Adds Ethereum genesis file generation with chain-specific configurations
- Updates initialization command to create both Cosmos and Ethereum genesis files
- Includes comprehensive test coverage for the new functionality
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| cmd/mitosisd/cmd/eth_genesis.go | Implements Ethereum genesis file generation with chain config and funded accounts |
| cmd/mitosisd/cmd/init.go | Updates initialization process to generate Ethereum genesis and display path info |
| cmd/mitosisd/cmd/eth_genesis_test.go | Comprehensive tests for Ethereum genesis generation functionality |
| cmd/mitosisd/cmd/init_test.go | Integration tests for updated initialization process with Ethereum support |
| Makefile | Updates linter scope to include specific directories |
| .golangci.yml | Excludes temporary files directory from linting |
Comments suppressed due to low confidence (1)
cmd/mitosisd/cmd/init.go:51
- The function name 'newPrintInfoWithEth' is inconsistent with Go naming conventions. Consider renaming to 'newPrintInfo' since this appears to be replacing the original function, or use a more descriptive name like 'newPrintInfoWithEthGenesis'.
func newPrintInfoWithEth(moniker, chainID, nodeID, genTxsDir string, appMessage json.RawMessage, ethGenesisPath string, ethChainID string) printInfo {
…b schedule and customization options - Updated `eth_genesis.go` to include a new `BlobSchedule` struct for managing blob configurations related to network upgrades. - Modified the `GenerateEthereumGenesisWithOptions` function to accept custom options for gas limit, funded address, and initial balance, improving flexibility in genesis file generation. - Adjusted test cases in `eth_genesis_test.go` and `init_test.go` to reflect changes in default values and validate the new blob schedule parameters. - Ensured the default funded address is now configurable, enhancing usability for different deployment scenarios.
|
Usage Output |
eth_genesis.goto handle Ethereum genesis file creation.GenerateEthereumGenesisfunction to generate a genesis file based on Cosmos chain ID.printInfostruct to include Ethereum genesis path and chain ID.InitCmdto generate the Ethereum genesis file during initialization.This addition enhances the integration of Ethereum functionalities within the Mitosis chain, allowing for seamless genesis file generation.