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

Add biguint and bigdecimal bcs types #76

Merged
merged 5 commits into from
Sep 5, 2024
Merged

Add biguint and bigdecimal bcs types #76

merged 5 commits into from
Sep 5, 2024

Conversation

ALPAC-4
Copy link
Contributor

@ALPAC-4 ALPAC-4 commented Sep 5, 2024

  • Add biguint and bigdecimal bcs types
  • fix some tests

Summary by CodeRabbit

  • New Features

    • Enhanced TypeScript support in testing, allowing for better handling of TypeScript files.
    • Introduced new functions for handling big integers and big decimals in the bcs module, improving serialization and deserialization capabilities.
    • Added a new test suite for the bcs module to ensure accurate serialization and parsing of large numeric values.
  • Bug Fixes

    • Updated dependencies to the latest version, potentially addressing bugs and improving performance.
  • Improvements

    • Updated API endpoints in test cases to reflect a new development environment, ensuring tests are relevant and accurate.
    • Expanded test coverage for various APIs, enhancing validation of expected parameters and types.

Copy link

coderabbitai bot commented Sep 5, 2024

Walkthrough

The changes involve updates to the Jest configuration for TypeScript support, an upgrade of the ts-jest package, modifications to import paths in various test files, and the introduction of new functions for handling big integers and decimals in the bcs module. Additionally, multiple test files have had their API endpoints updated to reflect a shift to a development environment.

Changes

File(s) Change Summary
jest.config.mjs Added a transform property for TypeScript support using ts-jest and formatted the export statement.
package.json Updated ts-jest version from ^29.1.1 to ^29.2.5.
src/client/lcd/api/IbcTransferAPI.spec.ts Changed import path for DenomTrace to a higher-level directory.
src/util/bcs.spec.ts, src/util/bcs.ts Introduced unit tests for the bcs module, focusing on serialization and parsing of big integers and decimals, and added biguint and bigdecimal functions for handling large numeric types.
src/client/lcd/api/*.spec.ts Updated APIRequester instantiation URL from https://stone-rest.initia.tech/ to https://lcd.devnet.initia.xyz/ across multiple test files.
src/client/lcd/api/IbcAPI.ts Modified the API endpoint in the parameters method from /ibc/client/v1/params to /ibc/core/client/v1/params.
src/client/lcd/api/GovAPI.spec.ts Expanded the expected parameters returned by gov.parameters() and updated types for some parameters.
src/client/lcd/api/MstakingAPI.spec.ts Updated expected types in the mstaking.parameters() test case and modified imports.
src/client/lcd/api/RewardAPI.spec.ts Changed expected type for dilution_period in the parameters method from String to Duration.
src/client/lcd/api/SlashingAPI.spec.ts Updated expected types for several parameters in the slashing.parameters() method.
src/client/lcd/api/UpgradeAPI.spec.ts Changed expected length of module versions returned by the upgrade instance from 22 to 34.

Sequence Diagram(s)

sequenceDiagram
    participant A as User
    participant B as Jest
    participant C as TypeScript
    participant D as Bcs Module

    A->>B: Run Tests
    B->>C: Transform TypeScript Files
    C-->>B: Processed Files
    B->>D: Serialize/Parse Big Numbers
    D-->>B: Test Results
    B-->>A: Return Test Results
Loading

🐰 "In the meadow, hops a little hare,
With changes made, we dance without a care.
TypeScript's here, and tests are bright,
Big numbers handled, all feels right!
So let’s rejoice, with a joyful cheer,
For every change brings us closer, dear!" 🐇✨


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.

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

github-actions bot commented Sep 5, 2024

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails
npm/async 3.2.6 🟢 4.8
Details
CheckScoreReason
Code-Review⚠️ 2Found 1/5 approved changesets -- score normalized to 2
Maintained🟢 1017 commit(s) and 10 issue activity found in the last 90 days -- score normalized to 10
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
License🟢 10license file detected
Signed-Releases⚠️ -1no releases found
Token-Permissions🟢 10GitHub workflow tokens follow principle of least privilege
Packaging⚠️ -1packaging workflow not detected
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Branch-Protection⚠️ 0branch protection not enabled on development/release branches
Binary-Artifacts🟢 10no binaries found in the repo
Security-Policy⚠️ 0security policy file not detected
Pinned-Dependencies🟢 4dependency not pinned by hash detected -- score normalized to 4
Fuzzing⚠️ 0project is not fuzzed
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0
Vulnerabilities⚠️ 016 existing vulnerabilities detected
npm/ejs 3.1.10 🟢 3.3
Details
CheckScoreReason
Code-Review⚠️ 2Found 5/18 approved changesets -- score normalized to 2
Maintained🟢 41 commit(s) and 4 issue activity found in the last 90 days -- score normalized to 4
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
License🟢 10license file detected
Signed-Releases⚠️ 0Project has not signed or included provenance with any releases.
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
Security-Policy🟢 4security policy file detected
Packaging⚠️ -1packaging workflow not detected
Binary-Artifacts🟢 10no binaries found in the repo
Branch-Protection⚠️ 0branch protection not enabled on development/release branches
Pinned-Dependencies⚠️ 0dependency not pinned by hash detected -- score normalized to 0
Fuzzing⚠️ 0project is not fuzzed
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0
Vulnerabilities🟢 37 existing vulnerabilities detected
npm/filelist 1.0.4 🟢 3.2
Details
CheckScoreReason
Code-Review⚠️ 1Found 3/17 approved changesets -- score normalized to 1
Maintained⚠️ 00 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
License🟢 10license file detected
Signed-Releases⚠️ -1no releases found
Packaging⚠️ -1packaging workflow not detected
Binary-Artifacts🟢 10no binaries found in the repo
Pinned-Dependencies⚠️ -1no dependencies found
Dangerous-Workflow⚠️ -1no workflows found
Token-Permissions⚠️ -1No tokens found
Branch-Protection⚠️ 0branch protection not enabled on development/release branches
Security-Policy⚠️ 0security policy file not detected
Fuzzing⚠️ 0project is not fuzzed
Vulnerabilities🟢 100 existing vulnerabilities detected
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0
npm/jake 10.9.2 🟢 3.7
Details
CheckScoreReason
Code-Review🟢 3Found 7/20 approved changesets -- score normalized to 3
Maintained⚠️ 23 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 2
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
License🟢 10license file detected
Signed-Releases⚠️ -1no releases found
Packaging⚠️ -1packaging workflow not detected
Dangerous-Workflow⚠️ -1no workflows found
Binary-Artifacts🟢 10no binaries found in the repo
Token-Permissions⚠️ -1No tokens found
Pinned-Dependencies⚠️ -1no dependencies found
Branch-Protection⚠️ 0branch protection not enabled on development/release branches
Security-Policy⚠️ 0security policy file not detected
Fuzzing⚠️ 0project is not fuzzed
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0
Vulnerabilities🟢 100 existing vulnerabilities detected
npm/minimatch 5.1.6 🟢 4.9
Details
CheckScoreReason
Code-Review⚠️ 1Found 3/30 approved changesets -- score normalized to 1
Maintained🟢 108 commit(s) and 5 issue activity found in the last 90 days -- score normalized to 10
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
License🟢 10license file detected
Packaging⚠️ -1packaging workflow not detected
Binary-Artifacts🟢 10no binaries found in the repo
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Branch-Protection⚠️ -1internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration
Signed-Releases⚠️ -1no releases found
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
Pinned-Dependencies⚠️ 0dependency not pinned by hash detected -- score normalized to 0
Fuzzing⚠️ 0project is not fuzzed
Security-Policy⚠️ 0security policy file not detected
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0
Vulnerabilities🟢 100 existing vulnerabilities detected
npm/ts-jest 29.2.5 🟢 7.2
Details
CheckScoreReason
Code-Review🟢 10all changesets reviewed
Maintained🟢 1030 commit(s) and 21 issue activity found in the last 90 days -- score normalized to 10
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
License🟢 10license file detected
Signed-Releases⚠️ -1no releases found
Branch-Protection⚠️ -1internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Token-Permissions🟢 10GitHub workflow tokens follow principle of least privilege
Packaging⚠️ -1packaging workflow not detected
Security-Policy⚠️ 0security policy file not detected
Binary-Artifacts🟢 10no binaries found in the repo
Pinned-Dependencies🟢 8dependency not pinned by hash detected -- score normalized to 8
Fuzzing⚠️ 0project is not fuzzed
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0
Vulnerabilities🟢 82 existing vulnerabilities detected
npm/ts-jest ^29.2.5 🟢 7.2
Details
CheckScoreReason
Code-Review🟢 10all changesets reviewed
Maintained🟢 1030 commit(s) and 21 issue activity found in the last 90 days -- score normalized to 10
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
License🟢 10license file detected
Signed-Releases⚠️ -1no releases found
Branch-Protection⚠️ -1internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Token-Permissions🟢 10GitHub workflow tokens follow principle of least privilege
Packaging⚠️ -1packaging workflow not detected
Security-Policy⚠️ 0security policy file not detected
Binary-Artifacts🟢 10no binaries found in the repo
Pinned-Dependencies🟢 8dependency not pinned by hash detected -- score normalized to 8
Fuzzing⚠️ 0project is not fuzzed
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0
Vulnerabilities🟢 82 existing vulnerabilities detected

Scanned Manifest Files

package-lock.json
package.json
  • ts-jest@^29.2.5
  • ts-jest@^29.1.1

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 9fbc469 and d0cf281.

Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
Files selected for processing (7)
  • jest.config.mjs (1 hunks)
  • package.json (1 hunks)
  • src/client/lcd/api/IbcTransferAPI.spec.ts (1 hunks)
  • src/core/auth/BaseAccount.spec.ts (1 hunks)
  • src/core/upgrade/Plan.spec.ts (1 hunks)
  • src/util/bcs.spec.ts (1 hunks)
  • src/util/bcs.ts (1 hunks)
Files skipped from review due to trivial changes (2)
  • src/client/lcd/api/IbcTransferAPI.spec.ts
  • src/core/auth/BaseAccount.spec.ts
Additional comments not posted (6)
jest.config.mjs (2)

4-6: Correct implementation of TypeScript transformation in Jest configuration.

The transform property has been correctly added to handle .ts and .tsx files using ts-jest. This is a standard approach for integrating TypeScript with Jest, ensuring that TypeScript files are properly transformed during testing.


9-9: Proper use of semicolon in export statement.

The addition of a semicolon at the end of the export statement is a minor but good practice for maintaining consistency in JavaScript syntax, especially in module files.

src/core/upgrade/Plan.spec.ts (2)

13-13: Verify the change in data type for the height field.

The test case has been updated to expect the height field as a number instead of a string. This change should be verified across the codebase to ensure consistency and correct handling of the height field in all related areas.

Run the following script to verify the usage of the height field:

Verification successful

The height field is consistently used as a number across the codebase.

The change in the height field from a string to a number in the test case is consistent with its usage in other parts of the codebase, such as in TxAPI.ts, UpgradeAPI.ts, and Plan.ts. This confirms the correctness of the test case update.

  • src/core/upgrade/Plan.spec.ts: height is expected as a number.
  • src/core/upgrade/Plan.ts: height is parsed as a number.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the `height` field across the codebase.

# Test: Search for the `height` field usage. Expect: Consistent usage as a number.
rg --type typescript -A 5 $'height'

Length of output: 69


Script:

#!/bin/bash
# Description: Verify the usage of the `height` field across the codebase.

# Test: Search for the `height` field usage. Expect: Consistent usage as a number.
rg --type ts -A 5 $'height'

Length of output: 179493


13-13: Verify the removal of deprecated fields.

The removal of the time and upgraded_client_state fields from the input object should be verified to ensure they are no longer required or used elsewhere in the codebase.

Run the following script to verify the removal of these fields:

src/util/bcs.spec.ts (1)

1-1: Ensure proper import paths.

Verify that the import path for the bcs module is correct and that the module exports the necessary functions and types used in this file.

package.json (1)

49-49: Approve the ts-jest version update.

The update from ^29.1.1 to ^29.2.5 in ts-jest is noted. This change is likely aimed at leveraging improvements or bug fixes in the newer version. It's important to ensure that this update integrates well with the existing project setup and does not introduce any compatibility issues with other dependencies.

Please verify the compatibility of the new ts-jest version with the entire project setup, especially with TypeScript configurations and other related dependencies. This can be done by running the test suite and checking for any new warnings or errors that might arise due to this version change.

src/util/bcs.spec.ts Outdated Show resolved Hide resolved
src/util/bcs.ts Show resolved Hide resolved
src/util/bcs.ts Show resolved Hide resolved
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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between d0cf281 and be59081.

Files selected for processing (1)
  • src/util/bcs.spec.ts (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • src/util/bcs.spec.ts

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

Outside diff range, codebase verification and nitpick comments (3)
src/client/lcd/api/SlashingAPI.spec.ts (1)

1-5: Action Required: API Endpoint Not Fully Operational

The API endpoint https://lcd.devnet.initia.xyz/ is reachable, but it returned a 501 Not Implemented status code. This indicates that the server does not support the functionality required to fulfill the request. Please verify the server configuration or contact the server administrator to ensure that the endpoint is fully operational and supports the necessary HTTP methods.

  • Ensure that the server is correctly configured to handle requests.
  • Verify that all necessary services are running on the server.
Analysis chain

Approved: Import and API endpoint changes.

The import of Duration is correctly added for use in the test. The update of the APIRequester's base URL to https://lcd.devnet.initia.xyz/ reflects a shift to a development environment. Ensure that this environment is fully operational and that all endpoints function as expected.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the readiness of the new API endpoint.

# Test: Check if the new API endpoint is reachable.
curl -I https://lcd.devnet.initia.xyz/

Length of output: 640

src/client/lcd/api/MstakingAPI.spec.ts (1)

5-5: API Endpoint Not Accessible: Server Returned 501 Status Code

The API endpoint https://lcd.devnet.initia.xyz/ is not accessible as expected, returning a 501 status code. This indicates that the server does not support the functionality required to fulfill the request. Please verify the server configuration or endpoint setup to ensure it is correctly configured and operational in the development environment.

Analysis chain

API endpoint updated to reflect environment shift.

The API endpoint for APIRequester has been changed from 'https://stone-rest.initia.tech/' to 'https://lcd.devnet.initia.xyz/'. This update likely reflects a shift to a different testing or development environment. It's important to verify that this new endpoint is correctly configured and accessible in the development environment.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the accessibility of the new API endpoint.

# Test: Check if the new API endpoint is reachable. Expect: HTTP 200 status code.
curl -o /dev/null -s -w "%{http_code}\n" https://lcd.devnet.initia.xyz/ | grep 200

Length of output: 84


Script:

#!/bin/bash
# Description: Verify the accessibility of the new API endpoint and capture the HTTP status code.

# Test: Check the HTTP status code returned by the new API endpoint.
curl -o /dev/null -s -w "%{http_code}\n" https://lcd.devnet.initia.xyz/

Length of output: 77

src/client/lcd/LCDClient.ts (1)

74-74: Endpoint Not Ready; Reconsider URL Change

The new endpoint https://lcd.devnet.initia.xyz is not fully operational, as indicated by the "Not Implemented" response to a GET request. It is advisable to revert the URL change in the example code or ensure that the server is correctly configured and ready for use before proceeding with this change.

  • Ensure the server is fully configured and operational.
  • Consider reverting the URL change until the endpoint is ready.
Analysis chain

URL Change Approved; Verify Endpoint Configuration

The change in the URL within the example code is approved as it correctly reflects the shift to a development environment. However, it's crucial to verify that the new endpoint (https://lcd.devnet.initia.xyz) is fully configured and operational to ensure seamless integration and functionality.

Run the following script to verify the endpoint configuration:

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the new endpoint configuration.

# Test: Check if the new URL is reachable and responds correctly.
curl -I https://lcd.devnet.initia.xyz

Length of output: 639


Script:

#!/bin/bash
# Description: Verify the new endpoint configuration with a GET request.

# Test: Check if the new URL responds correctly to a GET request.
curl -X GET https://lcd.devnet.initia.xyz

Length of output: 494

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between be59081 and 87c6dd9.

Files selected for processing (16)
  • src/client/lcd/APIRequester.spec.ts (3 hunks)
  • src/client/lcd/LCDClient.ts (1 hunks)
  • src/client/lcd/api/AuthAPI.spec.ts (1 hunks)
  • src/client/lcd/api/BankAPI.spec.ts (1 hunks)
  • src/client/lcd/api/DistributionAPI.spec.ts (1 hunks)
  • src/client/lcd/api/FeeGrantAPI.spec.ts (1 hunks)
  • src/client/lcd/api/GovAPI.spec.ts (1 hunks)
  • src/client/lcd/api/IbcAPI.spec.ts (1 hunks)
  • src/client/lcd/api/IbcAPI.ts (1 hunks)
  • src/client/lcd/api/IbcTransferAPI.spec.ts (1 hunks)
  • src/client/lcd/api/MstakingAPI.spec.ts (1 hunks)
  • src/client/lcd/api/RewardAPI.spec.ts (2 hunks)
  • src/client/lcd/api/SlashingAPI.spec.ts (1 hunks)
  • src/client/lcd/api/TendermintAPI.spec.ts (1 hunks)
  • src/client/lcd/api/TxAPI.spec.ts (1 hunks)
  • src/client/lcd/api/UpgradeAPI.spec.ts (2 hunks)
Files skipped from review due to trivial changes (4)
  • src/client/lcd/api/AuthAPI.spec.ts
  • src/client/lcd/api/BankAPI.spec.ts
  • src/client/lcd/api/DistributionAPI.spec.ts
  • src/client/lcd/api/IbcAPI.spec.ts
Files skipped from review as they are similar to previous changes (1)
  • src/client/lcd/api/IbcTransferAPI.spec.ts
Additional comments not posted (16)
src/client/lcd/api/SlashingAPI.spec.ts (1)

12-15: Approved: Updated type expectations in tests.

The changes in expected types for min_signed_per_window, downtime_jail_duration, slash_fraction_double_sign, and slash_fraction_downtime enhance type safety and accuracy. Verify that these changes accurately reflect the data types returned by the API.

src/client/lcd/api/UpgradeAPI.spec.ts (2)

5-5: Updated API endpoint.

The API endpoint has been updated from 'https://stone-rest.initia.tech/' to 'https://lcd.devnet.initia.xyz/'. This change is likely to reflect a shift to a development environment, which is a common practice. Ensure that all references to the old endpoint are updated across the entire test suite to maintain consistency.

Verification successful

Old API endpoint references removed.

The search for the old API endpoint 'https://stone-rest.initia.tech/' returned no results, indicating that all references have been successfully updated to the new endpoint. This ensures consistency across the codebase.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that all references to the old API endpoint are updated.

# Test: Search for the old API endpoint. Expect: No occurrences.
rg --type ts 'https://stone-rest.initia.tech/'

Length of output: 46


25-25: Updated expected length of module versions.

The expected length of the module versions returned by the upgrade instance has been updated from 22 to 34. This change suggests an update in the underlying data or functionality, potentially due to the introduction of new modules or changes in the API. Verify that this change is consistent with the updates made in the PR and accurately reflects the new state of the API.

src/client/lcd/api/RewardAPI.spec.ts (2)

5-5: Approved: Base URL change for APIRequester.

The update to the base URL from 'https://stone-rest.initia.tech/' to 'https://lcd.devnet.initia.xyz/' is appropriate for development environments, ensuring that tests are isolated from production.


22-22: Approved: Change in expected type for dilution_period.

Changing the expected type from expect.any(String) to expect.any(Duration) enhances type safety and clarity in the test. It's important to ensure that the Duration class is implemented correctly and integrates well with the rest of the application.

Verify the implementation of the Duration class:

Verification successful

Verified: The Duration class is implemented correctly.

The Duration class in src/core/Duration.ts is well-implemented, providing comprehensive functionality for handling duration data. The change in the test expectation to use expect.any(Duration) is appropriate and enhances type safety. No further issues were found with this change.

  • Location of Duration class: src/core/Duration.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation and usage of the `Duration` class.

# Test: Search for the `Duration` class definition and usage. Expect: Proper implementation and usage across the application.
ast-grep --lang typescript --pattern $'class Duration {
  $$$
}'

Length of output: 2389

src/client/lcd/APIRequester.spec.ts (3)

16-20: Verify the usage of axios.AxiosHeaders().

The test uses axios.AxiosHeaders() to set headers, which is not a standard export from axios. Please verify its existence or consider using a more typical approach, such as directly using an object for headers.


31-35: Verify URL construction and header usage.

Ensure that the URL is constructed correctly when using a base URL with a path segment. Also, verify the usage of axios.AxiosHeaders() as mentioned in the previous comment.


46-50: Verify URL construction with search parameters and header usage.

Ensure that the URL with search parameters is constructed correctly and that the query string is preserved. Also, verify the usage of axios.AxiosHeaders() as mentioned in previous comments.

src/client/lcd/api/TendermintAPI.spec.ts (1)

6-6: Verify the new API endpoint URL.

The change in the API endpoint URL from 'https://stone-rest.initia.tech/' to 'https://lcd.devnet.initia.xyz/' is significant as it indicates a shift to a development environment. This change can affect the behavior of the API being tested. It is crucial to verify:

  • The correctness of the new URL.
  • That the development environment is properly configured to handle the requests made by these tests.

Run the following script to verify the correctness of the new URL:

src/client/lcd/api/FeeGrantAPI.spec.ts (1)

4-4: Address the commented-out test suite and URL change.

The change in the URL from a production or staging environment to a development environment is noted. However, the entire test suite is commented out, which raises concerns about the current state of testing for this API. It's crucial to ensure that the tests are active and accurately reflect the intended environment to maintain the reliability of the test suite.

Please verify the following:

  • The reason for commenting out the entire test suite.
  • Plans to reactivate or update these tests to reflect the new environment.
src/client/lcd/api/MstakingAPI.spec.ts (2)

3-3: Updated imports to include new dependencies.

The import statement has been expanded to include Duration and ValConsPublicKey from the ../../../core module. This change is consistent with the new test assertions that utilize these types, ensuring that the necessary classes are available for the tests.


11-11: Refined test assertions to use more specific types.

The test assertions for unbonding_time and min_commission_rate have been updated:

  • unbonding_time now expects a Duration type instead of a generic Number, which enhances the specificity and correctness of the test.
  • min_comission_rate has been added as a new expectation, and it expects a String. This addition helps ensure that the API's response adheres to the updated contract.

These changes are crucial for maintaining the integrity of the tests and ensuring they align with the updated API specifications.

Also applies to: 17-17

src/client/lcd/api/GovAPI.spec.ts (1)

3-3: Imports and API endpoint setup are correctly updated.

The imports for Coins and Duration are correctly added to support the new test cases. The update to the API endpoint URL is consistent with the shift to a development environment, aligning with the PR objectives.

Also applies to: 5-5

src/client/lcd/api/TxAPI.spec.ts (1)

11-11: Verify the URL change for LCDClient initialization.

The URL has been changed from a production to a development environment. This is a significant change as it affects how the application interacts with the blockchain and could impact testing scenarios.

Please confirm that this change was intentional and verify that all related configurations and tests are aligned with this new environment.

src/client/lcd/api/IbcAPI.ts (2)

138-140: Endpoint Change in parameters Method

The API endpoint in the parameters method has been updated from /ibc/client/v1/params to /ibc/core/client/v1/params. This change is crucial as it may affect the data retrieved and the overall functionality of the API. Ensure that this change is reflected in all associated documentation and that any dependent systems are updated accordingly.

Please verify that this endpoint change has been communicated to all stakeholders and that integration tests cover this new endpoint to ensure it behaves as expected.


138-140: Consistency of Endpoint Change

The updated endpoint in the parameters method aligns with the other IBC-related API endpoints in this file, which also use the /ibc/core/... prefix. This consistency suggests that the change is part of a broader architectural update to standardize the API endpoint structure across the system.

src/client/lcd/api/GovAPI.spec.ts Show resolved Hide resolved
Copy link
Collaborator

@joon9823 joon9823 left a comment

Choose a reason for hiding this comment

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

LGTM

@joon9823 joon9823 merged commit 3b7b858 into main Sep 5, 2024
3 checks passed
@joon9823 joon9823 deleted the feat/bcs-bignumber branch September 5, 2024 07:21
@coderabbitai coderabbitai bot mentioned this pull request Oct 18, 2024
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