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

Problem: websocket refactoring not used #1239

Merged
merged 6 commits into from
Nov 14, 2023

Conversation

yihuang
Copy link
Collaborator

@yihuang yihuang commented Nov 13, 2023

Solution:

  • use the recent websocket/filter system refactoring in ethermint.

👮🏻👮🏻👮🏻 !!!! REFERENCE THE PROBLEM YOUR ARE SOLVING IN THE PR TITLE AND DESCRIBE YOUR SOLUTION HERE !!!! DO NOT FORGET !!!! 👮🏻👮🏻👮🏻

PR Checklist:

  • Have you read the CONTRIBUTING.md?
  • Does your PR follow the C4 patch requirements?
  • Have you rebased your work on top of the latest master?
  • Have you checked your code compiles? (make)
  • Have you included tests for any non-trivial functionality?
  • Have you checked your code passes the unit tests? (make test)
  • Have you checked your code formatting is correct? (go fmt)
  • Have you checked your basic code style is fine? (golangci-lint run)
  • If you added any dependencies, have you checked they do not contain any known vulnerabilities? (go list -json -m all | nancy sleuth)
  • If your changes affect the client infrastructure, have you run the integration test?
  • If your changes affect public APIs, does your PR follow the C4 evolution of public contracts?
  • If your code changes public APIs, have you incremented the crate version numbers and documented your changes in the CHANGELOG.md?
  • If you are contributing for the first time, please read the agreement in CONTRIBUTING.md now and add a comment to this pull request stating that your PR is in accordance with the Developer's Certificate of Origin.

Thank you for your code, it's appreciated! :)

Summary by CodeRabbit

  • Refactor

    • Enhanced the websocket/subscription system for better performance and stability.
    • Adjusted gas requirement calculations to be more accurate.
  • Tests

    • Simplified subscription integration tests by removing unnecessary flakiness controls.
  • Documentation

    • Updated CHANGELOG to reflect recent improvements and adjustments.

Solution:
- use the recent websocket/filter system refactoring in ethermint.
Copy link
Contributor

coderabbitai bot commented Nov 13, 2023

Walkthrough

The recent updates include a significant refactoring of the websocket/subscription system to improve performance and stability. Additionally, there's an adjustment to the gas requirements in a relayer precompile to better match actual usage. A test case in the integration tests has been simplified by removing a flaky decorator, and there's a shift in the RPC API implementation from using CometBFT to Ethermint's streaming service.

Changes

File Path Change Summary
CHANGELOG.md Improved websocket/subscription system; adjusted gas requirement in relayer precompile.
.../test_subscribe.py Removed pytest import and @pytest.mark.flaky decorator from test_subscribe_basic.
x/cronos/rpc/api.go Replaced CometBFT RPC client import with Ethermint stream; updated CreateCronosRPCAPIs function signature.

Poem

As autumn leaves fall, we code away, 🍂💻
Refactoring webs, in Ethermint's sway.
Gas aligns with use, tests now less flaky,
A rabbit's touch, making blockchains sprightly! 🐇✨


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Note: For conversation with the bot, please use the review comments on code diffs or files.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

Copy link

codecov bot commented Nov 13, 2023

Codecov Report

Merging #1239 (3f2c0d1) into main (e7a8ea8) will increase coverage by 20.22%.
The diff coverage is 0.00%.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main    #1239       +/-   ##
===========================================
+ Coverage   16.67%   36.89%   +20.22%     
===========================================
  Files          79      115       +36     
  Lines        5786    10255     +4469     
===========================================
+ Hits          965     3784     +2819     
- Misses       4743     6097     +1354     
- Partials       78      374      +296     
Files Coverage Δ
x/cronos/rpc/api.go 0.35% <0.00%> (ø)

... and 54 files with indirect coverage changes

@yihuang yihuang marked this pull request as ready for review November 14, 2023 05:56
@yihuang yihuang requested a review from a team as a code owner November 14, 2023 05:56
@yihuang yihuang requested review from mmsqe and devashishdxt and removed request for a team November 14, 2023 05:56
go.mod Show resolved Hide resolved
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.

Review Status

Actionable comments generated: 2

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between e7a8ea8 and 3f2c0d1.
Files ignored due to filter (3)
  • go.mod
  • go.sum
  • gomod2nix.toml
Files selected for processing (3)
  • CHANGELOG.md (1 hunks)
  • integration_tests/test_subscribe.py (2 hunks)
  • x/cronos/rpc/api.go (3 hunks)
Files skipped from review due to trivial changes (1)
  • integration_tests/test_subscribe.py
Additional comments: 3
x/cronos/rpc/api.go (3)
  • 8-13: The import statement for "github.com/cometbft/cometbft/rpc/core/types" has been removed. Verify that this dependency is no longer required and that no code in this file or project relies on it.

  • 18-24: The import statement for "github.com/evmos/ethermint/rpc/stream" has been added. Ensure that all references to the old websocket client have been updated to use the new stream client.

  • 42-46: The signature of CreateCronosRPCAPIs has been changed to accept a *stream.RPCStream instead of *rpcclient.WSClient. Ensure that all invocations of this function have been updated accordingly and that the new RPCStream is being used correctly within the function.

CHANGELOG.md Show resolved Hide resolved
CHANGELOG.md Show resolved Hide resolved
@yihuang yihuang added this pull request to the merge queue Nov 14, 2023
Merged via the queue into crypto-org-chain:main with commit 54e4d9c Nov 14, 2023
31 of 32 checks passed
@yihuang yihuang deleted the ws-refactor branch November 14, 2023 08:11
yihuang added a commit to yihuang/cronos that referenced this pull request Nov 15, 2023
* Problem: websocket refactoring not used

Solution:
- use the recent websocket/filter system refactoring in ethermint.

* update ethermint

* update filter offset to latest so only new changes are fetched in next call

* fix filter

* Revert "update filter offset to latest so only new changes are fetched in next call"

This reverts commit 6910f84.

* changelog

---------

Co-authored-by: mmsqe <[email protected]>
yihuang added a commit that referenced this pull request Nov 15, 2023
* Problem: websocket refactoring not used (backport #1239)

* Problem: websocket refactoring not used

Solution:
- use the recent websocket/filter system refactoring in ethermint.

* update ethermint

* update filter offset to latest so only new changes are fetched in next call

* fix filter

* Revert "update filter offset to latest so only new changes are fetched in next call"

This reverts commit 6910f84.

* changelog

---------

Co-authored-by: mmsqe <[email protected]>

* changelog

---------

Co-authored-by: mmsqe <[email protected]>
yihuang added a commit to yihuang/cronos that referenced this pull request Nov 15, 2023
* Problem: websocket refactoring not used

Solution:
- use the recent websocket/filter system refactoring in ethermint.

* update ethermint

* update filter offset to latest so only new changes are fetched in next call

* fix filter

* Revert "update filter offset to latest so only new changes are fetched in next call"

This reverts commit 6910f84.

* changelog

---------

Co-authored-by: mmsqe <[email protected]>
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