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: whitelist 0x routers #810

Merged
merged 3 commits into from
Sep 26, 2024
Merged

feat: whitelist 0x routers #810

merged 3 commits into from
Sep 26, 2024

Conversation

myz1237
Copy link
Contributor

@myz1237 myz1237 commented Sep 24, 2024

Which Jira task belongs to this PR?

https://lifi.atlassian.net/browse/LF-9741

Why did I implement it this way?

  • Add new AllowanceHolder Router to the whitelist lists

Checklist before requesting a review

  • I have performed a self-review of my code
  • This pull request is as small as possible and only tackles one problem
  • I have added tests that cover the functionality / test the bug
  • I have updated any required documentation

Checklist for reviewer (DO NOT DEPLOY and contracts BEFORE CHECKING THIS!!!)

  • I have checked that any arbitrary calls to external contracts are validated and or restricted
  • I have checked that any privileged calls (i.e. storage modifications) are validated and or restricted
  • I have ensured that any new contracts have had AT A MINIMUM 1 preliminary audit conducted on by <company/auditor>

Copy link
Contributor

coderabbitai bot commented Sep 24, 2024

Walkthrough

The changes involve updates to the config/dexs.json file, where new Ethereum addresses have been added to the arrays corresponding to several blockchain networks. Specifically, the address 0x0000000000001ff3684f28c67538d4d072c22734 has been included in the arrays for the arbitrum, polygon, blast, and goerli networks, while 0x0000000000005e88410ccdfade4a5efae4b49562 has been added to the aurora and rootstock networks. Additionally, the config/sigs.json file has been updated to include a new hexadecimal string in its array. Existing entries in both files remain unchanged.

Changes

File Change Summary
config/dexs.json Added new Ethereum addresses to arrays for arbitrum, polygon, blast, goerli, aurora, and rootstock.
config/sigs.json Added a new hexadecimal string to the array in config/sigs.json.

Assessment against linked issues

Objective Addressed Explanation
update 0x API (LF-9741)

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 186724b and 1549093.

📒 Files selected for processing (1)
  • config/dexs.json (10 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • config/dexs.json

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.

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

@lifi-action-bot lifi-action-bot marked this pull request as draft September 24, 2024 13:45
@myz1237 myz1237 marked this pull request as ready for review September 24, 2024 13:46
@lifi-action-bot
Copy link
Collaborator

Test Coverage Report

Line Coverage: 75.15% (1576 / 2097 lines)
Function Coverage: 83.25% ( 343 / 412 functions)
Branch Coverage: 49.31% ( 253 / 513 branches)
Test coverage (75.15%) is above min threshold (74%). Check passed.

@myz1237
Copy link
Contributor Author

myz1237 commented Sep 24, 2024

One question: shall we delete previous approved router contracts after we successfully update 0x api from v1 to v2?

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 (1)
config/dexs.json (1)

Additional Addresses Added Across Multiple Networks

The primary address (0x0000000000001ff3684f28c67538d4d072c22734) has been successfully added to the whitelist across multiple networks. However, several additional addresses have been included that were not outlined in the PR objectives. These additions span numerous networks, which may require further clarification to ensure they align with the project's goals.

Could you please provide insights into the purpose of these additional addresses and confirm whether their inclusion is intentional? Understanding the rationale behind these changes will help maintain the project's integrity and ensure all modifications are purposeful.

Analysis chain

Line range hint 1-657: Summary of changes and request for clarification

The primary objective of adding the new AllowanceHolder Router (0x0000000000001ff3684f28c67538d4d072c22734) to the whitelist has been achieved across multiple networks. However, several additional addresses were added that weren't mentioned in the PR objectives:

  1. 0x216b4b4ba9f3e719726886d34a177484278bfcae (added to arbitrum and optimism)
  2. 0x0000000000005e88410ccdfade4a5efae4b49562 (added to avalanche)
  3. 0xcdbcd51a5e8728e0af4895ce5771b7d17ff71959 (added to blast)
  4. 0x111111125421ca6dc452d289314280a0f8842a65 (added to polygon)
  5. 0x93aaae79a53759cd164340e4c8766e4db5331cd7 (added to base)

Could you please provide clarification on the purpose of these additional addresses and explain why different addresses were added to different networks? This information will help us understand the full scope of the changes and ensure that they align with the project's objectives.

To get a complete picture of the changes, let's run a script to show all new addresses added across all networks:

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Show all new addresses added across all networks
echo "New addresses added to each network:"
grep -n '^[   ]*"0x' config/dexs.json | sort -n | uniq -c | awk '$1 == 1 {print $0}' | sed 's/^[ \t]*//' | sed 's/:/: /'

Length of output: 470


Script:

#!/bin/bash
# Extract all addresses from config/dexs.json and identify additional addresses not part of the primary objective.

# Define the primary address mentioned in the PR objectives
PRIMARY_ADDRESS="0x0000000000001ff3684f28c67538d4d072c22734"

# Use jq to extract all unique addresses across all networks
jq -r 'to_entries[].value[]' config/dexs.json | sort | uniq > all_addresses.txt

# Check if the primary address exists and list additional addresses
if grep -qi "$PRIMARY_ADDRESS" all_addresses.txt; then
    echo "Primary address ($PRIMARY_ADDRESS) is present."
    echo "Additional addresses added:"
    grep -vi "$PRIMARY_ADDRESS" all_addresses.txt
else
    echo "Primary address ($PRIMARY_ADDRESS) is missing."
fi

Length of output: 10290

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e62be31 and ad4577a.

Files selected for processing (1)
  • config/dexs.json (10 hunks)
Additional comments not posted (7)
config/dexs.json (7)

608-609: New addresses added to base network - clarification needed.

The address 0x0000000000001ff3684f28c67538d4d072c22734 has been added as expected. However, an additional address 0x93aaae79a53759cd164340e4c8766e4db5331cd7 was also added, which wasn't mentioned in the PR objectives.

Could you please clarify the purpose of adding 0x93aaae79a53759cd164340e4c8766e4db5331cd7? Let's check if this address is present in other networks:

#!/bin/bash
# Check for the additional base address across all networks
echo "Networks containing the additional base address:"
grep -l '"0x93aaae79a53759cd164340e4c8766e4db5331cd7"' config/dexs.json | xargs -I {} grep -B1 '"0x93aaae79a53759cd164340e4c8766e4db5331cd7"' {} | grep -v "0x93aaae79a53759cd164340e4c8766e4db5331cd7" | sed 's/[":,]//g'

134-135: Different address added to avalanche network - clarification needed.

A new address 0x0000000000005e88410ccdfade4a5efae4b49562 has been added to the avalanche network. This address is different from the one added to mainnet and arbitrum, and it wasn't mentioned in the PR objectives.

Could you please explain the reason for adding this different address to the avalanche network? Let's check if this address is present in other networks:

#!/bin/bash
# Check for the new avalanche address across all networks
echo "Networks containing the new avalanche address:"
grep -l '"0x0000000000005e88410ccdfade4a5efae4b49562"' config/dexs.json | xargs -I {} grep -B1 '"0x0000000000005e88410ccdfade4a5efae4b49562"' {} | grep -v "0x0000000000005e88410ccdfade4a5efae4b49562" | sed 's/[":,]//g'

145-146: New addresses added to blast network - clarification needed.

The address 0x0000000000001ff3684f28c67538d4d072c22734 has been added as expected. However, an additional address 0xcdbcd51a5e8728e0af4895ce5771b7d17ff71959 was also added, which wasn't mentioned in the PR objectives.

Could you please clarify the purpose of adding 0xcdbcd51a5e8728e0af4895ce5771b7d17ff71959? Let's check if this address is present in other networks:

#!/bin/bash
# Check for the additional blast address across all networks
echo "Networks containing the additional blast address:"
grep -l '"0xcdbcd51a5e8728e0af4895ce5771b7d17ff71959"' config/dexs.json | xargs -I {} grep -B1 '"0xcdbcd51a5e8728e0af4895ce5771b7d17ff71959"' {} | grep -v "0xcdbcd51a5e8728e0af4895ce5771b7d17ff71959" | sed 's/[":,]//g'

534-535: New addresses added to polygon network - clarification needed.

The address 0x0000000000001ff3684f28c67538d4d072c22734 has been added as expected. However, an additional address 0x111111125421ca6dc452d289314280a0f8842a65 was also added, which wasn't mentioned in the PR objectives.

Could you please clarify the purpose of adding 0x111111125421ca6dc452d289314280a0f8842a65? Let's check if this address is present in other networks:


38-39: LGTM: New AllowanceHolder Router added to mainnet.

The new address 0x0000000000001ff3684f28c67538d4d072c22734 has been successfully added to the mainnet network. This change aligns with the PR objectives.

Let's verify if this address is consistently added to other major networks:

Verification successful

Verified: New AllowanceHolder Router added across multiple networks.

The new address 0x0000000000001ff3684f28c67538d4d072c22734 has been successfully added to the following networks: mainnet, arbitrum, blast, bsc, optimism, polygon, and base. This change aligns with the PR objectives.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for the new address across major networks
echo "Networks containing the new address:"
grep -l '"0x0000000000001ff3684f28c67538d4d072c22734"' config/dexs.json | xargs -I {} grep -B1 '"0x0000000000001ff3684f28c67538d4d072c22734"' {} | grep -v "0x0000000000001ff3684f28c67538d4d072c22734" | sed 's/[":,]//g'

Length of output: 472


Script:

#!/bin/bash
# Check for the new address across major networks
ADDRESS="0x0000000000001ff3684f28c67538d4d072c22734"
echo "Networks containing the new address $ADDRESS:"
grep -l "\"$ADDRESS\"" config/dexs.json | xargs -I {} grep -B1 "\"$ADDRESS\"" {} | grep -v "$ADDRESS" | sed 's/[":,]//g'

Length of output: 791


Script:

#!/bin/bash
# Find networks containing the new address
ADDRESS="0x0000000000001ff3684f28c67538d4d072c22734"
echo "Networks containing the new address $ADDRESS:"
jq --arg addr "$ADDRESS" 'to_entries | map(select(.value | index($addr)) | .key)' config/dexs.json

Length of output: 441


77-78: New addresses added to arbitrum network - clarification needed.

The address 0x0000000000001ff3684f28c67538d4d072c22734 has been added as expected. However, an additional address 0x216b4b4ba9f3e719726886d34a177484278bfcae was also added, which wasn't mentioned in the PR objectives.

Could you please clarify the purpose of adding 0x216b4b4ba9f3e719726886d34a177484278bfcae? Let's check if this address is present in other networks:


490-491: New addresses added to optimism network - consistent with arbitrum.

The addresses added to the optimism network are the same as those added to the arbitrum network:

  1. 0x216b4b4ba9f3e719726886d34a177484278bfcae
  2. 0x0000000000001ff3684f28c67538d4d072c22734

The second address is consistent with the PR objectives. However, the purpose of the first address is still unclear.

As we've seen this pattern before, let's check if these two addresses are consistently added together across other networks:

@maxklenk
Copy link
Contributor

Please also add signature 0x2213bc0b

Copy link
Contributor

@maxklenk maxklenk left a comment

Choose a reason for hiding this comment

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

The addresses and signatures are right.

@maxklenk
Copy link
Contributor

The whitelisting has been synced to the chains supported by 0x.

@myz1237
Copy link
Contributor Author

myz1237 commented Sep 26, 2024

We need a sc core dev approve

@myz1237 myz1237 enabled auto-merge September 26, 2024 08:06
@myz1237 myz1237 merged commit b0a9b63 into main Sep 26, 2024
12 checks passed
@myz1237 myz1237 deleted the whitelist-0x-routers branch September 26, 2024 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants