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

refactor: add events #14

Merged
merged 3 commits into from
May 21, 2024
Merged

refactor: add events #14

merged 3 commits into from
May 21, 2024

Conversation

johnletey
Copy link
Member

@johnletey johnletey commented May 21, 2024

Summary by CodeRabbit

  • New Features

    • Introduced event emission for AccountRegistered, AccountCleared, and AllowedDenomsConfigured actions to provide better tracking and logging of account-related events.
  • Improvements

    • Enhanced the module to include an EventService for more efficient event management and processing.

These changes improve the transparency and traceability of account-related operations.

@johnletey johnletey self-assigned this May 21, 2024
Copy link

coderabbitai bot commented May 21, 2024

Warning

Rate Limit Exceeded

@johnletey has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 39 minutes and 4 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.
Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.
Please see our FAQ for further information.

Commits Files that changed from the base of the PR and between 744ae29 and 1933407.

Walkthrough

The recent updates enhance the event-handling capabilities of the forwarding module. Key modifications include the addition of event emission in the msg_server.go file's functions, integration of an EventService in the Keeper struct, and updates to the ModuleInputs struct in module.go to utilize this service. These changes ensure that events such as account registration, clearing, and allowed denominations configuration are properly emitted and managed.

Changes

File Path Summary
proto/noble/forwarding/v1/events.proto Defines messages for events related to forwarding accounts: AccountRegistered, AccountCleared, and AllowedDenomsConfigured.
x/forwarding/keeper/keeper.go Added eventService field to Keeper struct and updated NewKeeper function to initialize it.
x/forwarding/keeper/msg_server.go Modified RegisterAccount, ClearAccount, and SetAllowedDenoms functions to include event emission.
x/forwarding/module.go Added EventService to ModuleInputs struct and used it in the ProvideModule function.

🐇
In the realm of code so grand,
Events now flow at our command.
Accounts will register, clear, and set,
With every change, events beget.
A rabbit's joy, in lines of code,
Emitting tales on the forwarding road.
🌟


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.

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Outside diff range and nitpick comments (3)
api/noble/forwarding/v1/events.pulsar.go (3)

1728-1729: Ensure proper documentation for the AccountRegistered event.

Consider adding more detailed comments to the AccountRegistered struct to explain the purpose and usage of each field. This can improve code readability and maintainability.


1792-1793: Ensure proper documentation for the AccountCleared event.

Similar to the previous comment, it would be beneficial to add detailed comments to the AccountCleared struct. This helps in understanding the context and use of the fields within this struct.


1838-1839: Ensure proper documentation for the AllowedDenomsConfigured event.

The AllowedDenomsConfigured struct could use detailed field descriptions. This is especially important for fields like previous_denoms and current_denoms to clarify what constitutes a denom and how these lists are used.

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 12a1746 and 744ae29.
Files ignored due to path filters (1)
  • x/forwarding/types/events.pb.go is excluded by !**/*.pb.go
Files selected for processing (5)
  • api/noble/forwarding/v1/events.pulsar.go (1 hunks)
  • proto/noble/forwarding/v1/events.proto (1 hunks)
  • x/forwarding/keeper/keeper.go (4 hunks)
  • x/forwarding/keeper/msg_server.go (5 hunks)
  • x/forwarding/module.go (3 hunks)
Files not summarized due to errors (1)
  • api/noble/forwarding/v1/events.pulsar.go: Error: Message exceeds token limit
Files skipped from review due to trivial changes (1)
  • proto/noble/forwarding/v1/events.proto
Additional comments not posted (2)
x/forwarding/keeper/msg_server.go (1)

131-134: Event emission logic added to ClearAccount function looks correct and well-placed after successful operations.

x/forwarding/keeper/keeper.go (1)

8-8: Addition of eventService to the Keeper struct and its initialization in NewKeeper function are correctly implemented.

Also applies to: 27-27, 52-52, 68-68

Verification successful

The eventService is properly integrated with the Keeper struct and is used for emitting events in msg_server.go.

  • x/forwarding/keeper/msg_server.go: Proper usage of eventService for emitting events.
Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify integration of `eventService` in the `Keeper` struct with the rest of the system.

# Test: Search for usage of `eventService` in the system. Expect: Proper usage and handling of events.
rg --type go $'eventService'

Length of output: 856

x/forwarding/keeper/msg_server.go Show resolved Hide resolved
x/forwarding/keeper/msg_server.go Show resolved Hide resolved
x/forwarding/module.go Show resolved Hide resolved
@johnletey johnletey merged commit 86712c4 into main May 21, 2024
10 checks passed
@johnletey johnletey deleted the events branch May 21, 2024 09:07
@johnletey johnletey added this to the v2.0.0 milestone May 30, 2024
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