ibc-go icon indicating copy to clipboard operation
ibc-go copied to clipboard

Pass keys to light client modules during initialization.

Open DimitrisJim opened this issue 11 months ago • 3 comments

Description

Opening as draft, parent issue requires discussion.

Upsides:

  • simpler router
  • slightly slimmer lcm interface
  • no dangling nils after init

Downsides:

  • more requirements by light client devs in app.go

closes: #6009


Before we can merge this PR, please make sure that all the following items have been checked off. If any of the checklist items are not applicable, please leave them but write a little note why.

  • [ ] Targeted PR against the correct branch (see CONTRIBUTING.md).
  • [ ] Linked to GitHub issue with discussion and accepted design, OR link to spec that describes this work.
  • [ ] Code follows the module structure standards and Go style guide.
  • [ ] Wrote unit and integration tests.
  • [ ] Updated relevant documentation (docs/).
  • [ ] Added relevant godoc comments.
  • [ ] Provide a conventional commit message to follow the repository standards.
  • [ ] Include a descriptive changelog entry when appropriate. This may be left to the discretion of the PR reviewers. (e.g. chores should be omitted from changelog)
  • [ ] Re-reviewed Files changed in the GitHub PR explorer.
  • [ ] Review SonarCloud Report in the comment section below once CI passes.

Summary by CodeRabbit

  • Refactor
    • Standardized the use of storetypes.StoreKey across various light client modules for simplified initialization.
    • Streamlined the LightClientModule interface by removing the RegisterStoreProvider method.
    • Enhanced setup processes in multiple testing applications by updating the NewSimApp function with additional parameters.

DimitrisJim avatar Mar 20 '24 09:03 DimitrisJim

Walkthrough

Walkthrough

The primary focus of the changes is on decentralizing the initialization of the storeProvider to the light client modules, enhancing modularity and simplifying the setup process. This restructuring involves adding storetypes.StoreKey to the NewLightClientModule function, initializing storeProvider within the modules, and removing the RegisterStoreProvider method to streamline the configuration of light client modules.

Changes

Files Change Summary
modules/.../testing/simapp/app.go, modules/light-clients/06-solomachine/light_client_module.go, modules/light-clients/07-tendermint/light_client_module.go, modules/light-clients/08-wasm/light_client_module.go, modules/light-clients/09-localhost/light_client_module.go Added storetypes.StoreKey to NewLightClientModule function and initialized storeProvider. Removed RegisterStoreProvider method.
modules/core/02-client/keeper/keeper.go NewKeeper function initializes router without key parameter.
modules/core/02-client/types/router.go, modules/core/exported/client.go Simplified Router by removing storeProvider and related functionality. Removed RegisterStoreProvider from LightClientModule interface.

Assessment against linked issues

Objective Addressed Explanation
Move initialization of storeProvider to light client modules (#6009)
Decouple encoding and routing; Address interface functions and state handling issues (#5845) The changes focus on storeProvider initialization and do not address encoding, routing, or interface adjustments directly.
Enhance flexibility and maintainability of 08-wasm module (#5084) The PR does not specifically address wasm module restructuring or the introduction of a client_type field.
Implement conditional client functionality and dependency management (#5112) The modifications are unrelated to conditional clients or their specific dependency management needs.
Enhance modularity and reduce dependencies by providing 06-solomachine with its own go.mod file (#4213) Changes are centered on storeProvider and do not include modularization or dependency reduction efforts for 06-solomachine.
Move client state testing to light client module entry points (#6001) While the changes align with enhancing light client module autonomy, it's unclear if they directly facilitate the movement of client state testing to module entry points.

Possibly related issues

  • #5084: The changes indirectly support enhancing module flexibility, although not directly addressing the restructuring goals of the 08-wasm module.
  • #5112: The decentralization of storeProvider could indirectly benefit the development of conditional clients by simplifying client module structures, although not directly addressing the issue's objectives.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar Mar 20 '24 09:03 coderabbitai[bot]

dunno why I kept this in draft, opening for review. Can ignore linting issue will fix tomorrow.

edit: whoops, seems the rebase messed with me, I'll fix em up.

DimitrisJim avatar Mar 25 '24 11:03 DimitrisJim

Quality Gate Passed Quality Gate passed for 'ibc-go'

Issues
7 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

sonarqubecloud[bot] avatar Apr 18 '24 10:04 sonarqubecloud[bot]

Quality Gate Passed Quality Gate passed for 'ibc-go'

Issues
8 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

sonarqubecloud[bot] avatar May 21 '24 18:05 sonarqubecloud[bot]