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

fix: remove etherscan activity for bsc #579

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

gamalielhere
Copy link
Contributor

@gamalielhere gamalielhere commented Dec 18, 2024

Summary by CodeRabbit

  • New Features

    • Simplified activity handling for the Binance Smart Chain network, now returning a static response.
    • Enhanced activity handling for Arb Nova, Holesky, opBNB, and Palm networks by integrating a new management function.
  • Bug Fixes

    • Resolved issues related to activity fetching by providing an empty array response.

Copy link

coderabbitai bot commented Dec 18, 2024

Walkthrough

The changes involve modifications to the activity handling mechanisms across several Ethereum network configurations in the extension. The Binance Smart Chain (BSC) configuration has been simplified to return a static response, while other networks like Arb Nova, Holesky, opBNB, and Palm have been updated to utilize a new wrapActivityHandler function for their activity handlers. This adjustment standardizes the approach to activity handling across different networks.

Changes

File Change Summary
packages/extension/src/providers/ethereum/networks/bsc.ts - Removed import of EtherscanActivity
- Removed import of wrapActivityHandler
- Updated activityHandler to return a resolved promise with an empty array
packages/extension/src/providers/ethereum/networks/arb-nova.ts - Added import of wrapActivityHandler
- Updated activityHandler to use wrapActivityHandler for promise resolution
packages/extension/src/providers/ethereum/networks/holesky.ts - Added import of wrapActivityHandler
- Updated activityHandler to use wrapActivityHandler for promise resolution
packages/extension/src/providers/ethereum/networks/op-bnb.ts - Added import of wrapActivityHandler
- Updated activityHandler to use wrapActivityHandler for promise resolution
packages/extension/src/providers/ethereum/networks/palm.ts - Added import of wrapActivityHandler
- Updated activityHandler to use wrapActivityHandler for promise resolution

Suggested reviewers

  • SemajaM8

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. We would love to hear your feedback on Discord.


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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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

github-actions bot commented Dec 18, 2024

💼 Build Files
chrome: enkrypt-chrome-9edd1192.zip
firefox: enkrypt-firefox-9edd1192.zip

💉 Virus total analysis
chrome: 9edd1192
firefox: 9edd1192

Copy link

@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

🧹 Nitpick comments (1)
packages/extension/src/providers/ethereum/networks/bsc.ts (1)

24-24: Consider adding a code comment explaining the removal of activity tracking

To improve maintainability, consider adding a comment explaining why BSC activity tracking was removed. This will help future maintainers understand the intentional design decision.

-  activityHandler: () => Promise.resolve([]),
+  // BSC activity tracking removed as per PR #579
+  activityHandler: () => Promise.resolve([]),
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eec3ed6 and 9c80f90.

📒 Files selected for processing (1)
  • packages/extension/src/providers/ethereum/networks/bsc.ts (1 hunks)
🔇 Additional comments (1)
packages/extension/src/providers/ethereum/networks/bsc.ts (1)

24-24: Verify the implications of removing activity tracking for BSC

The change to return an empty array means BSC transaction history won't be available to users. While this aligns with the PR objective, please ensure this is the intended behavior.

Let's verify there are no remaining references to BSC activity tracking:

✅ Verification successful

Removal of BSC activity tracking is consistent with other networks

The change to return an empty array for BSC's activity handler is consistent with the codebase patterns. Several other Ethereum-based networks also use the same empty array pattern (e.g., palm, holesky, arb-nova, op-bnb). This appears to be an intentional design choice for networks where activity tracking is not supported or has been deliberately disabled.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any remaining references to BSC activity tracking
rg -i "bsc.*activity|activity.*bsc" ./packages/extension/src/

# Check if other network configurations have similar changes
fd -e ts$ . ./packages/extension/src/providers/ethereum/networks/ --exec grep -l "activityHandler"

Length of output: 4540


Script:

#!/bin/bash
# Let's check ethereum network configurations for activity handlers
rg -A 2 "activityHandler" ./packages/extension/src/providers/ethereum/networks/

Length of output: 16076

Copy link

@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

🧹 Nitpick comments (2)
packages/extension/src/providers/ethereum/networks/arb-nova.ts (1)

Line range hint 1-1: Consider updating PR title and description to reflect broader changes

The PR title "fix: remove etherscan activity for bsc" doesn't fully capture the scope of changes:

  1. Activity handling is being standardized across multiple networks
  2. Empty activity lists are being implemented for both test and production networks
  3. This appears to be an architectural change rather than a BSC-specific fix

Consider:

  1. Updating the PR title to reflect the broader scope
  2. Adding PR description explaining the architectural decision
  3. Documenting the impact on user experience (empty activity lists)
packages/extension/src/providers/ethereum/networks/palm.ts (1)

24-24: Consider documenting the rationale for empty activity handling

The implementation correctly uses wrapActivityHandler to return an empty array, which aligns with the PR's objective of removing specific activity handling. However, given the existing comments about Palm API issues, it would be helpful to document why we're choosing to return empty activities.

- activityHandler: wrapActivityHandler(() => Promise.resolve([])),
+ // Return empty activities as Palm's API is currently not supported
+ activityHandler: wrapActivityHandler(() => Promise.resolve([])),
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9c80f90 and 9edd119.

📒 Files selected for processing (5)
  • packages/extension/src/providers/ethereum/networks/arb-nova.ts (2 hunks)
  • packages/extension/src/providers/ethereum/networks/bsc.ts (1 hunks)
  • packages/extension/src/providers/ethereum/networks/holesky.ts (2 hunks)
  • packages/extension/src/providers/ethereum/networks/op-bnb.ts (2 hunks)
  • packages/extension/src/providers/ethereum/networks/palm.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/extension/src/providers/ethereum/networks/bsc.ts
🔇 Additional comments (5)
packages/extension/src/providers/ethereum/networks/holesky.ts (1)

4-4: LGTM! Implementation is consistent with other networks

The changes correctly implement the new activity handling pattern using wrapActivityHandler. The empty array response is appropriate for the Holesky test network.

Also applies to: 18-18

packages/extension/src/providers/ethereum/networks/op-bnb.ts (1)

6-6: Verify if empty activity handler is intended for production network

While the implementation is consistent with other networks, please confirm if returning an empty array for activities is the intended behavior for opBNB, which is a production network (isTestNetwork: false).

Let's check if other production networks follow the same pattern:

Also applies to: 24-24

✅ Verification successful

Empty activity handler is consistent with several production networks

The empty activity handler implementation for opBNB is consistent with several other production networks. Looking at the codebase, we can see multiple production networks that also return empty arrays:

  • BSC (Binance Smart Chain)
  • Klaytn
  • Palm
  • ZCD
  • Bitrock
  • Arb Nova

This appears to be an intentional pattern for networks where activity tracking might not be implemented yet or where a different activity tracking mechanism is used.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for activity handler implementations in production network configurations
rg "isTestNetwork:\s*false" -A 10 -B 10 "packages/extension/src/providers/ethereum/networks/*.ts" | rg "activityHandler|isTestNetwork"

Length of output: 232


Script:

#!/bin/bash
# First, let's find all network configuration files
fd ".*\.ts$" packages/extension/src/providers/ethereum/networks/

# Then, let's examine the activity handlers and test network flags in these files
rg "isTestNetwork|activityHandler" packages/extension/src/providers/ethereum/networks/

Length of output: 18600

packages/extension/src/providers/ethereum/networks/arb-nova.ts (1)

6-6: Document the architectural decision to remove activity tracking

The implementation is consistent with other networks, but there's a pattern of removing activity tracking across production networks (Arbitrum Nova, opBNB). Consider:

  1. Adding a comment explaining why activity tracking is being removed
  2. Updating relevant documentation
  3. Ensuring the UI appropriately handles the empty activity lists

Let's check for any related documentation or comments:

Also applies to: 24-24

packages/extension/src/providers/ethereum/networks/palm.ts (2)

5-5: LGTM: Clean import addition

The import statement for wrapActivityHandler is properly placed with other imports.


Line range hint 7-9: Verify the impact of returning empty activities

Given the comments about Palm's API issues and the change to return empty activities, we should verify if this is the intended behavior for Palm network users.

Also applies to: 24-24

✅ Verification successful

Returning empty activities for Palm network is acceptable

The implementation is correct and intentional for the following reasons:

  • The Palm network's API endpoints are explicitly documented as non-functional due to DNS resolution issues
  • The network is properly configured with a fallback behavior using wrapActivityHandler(() => Promise.resolve([])))
  • The activity state management system (ActivityState class) can handle empty activity arrays gracefully
  • No UI components directly depend on Palm-specific activity handling
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if Palm network activity was previously used in the UI or other components

# Look for references to Palm network activity in components
rg -l "Palm.*activity" --type ts --type vue

# Check for any existing error handling related to Palm activities
rg -l "Palm.*error" --type ts --type vue

# Look for any tests that might need updating
fd -e test.ts -e spec.ts | xargs rg -l "Palm"

Length of output: 190


Script:

#!/bin/bash
# Let's try a different approach to find Palm network references

# Search for Palm network configuration and usage
rg -l "Palm" --type ts

# Look for activity-related code in the network providers
rg -l "getActivities|fetchActivities" --type ts

# Check for any UI components that might be affected
rg -l "\.(vue|tsx?)$" | xargs rg -l "Palm"

# Look for test files specifically
find . -type f -name "*.test.ts" -o -name "*.spec.ts" | xargs rg -l "Palm"

Length of output: 434


Script:

#!/bin/bash
# Let's examine the content of relevant files to understand the impact

# Check Palm network definition and configuration
cat packages/types/src/networks.ts | grep -A 10 -B 10 "Palm"

# Check activity handling implementation
cat packages/extension/src/libs/activity-state/index.ts

# Examine Palm network provider implementation
cat packages/extension/src/providers/ethereum/networks/palm.ts

# Look for any error handling or UI feedback mechanisms
rg "NetworkError|ActivityError" --type ts

Length of output: 5617

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