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

Client fix for evaluating ETH balance across networks #1001

Merged
merged 15 commits into from
Sep 11, 2024

Conversation

clemire
Copy link
Contributor

@clemire clemire commented Sep 6, 2024

This PR involves an API change to allow harmony / other users to pass in which supported xchain ids are ether-based chains.

^^ requires a small harmony refactor.

Changes:

  • Updated API to take an XChainConfig that is extensible with future information and expresses which supported networks use ether as a network fee currency
  • fix typescript implementation to check across all supported eth-based networks
  • update unit and e2e tests to be cross-network

@clemire clemire force-pushed the crystal/github-838-eth-balance-across-chains-client branch from 1ae4073 to de06289 Compare September 7, 2024 00:44
@clemire clemire marked this pull request as ready for review September 7, 2024 00:48
@clemire clemire force-pushed the crystal/github-838-eth-balance-across-chains-client branch from de06289 to ede6d0e Compare September 9, 2024 18:57
Base automatically changed from crystal/github-838-eth-balance-across-chains to main September 9, 2024 21:15
Copy link
Contributor

coderabbitai bot commented Sep 9, 2024

Warning

Rate limit exceeded

@clemire has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 12 minutes and 18 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between 8704b81 and ed28104.

Walkthrough

The pull request introduces significant changes across multiple files, primarily focusing on the transition from native coin balance checks to Ethereum-specific balance checks. This includes renaming functions and test cases, updating logic for balance management, and implementing a new configuration structure, XchainConfig, for handling cross-chain operations. The changes are reflected in test files, utility functions, and interface definitions, ensuring that the codebase aligns with the new Ethereum-centric functionality.

Changes

Files Change Summary
packages/sdk/src/channelsWithEntitlements.test.ts, packages/sdk/src/spaceWithEntitlements.test.ts Replaced nativeCoinBalanceCheckOp with ethBalanceCheckOp, updated test cases for Ethereum balance checks, and modified wallet balance management methods.
packages/sdk/src/util.test.ts Renamed getXchainSupportedRpcUrlsForTesting to getXchainConfigForTesting, returning a structured XchainConfig object. Renamed nativeCoinBalanceCheckOp to ethBalanceCheckOp.
packages/web3/src/ConvertersEntitlements.ts Replaced CheckOperationType.NATIVE_COIN_BALANCE with CheckOperationType.ETH_BALANCE in two functions.
packages/web3/src/ISpaceDapp.ts Updated supportedXChainRpcUrls parameter to xchainConfig: XchainConfig in methods for improved configuration handling.
packages/web3/src/TestEthBalance.ts Added foundryRiver chain definition, renamed setBalance to setBaseBalance, introduced setRiverBalance and getRiverBalance.
packages/web3/src/entitlement.test.ts, packages/web3/src/entitlement.ts Introduced XchainConfig, updated tests and functions to utilize this new configuration for managing RPC URLs and balance checks.
packages/web3/src/v3/SpaceDapp.ts Defined EmptyXchainConfig, updated method signatures to use xchainConfig: XchainConfig for cross-chain operations.

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 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, codebase verification and nitpick comments (1)
packages/web3/src/ISpaceDapp.ts (1)

211-211: Function calls need updating

The search results indicate that there are multiple instances of isEntitledToChannel being called with the old signature. Ensure all calls are updated to use xchainConfig as the parameter.

  • Files to update:
    • packages/sdk/src/util.test.ts
    • packages/sdk/src/channelsWithEntitlements.test.ts
    • packages/sdk/src/sync-agent/entitlements/entitlements.ts
Analysis chain

LGTM, but verify the function usage.

The parameter update is approved.

However, ensure that this change is thoroughly tested to confirm that it behaves as expected and that all function calls to isEntitledToChannel have been updated to match the new signature.

Run the following script to verify the function usage:

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `isEntitledToChannel` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type typescript -A 5 $'isEntitledToChannel'

Length of output: 82


Script:

#!/bin/bash
# Description: Verify all function calls to `isEntitledToChannel` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type ts -A 5 $'isEntitledToChannel'

Length of output: 9277

@clemire clemire merged commit 425f860 into main Sep 11, 2024
7 checks passed
@clemire clemire deleted the crystal/github-838-eth-balance-across-chains-client branch September 11, 2024 01:07
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.

3 participants