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/sync dev with v1.8.1 #363

Merged
merged 3 commits into from
Dec 9, 2024
Merged

Feat/sync dev with v1.8.1 #363

merged 3 commits into from
Dec 9, 2024

Conversation

PavelInjective
Copy link
Contributor

@PavelInjective PavelInjective commented Dec 5, 2024

PR to sync the dev branch with the changes introduced in master for the v1.8.1 release

Summary by CodeRabbit

Release Notes for Version 1.9.0-pre

  • New Features

    • Updated the OFAC list with new identifiers for enhanced compliance.
    • Changed the data source URL for fetching the OFAC list, improving data accuracy.
  • Bug Fixes

    • Improved links and content related to the OFAC list.
  • Documentation

    • Changelog updated to reflect the latest version and changes.

@PavelInjective PavelInjective requested a review from aarmoa December 5, 2024 08:51
Copy link
Contributor

coderabbitai bot commented Dec 5, 2024

Walkthrough

The pull request introduces updates to the project's changelog, modifies the OFAC identifiers in a JSON file, changes the URL for fetching the OFAC list in the code, and increments the project version in the configuration file. Specifically, the changelog reflects version 1.8.1 and documents the changes made, while the JSON file sees new identifiers added and one moved. The URL change in the OfacChecker class updates the source for the OFAC list, and the version update in pyproject.toml marks the new pre-release.

Changes

File Change Summary
CHANGELOG.md Updated to version 1.8.1 with new entry for OFAC list updates and retained previous entries.
pyinjective/ofac.json Added three new identifiers and moved one existing identifier within the array.
pyinjective/ofac.py Updated OFAC_LIST_URL to point to ofacAndRestricted.json instead of ofac.json.
pyproject.toml Incremented project version from 1.8.0 to 1.9.0-pre.

Possibly related PRs

  • (fix) Update OFAC list URL and filename #362: The changes in this PR involve updating the OFAC_LIST_URL and OFAC_LIST_FILENAME_DEFAULT in pyinjective/ofac.py, which directly relates to the updates made in the main PR regarding the OFAC list link and contents.

Suggested reviewers

  • aarmoa

Poem

In the burrow where code does play,
New identifiers hop in today.
The changelog sings of version's rise,
With OFAC lists that now comply.
A joyful leap, a swift update,
In rabbit code, we celebrate! 🐇✨


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 62da05d and 5c0fb1f.

📒 Files selected for processing (1)
  • pyproject.toml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • pyproject.toml

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.

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

🧹 Outside diff range and nitpick comments (4)
pyinjective/ofac.py (4)

11-12: Consider updating the local filename to match the source.

The local filename ofac.json no longer matches the source file ofacAndRestricted.json, which could be confusing for maintenance.

-OFAC_LIST_FILENAME_DEFAULT = "ofac.json"
+OFAC_LIST_FILENAME_DEFAULT = "ofacAndRestricted.json"

Line range hint 16-24: Enhance error handling for the expanded restricted list.

Given that we're now using a combined OFAC and restricted list, consider improving the error message to be more specific.

         except Exception as e:
             raise Exception(
-                f"Error parsing OFAC list. Please, download it by running python3 pyinjective/ofac_list.py ({e})"
+                f"Error parsing OFAC and restricted addresses list. Please download it by running python3 pyinjective/ofac.py ({e})"
             )

Line range hint 33-42: Consider adding validation for the expanded list format.

Since we're now handling a combined list of OFAC and restricted addresses, it would be prudent to add validation of the downloaded content.

                     response.raise_for_status()
                     text_content = await response.text()
                     ofac_list = json.loads(text_content)
+                    # Validate the downloaded list
+                    if not isinstance(ofac_list, list) or not all(isinstance(addr, str) for addr in ofac_list):
+                        raise ValueError("Invalid format: Expected a list of address strings")
                     ofac_file_path = cls.get_ofac_list_path()
                     with open(ofac_file_path, "w") as f:
                         json.dump(ofac_list, f, indent=2)

Line range hint 44-45: Consider adding logging for blacklist checks.

Given the critical nature of OFAC compliance, it would be valuable to log when addresses are found on the blacklist.

+import logging
+
 def is_blacklisted(self, address: str) -> bool:
-    return address in self._ofac_list
+    result = address in self._ofac_list
+    if result:
+        logging.warning(f"Address {address} found in OFAC/restricted list")
+    return result
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between cd67089 and 62da05d.

📒 Files selected for processing (4)
  • CHANGELOG.md (1 hunks)
  • pyinjective/ofac.json (1 hunks)
  • pyinjective/ofac.py (1 hunks)
  • pyproject.toml (1 hunks)
✅ Files skipped from review due to trivial changes (3)
  • pyproject.toml
  • CHANGELOG.md
  • pyinjective/ofac.json
🔇 Additional comments (1)
pyinjective/ofac.py (1)

8-9: Verify the stability and accessibility of the new OFAC list endpoint.

The URL change from ofac.json to ofacAndRestricted.json suggests a more comprehensive list. Let's verify the endpoint and data format.

✅ Verification successful

Let me gather more information about how this URL is used in the code to ensure the data format compatibility beyond just the array type.


URL change for OFAC list endpoint is safe and compatible

The new endpoint is:

  • ✓ Accessible and returns valid JSON
  • ✓ Maintains the same array data structure as the old endpoint
  • ✓ Uses identical data format (array of address strings)
  • ✓ Contains the same type of entries (ethereum-style addresses)
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the new OFAC list endpoint and data format

# Test 1: Check if the new endpoint is accessible and returns valid JSON
echo "Checking new endpoint accessibility..."
curl -s "https://raw.githubusercontent.com/InjectiveLabs/injective-lists/refs/heads/master/json/wallets/ofacAndRestricted.json" | jq . >/dev/null && echo "✓ Endpoint is accessible and returns valid JSON" || echo "✗ Endpoint check failed"

# Test 2: Compare structure with old endpoint to ensure compatibility
echo -e "\nComparing data structure with old endpoint..."
curl -s "https://raw.githubusercontent.com/InjectiveLabs/injective-lists/refs/heads/master/json/wallets/ofac.json" | jq 'type' 
echo "vs"
curl -s "https://raw.githubusercontent.com/InjectiveLabs/injective-lists/refs/heads/master/json/wallets/ofacAndRestricted.json" | jq 'type'

Length of output: 725


Script:

#!/bin/bash
# Check how the OFAC data is processed in the code
ast-grep --pattern 'def download_ofac_list($$$):'

# Check the structure of both JSON files to ensure compatibility
echo "Old OFAC list structure:"
curl -s "https://raw.githubusercontent.com/InjectiveLabs/injective-lists/refs/heads/master/json/wallets/ofac.json" | jq '.[0]'
echo -e "\nNew OFAC list structure:"
curl -s "https://raw.githubusercontent.com/InjectiveLabs/injective-lists/refs/heads/master/json/wallets/ofacAndRestricted.json" | jq '.[0]'

Length of output: 532

Copy link
Collaborator

@aarmoa aarmoa left a comment

Choose a reason for hiding this comment

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

@PavelInjective please fix the version number we use for dev branch (you can solve it quickly by solving the merge conflicts in the PR)

pyproject.toml Outdated
@@ -1,6 +1,6 @@
[tool.poetry]
name = "injective-py"
version = "1.8.0"
version = "1.8.1"
Copy link
Collaborator

Choose a reason for hiding this comment

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

In the dev branch the version should be 1.9.0-pre

@PavelInjective PavelInjective requested a review from aarmoa December 9, 2024 13:41
Copy link
Collaborator

@aarmoa aarmoa left a comment

Choose a reason for hiding this comment

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

Changes look good to me

@PavelInjective PavelInjective merged commit 240d229 into dev Dec 9, 2024
12 checks passed
This was referenced Dec 12, 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.

2 participants