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

dedupe commitee listener #2382

Merged
merged 2 commits into from
Mar 28, 2024
Merged

dedupe commitee listener #2382

merged 2 commits into from
Mar 28, 2024

Conversation

trajan0x
Copy link
Contributor

@trajan0x trajan0x commented Mar 27, 2024

Description

Dedupe listener for commitee

Summary by CodeRabbit

  • Refactor
    • Enhanced data storage capabilities for improved performance.
    • Updated node initialization to better handle blockchain interactions.
  • Chores
    • Updated dependencies in the go.mod file for better package management.

Copy link
Contributor

coderabbitai bot commented Mar 27, 2024

Walkthrough

The recent modifications enhance the integration and functionality of the Store structure by embedding ChainListenerDB for improved blockchain event listening. Additionally, the reorganization of imports and updates in the NewNode function reflect a streamlined approach to managing blockchain interactions, particularly with handling the latest block numbers.

Changes

Files Change Summary
committee/db/base/store.go Embeds ChainListenerDB, initializes it in NewStore, updates GetAllModels
committee/node/node.go Updated imports for listener, adjusted NewNode for latest block handling

🐇✨
In the realm of code, where changes abound,
A rabbit hopped in, with updates profound.
"To better listen," it said with a grin,
We'll tweak and we'll change, from within.
So here's to the code, ever so bright,
With each line we write, we bring light.
🌟📜🐾

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-tests 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 tests 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 tests.
    • @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.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

@github-actions github-actions bot added go Pull requests that update Go code size/s labels Mar 27, 2024
Copy link
Contributor

@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.

Review Status

Actionable comments generated: 0

Configuration used: .coderabbit.yaml

Commits Files that changed from the base of the PR and between b047dcf and f0853a1.
Files selected for processing (2)
  • committee/db/base/store.go (3 hunks)
  • committee/node/node.go (2 hunks)
Additional comments: 5
committee/db/base/store.go (3)
  • 21-21: The embedding of ChainListenerDB into the Store struct is a significant change that integrates listener functionalities directly into the store. This approach simplifies the architecture by reducing the need for separate components to handle listener-related operations. Ensure that all methods from ChainListenerDB that are now part of Store are appropriately used throughout the codebase, and consider any potential naming conflicts or method overrides.
  • 31-33: Initialization of ChainListenerDB within the NewStore function is correctly done, ensuring that the store is fully equipped with listener functionalities upon creation. This initialization is crucial for the seamless integration of listener capabilities into the store's operations. Verify that the db and metrics parameters passed to NewChainListenerStore are correctly handled and that there are no unintended side effects.
  • 97-98: The expansion of the GetAllModels function to include listenerDB.GetAllModels() is a clear indication of the broader scope for data retrieval, now encompassing listener-specific models. This change is aligned with the objective of enhancing the store's capabilities. Ensure that the models returned by listenerDB.GetAllModels() are correctly handled during migrations or any other operations that utilize the allModels slice.
committee/node/node.go (2)
  • 23-23: The modification of import statements to reflect a change in the source package for the listener functionality indicates a reorganization of the listener codebase. This change is likely part of the deduplication and optimization efforts. Ensure that the new import path is correct and that all references to the listener package throughout the codebase are updated accordingly.
  • 78-83: The updates in the NewNode function to handle the latest block number are part of the optimization efforts. Retrieving the latest block number and passing it to NewChainListener ensures that the listener starts from the current state of the blockchain, which is crucial for accurate and up-to-date listening. Verify that error handling for chainClient.BlockNumber(ctx) and listener.NewChainListener(...) is robust and that any failures in these operations are correctly managed to prevent partial initializations or inconsistent states.

Copy link

codecov bot commented Mar 27, 2024

Codecov Report

Attention: Patch coverage is 40.00000% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 46.84598%. Comparing base (0aedf05) to head (5c0ba84).
Report is 3 commits behind head on master.

Files Patch % Lines
committee/node/node.go 40.00000% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@                 Coverage Diff                 @@
##              master       #2382         +/-   ##
===================================================
- Coverage   46.88667%   46.84598%   -0.04070%     
===================================================
  Files            383         383                 
  Lines          29181       29185          +4     
  Branches          83          83                 
===================================================
- Hits           13682       13672         -10     
- Misses         14041       14053         +12     
- Partials        1458        1460          +2     
Flag Coverage Δ
committee 62.20028% <40.00000%> (-1.77135%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

cloudflare-workers-and-pages bot commented Mar 27, 2024

Deploying sanguine-fe with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5c0ba84
Status:⚡️  Build in progress...

View logs

@github-actions github-actions bot added size/m and removed size/s labels Mar 28, 2024
Copy link
Contributor

@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.

Review Status

Actionable comments generated: 0

Configuration used: .coderabbit.yaml

Commits Files that changed from the base of the PR and between f0853a1 and 5c0ba84.
Files selected for processing (2)
  • committee/db/base/model.go (1 hunks)
  • committee/go.mod (2 hunks)
Additional comments (2)
committee/db/base/model.go (1)
  • 4-14: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [1-12]

The changes in the init function to initialize transactionIDFieldName and statusFieldName using dbcommon.NewNamer(GetAllModels()) are good for maintaining consistent naming conventions. Ensure that the removal of chainIDFieldName and blockNumberFieldName does not negatively impact any functionality that relied on these fields.

committee/go.mod (1)
  • 214-214: The addition of github.com/jpillora/backoff v1.0.0 as an indirect requirement is noted. Ensure that this addition does not introduce any version conflicts or unexpected behavior in the project.

@trajan0x trajan0x merged commit 57260d9 into master Mar 28, 2024
27 of 29 checks passed
@trajan0x trajan0x deleted the fix/dedupe-listener branch March 28, 2024 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go Pull requests that update Go code size/m
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant