Skip to content

Commit

Permalink
Problem: websocket refactoring not used (#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 authored Nov 14, 2023
1 parent e7a8ea8 commit 54e4d9c
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@

- [#1232](https://github.com/crypto-org-chain/cronos/pull/1232) Adjust require gas in relayer precompile to be closed with actual consumed.

### Improvements

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


*October 17, 2023*

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.20231101080732-b9078abfe0fd
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.20231101080732-b9078abfe0fd h1:8AWwJrxYtQxoZ1rrM9+w6MLScVe6LzskRo8UF9ep7Qs=
github.com/crypto-org-chain/ethermint v0.6.1-0.20231101080732-b9078abfe0fd/go.mod h1:rbAKU2rftDobCIoCiol3SO+bTqw2cERu9TEki7PvfK0=
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.20231101080732-b9078abfe0fd"
hash = "sha256-FlKoOdJbNqQfloOxV5AGd5TIm3VLjoZW8YOLnuJY7FY="
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 54e4d9c

Please sign in to comment.