Skip to content

Commit

Permalink
Problem: invalid txs_results returned for legacy ABCI responses
Browse files Browse the repository at this point in the history
  • Loading branch information
mmsqe committed Jun 26, 2024
1 parent 1cc2d06 commit 144351b
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 10 deletions.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ replace (
github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0
// for go-ethereum
github.com/cockroachdb/pebble => github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811
github.com/cometbft/cometbft => github.com/mmsqe/cometbft v0.34.21-0.20240626063947-711a7779cb38
github.com/cometbft/cometbft-db => github.com/crypto-org-chain/cometbft-db v0.0.0-20231011055109-57922ac52a63
// dgrijalva/jwt-go is deprecated and doesn't receive security updates.
// TODO: remove it: https://github.com/cosmos/cosmos-sdk/issues/13134
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,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.38.7 h1:ULhIOJ9+LgSy6nLekhq9ae3juX3NnQUMMPyVdhZV6Hk=
github.com/cometbft/cometbft v0.38.7/go.mod h1:HIyf811dFMI73IE0F7RrnY/Fr+d1+HuJAgtkEpQjCMY=
github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg=
github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM=
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
Expand Down Expand Up @@ -903,6 +901,8 @@ github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyua
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A=
github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4=
github.com/mmsqe/cometbft v0.34.21-0.20240626063947-711a7779cb38 h1:2AkbJlFj838TMztkG/gKjq40wuyAYoFXsCQdneyyBZE=
github.com/mmsqe/cometbft v0.34.21-0.20240626063947-711a7779cb38/go.mod h1:HIyf811dFMI73IE0F7RrnY/Fr+d1+HuJAgtkEpQjCMY=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
Expand Down
5 changes: 3 additions & 2 deletions gomod2nix.toml
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,9 @@ schema = 3
version = "v1.0.0"
hash = "sha256-z/0E0NiEGo7zxM7d94ImgUf8P0/KG6hbP9T4Vuym4p0="
[mod."github.com/cometbft/cometbft"]
version = "v0.38.7"
hash = "sha256-mN7L3Q4xZ0YcwMIRkIsodCzRPBZqrSKD7VgDHBOWM98="
version = "v0.34.21-0.20240626063947-711a7779cb38"
hash = "sha256-VN7iVJKwTJFmzdLjxT8jOx+7fR5+mNs7idngf36ob44="
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
25 changes: 19 additions & 6 deletions integration_tests/test_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from pathlib import Path

import pytest
import requests
from pystarport import ports
from pystarport.cluster import SUPERVISOR_CONFIG_FILE

Expand All @@ -33,6 +34,15 @@ def custom_cronos(tmp_path_factory):
yield from setup_cronos_test(tmp_path_factory)


def get_txs(base_port, end):
port = ports.rpc_port(base_port)
res = []
for h in range(1, end):
url = f"http://127.0.0.1:{port}/block_results?height={h}"
res.append(requests.get(url).json().get("result")["txs_results"])
return res


def init_cosmovisor(home):
"""
build and setup cosmovisor directory structure in each node's home directory
Expand Down Expand Up @@ -108,7 +118,8 @@ def exec(c, tmp_path_factory):
- it should work transparently
"""
cli = c.cosmos_cli()
port = ports.api_port(c.base_port(0))
base_port = c.base_port(0)
port = ports.api_port(base_port)
send_enable = [
{"denom": "basetcro", "enabled": False},
{"denom": "stake", "enabled": True},
Expand All @@ -125,7 +136,7 @@ def exec(c, tmp_path_factory):
fp.flush()

c.supervisorctl("start", "cronos_777-1-node0", "cronos_777-1-node1")
wait_for_port(ports.evmrpc_port(c.base_port(0)))
wait_for_port(ports.evmrpc_port(base_port))
wait_for_new_blocks(cli, 1)

def do_upgrade(plan_name, target, mode=None):
Expand All @@ -150,7 +161,7 @@ def do_upgrade(plan_name, target, mode=None):
)
# block should pass the target height
wait_for_block(c.cosmos_cli(), target + 2, timeout=480)
wait_for_port(ports.rpc_port(c.base_port(0)))
wait_for_port(ports.rpc_port(base_port))

# test migrate keystore
cli.migrate_keystore()
Expand All @@ -162,7 +173,7 @@ def do_upgrade(plan_name, target, mode=None):
cli = c.cosmos_cli()

# check basic tx works
wait_for_port(ports.evmrpc_port(c.base_port(0)))
wait_for_port(ports.evmrpc_port(base_port))
receipt = send_transaction(
c.w3,
{
Expand Down Expand Up @@ -198,7 +209,7 @@ def do_upgrade(plan_name, target, mode=None):
cli = c.cosmos_cli()

# check basic tx works
wait_for_port(ports.evmrpc_port(c.base_port(0)))
wait_for_port(ports.evmrpc_port(base_port))
receipt = send_transaction(
c.w3,
{
Expand Down Expand Up @@ -227,7 +238,7 @@ def do_upgrade(plan_name, target, mode=None):
ADDRS["validator"]
)
# check consensus params
port = ports.rpc_port(c.base_port(0))
port = ports.rpc_port(base_port)
res = get_consensus_params(port, w3.eth.get_block_number())
assert res["block"]["max_gas"] == "60000000"

Expand Down Expand Up @@ -262,7 +273,9 @@ def do_upgrade(plan_name, target, mode=None):
height = cli.block_height()
target_height2 = height + 15
print("upgrade v1.3 height", target_height2)
txs = get_txs(base_port, height)
do_upgrade("v1.3", target_height2)
assert txs == get_txs(base_port, height)

cli = c.cosmos_cli()
assert e0 == cli.query_params("evm", height=target_height0 - 1)["params"]
Expand Down

0 comments on commit 144351b

Please sign in to comment.