Skip to content

Commit a9f0bb0

Browse files
committed
Merge remote-tracking branch 'origin/main' into detail_cb
2 parents 71c10ff + 607fa83 commit a9f0bb0

File tree

7 files changed

+20
-18
lines changed

7 files changed

+20
-18
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
- [#1232](https://github.com/crypto-org-chain/cronos/pull/1232) Adjust require gas in relayer precompile to be closed with actual consumed.
1616
- [#1235](https://github.com/crypto-org-chain/cronos/pull/1235) Add channel detail in ica packet callback.
1717

18+
### Improvements
19+
20+
- [#1239](https://github.com/crypto-org-chain/cronos/pull/1239) Refactor websocket/subscription system to improve performance and stability.
21+
1822

1923
*October 17, 2023*
2024

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ replace (
234234
// TODO: remove it: https://github.com/cosmos/cosmos-sdk/issues/13134
235235
github.com/dgrijalva/jwt-go => github.com/golang-jwt/jwt/v4 v4.4.2
236236
github.com/ethereum/go-ethereum => github.com/evmos/go-ethereum v1.10.26-evmos-rc1
237-
github.com/evmos/ethermint => github.com/crypto-org-chain/ethermint v0.6.1-0.20231101080732-b9078abfe0fd
237+
github.com/evmos/ethermint => github.com/crypto-org-chain/ethermint v0.6.1-0.20231114052006-8b1ec2327fac
238238
// Fix upstream GHSA-h395-qcrw-5vmq and GHSA-3vp4-m3rf-835h vulnerabilities.
239239
// TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409
240240
github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -484,8 +484,8 @@ github.com/crypto-org-chain/cometbft-db v0.0.0-20231011055109-57922ac52a63 h1:R1
484484
github.com/crypto-org-chain/cometbft-db v0.0.0-20231011055109-57922ac52a63/go.mod h1:rocwIfnS+kA060x64gkSIRvWB9StSppIkJuo5MWzL24=
485485
github.com/crypto-org-chain/cosmos-sdk v0.46.0-beta2.0.20231013072415-eec017435467 h1:m0/aHPIJAzi2MSP3TXzzbLTFf+koRFQiaYmerRZUtK4=
486486
github.com/crypto-org-chain/cosmos-sdk v0.46.0-beta2.0.20231013072415-eec017435467/go.mod h1:G384omH7cXgm90xXR7xpHvsKG7vdBaDuz4To6GpTHUU=
487-
github.com/crypto-org-chain/ethermint v0.6.1-0.20231101080732-b9078abfe0fd h1:8AWwJrxYtQxoZ1rrM9+w6MLScVe6LzskRo8UF9ep7Qs=
488-
github.com/crypto-org-chain/ethermint v0.6.1-0.20231101080732-b9078abfe0fd/go.mod h1:rbAKU2rftDobCIoCiol3SO+bTqw2cERu9TEki7PvfK0=
487+
github.com/crypto-org-chain/ethermint v0.6.1-0.20231114052006-8b1ec2327fac h1:b2Zd0b52V+AyCNRGLRiMtxzNGSzG9aLJmrBhmV2wzvc=
488+
github.com/crypto-org-chain/ethermint v0.6.1-0.20231114052006-8b1ec2327fac/go.mod h1:rbAKU2rftDobCIoCiol3SO+bTqw2cERu9TEki7PvfK0=
489489
github.com/crypto-org-chain/gravity-bridge/module/v2 v2.0.1-0.20230825054824-75403cd90c6e h1:rSTc35OBjjCBx47rHPWBCIHNGPbMnEj8f7fNcK2TjVI=
490490
github.com/crypto-org-chain/gravity-bridge/module/v2 v2.0.1-0.20230825054824-75403cd90c6e/go.mod h1:HBaDqlFjlaXJwVQtA7jHejyaA7xwjXI2o6pU/ccP3tE=
491491
github.com/cyphar/filepath-securejoin v0.2.3/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=

gomod2nix.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,8 @@ schema = 3
216216
hash = "sha256-GgcReGsIIuBE2TabDYqDO9sBGogdVr9RSh4arQzdPnE="
217217
replaced = "github.com/evmos/go-ethereum"
218218
[mod."github.com/evmos/ethermint"]
219-
version = "v0.6.1-0.20231101080732-b9078abfe0fd"
220-
hash = "sha256-FlKoOdJbNqQfloOxV5AGd5TIm3VLjoZW8YOLnuJY7FY="
219+
version = "v0.6.1-0.20231114052006-8b1ec2327fac"
220+
hash = "sha256-+Rgexd0GX8/afOw2lMULQfOn8tW5dk5RkxpCFrco3og="
221221
replaced = "github.com/crypto-org-chain/ethermint"
222222
[mod."github.com/felixge/httpsnoop"]
223223
version = "v1.0.2"

integration_tests/test_basic.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ def test_contract(cronos):
785785
origin_cmd = None
786786

787787

788-
@pytest.mark.parametrize("max_gas_wanted", [80000000, 40000000, 25000000, 500000])
788+
@pytest.mark.parametrize("max_gas_wanted", [80000000, 40000000, 25000000, 500000, None])
789789
def test_tx_inclusion(cronos, max_gas_wanted):
790790
"""
791791
- send multiple heavy transactions at the same time.
@@ -798,6 +798,8 @@ def fn(cmd):
798798
global origin_cmd
799799
if origin_cmd is None:
800800
origin_cmd = cmd
801+
if max_gas_wanted is None:
802+
return origin_cmd
801803
return f"{origin_cmd} --evm.max-tx-gas-wanted {max_gas_wanted}"
802804

803805
modify_command_in_supervisor_config(
@@ -807,6 +809,10 @@ def fn(cmd):
807809
cronos.supervisorctl("update")
808810
wait_for_port(ports.evmrpc_port(cronos.base_port(0)))
809811

812+
# reset to origin_cmd only
813+
if max_gas_wanted is None:
814+
return
815+
810816
w3 = cronos.w3
811817
cli = cronos.cosmos_cli()
812818
block_gas_limit = 81500000

integration_tests/test_subscribe.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import time
44
from collections import defaultdict
55

6-
import pytest
76
import websockets
87
from eth_utils import abi
98
from hexbytes import HexBytes
@@ -16,7 +15,6 @@
1615
CONTRACTS,
1716
KEYS,
1817
deploy_contract,
19-
modify_command_in_supervisor_config,
2018
send_raw_transactions,
2119
send_transaction,
2220
sign_transaction,
@@ -82,16 +80,10 @@ async def unsubscribe(self, sub_id):
8280
TEST_EVENT_TOPIC = Web3.keccak(text="TestEvent(uint256)")
8381

8482

85-
@pytest.mark.flaky(max_runs=2)
8683
def test_subscribe_basic(cronos: Cronos):
8784
"""
8885
test basic subscribe and unsubscribe
8986
"""
90-
modify_command_in_supervisor_config(
91-
cronos.base_dir / "tasks.ini",
92-
lambda cmd: f"{cmd} --evm.max-tx-gas-wanted {0}",
93-
)
94-
cronos.supervisorctl("update")
9587
wait_for_port(ports.evmrpc_ws_port(cronos.base_port(0)))
9688
cli = cronos.cosmos_cli()
9789
loop = asyncio.get_event_loop()
@@ -161,11 +153,11 @@ async def async_test():
161153
await asyncio.gather(*[subscriber_test(c) for i in range(3)])
162154
contract = deploy_contract(cronos.w3, CONTRACTS["TestERC20A"])
163155
address = contract.address
164-
await asyncio.gather(*[transfer_test(c, cronos.w3, contract, address)])
156+
await transfer_test(c, cronos.w3, contract, address)
165157
contract = deploy_contract(cronos.w3, CONTRACTS["TestMessageCall"])
166158
inner = contract.caller.inner()
167159
begin = time.time()
168-
await asyncio.gather(*[logs_test(c, cronos.w3, contract, inner)])
160+
await logs_test(c, cronos.w3, contract, inner)
169161
print("msg call time", time.time() - begin)
170162
t.cancel()
171163
try:

x/cronos/rpc/api.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88

99
"github.com/cometbft/cometbft/libs/log"
1010
coretypes "github.com/cometbft/cometbft/rpc/core/types"
11-
rpcclient "github.com/cometbft/cometbft/rpc/jsonrpc/client"
1211
"github.com/cosmos/cosmos-sdk/client"
1312
"github.com/cosmos/cosmos-sdk/server"
1413
"github.com/crypto-org-chain/cronos/v2/x/cronos/types"
@@ -19,6 +18,7 @@ import (
1918
"github.com/ethereum/go-ethereum/rpc"
2019
evmrpc "github.com/evmos/ethermint/rpc"
2120
"github.com/evmos/ethermint/rpc/backend"
21+
"github.com/evmos/ethermint/rpc/stream"
2222
rpctypes "github.com/evmos/ethermint/rpc/types"
2323
ethermint "github.com/evmos/ethermint/types"
2424
evmtypes "github.com/evmos/ethermint/x/evm/types"
@@ -40,7 +40,7 @@ func init() {
4040
}
4141

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

0 commit comments

Comments
 (0)