Skip to content

Commit

Permalink
Problem: pending tx comes after get mined
Browse files Browse the repository at this point in the history
  • Loading branch information
mmsqe committed May 22, 2024
1 parent ac56118 commit d73177c
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

* (rpc) [#1444](https://github.com/crypto-org-chain/cronos/pull/1444) Avoid nil pointer error when query blocks before feemarket module gets enabled.
* [#1439](https://github.com/crypto-org-chain/cronos/pull/1439) Add back default prepare proposal logic.
* [#1450](https://github.com/crypto-org-chain/cronos/pull/1450) Fix handling of pending transactions related APIs.

*May 3, 2024*

Expand Down
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ require (
replace (
// Use cosmos keyring
github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0
github.com/cometbft/cometbft => github.com/mmsqe/cometbft v0.37.0-rc3.0.20240522012039-7afac3fc677d
github.com/cometbft/cometbft-db => github.com/crypto-org-chain/cometbft-db v0.0.0-20231011055109-57922ac52a63
// release/v0.47.x
github.com/cosmos/cosmos-sdk => github.com/crypto-org-chain/cosmos-sdk v0.46.0-beta2.0.20240517084251-5ba20d99ec23
Expand All @@ -250,7 +251,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/crypto-org-chain/go-ethereum v1.10.20-0.20231207063621-43cf32d91c3e
github.com/evmos/ethermint => github.com/crypto-org-chain/ethermint v0.6.1-0.20240502043119-814fcacedf60
github.com/evmos/ethermint => github.com/mmsqe/ethermint v0.6.5-0.20240522012842-7a5ec24e05b1
// 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
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -426,8 +426,6 @@ github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZ
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI=
github.com/coinbase/rosetta-sdk-go/types v1.0.0 h1:jpVIwLcPoOeCR6o1tU+Xv7r5bMONNbHU7MuEHboiFuA=
github.com/coinbase/rosetta-sdk-go/types v1.0.0/go.mod h1:eq7W2TMRH22GTW0N0beDnN931DW0/WOI1R2sdHNHG4c=
github.com/cometbft/cometbft v0.37.7-0.20240515092623-8a0f4814d1dc h1:uXdNbzatJAZ+hznHwYU22BePtqqf2VCRssnm7/0DD3M=
github.com/cometbft/cometbft v0.37.7-0.20240515092623-8a0f4814d1dc/go.mod h1:gFGCFXNGDci6tMLemANPGTfU+j4+oH63PjeLe0iIjJk=
github.com/confio/ics23/go v0.9.0 h1:cWs+wdbS2KRPZezoaaj+qBleXgUk5WOQFMP3CQFGTr4=
github.com/confio/ics23/go v0.9.0/go.mod h1:4LPZ2NYqnYIVRklaozjNR1FScgDJ2s5Xrp+e/mYVRak=
github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U=
Expand Down Expand Up @@ -491,8 +489,6 @@ 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.20240517084251-5ba20d99ec23 h1:pmpedXv3cd18uDwv62mfevmEVa0KCMgR/hlsTRU9p8g=
github.com/crypto-org-chain/cosmos-sdk v0.46.0-beta2.0.20240517084251-5ba20d99ec23/go.mod h1:vdMQLvLSGh56GqAAQP/w2R389j+g+hHOIwKcUNt9yAc=
github.com/crypto-org-chain/ethermint v0.6.1-0.20240502043119-814fcacedf60 h1:wyqbGGnU3FzSWbu72wrg0RJ1lD25EpYBnVrYTUH9lqk=
github.com/crypto-org-chain/ethermint v0.6.1-0.20240502043119-814fcacedf60/go.mod h1:zJYmx1D+tDggzvXmdJ0/I62TeIykdCMfJBjBxOcniAU=
github.com/crypto-org-chain/go-ethereum v1.10.20-0.20231207063621-43cf32d91c3e h1:vnyepPQ/m25+19xcTuBUdRxmltZ/EjVWNqEjhg7Ummk=
github.com/crypto-org-chain/go-ethereum v1.10.20-0.20231207063621-43cf32d91c3e/go.mod h1:+a8pUj1tOyJ2RinsNQD4326YS+leSoKGiG/uVVb0x6Y=
github.com/crypto-org-chain/gravity-bridge/module/v2 v2.0.1-0.20230825054824-75403cd90c6e h1:rSTc35OBjjCBx47rHPWBCIHNGPbMnEj8f7fNcK2TjVI=
Expand Down Expand Up @@ -1170,6 +1166,10 @@ github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjU
github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4=
github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
github.com/mitchellh/reflectwalk v1.0.1/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
github.com/mmsqe/cometbft v0.37.0-rc3.0.20240522012039-7afac3fc677d h1:H79csKmNA7cwnXPLWIONX4abbRoBfTw3wagePxW+kBE=
github.com/mmsqe/cometbft v0.37.0-rc3.0.20240522012039-7afac3fc677d/go.mod h1:gFGCFXNGDci6tMLemANPGTfU+j4+oH63PjeLe0iIjJk=
github.com/mmsqe/ethermint v0.6.5-0.20240522012842-7a5ec24e05b1 h1:/9a4M5pMo67/9yLyvZ4VKSZa9sYtjQoIRi4ptPymvVs=
github.com/mmsqe/ethermint v0.6.5-0.20240522012842-7a5ec24e05b1/go.mod h1:zJYmx1D+tDggzvXmdJ0/I62TeIykdCMfJBjBxOcniAU=
github.com/moby/sys/mountinfo v0.5.0/go.mod h1:3bMD3Rg+zkqx8MRYPi7Pyb0Ie97QEBmdxbhnCLlSvSU=
github.com/moby/term v0.0.0-20201216013528-df9cb8a40635/go.mod h1:FBS0z0QWA44HXygs7VXDUOGoN/1TV3RuWkLO04am3wc=
github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6/go.mod h1:E2VnQOmVuvZB6UYnnDB0qG5Nq/1tD9acaOpo6xmt0Kw=
Expand Down
11 changes: 6 additions & 5 deletions gomod2nix.toml
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,9 @@ schema = 3
version = "v1.0.0"
hash = "sha256-z/0E0NiEGo7zxM7d94ImgUf8P0/KG6hbP9T4Vuym4p0="
[mod."github.com/cometbft/cometbft"]
version = "v0.37.7-0.20240515092623-8a0f4814d1dc"
hash = "sha256-e5IRb9X+IfkcNlG/95JTuv31R7uafdWpP1wWRvg7uSM="
version = "v0.37.0-rc3.0.20240522012039-7afac3fc677d"
hash = "sha256-i8MC9223AffC2T0WZns3RX3eV8sb999+BEGvvni1DDk="
replaced = "github.com/mmsqe/cometbft"
[mod."github.com/cometbft/cometbft-db"]
version = "v0.0.0-20231011055109-57922ac52a63"
hash = "sha256-iLs/FN1be3AcoyhKj2+b5Msqeat9j2ja4acyOs+w+Uk="
Expand Down Expand Up @@ -219,9 +220,9 @@ schema = 3
hash = "sha256-lDIqRLUrXYCb9mmFBY/+WW+ee69+IkxOgqjHVyo4ij0="
replaced = "github.com/crypto-org-chain/go-ethereum"
[mod."github.com/evmos/ethermint"]
version = "v0.6.1-0.20240502043119-814fcacedf60"
hash = "sha256-dPO5F/J8XKGLUHiPTpSLBiZcYn42CNzRQ6Ntqcuc8kY="
replaced = "github.com/crypto-org-chain/ethermint"
version = "v0.6.5-0.20240522012842-7a5ec24e05b1"
hash = "sha256-XeJysbUohfi/HLhx86UszHFJH6PGgnsYLgxHOkc6NA8="
replaced = "github.com/mmsqe/ethermint"
[mod."github.com/felixge/httpsnoop"]
version = "v1.0.4"
hash = "sha256-c1JKoRSndwwOyOxq9ddCe+8qn7mG9uRq2o/822x5O/c="
Expand Down
4 changes: 4 additions & 0 deletions integration_tests/configs/default.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
mempool: {
version: 'v1',
},
consensus: {
create_empty_blocks: false,
create_empty_blocks_interval: '1ms',
},
},
'app-config': {
chain_id: 'cronos_777-1',
Expand Down
33 changes: 32 additions & 1 deletion integration_tests/test_e2ee.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import json

import pytest
from eth_utils import to_checksum_address
from hexbytes import HexBytes
from pystarport import ports

from .network import Cronos
from .utils import wait_for_new_blocks
from .utils import ADDRS, bech32_to_eth, wait_for_new_blocks, wait_for_port


def test_register(cronos: Cronos):
Expand Down Expand Up @@ -93,8 +96,36 @@ def test_block_list(cronos):
with pytest.raises(AssertionError) as exc:
cli.event_query_tx_for(txhash)
assert "timed out waiting" in str(exc.value)
nonce = int(cli.query_account(user)["base_account"]["sequence"])

# clear blocklist
encrypt_to_validators(cli, {})

# the blocked tx should be unblocked now
wait_for_new_blocks(cli, 1)
assert nonce + 1 == int(cli.query_account(user)["base_account"]["sequence"])


def test_block_list_evm(cronos):
gen_validator_identity(cronos)
cli = cronos.cosmos_cli()
user = cli.address("signer2")
# set blocklist
encrypt_to_validators(cli, {"addresses": [user]})
tx = {
"from": to_checksum_address(bech32_to_eth(user)),
"to": ADDRS["community"],
"value": 1,
}
wait_for_port(ports.evmrpc_ws_port(cronos.base_port(0)))
w3 = cronos.w3
flt = w3.eth.filter("pending")
assert flt.get_new_entries() == []
txhash = w3.eth.send_transaction(tx).hex()
nonce = int(cli.query_account(user)["base_account"]["sequence"])
# check tx in mempool
new_txs = flt.get_new_entries()
assert HexBytes(txhash) in new_txs

# clear blocklist
encrypt_to_validators(cli, {})
Expand Down

0 comments on commit d73177c

Please sign in to comment.