From 3410f07d20071aa8def7cae6b7a9c26c42f498f1 Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Thu, 21 Dec 2023 22:17:23 +0100 Subject: [PATCH] test(e2e): TestApp_TxTooBig needs correct tx order --- test/e2e/app/app.go | 11 ++++++++++- test/e2e/tests/app_test.go | 5 +---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/test/e2e/app/app.go b/test/e2e/app/app.go index 027577b30a..633a614b8d 100644 --- a/test/e2e/app/app.go +++ b/test/e2e/app/app.go @@ -258,5 +258,14 @@ func verifyTx(tx types.Tx, _ abci.CheckTxType) (abci.ResponseCheckTx, error) { fmt.Errorf("malformed vote extension transaction %X=%X: %w", k, v, err) } } - return abci.ResponseCheckTx{Code: code.CodeTypeOK, GasWanted: 1}, nil + // For TestApp_TxTooBig we need to preserve order of transactions + var priority int64 + // in this case, k is defined as fmt.Sprintf("testapp-big-tx-%v-%08x-%d=", node.Name, session, i) + // but in general, we take last digit as inverse priority + split = bytes.Split(k, []byte{'-'}) + if n, err := strconv.ParseInt(string(split[len(split)-1]), 10, 64); err == nil { + priority = 1000000000 - n + } + + return abci.ResponseCheckTx{Code: code.CodeTypeOK, GasWanted: 1, Priority: priority}, nil } diff --git a/test/e2e/tests/app_test.go b/test/e2e/tests/app_test.go index 03706c2771..ac9b3566f5 100644 --- a/test/e2e/tests/app_test.go +++ b/test/e2e/tests/app_test.go @@ -219,7 +219,7 @@ func TestApp_TxTooBig(t *testing.T) { var key string for i := 0; i < numTxs; i++ { - key = fmt.Sprintf("testapp-big-tx-%v-%08x-%06x=", node.Name, session, i) + key = fmt.Sprintf("testapp-big-tx-%v-%08x-%d=", node.Name, session, i) copy(tx, key) payloadOffset := len(tx) - 8 // where we put the `i` into the payload @@ -233,7 +233,6 @@ func TestApp_TxTooBig(t *testing.T) { } _, err = client.BroadcastTxAsync(ctx, tx) - t.Logf("submitted tx %x", tx.Hash()) assert.NoError(t, err, "failed to broadcast tx %06x", i) } @@ -257,8 +256,6 @@ func TestApp_TxTooBig(t *testing.T) { return true } - // tx2 not there yet - t.Log("last tx not committed within timeout") return false }, timeout, // timeout