-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
feat(simapp): Genesis related commands under one genesis
command
#14149
Conversation
genesis
commandgenesis
command
x/genutil/client/cli/genaccount.go
Outdated
appendflag, _ := cmd.Flags().GetBool(flagAppendMode) | ||
vestingStart, _ := cmd.Flags().GetInt64(flagVestingStart) | ||
vestingEnd, _ := cmd.Flags().GetInt64(flagVestingEnd) | ||
vestingAmtStr, _ := cmd.Flags().GetString(flagVestingAmt) |
Check warning
Code scanning / gosec
Returned error is not propagated up the stack.
x/genutil/client/cli/genaccount.go
Outdated
|
||
appendflag, _ := cmd.Flags().GetBool(flagAppendMode) | ||
vestingStart, _ := cmd.Flags().GetInt64(flagVestingStart) | ||
vestingEnd, _ := cmd.Flags().GetInt64(flagVestingEnd) |
Check warning
Code scanning / gosec
Returned error is not propagated up the stack.
x/genutil/client/cli/genaccount.go
Outdated
} | ||
|
||
appendflag, _ := cmd.Flags().GetBool(flagAppendMode) | ||
vestingStart, _ := cmd.Flags().GetInt64(flagVestingStart) |
Check warning
Code scanning / gosec
Returned error is not propagated up the stack.
x/genutil/client/cli/genaccount.go
Outdated
} | ||
} | ||
|
||
appendflag, _ := cmd.Flags().GetBool(flagAppendMode) |
Check warning
Code scanning / gosec
Returned error is not propagated up the stack.
x/genutil/client/cli/genaccount.go
Outdated
addr, err := sdk.AccAddressFromBech32(args[0]) | ||
if err != nil { | ||
inBuf := bufio.NewReader(cmd.InOrStdin()) | ||
keyringBackend, _ := cmd.Flags().GetString(flags.FlagKeyringBackend) |
Check warning
Code scanning / gosec
Returned error is not propagated up the stack.
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.
Hi, thanks for your contribution! However, simapp must not be imported in the SDK.
@julienrbrt Fixed. One question left though, why does the |
genesis
commandgenesis
command
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.
I like the fact you've moved genaccount.go.
Apps are not supposed to import simapp, so it makes sense to have it in the SDK.
Thanks for that. For that exact reason, I think we can actually delete the old genaccount.go
/ genaccount_test.go
from simapp as clean-up, and add a changelog.
x/genutil/client/cli/genaccount.go
Outdated
@@ -0,0 +1,89 @@ | |||
// This file is deprecated. Use x/genutil/client/cli/genaccount.go |
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.
// This file is deprecated. Use x/genutil/client/cli/genaccount.go |
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.
This is not resolved. We can remove this comment.
One more comment, can we update the docs / scripts to use the genesis sub-command? |
@tac0turtle @julienrbrt Changes addressed. Still, my question is open: is it worth also adding |
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.
lgtm, one nit.
@@ -207,6 +200,40 @@ func addModuleInitFlags(startCmd *cobra.Command) { | |||
crisis.AddModuleInitFlags(startCmd) | |||
} | |||
|
|||
// genesisCommand builds genesis-related `simd genesis` command. Users may provide application specific commands as a parameter | |||
func genesisCommand(encodingConfig params.EncodingConfig, cmds ...*cobra.Command) *cobra.Command { |
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.
This is not so useful if genesisCoreCommand
is still in simapp.
We can move genesisCoreCommand
under x/genutil/...
but do not import simapp (so, adding BasicManager
as an argument and the nodeHomePath
)
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.
that's a fair point, changes addressed
This makes sense to me, but personally, I think keeping |
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.
lgtm, a small nit.
there is an empty file committed. https://github.com/cosmos/cosmos-sdk/pull/14149/files#diff-5ed89ad8d3d6fd496b68d70f5f1ab683bb115e37455f9e78d09af4d7f09f559a
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.
lgtm! Thank you 🙏
"github.com/spf13/cobra" | ||
) | ||
|
||
// genesisCoreCommand adds core sdk's sub-commands into genesis command: |
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.
// genesisCoreCommand adds core sdk's sub-commands into genesis command: | |
// GenesisCoreCommand adds core sdk's sub-commands into genesis command: |
|
||
// genesisCoreCommand adds core sdk's sub-commands into genesis command: | ||
// -> gentx, migrate, collect-gentxs, validate-genesis, add-genesis-account | ||
func GenesisCoreCommand(encodingConfig client.TxConfig, moduleBasics module.BasicManager, defaultNodeHome string) *cobra.Command { |
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.
func GenesisCoreCommand(encodingConfig client.TxConfig, moduleBasics module.BasicManager, defaultNodeHome string) *cobra.Command { | |
func GenesisCoreCommand(txConfig client.TxConfig, moduleBasics module.BasicManager, defaultNodeHome string) *cobra.Command { |
gentxModule := moduleBasics[genutiltypes.ModuleName].(genutil.AppModuleBasic) | ||
|
||
cmd.AddCommand( | ||
GenTxCmd(moduleBasics, encodingConfig, |
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.
GenTxCmd(moduleBasics, encodingConfig, | |
GenTxCmd(moduleBasics, txConfig, |
oh, thanks for noticing, fixed |
@julienrbrt addressed! |
Awesome! If you rebase it'll automerge. |
Description
Closes: #14130
Changes
genesis
command insimd
. These ones are:add-genesis-accound
command source) and it's test tox/genutil/client/cli
. Marked original files as deprecated.After this PR is merged, will create a PR to gaia with similar changes.
Further question
Should we also add
export
command as a sub-command togenesis
?