Skip to content
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

Generate genesis file from input config file #747

Merged
merged 4 commits into from
Dec 15, 2023
Merged

Conversation

miladz68
Copy link
Contributor

@miladz68 miladz68 commented Dec 12, 2023

Description

This PR adds a CLI command which allows to generate a genesis file from a given input config file. The point of the PR is to remove genesis creation logic from crust, so crust will be less dependent on coreum version, and can create correct genesis by just interacting with the cored binary, and will not need to import genesis template.

Reviewers checklist:

  • Try to write more meaningful comments with clear actions to be taken.
  • Nit-picking should be unblocking. Focus on core issues.

Authors checklist

  • Provide a concise and meaningful description
  • Review the code yourself first, before making the PR.
  • Annotate your PR in places that require explanation.
  • Think and try to split the PR to smaller PR if it is big.

This change is Reviewable

@miladz68 miladz68 requested a review from a team as a code owner December 12, 2023 16:21
@miladz68 miladz68 requested review from dzmitryhil, ysv and wojtek-coreum and removed request for a team December 12, 2023 16:21
Copy link
Collaborator

@wojtek-coreum wojtek-coreum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 3 of 3 files at r1, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @dzmitryhil, @miladz68, and @ysv)


cmd/cored/cosmoscmd/generate_network.go line 89 at r1 (raw file):

			if genCfg.Denom != "" {
				sdk.DefaultBondDenom = genCfg.Denom

why is it needed?


cmd/cored/cosmoscmd/generate_network.go line 132 at r1 (raw file):

	customparamsGenesis := customparamstypes.DefaultGenesisState()
	if !cfg.CustomParamsConfig.MinSelfDelegation.IsNil() &&
		cfg.CustomParamsConfig.MinSelfDelegation.IsPositive() {

shouldn't it return error if it's not positive?


cmd/cored/cosmoscmd/generate_network.go line 139 at r1 (raw file):

	// assetft params
	assetftGenesis := assetfttypes.DefaultGenesis()
	assetftGenesis.Params.IssueFee.Amount = sdk.NewInt(10_000_000)

Here and below: shouldn't all the numbers be taken from config file?

Copy link
Contributor

@dzmitryhil dzmitryhil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @miladz68, @wojtek-coreum, and @ysv)


cmd/cored/cosmoscmd/generate_network.go line 139 at r1 (raw file):

Previously, wojtek-coreum (Wojtek) wrote…

Here and below: shouldn't all the numbers be taken from config file?

Same question.

Copy link
Contributor Author

@miladz68 miladz68 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @wojtek-coreum and @ysv)


cmd/cored/cosmoscmd/generate_network.go line 89 at r1 (raw file):

Previously, wojtek-coreum (Wojtek) wrote…

why is it needed?

All modules read the bond denom from this variable, when creating the default genesis.


cmd/cored/cosmoscmd/generate_network.go line 132 at r1 (raw file):

Previously, wojtek-coreum (Wojtek) wrote…

shouldn't it return error if it's not positive?

Done.


cmd/cored/cosmoscmd/generate_network.go line 139 at r1 (raw file):

Previously, dzmitryhil (Dzmitry Hil) wrote…

Same question.

if all config is taken from the file, then we have the same situation that crust must know all the config of all the modules and actively manage it.
the point is that crust should know as little as possible.

Copy link
Collaborator

@wojtek-coreum wojtek-coreum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @ysv)

Copy link
Contributor

@dzmitryhil dzmitryhil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 3 files at r1.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @ysv)

Copy link
Contributor

@dzmitryhil dzmitryhil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @ysv)

@miladz68 miladz68 merged commit 95a8a4c into master Dec 15, 2023
7 checks passed
@miladz68 miladz68 deleted the milad/generate-genesis branch December 15, 2023 07:16
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.

3 participants