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

Add ModuleHashByHeightQuery command in server/v2/store #23019

Open
julienrbrt opened this issue Dec 19, 2024 · 5 comments
Open

Add ModuleHashByHeightQuery command in server/v2/store #23019

julienrbrt opened this issue Dec 19, 2024 · 5 comments
Assignees
Labels
C:server/v2 Issues related to server/v2

Comments

@julienrbrt
Copy link
Member

julienrbrt commented Dec 19, 2024

Noticed while doing #23018 that the newly added ModuleHashByHeightQuery command in 0.52 doesn't exist in a server/v2 world.

func ModuleHashByHeightQuery[T servertypes.Application](appCreator servertypes.AppCreator[T]) *cobra.Command {
cmd := &cobra.Command{
Use: "module-hash-by-height <height>",
Short: "Get module hashes at a given height",
Long: "Get module hashes at a given height. This command is useful for debugging and verifying the state of the application at a given height. Daemon should not be running when calling this command.",
Example: fmt.Sprintf("%s module-hash-by-height 16841115", version.AppName),
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
heightToRetrieveString := args[0]
serverCtx := GetServerContextFromCmd(cmd)
height, err := strconv.ParseInt(heightToRetrieveString, 10, 64)
if err != nil {
return fmt.Errorf("invalid height: %w", err)
}
commitInfoForHeight, err := getModuleHashesAtHeight(serverCtx, appCreator, height)
if err != nil {
return err
}
clientCtx := client.GetClientContextFromCmd(cmd)
return clientCtx.PrintProto(commitInfoForHeight)
},
}
flags.AddQueryFlagsToCmd(cmd)
return cmd
}
/ #20779

We should add this command in server/v2/store component: https://github.com/cosmos/cosmos-sdk/tree/main/server/v2/store

@github-actions github-actions bot added the needs-triage Issue that needs to be triaged label Dec 19, 2024
@julienrbrt julienrbrt added C:server/v2 Issues related to server/v2 and removed needs-triage Issue that needs to be triaged labels Dec 19, 2024
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Cosmos-SDK Dec 19, 2024
@julienrbrt julienrbrt changed the title Add ModuleHashByHeightQuery command in server/v2 Add ModuleHashByHeightQuery command in server/v2/store Dec 19, 2024
@DioBr4nd0
Copy link

Hey @julienrbrt I want to work on this issue , can you please assign this one to me.

@julienrbrt
Copy link
Member Author

Hey! That's great thanks!

@DioBr4nd0
Copy link

Hey @julienrbrt , I was working on this issue from the pull of the main branch but couldn't find the file server/module_hash.go in the main branch, then I tried to add it to server but there are some functions that are also not present in the code , Like the GetServerContextFromCmd also it's type is invalid, I also went through changelogs and found it got replaced. So do I need to pull any other branch for this code to be present . Please clarify these points.
Thanks

@julienrbrt
Copy link
Member Author

Hey that code just got deleted from main, you can find it on main in commits from two days ago. Or release/v0.52.x branch.

Additionally it needs to use the server/v2 APIs yes, so I'd invite you to check that package, it should have everything you need.

@DioBr4nd0
Copy link

DioBr4nd0 commented Dec 21, 2024

sure there are some functions, types like GetServerContextFromCmd and those functions and data members are already deleted, am I doing something wrong? Apologies for asking again and again @julienrbrt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:server/v2 Issues related to server/v2
Projects
Status: 📋 Backlog
Development

No branches or pull requests

2 participants