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

feat: adopt single challenger and register this challenger as channel admin #110

Merged
merged 2 commits into from
Sep 25, 2024

Conversation

beer-1
Copy link
Contributor

@beer-1 beer-1 commented Sep 25, 2024

Description

Closes: #XXXX


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title, you can find examples of the prefixes below:
  • confirmed ! in the type prefix if API or client breaking change
  • targeted the correct branch
  • provided a link to the relevant issue or specification
  • reviewed "Files changed" and left comments if necessary
  • included the necessary unit and integration tests
  • updated the relevant documentation or specification, including comments for documenting Go code
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic, API design and naming, documentation is accurate, tests and test coverage

Summary by CodeRabbit

  • New Features

    • Transitioned from handling multiple challengers to a single challenger in various configurations and structures.
    • Simplified validation logic for BridgeConfig focusing on a single Challenger.
  • Bug Fixes

    • Improved readability and maintainability through formatting adjustments across multiple proto files and structures.
  • Refactor

    • Renamed and streamlined methods and structures related to challengers, enhancing the code's clarity and reducing complexity.
  • Tests

    • Updated test cases to reflect the new single challenger structure and corresponding method changes.

@beer-1 beer-1 self-assigned this Sep 25, 2024
@beer-1 beer-1 requested a review from a team as a code owner September 25, 2024 12:27
Copy link

coderabbitai bot commented Sep 25, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

The changes involve significant modifications to several files, primarily focusing on the transition from handling multiple challengers to a single challenger within the bridge configuration. This includes updates to message structures, method signatures, and validation logic, ensuring consistency across the codebase. Formatting adjustments in .proto files and the Makefile are also present, enhancing readability and maintainability without altering functionality.

Changes

Files Change Summary
Makefile Changed the .proto formatting command from clang-format to buf format, applying it to all .proto files in the ./proto directory.
api/opinit/ophost/v1/auth.pulsar.go Updated import statements for cosmos/auth/v1beta1, reorganizing the byte array without altering functionality.
api/opinit/ophost/v1/tx.pulsar.go Renamed MsgUpdateChallengers to MsgUpdateChallenger, changing its fields from a list to a single string. Updated associated reflection methods and response messages accordingly.
api/opinit/ophost/v1/types.pulsar.go Modified BridgeConfig structure, changing Challengers []string to Challenger string, simplifying related methods.
contrib/launchtools/steps/opbridge.go Updated createOpBridge function to reflect the change from Challengers to Challenger.
proto/opinit/opchild/module/v1/module.proto Condensed the formatting of the go_import option into a single line without affecting functionality.
proto/opinit/opchild/v1/genesis.proto Reformatted field options in GenesisState for better readability without altering logic.
proto/opinit/opchild/v1/query.proto Aligned option declarations and message definitions for readability, with no functional changes.
proto/opinit/opchild/v1/tx.proto Renamed several RPC methods and message types to singular forms, improving formatting consistency.
x/opchild/client/cli/tx.go Updated BridgeConfig structure to replace Challengers with Challenger.
x/opchild/client/cli/tx_test.go Modified JSON structure in tests to reflect the change from challengers to challenger.
x/opchild/keeper/genesis_test.go Changed Challengers to Challenger in test functions, simplifying the configuration.
x/opchild/keeper/msg_server_test.go Refactored tests to manage a single challenger instead of multiple, updating method signatures and assertions.
x/opchild/keeper/output_test.go Updated tests to reflect the change from Challengers to Challenger.
x/ophost/client/cli/tx.go Adjusted bridge-config.json structure to use challenger instead of challengers.
x/ophost/client/cli/tx_test.go Modified test JSON structure to reflect the change to a single challenger.
x/ophost/types/bridge_config.go Simplified validation logic by removing checks for Challengers and focusing on the single Challenger field.
x/ophost/types/bridge_config_test.go Updated tests to reflect the change from Challengers to Challenger.
x/ophost/types/codec.go Renamed MsgUpdateChallengers to MsgUpdateChallenger in codec registration functions.
x/ophost/types/hook/bridge_hook.go Updated PermKeeper interface and BridgeHook methods to manage a single admin instead of multiple challengers.
x/ophost/types/hook/bridge_hook_test.go Adjusted tests to reflect changes in permission management from multiple relayers to a single admin.
x/ophost/types/hooks.go Renamed method BridgeChallengersUpdated to BridgeChallengerUpdated in the interface and implementation.
x/ophost/types/tx.go Refactored MsgUpdateChallengers to MsgUpdateChallenger, updating validation logic to check a single challenger.

Possibly related PRs

  • fix: audit #107: This PR does not relate to the changes in the main PR, which focuses on modifications in the Makefile and .proto files, while fix: audit #107 addresses logic changes in the MsgServer struct and other unrelated files.
  • feat: update slinky => connect/v2 #109: This PR primarily involves updating dependencies and does not have a direct connection to the changes made in the main PR regarding the Makefile and .proto files.

Poem

🐇 In the code where challengers once thrived,
A single brave soul now has arrived.
With cleaner paths and simpler ways,
The bridge stands strong, ready to blaze.
Hooray for the changes, let’s cheer and hop,
For a streamlined code, we’ll never stop! 🌟


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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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.

Copy link

codecov bot commented Sep 25, 2024

Codecov Report

Attention: Patch coverage is 41.93548% with 36 lines in your changes missing coverage. Please review.

Project coverage is 48.58%. Comparing base (4a59e7d) to head (cff2634).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
x/ophost/types/hook/bridge_hook.go 44.11% 8 Missing and 11 partials ⚠️
x/ophost/types/tx.go 0.00% 9 Missing ⚠️
x/ophost/types/bridge_config.go 0.00% 3 Missing and 1 partial ⚠️
x/ophost/types/codec.go 0.00% 2 Missing ⚠️
x/ophost/keeper/msg_server.go 88.88% 0 Missing and 1 partial ⚠️
x/ophost/types/hooks.go 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #110      +/-   ##
==========================================
+ Coverage   48.50%   48.58%   +0.07%     
==========================================
  Files          57       57              
  Lines        4284     4232      -52     
==========================================
- Hits         2078     2056      -22     
+ Misses       1771     1746      -25     
+ Partials      435      430       -5     
Files with missing lines Coverage Δ
x/opchild/client/cli/tx.go 57.43% <100.00%> (ø)
x/ophost/client/cli/tx.go 60.48% <100.00%> (ø)
x/ophost/keeper/msg_server.go 56.60% <88.88%> (-1.39%) ⬇️
x/ophost/types/hooks.go 0.00% <0.00%> (ø)
x/ophost/types/codec.go 0.00% <0.00%> (ø)
x/ophost/types/bridge_config.go 26.56% <0.00%> (+3.10%) ⬆️
x/ophost/types/tx.go 10.50% <0.00%> (+0.38%) ⬆️
x/ophost/types/hook/bridge_hook.go 53.16% <44.11%> (+0.41%) ⬆️

@beer-1 beer-1 merged commit a2f5a14 into main Sep 25, 2024
5 of 7 checks passed
@beer-1 beer-1 deleted the feat/challenger-as-channel-admin branch September 25, 2024 12:41
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.

1 participant