-
Notifications
You must be signed in to change notification settings - Fork 32
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
Conversation
(fix) Update OFAC list URL and filename
WalkthroughThe 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 Changes
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this 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 fileofacAndRestricted.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
📒 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
There was a problem hiding this 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" |
There was a problem hiding this comment.
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
There was a problem hiding this 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
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
Bug Fixes
Documentation