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

[screener] add blacklist #2825

Merged
merged 1 commit into from
Jun 30, 2024
Merged

[screener] add blacklist #2825

merged 1 commit into from
Jun 30, 2024

Conversation

trajan0x
Copy link
Contributor

@trajan0x trajan0x commented Jun 30, 2024

Description

blacklist through config

Summary by CodeRabbit

  • New Features

    • Added the ability to blacklist addresses in addition to whitelisting them.
  • Refactor

    • Updated internal handling of blacklisted items for improved consistency and performance.

Copy link
Contributor

coderabbitai bot commented Jun 30, 2024

Walkthrough

The configuration of the screener API has been enhanced to include a blacklist alongside the existing whitelist. The internal handling and initialization of the blacklist have been streamlined and updated across relevant components to reflect this change.

Changes

File Change Summary
contrib/screener-api/config/config.go Added Blacklist field to the Config struct for managing blacklisted addresses.
contrib/screener-api/screener/screener.go Replaced blacklistCache with blacklist in screenerImpl struct and updated handling in corresponding functions.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant ConfigLoader
  participant Screener

  User->>ConfigLoader: Load configuration (includes blacklist)
  ConfigLoader->>Screener: Initialize screener with config
  Screener->>ConfigLoader: Fetch blacklist
  Screener->>Screener: Process blacklist addresses

  loop Screening process
    User->>Screener: Request screen
    Screener->>User: Check blacklist and respond
  end
Loading

Poem

In the land of code where blacklists grow,
A screening rabbit with swift flow.
Whitelists bright and blacklists grim,
Through config files, they softly swim.
New changes bloom, so sleek and clear,
With every line, we all shall cheer! 🐇✨


Tip

Early access features: enabled

We are currently testing the following features in early access:

  • OpenAI gpt-4o model for code reviews and chat: OpenAI claims that this model is better at understanding and generating code than the previous models. We seek your feedback over the next few weeks before making it generally available.

Note:

  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.
  • Please join our Discord Community to provide feedback and report issues.
  • OSS projects are always opted into early access features.

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.

@github-actions github-actions bot added go Pull requests that update Go code size/xs labels Jun 30, 2024
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

  • Added Blacklist field to Config struct in contrib/screener-api/config/config.go
  • Replaced blacklistCache with blacklist map initialized from config in contrib/screener-api/screener/screener.go
  • Simplified handling of blacklisted addresses by using config directly

2 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

Copy link

codecov bot commented Jun 30, 2024

Codecov Report

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

Project coverage is 25.91575%. Comparing base (8e3cf39) to head (7431f36).
Report is 1 commits behind head on master.

Files Patch % Lines
contrib/screener-api/screener/screener.go 57.14286% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@                 Coverage Diff                 @@
##              master       #2825         +/-   ##
===================================================
+ Coverage   25.58902%   25.91575%   +0.32672%     
===================================================
  Files            766         751         -15     
  Lines          54922       53890       -1032     
  Branches          80          80                 
===================================================
- Hits           14054       13966         -88     
+ Misses         39422       38480        -942     
+ Partials        1446        1444          -2     
Flag Coverage Δ
cctp-relayer 31.93780% <ø> (ø)
opbot 0.21082% <ø> (ø)
promexporter ?
rfq 27.12163% <ø> (ø)
screener-api 29.29293% <57.14286%> (-0.14870%) ⬇️

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

Actionable comments posted: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 222ffd4 and 7431f36.

Files selected for processing (2)
  • contrib/screener-api/config/config.go (1 hunks)
  • contrib/screener-api/screener/screener.go (5 hunks)
Additional comments not posted (8)
contrib/screener-api/config/config.go (2)

24-24: LGTM!

The comment for the new Blacklist field is clear and concise.


25-25: LGTM!

The addition of the Blacklist field to the Config struct is consistent with the existing structure.

contrib/screener-api/screener/screener.go (6)

57-57: LGTM!

The addition of the blacklist field to the screenerImpl struct is consistent with the existing structure.


77-77: LGTM!

The initialization of the blacklist map in the NewScreener function is consistent with the initialization of the whitelist map.


83-85: LGTM!

The population of the blacklist map with addresses from the cfg.Blacklist slice is consistent with the population of the whitelist map.


173-173: LGTM!

The addition of the item to the blacklist map in the fetchBlacklist function is consistent with the function's purpose.


257-257: LGTM!

The check if an address is in the blacklist map in the isBlacklistedCache function is consistent with the function's purpose.


305-305: LGTM!

The addition of the item to the blacklist map in the blacklistAddress function is consistent with the function's purpose.

Copy link

Deploying sanguine-fe with  Cloudflare Pages  Cloudflare Pages

Latest commit: 7431f36
Status: ✅  Deploy successful!
Preview URL: https://cf45eb78.sanguine-fe.pages.dev
Branch Preview URL: https://fix-secondary-blacklist.sanguine-fe.pages.dev

View logs

@trajan0x trajan0x merged commit d0f1508 into master Jun 30, 2024
35 checks passed
@trajan0x trajan0x deleted the fix/secondary-blacklist branch June 30, 2024 18:37
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/xs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant