Closed czarcas7ic closed 1 week ago
The recent update introduces a new command module-hash-by-height
that allows users to retrieve and display module hashes at a specific blockchain height. This feature is part of the cmd
package within the Osmosis application's command-line interface. The new functionality assists in debugging by enabling users to query module hashes at particular heights, facilitating better insights into the application's state at those points in time.
Files | Change Summary |
---|---|
cmd/.../module_hash_by_height.go |
Introduces module-hash-by-height command, functions to query module hashes, and utility for database access. |
cmd/.../root.go |
Adds moduleHashByHeightQuery function to the root command initialization, integrating the new query functionality. |
sequenceDiagram
participant User as User
participant CLI as CLI (osmosisd)
participant Server as Server Context
participant Database as Database
User->>CLI: Run `module-hash-by-height` with specific height
CLI->>Server: Initialize server context
CLI->>Database: Open Database connection
Database-->>CLI: Database Connection Established
CLI->>Server: Query module hashes at given height
Server-->>CLI: Return module hashes
CLI-->>User: Display module hashes
cmd/osmosisd/cmd/module_hash_by_height.go (3)
`25-26`: **New function `moduleHashByHeightQuery` added.** This function is the entry point for the new CLI command to retrieve module hashes at a specific height. It is well-structured and follows the expected pattern for Cobra commands. --- `60-106`: **Function `getModuleHashesAtHeight` effectively retrieves and processes module hashes.** This function is responsible for the core functionality of fetching module hashes at a given height. It handles errors appropriately and transforms the hashes into a more readable format before sorting them. --- `108-111`: **Function `openDB` added for database access.** This utility function is a clean abstraction for opening a database connection. It uses parameters to specify the database type and location, which enhances modularity and reusability.cmd/osmosisd/cmd/root.go (1)
`720-720`: **Integration of `moduleHashByHeightQuery` into the root command.** The new command is correctly integrated into the root command sequence. It is placed logically in the command initialization, ensuring it's available alongside other similar functionality.
Query that exposes the per module hash at a given height, which is useful for debugging app hashes.