Skip to content

Commit

Permalink
Problem: websocket refactoring not used (crypto-org-chain#1239)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
yihuang and mmsqe committed Nov 15, 2023
1 parent e61acd9 commit 3aa6a9a
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Changelog

- [#1239](https://github.com/crypto-org-chain/cronos/pull/1239) Refactor websocket/subscription system to improve performance and stability.

*October 17, 2023*

## v1.1.0-rc1
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ replace (
// TODO: remove it: https://github.com/cosmos/cosmos-sdk/issues/13134
github.com/dgrijalva/jwt-go => github.com/golang-jwt/jwt/v4 v4.4.2
github.com/ethereum/go-ethereum => github.com/evmos/go-ethereum v1.10.26-evmos-rc1
github.com/evmos/ethermint => github.com/crypto-org-chain/ethermint v0.6.1-0.20230925072753-4062d0cc2a32
github.com/evmos/ethermint => github.com/crypto-org-chain/ethermint v0.6.1-0.20231114052006-8b1ec2327fac
// Fix upstream GHSA-h395-qcrw-5vmq and GHSA-3vp4-m3rf-835h vulnerabilities.
// TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409
github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,8 @@ github.com/crypto-org-chain/cometbft-db v0.0.0-20231011055109-57922ac52a63 h1:R1
github.com/crypto-org-chain/cometbft-db v0.0.0-20231011055109-57922ac52a63/go.mod h1:rocwIfnS+kA060x64gkSIRvWB9StSppIkJuo5MWzL24=
github.com/crypto-org-chain/cosmos-sdk v0.46.0-beta2.0.20231013072415-eec017435467 h1:m0/aHPIJAzi2MSP3TXzzbLTFf+koRFQiaYmerRZUtK4=
github.com/crypto-org-chain/cosmos-sdk v0.46.0-beta2.0.20231013072415-eec017435467/go.mod h1:G384omH7cXgm90xXR7xpHvsKG7vdBaDuz4To6GpTHUU=
github.com/crypto-org-chain/ethermint v0.6.1-0.20230925072753-4062d0cc2a32 h1:A++epzNCr3EY57dnU6UTSDwbCiPD6MjvUKHKSd/PoI8=
github.com/crypto-org-chain/ethermint v0.6.1-0.20230925072753-4062d0cc2a32/go.mod h1:wnJQyK4n0vShhL+YIAUd7XCzUhgZ9fgG6yJ14n7qefo=
github.com/crypto-org-chain/ethermint v0.6.1-0.20231114052006-8b1ec2327fac h1:b2Zd0b52V+AyCNRGLRiMtxzNGSzG9aLJmrBhmV2wzvc=
github.com/crypto-org-chain/ethermint v0.6.1-0.20231114052006-8b1ec2327fac/go.mod h1:rbAKU2rftDobCIoCiol3SO+bTqw2cERu9TEki7PvfK0=
github.com/crypto-org-chain/gravity-bridge/module/v2 v2.0.1-0.20230825054824-75403cd90c6e h1:rSTc35OBjjCBx47rHPWBCIHNGPbMnEj8f7fNcK2TjVI=
github.com/crypto-org-chain/gravity-bridge/module/v2 v2.0.1-0.20230825054824-75403cd90c6e/go.mod h1:HBaDqlFjlaXJwVQtA7jHejyaA7xwjXI2o6pU/ccP3tE=
github.com/cyphar/filepath-securejoin v0.2.3/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=
Expand Down
4 changes: 2 additions & 2 deletions gomod2nix.toml
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ schema = 3
hash = "sha256-GgcReGsIIuBE2TabDYqDO9sBGogdVr9RSh4arQzdPnE="
replaced = "github.com/evmos/go-ethereum"
[mod."github.com/evmos/ethermint"]
version = "v0.6.1-0.20230925072753-4062d0cc2a32"
hash = "sha256-8zwdHROHnAVfly2PIaNAfiXfb2fWsTqePaZ58EJtjH4="
version = "v0.6.1-0.20231114052006-8b1ec2327fac"
hash = "sha256-+Rgexd0GX8/afOw2lMULQfOn8tW5dk5RkxpCFrco3og="
replaced = "github.com/crypto-org-chain/ethermint"
[mod."github.com/felixge/httpsnoop"]
version = "v1.0.2"
Expand Down
2 changes: 0 additions & 2 deletions integration_tests/test_subscribe.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import time
from collections import defaultdict

import pytest
import websockets
from eth_utils import abi
from hexbytes import HexBytes
Expand Down Expand Up @@ -82,7 +81,6 @@ async def unsubscribe(self, sub_id):
TEST_EVENT_TOPIC = Web3.keccak(text="TestEvent(uint256)")


@pytest.mark.flaky(max_runs=2)
def test_subscribe_basic(cronos: Cronos):
"""
test basic subscribe and unsubscribe
Expand Down
4 changes: 2 additions & 2 deletions x/cronos/rpc/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (

"github.com/cometbft/cometbft/libs/log"
coretypes "github.com/cometbft/cometbft/rpc/core/types"
rpcclient "github.com/cometbft/cometbft/rpc/jsonrpc/client"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/server"
"github.com/crypto-org-chain/cronos/v2/x/cronos/types"
Expand All @@ -19,6 +18,7 @@ import (
"github.com/ethereum/go-ethereum/rpc"
evmrpc "github.com/evmos/ethermint/rpc"
"github.com/evmos/ethermint/rpc/backend"
"github.com/evmos/ethermint/rpc/stream"
rpctypes "github.com/evmos/ethermint/rpc/types"
ethermint "github.com/evmos/ethermint/types"
evmtypes "github.com/evmos/ethermint/x/evm/types"
Expand All @@ -40,7 +40,7 @@ func init() {
}

// CreateCronosRPCAPIs creates extension json-rpc apis
func CreateCronosRPCAPIs(ctx *server.Context, clientCtx client.Context, tmWSClient *rpcclient.WSClient, allowUnprotectedTxs bool, indexer ethermint.EVMTxIndexer) []rpc.API {
func CreateCronosRPCAPIs(ctx *server.Context, clientCtx client.Context, _ *stream.RPCStream, allowUnprotectedTxs bool, indexer ethermint.EVMTxIndexer) []rpc.API {
evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer)
return []rpc.API{
{
Expand Down

0 comments on commit 3aa6a9a

Please sign in to comment.