From 2d37695166b5dd7b8e1f70a4d51a22f728c8e2f8 Mon Sep 17 00:00:00 2001 From: dudong2 Date: Wed, 20 Dec 2023 17:20:45 +0900 Subject: [PATCH] test: fix integration test(broken test - patch file, SyncInfo -> sync_info --- .../integration_tests/configs/broken-ethermintd.patch | 10 +++++----- tests/integration_tests/cosmoscli.py | 4 ++-- tests/integration_tests/utils.py | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/integration_tests/configs/broken-ethermintd.patch b/tests/integration_tests/configs/broken-ethermintd.patch index 255e99493f..0f0d967dab 100644 --- a/tests/integration_tests/configs/broken-ethermintd.patch +++ b/tests/integration_tests/configs/broken-ethermintd.patch @@ -1,15 +1,15 @@ diff --git a/app/app.go b/app/app.go -index 158bf7a3..a3b5718c 100644 +index acd2c76b..bb6faed3 100644 --- a/app/app.go +++ b/app/app.go -@@ -681,6 +681,10 @@ func (app *EthermintApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBloc +@@ -907,6 +907,10 @@ func (app *EthermintApp) PreBlocker(ctx sdk.Context, _ *abci.RequestFinalizeBloc - // EndBlocker updates every end block - func (app *EthermintApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock { + // BeginBlocker updates every begin block + func (app *EthermintApp) BeginBlocker(ctx sdk.Context) (sdk.BeginBlock, error) { + if ctx.BlockHeight()%10 == 0 { + store := ctx.KVStore(app.keys["evm"]) + store.Set([]byte("hello"), []byte("world")) + } - return app.mm.EndBlock(ctx, req) + return app.ModuleManager.BeginBlock(ctx) } diff --git a/tests/integration_tests/cosmoscli.py b/tests/integration_tests/cosmoscli.py index 375a0bcc93..ab16ce8a9c 100644 --- a/tests/integration_tests/cosmoscli.py +++ b/tests/integration_tests/cosmoscli.py @@ -130,10 +130,10 @@ def status(self): return json.loads(self.raw("status", node=self.node_rpc)) def block_height(self): - return int(self.status()["SyncInfo"]["latest_block_height"]) + return int(self.status()["sync_info"]["latest_block_height"]) def block_time(self): - return isoparse(self.status()["SyncInfo"]["latest_block_time"]) + return isoparse(self.status()["sync_info"]["latest_block_time"]) def balances(self, addr): return json.loads( diff --git a/tests/integration_tests/utils.py b/tests/integration_tests/utils.py index 6bf22c3b81..cec66a7f00 100644 --- a/tests/integration_tests/utils.py +++ b/tests/integration_tests/utils.py @@ -76,10 +76,10 @@ def w3_wait_for_new_blocks(w3, n, sleep=0.5): def wait_for_new_blocks(cli, n, sleep=0.5): - cur_height = begin_height = int((cli.status())["SyncInfo"]["latest_block_height"]) + cur_height = begin_height = int((cli.status())["sync_info"]["latest_block_height"]) while cur_height - begin_height < n: time.sleep(sleep) - cur_height = int((cli.status())["SyncInfo"]["latest_block_height"]) + cur_height = int((cli.status())["sync_info"]["latest_block_height"]) return cur_height @@ -90,7 +90,7 @@ def wait_for_block(cli, height, timeout=240): except AssertionError as e: print(f"get sync status failed: {e}", file=sys.stderr) else: - current_height = int(status["SyncInfo"]["latest_block_height"]) + current_height = int(status["sync_info"]["latest_block_height"]) if current_height >= height: break print("current block height", current_height) @@ -117,7 +117,7 @@ def w3_wait_for_block(w3, height, timeout=240): def wait_for_block_time(cli, t): print("wait for block time", t) while True: - now = isoparse((cli.status())["SyncInfo"]["latest_block_time"]) + now = isoparse((cli.status())["sync_info"]["latest_block_time"]) print("block time now: ", now) if now >= t: break