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

Rollback common #302

Merged
merged 6 commits into from
Jul 24, 2024
Merged

Rollback common #302

merged 6 commits into from
Jul 24, 2024

Conversation

haunv3
Copy link
Contributor

@haunv3 haunv3 commented Jul 23, 2024

Summary by CodeRabbit

  • New Features

    • Introduced a new TypeScript configuration to enhance build processes and support modern JavaScript features.
  • Bug Fixes

    • Simplified GitHub Actions workflow by changing the branch trigger and removing Discord notifications, which may improve deployment efficiency but reduces user visibility on publication status.
    • Removed the dependency on tronweb, indicating a potential shift in the project's reliance on this library.
  • Tests

    • Enhanced testing suite with improved mocking techniques and adjustments to test organization; however, some test cases have been temporarily commented out for refactoring purposes.
  • Updates

    • Updated the versioning of the @oraichain/oraidex-common package to a beta release and added a new dependency on tronweb.

Copy link

coderabbitai bot commented Jul 23, 2024

Walkthrough

The recent changes streamline the project's GitHub Actions workflow and testing processes. The workflow now triggers on the rollback-common branch, removing Discord notifications to simplify communication. Test cases for the universal swap handler have been restructured, with many commented out for potential refactoring. Additionally, new TypeScript configurations have been added, enhancing project compatibility with modern JavaScript standards and improving build efficiency.

Changes

Files Change Summary
.github/workflows/publish_package_universal_common.yml Updated trigger branch from feat/oraidex-universal-swap to rollback-common; removed Discord notification job, simplifying workflow communication.
packages/universal-swap/tests/index.spec.ts Enhanced mocking with vi.useFakeTimers(), commented out several test cases indicating possible refactoring, added console.log for debugging, and adjusted test structure while retaining core functionality.
tsconfig.build.json Introduced a new TypeScript configuration for building, targeting ECMAScript 2020, enabling CommonJS modules, and streamlining the build process with options for source maps and decorators.
tsconfig.json Changed TypeScript module system from "commonjs" to "es2020", aligning with modern JavaScript standards, potentially affecting module compatibility in the codebase.
package.json, packages/oraidex-common/package.json Removed tronweb dependency from package.json; updated @oraichain/oraidex-common version to 1.0.93-beta.2 and added tronweb dependency.

Sequence Diagram(s)

sequenceDiagram
    participant Developer
    participant GitHub Actions
    participant Test Suite

    Developer->>GitHub Actions: Push to rollback-common
    GitHub Actions->>Test Suite: Run tests
    Test Suite->>GitHub Actions: Return test results
    GitHub Actions->>Developer: Notify on completion (without Discord)
Loading

Poem

In fields of code where rabbits play,
We hop and leap, and change the way.
With workflows sleek and tests so bright,
Our universal swaps take flight!
Hooray for builds, and cheers for fun,
Together, we'll get the job done! 🐇✨


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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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 Jul 23, 2024

badge

Code Coverage Summary

Filename                                                                      Stmts    Miss  Cover    Missing
--------------------------------------------------------------------------  -------  ------  -------  ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
docs/assets/main.js                                                              58      58  0.00%    1-58
docs/assets/search.js                                                             1       1  0.00%    1
packages/ibc-routing/hardhat.config.ts                                           59      59  0.00%    1-75
packages/ibc-routing/src/db.ts                                                  158     158  0.00%    1-263
packages/ibc-routing/src/event.ts                                                85      85  0.00%    1-122
packages/ibc-routing/src/index.ts                                                31      31  0.00%    1-56
packages/ibc-routing/src/machine.ts                                              30      30  0.00%    1-34
packages/ibc-routing/test/mock-eth-ws.ts                                         52      52  0.00%    1-55
packages/ibc-routing/test/mock-tendermint-ws.spec.ts                             25      17  32.00%   7-24
packages/oraidex-common/src/alpha-network.ts                                     61       0  100.00%
packages/oraidex-common/src/axios-request.ts                                     17      17  0.00%    1-20
packages/oraidex-common/src/bigdecimal.ts                                       139      50  64.02%   23-24, 30-33, 40-41, 45-54, 63-65, 71-73, 120-124, 127-146, 149-150, 153-154, 180-181, 184-185
packages/oraidex-common/src/constant.ts                                         157       0  100.00%
packages/oraidex-common/src/helper.ts                                           464     139  70.04%   141-142, 145-156, 159-169, 276-283, 286-299, 309-315, 325-340, 343-350, 353-383, 386-394, 397-399, 402-404, 408-417, 426-440, 446-448, 533-534, 559-562
packages/oraidex-common/src/ibc-info.ts                                         168     168  0.00%    1-200
packages/oraidex-common/src/index.ts                                             13      13  0.00%    1-13
packages/oraidex-common/src/network.ts                                          959       0  100.00%
packages/oraidex-common/src/pairs.ts                                            154       4  97.40%   151-152, 157-158
packages/oraidex-common/src/token.ts                                             71       0  100.00%
packages/oraidex-common/src/wallet.ts                                           146     146  0.00%    1-236
packages/oraidex-common/src/config/chainInfosWithIcon.ts                        196     196  0.00%    1-210
packages/oraidex-common/src/interface/index.ts                                    1       1  0.00%    1
packages/oraidex-common/src/interface/wallet.ts                                  19      19  0.00%    1-20
packages/oraidex-common/tests/bigdecimal.spec.ts                                220       0  100.00%
packages/oraidex-common/tests/helper.spec.ts                                    560       8  98.57%   97-98, 337-338, 628-629, 659-660
packages/oraidex-common/tests/pairs.spec.ts                                      24       0  100.00%
packages/oraiswap-v3/src/const.ts                                                39       0  100.00%
packages/oraiswap-v3/src/handler.ts                                             107       0  100.00%
packages/oraiswap-v3/src/helpers.ts                                             193      10  94.81%   110-111, 121-122, 147-148, 176-177, 187-188
packages/oraiswap-v3/src/index.ts                                                 4       0  100.00%
packages/oraiswap-v3/src/types.ts                                                 0       0  100.00%
packages/oraiswap-v3/tests/handler.spec.ts                                       81       0  100.00%
packages/oraiswap-v3/tests/helpers.spec.ts                                      455       0  100.00%
packages/oraiswap-v3/tests/test-common.ts                                        32       0  100.00%
packages/universal-swap/src/handler.ts                                         1111     552  50.31%   77-78, 99-100, 114-116, 122-125, 136-138, 167-189, 268-298, 401-421, 504-514, 533, 535-539, 552-563, 570-616, 641-651, 654-664, 671-678, 692-770, 774-805, 809-828, 831-848, 852-903, 908-991, 997-1068, 1077-1082, 1101-1102, 1104-1105, 1111, 1115-1130, 1139-1142, 1186-1189, 1196-1204, 1209, 1249-1250, 1280-1291, 1358-1359
packages/universal-swap/src/helper.ts                                           767     244  68.18%   80-82, 218-219, 373-375, 397-403, 427-429, 433-435, 442-468, 523-524, 566-573, 580-621, 635-692, 731-732, 747, 775, 782-803, 805-806, 839-840, 843-846, 856-898, 906-922, 981-991, 1002-1007, 1026
packages/universal-swap/src/index.ts                                              5       5  0.00%    1-5
packages/universal-swap/src/swap-filter.ts                                       40       0  100.00%
packages/universal-swap/src/types.ts                                             10       0  100.00%
packages/universal-swap/src/wrapper.ts                                           79      79  0.00%    1-117
packages/universal-swap/src/proto/proto-gen.ts                                   71       0  100.00%
packages/universal-swap/src/universal-demos/alpha-smart-router.ts                71      71  0.00%    1-546
packages/universal-swap/src/universal-demos/evm-to-evm.ts                        48      48  0.00%    1-63
packages/universal-swap/src/universal-demos/from-cosmos-to-evm.ts                41      41  0.00%    1-53
packages/universal-swap/src/universal-demos/from-oraichain-to-oraichain.ts       49      49  0.00%    1-66
packages/universal-swap/src/universal-demos/ibc-hooks-demo.ts                    40      40  0.00%    1-55
packages/universal-swap/src/universal-demos/neutaro-ibc-demo.ts                  40      40  0.00%    1-47
packages/universal-swap/src/universal-demos/noble-ibc-demo.ts                    41      41  0.00%    1-45
packages/universal-swap/src/universal-demos/offline-wallet.ts                    19      19  0.00%    1-21
packages/universal-swap/tests/helper.spec.ts                                    883      26  97.05%   592-594, 956-978
packages/universal-swap/tests/index.spec.ts                                    1624      32  98.02%   239-242, 271-272, 283-284, 289-290, 292-293, 295-296, 1050-1069
packages/universal-swap/tests/smart-router-common.ts                            805       0  100.00%
packages/universal-swap/tests/test-common.ts                                     56       0  100.00%
TOTAL                                                                         10579    2549  75.90%

Diff against main

Filename                                       Stmts    Miss  Cover
-------------------------------------------  -------  ------  --------
packages/oraidex-common/src/wallet.ts             -2      -2  +100.00%
packages/universal-swap/tests/index.spec.ts       +1       0  +100.00%
TOTAL                                             -1      -2  +0.02%

Results for commit: 8888458

Minimum allowed coverage is 0%

♻️ This comment has been updated with latest results

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 014b82f and 2e9faca.

Files selected for processing (4)
  • .github/workflows/publish_package_universal_common.yml (2 hunks)
  • packages/universal-swap/tests/index.spec.ts (4 hunks)
  • tsconfig.build.json (1 hunks)
  • tsconfig.json (1 hunks)
Files skipped from review due to trivial changes (2)
  • .github/workflows/publish_package_universal_common.yml
  • tsconfig.build.json
Additional comments not posted (4)
tsconfig.json (1)

5-5: LGTM! But verify module compatibility.

The change to es2020 module format aligns with modern JavaScript standards. Ensure that all module loaders and bundlers in the codebase support ES2020 modules.

packages/universal-swap/tests/index.spec.ts (3)

118-118: Good addition for time-dependent tests.

Using vi.useFakeTimers() enhances control over time-dependent tests, making them more predictable.


466-466: Revisit and refactor commented out test cases.

Several test cases have been commented out. Ensure that these tests are revisited and either refactored or re-enabled to maintain comprehensive test coverage.

Also applies to: 467-467, 468-468, 469-469, 512-539, 542-563, 566-601, 604-634, 639-648, 651-691, 695-719, 721-794, 797-880, 883-974, 976-987, 989-1003, 1005-1019, 1022-1039, 1042-1070, 1073-1085, 1087-1097, 1098-1106, 1109-1293, 1295-1378, 1380-1424, 1426-1760


476-476: Remove console logging in the final version.

The console.log statement aids in debugging but should be removed or commented out in the final version of the test code.

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 2e9faca and 8888458.

Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
Files selected for processing (3)
  • package.json (1 hunks)
  • packages/oraidex-common/package.json (2 hunks)
  • packages/universal-swap/tests/index.spec.ts (4 hunks)
Files skipped from review due to trivial changes (1)
  • package.json
Files skipped from review as they are similar to previous changes (1)
  • packages/universal-swap/tests/index.spec.ts
Additional comments not posted (2)
packages/oraidex-common/package.json (2)

3-3: Verify the versioning strategy for beta releases.

The version has been updated to 1.0.93-beta.2, indicating a beta release. Ensure this aligns with the project's versioning strategy and that all stakeholders are aware of the potential instability.


28-28: Verify compatibility and stability of the tronweb dependency.

A new dependency, tronweb version 6.0.0-beta.4, has been added. Ensure it is compatible with existing dependencies and that the beta version is stable enough for the project's needs.

@haunv3 haunv3 merged commit bf16163 into main Jul 24, 2024
2 checks passed
@quangdz1704 quangdz1704 deleted the rollback-common branch July 24, 2024 07:32
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.

4 participants