Skip to content

Commit

Permalink
Problem: invalid txs_results returned for legacy ABCI responses (#1485)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmsqe authored Jul 11, 2024
1 parent 14572fa commit 4556276
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 9 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ require (
cosmossdk.io/x/upgrade v0.1.1
filippo.io/age v1.1.1
github.com/99designs/keyring v1.2.2
github.com/cometbft/cometbft v0.38.8
github.com/cometbft/cometbft v0.38.10-0.20240709120009-0792c8bdda44
github.com/cosmos/cosmos-db v1.0.3-0.20240408151834-e75f6e4b28d8
github.com/cosmos/cosmos-proto v1.0.0-beta.5
github.com/cosmos/cosmos-sdk v0.50.6
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,8 @@ github.com/coinbase/rosetta-sdk-go/types v1.0.0 h1:jpVIwLcPoOeCR6o1tU+Xv7r5bMONN
github.com/coinbase/rosetta-sdk-go/types v1.0.0/go.mod h1:eq7W2TMRH22GTW0N0beDnN931DW0/WOI1R2sdHNHG4c=
github.com/cometbft/cometbft v0.38.8 h1:XyJ9Cu3xqap6xtNxiemrO8roXZ+KS2Zlu7qQ0w1trvU=
github.com/cometbft/cometbft v0.38.8/go.mod h1:xOoGZrtUT+A5izWfHSJgl0gYZUE7lu7Z2XIS1vWG/QQ=
github.com/cometbft/cometbft v0.38.10-0.20240709120009-0792c8bdda44 h1:Tm6SG54Tj/bGVEZUyFPs2UyG0BYvCO3oqvWNyw99bi4=
github.com/cometbft/cometbft v0.38.10-0.20240709120009-0792c8bdda44/go.mod h1:jHPx9vQpWzPHEAiYI/7EDKaB1NXhK6o3SArrrY8ExKc=
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
4 changes: 2 additions & 2 deletions gomod2nix.toml
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ schema = 3
version = "v1.0.0"
hash = "sha256-z/0E0NiEGo7zxM7d94ImgUf8P0/KG6hbP9T4Vuym4p0="
[mod."github.com/cometbft/cometbft"]
version = "v0.38.8"
hash = "sha256-FJ04SP2VDpkvNGRGojaNeuwCqC54Deru244YJERAmi8="
version = "v0.38.10-0.20240709120009-0792c8bdda44"
hash = "sha256-ZKAAgJ78Z1Mgww2D8BZz9Qug/m3CXWa9MKM8W4CTbGI="
[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 4556276

Please sign in to comment.