Skip to content

Commit

Permalink
test(e2e): TestApp_TxTooBig needs correct tx order
Browse files Browse the repository at this point in the history
  • Loading branch information
lklimek committed Jan 30, 2024
1 parent 4a22097 commit 3410f07
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
11 changes: 10 additions & 1 deletion test/e2e/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
5 changes: 1 addition & 4 deletions test/e2e/tests/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
}
Expand All @@ -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
Expand Down

0 comments on commit 3410f07

Please sign in to comment.