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: devnet #269

Closed
wants to merge 6 commits into from
Closed

fix: devnet #269

wants to merge 6 commits into from

Conversation

fmorency
Copy link
Contributor

@fmorency fmorency commented Feb 12, 2025

This PR bumps the chain registry and provides a fix for the devnet build.

Summary by CodeRabbit

  • New Features

    • Introduced dynamic configuration management that loads chain data based on the running environment.
    • Enhanced fee estimation logic to support additional network variations for more accurate fee calculations.
  • Chores

    • Updated several dependencies to their latest versions, ensuring improved performance and stability.
  • Refactor

    • Streamlined how chain and asset configurations are sourced throughout the application.
    • Added an improved utility for converting data formats to support staking operations.

@fmorency fmorency added the bug Something isn't working label Feb 12, 2025
@fmorency fmorency requested a review from chalabi2 February 12, 2025 21:01
@fmorency fmorency self-assigned this Feb 12, 2025
Copy link
Contributor

coderabbitai bot commented Feb 12, 2025

Warning

Rate limit exceeded

@fmorency has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 13 minutes and 1 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

Reviewing files that changed from the base of the PR and between 479f194 and 5af6548.

📒 Files selected for processing (2)
  • config/manifestChain.ts (1 hunks)
  • hooks/useFeeEstimation.ts (1 hunks)

Walkthrough

This pull request introduces a dynamic manifest loading module in config/manifestChain.ts that selects manifest data based on the environment configuration. The changes update several files to use the new manifest module instead of hardcoded imports from chain-registry/testnet/manifesttestnet. Additionally, the fee estimation logic in hooks/useFeeEstimation.ts is modified to include an extra condition, dependency versions in package.json are updated with a new dependency added, and a new helper function is introduced in utils/staking.ts for data conversion.

Changes

Files Change Summary
config/manifestChain.ts New module dynamically importing manifest data based on env.chainTier. Exports manifestAssets, manifestChain, and manifestIbc (empty for 'qa').
pages/_app.tsx, tests/render.tsx, utils/ibc.ts Updated import statements to source manifest data from @/config/manifestChain instead of chain-registry/testnet/manifesttestnet. This centralizes configuration management across the application and tests.
hooks/useFeeEstimation.ts Modified gas price suffix condition to include 'manifestdevnet' alongside 'manifesttestnet' and adjusted the formatting of the GasPrice.fromString call for improved readability.
package.json Updated dependency versions for @chain-registry/assets and chain-registry, and added a new dependency bech32 with version ^2.0.0.
utils/staking.ts Changed the bech32 import from a namespace to a named import and added a new function wordArrayToUint8Array to convert a CryptoJS word array into a Uint8Array.

Sequence Diagram(s)

sequenceDiagram
    participant App as Application
    participant MC as ManifestChain Module
    participant Env as Environment Config
    participant Registry as Chain-Registry

    App->>MC: Request manifest data
    MC->>Env: Check env.chainTier value
    alt chainTier is 'qa'
      MC->>Registry: Import development manifest files (assets, chain)
      Note over MC: Set manifestIbc to empty array
    else chainTier is not 'qa'
      MC->>Registry: Import testnet manifest files (assets, chain, ibc)
    end
    MC-->>App: Return manifestAssets, manifestChain, manifestIbc
Loading

Possibly related PRs

Suggested reviewers

  • chalabi2

Poem

Oh, I’m the rabbit in the code burrow,
Hopping through manifests high and low.
Dynamic imports make the system sing,
Gas fees adjusted with a joyful ring.
With dependencies fresh and functions bright,
I celebrate these changes day and night!
🐇✨


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.

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.

Copy link

codecov bot commented Feb 12, 2025

Codecov Report

Attention: Patch coverage is 59.37500% with 13 lines in your changes missing coverage. Please review.

Project coverage is 54.47%. Comparing base (18dc41c) to head (5af6548).

Files with missing lines Patch % Lines
hooks/useFeeEstimation.ts 0.00% 7 Missing ⚠️
config/manifestChain.ts 72.72% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #269      +/-   ##
==========================================
- Coverage   54.47%   54.47%   -0.01%     
==========================================
  Files         206      207       +1     
  Lines       17712    17736      +24     
==========================================
+ Hits         9649     9661      +12     
- Misses       8063     8075      +12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

🧹 Nitpick comments (2)
utils/staking.ts (1)

184-195: Add input validation and documentation.

The function logic is correct, but could benefit from:

  1. Input validation for null/undefined wordArray
  2. JSDoc documentation explaining the purpose and parameters

Apply this diff to improve the function:

+/**
+ * Converts a CryptoJS WordArray to Uint8Array
+ * @param wordArray - The CryptoJS WordArray to convert
+ * @throws {Error} If wordArray is null or undefined
+ * @returns {Uint8Array} The converted array
+ */
 function wordArrayToUint8Array(wordArray: CryptoJS.lib.WordArray) {
+  if (!wordArray) {
+    throw new Error('wordArray is required');
+  }
   const words = wordArray.words;
   const sigBytes = wordArray.sigBytes;
   const u8 = new Uint8Array(sigBytes);
config/manifestChain.ts (1)

7-7: Consider tracking mainnet manifest requirement.

The TODO comment about mainnet manifest should be tracked for future implementation.

Would you like me to create an issue to track the mainnet manifest requirement?

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 18dc41c and 479f194.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (7)
  • config/manifestChain.ts (1 hunks)
  • hooks/useFeeEstimation.ts (1 hunks)
  • package.json (2 hunks)
  • pages/_app.tsx (1 hunks)
  • tests/render.tsx (1 hunks)
  • utils/ibc.ts (1 hunks)
  • utils/staking.ts (2 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
hooks/useFeeEstimation.ts

[error] 29-29: Unexpected constant condition.

(lint/correctness/noConstantCondition)

🪛 GitHub Check: codecov/patch
hooks/useFeeEstimation.ts

[warning] 28-30: hooks/useFeeEstimation.ts#L28-L30
Added lines #L28 - L30 were not covered by tests

config/manifestChain.ts

[warning] 9-9: config/manifestChain.ts#L9
Added line #L9 was not covered by tests


[warning] 17-20: config/manifestChain.ts#L17-L20
Added lines #L17 - L20 were not covered by tests

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build
🔇 Additional comments (7)
utils/staking.ts (1)

2-2: LGTM!

The change to a named import is more specific and follows modern JavaScript/TypeScript best practices.

package.json (1)

36-36: Verify the dependency versions.

The dependency updates look good, but let's verify the latest versions and any potential security advisories.

Also applies to: 58-59

❌ Verification inconclusive

🏁 Script executed:

#!/bin/bash
# Description: Check latest versions and security advisories for the updated dependencies

# Check NPM for latest versions
echo "Checking latest versions..."
npm view @chain-registry/assets version
npm view chain-registry version
npm view bech32 version

# Check for known vulnerabilities
echo "Checking for vulnerabilities..."
npm audit @chain-registry/assets@^1.70.122
npm audit chain-registry@^1.69.122
npm audit bech32@^2.0.0

Length of output: 1424


Dependency Versions Verified but Vulnerability Scan Inconclusive

  • The npm view commands confirm that:
    • @chain-registry/assets is at 1.70.122
    • chain-registry is at 1.69.122
    • bech32 is at 2.0.0
  • The vulnerability audit commands failed due to the absence of a package lockfile (use npm i --package-lock-only to generate it). This prevents a proper security advisory check.
config/manifestChain.ts (1)

16-26: Add test coverage for manifest initialization.

The manifest initialization logic lacks test coverage, particularly for the 'qa' build type path.

❌ Verification inconclusive

🏁 Script executed:

#!/bin/bash
# Description: Check test coverage for manifest initialization

# Search for test files related to manifestChain
fd -e test.ts -e spec.ts manifestChain

# Search for any tests that might be testing this functionality
rg -l "manifestChain" $(fd -e test.ts -e spec.ts)

Length of output: 120


Missing Test Coverage for Manifest Initialization

The search results indicate that there aren’t any test files directly covering the manifest initialization logic—especially for the 'qa' build type path—in the repository. Only an unrelated reference in utils/profanityFilter.test.ts was found.

  • config/manifestChain.ts: No tests appear to cover the conditional logic that initializes manifestAssets, manifestChain, and manifestIbc for the 'qa' build type.
  • Test files found: The only hit was in utils/profanityFilter.test.ts, which is not related to manifest initialization.

This confirms the original review comment: additional test coverage is required to validate the manifest initialization logic.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 17-20: config/manifestChain.ts#L17-L20
Added lines #L17 - L20 were not covered by tests

tests/render.tsx (1)

13-13: LGTM!

The import statement has been correctly updated to use the new dynamic manifest loading module.

utils/ibc.ts (1)

8-8: LGTM!

The imports and usage of manifest assets and IBC data have been correctly updated to use the new dynamic manifest loading module.

Also applies to: 10-10, 70-70

pages/_app.tsx (2)

45-45: LGTM! Import statement updated to use dynamic manifest loading.

The change aligns with the PR's objective to fix devnet by using the new dynamic manifest loading module instead of hardcoded testnet imports.


203-204: Verify chain configuration compatibility.

The manifest chain is combined with osmosis and axelar testnet chains. Please ensure that the dynamic manifest configuration is compatible with these testnet chains, especially for cross-chain operations.

Run the following script to check for any potential chain configuration mismatches:

✅ Verification successful

🏁 Script executed:

#!/bin/bash
# Description: Check chain configuration compatibility between manifest and other chains

# Search for chain configuration usage patterns
rg -A 5 'chain-registry/testnet/(osmosistestnet|axelartestnet)'

# Search for IBC configuration
ast-grep --pattern 'ibc: {
  $$$
}'

Length of output: 1591


I'll perform a further scan for "manifestIbc" in the repository to verify if the manifest chain's IBC configuration is defined and aligned with the corresponding testnet IBC configurations.


🏁 Script executed:

#!/bin/bash
# Search for manifest IBC configuration in the repository
rg 'manifestIbc' -n .

Length of output: 539


Chain Configuration Compatibility Check

I reviewed the manifest chain’s configuration in config/manifestChain.ts and its usage in cross-chain IBC setups (e.g., in utils/ibc.ts). The manifest chain assigns an empty IBC configuration by default (with a comment noting that the devnet doesn’t include IBC) but later assigns ibc dynamically. This means that—as long as the dynamic assignment properly provides IBC details—the manifest chain configuration will be compatible with the osmosis and axelar testnet chains used for cross-chain operations.

  • Verified: Manifest chain’s IBC configuration is merged with testnet configurations (as seen in utils/ibc.ts), and the dynamic assignment in config/manifestChain.ts ensures that a proper IBC configuration is used when available.

No mismatches were found in the configuration patterns based on our repository search.

config/manifestChain.ts Outdated Show resolved Hide resolved
hooks/useFeeEstimation.ts Outdated Show resolved Hide resolved
fmorency and others added 3 commits February 12, 2025 16:06
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Signed-off-by: Félix C. Morency <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Signed-off-by: Félix C. Morency <[email protected]>
Copy link
Collaborator

@chalabi2 chalabi2 left a comment

Choose a reason for hiding this comment

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

lgtm

@fmorency fmorency mentioned this pull request Feb 12, 2025
@fmorency
Copy link
Contributor Author

Superseded by #270

@fmorency fmorency closed this Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants