From 4799596d2ac366a369610931a7fa10b217d4bc08 Mon Sep 17 00:00:00 2001 From: Vlad Date: Mon, 13 Oct 2025 13:50:13 -0400 Subject: [PATCH 1/8] debug msg on failure --- tests/systemtests/clients/ethclient.go | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/systemtests/clients/ethclient.go b/tests/systemtests/clients/ethclient.go index 8ef69de82..a4644fa6b 100644 --- a/tests/systemtests/clients/ethclient.go +++ b/tests/systemtests/clients/ethclient.go @@ -133,6 +133,7 @@ func (ec *EthClient) CheckTxsPending( case <-ticker.C: pendingTxs, _, err := ec.TxPoolContent(nodeID) if err != nil { + fmt.Printf("DEBUG: failed to get txpool content: %v", err) continue // Retry on error } From 92965270951f31e013bc048fab5d57aade018e2f Mon Sep 17 00:00:00 2001 From: Vlad Date: Mon, 13 Oct 2025 13:59:22 -0400 Subject: [PATCH 2/8] increase current gas by 10x --- tests/systemtests/mempool/interface.go | 1 + tests/systemtests/mempool/test_exceptions.go | 18 +-- tests/systemtests/mempool/test_ordering.go | 2 +- tests/systemtests/mempool/test_replacement.go | 120 +++++++++--------- tests/systemtests/suite/test_helpers.go | 4 + 5 files changed, 75 insertions(+), 70 deletions(-) diff --git a/tests/systemtests/mempool/interface.go b/tests/systemtests/mempool/interface.go index 87834d2f1..a13491e79 100644 --- a/tests/systemtests/mempool/interface.go +++ b/tests/systemtests/mempool/interface.go @@ -42,4 +42,5 @@ type TestSuite interface { // Test Utils AwaitNBlocks(t *testing.T, n int64, duration ...time.Duration) + GetTxGasPrice(baseFee *big.Int) *big.Int } diff --git a/tests/systemtests/mempool/test_exceptions.go b/tests/systemtests/mempool/test_exceptions.go index 31e9a2f57..3f38bba6a 100644 --- a/tests/systemtests/mempool/test_exceptions.go +++ b/tests/systemtests/mempool/test_exceptions.go @@ -17,21 +17,21 @@ func TestTxRebroadcasting(t *testing.T) { name: "ordering of pending txs %s", actions: []func(s TestSuite){ func(s TestSuite) { - tx1, err := s.SendTx(t, s.Node(0), "acc0", 0, s.BaseFee(), nil) + tx1, err := s.SendTx(t, s.Node(0), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), nil) require.NoError(t, err, "failed to send tx") - tx2, err := s.SendTx(t, s.Node(1), "acc0", 1, s.BaseFee(), nil) + tx2, err := s.SendTx(t, s.Node(1), "acc0", 1, s.GetTxGasPrice(s.BaseFee()), nil) require.NoError(t, err, "failed to send tx") - tx3, err := s.SendTx(t, s.Node(2), "acc0", 2, s.BaseFee(), nil) + tx3, err := s.SendTx(t, s.Node(2), "acc0", 2, s.GetTxGasPrice(s.BaseFee()), nil) require.NoError(t, err, "failed to send tx") // Skip tx4 with nonce 3 - tx5, err := s.SendTx(t, s.Node(3), "acc0", 4, s.BaseFee(), nil) + tx5, err := s.SendTx(t, s.Node(3), "acc0", 4, s.GetTxGasPrice(s.BaseFee()), nil) require.NoError(t, err, "failed to send tx") - tx6, err := s.SendTx(t, s.Node(0), "acc0", 5, s.BaseFee(), nil) + tx6, err := s.SendTx(t, s.Node(0), "acc0", 5, s.GetTxGasPrice(s.BaseFee()), nil) require.NoError(t, err, "failed to send tx") // At AfterEachAction hook, we will check expected queued txs are not broadcasted. @@ -49,7 +49,7 @@ func TestTxRebroadcasting(t *testing.T) { // so, we should set nonce idx to 0. nonce3Idx := uint64(0) - tx4, err := s.SendTx(t, s.Node(2), "acc0", nonce3Idx, s.BaseFee(), nil) + tx4, err := s.SendTx(t, s.Node(2), "acc0", nonce3Idx, s.GetTxGasPrice(s.BaseFee()), nil) require.NoError(t, err, "failed to send tx") // At AfterEachAction hook, we will check expected pending txs are broadcasted. @@ -96,13 +96,13 @@ func TestMinimumGasPricesZero(t *testing.T) { name: "sequencial pending txs %s", actions: []func(s TestSuite){ func(s TestSuite) { - tx1, err := s.SendTx(t, s.Node(0), "acc0", 0, s.BaseFee(), nil) + tx1, err := s.SendTx(t, s.Node(0), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), nil) require.NoError(t, err, "failed to send tx") - tx2, err := s.SendTx(t, s.Node(1), "acc0", 1, s.BaseFee(), nil) + tx2, err := s.SendTx(t, s.Node(1), "acc0", 1, s.GetTxGasPrice(s.BaseFee()), nil) require.NoError(t, err, "failed to send tx") - tx3, err := s.SendTx(t, s.Node(2), "acc0", 2, s.BaseFee(), nil) + tx3, err := s.SendTx(t, s.Node(2), "acc0", 2, s.GetTxGasPrice(s.BaseFee()), nil) require.NoError(t, err, "failed to send tx") s.SetExpPendingTxs(tx1, tx2, tx3) diff --git a/tests/systemtests/mempool/test_ordering.go b/tests/systemtests/mempool/test_ordering.go index b0ba8f7c6..e428c5b27 100644 --- a/tests/systemtests/mempool/test_ordering.go +++ b/tests/systemtests/mempool/test_ordering.go @@ -31,7 +31,7 @@ func TestTxsOrdering(t *testing.T) { nodeId = s.Node(i % 4) } - txInfo, err := s.SendTx(t, nodeId, "acc0", nonceIdx, s.BaseFee(), big.NewInt(1)) + txInfo, err := s.SendTx(t, nodeId, "acc0", nonceIdx, s.GetTxGasPrice(s.BaseFee()), big.NewInt(1)) require.NoError(t, err, "failed to send tx") // nonce order of committed txs: 0,1,2,3,4 diff --git a/tests/systemtests/mempool/test_replacement.go b/tests/systemtests/mempool/test_replacement.go index 6e92587f4..f468a1128 100644 --- a/tests/systemtests/mempool/test_replacement.go +++ b/tests/systemtests/mempool/test_replacement.go @@ -18,9 +18,9 @@ func TestTxsReplacement(t *testing.T) { name: "single pending tx submitted to same nodes %s", actions: []func(s TestSuite){ func(s TestSuite) { - _, err := s.SendTx(t, s.Node(0), "acc0", 0, s.BaseFee(), nil) + _, err := s.SendTx(t, s.Node(0), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), nil) require.NoError(t, err, "failed to send tx") - tx2, err := s.SendTx(t, s.Node(1), "acc0", 0, s.BaseFeeX2(), big.NewInt(1)) + tx2, err := s.SendTx(t, s.Node(1), "acc0", 0, s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(1)) require.NoError(t, err, "failed to send tx") s.SetExpPendingTxs(tx2) @@ -31,19 +31,19 @@ func TestTxsReplacement(t *testing.T) { name: "multiple pending txs submitted to same nodes %s", actions: []func(s TestSuite){ func(s TestSuite) { - _, err := s.SendTx(t, s.Node(0), "acc0", 0, s.BaseFee(), nil) + _, err := s.SendTx(t, s.Node(0), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), nil) require.NoError(t, err, "failed to send tx") - tx2, err := s.SendTx(t, s.Node(1), "acc0", 0, s.BaseFeeX2(), big.NewInt(1)) + tx2, err := s.SendTx(t, s.Node(1), "acc0", 0, s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(1)) require.NoError(t, err, "failed to send tx") - _, err = s.SendTx(t, s.Node(0), "acc0", 1, s.BaseFee(), nil) + _, err = s.SendTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFee()), nil) require.NoError(t, err, "failed to send tx") - tx4, err := s.SendTx(t, s.Node(1), "acc0", 1, s.BaseFeeX2(), big.NewInt(1)) + tx4, err := s.SendTx(t, s.Node(1), "acc0", 1, s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(1)) require.NoError(t, err, "failed to send tx") - _, err = s.SendTx(t, s.Node(0), "acc0", 2, s.BaseFee(), nil) + _, err = s.SendTx(t, s.Node(0), "acc0", 2, s.GetTxGasPrice(s.BaseFee()), nil) require.NoError(t, err, "failed to send tx") - tx6, err := s.SendTx(t, s.Node(1), "acc0", 2, s.BaseFeeX2(), big.NewInt(1)) + tx6, err := s.SendTx(t, s.Node(1), "acc0", 2, s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(1)) require.NoError(t, err, "failed to send tx") s.SetExpPendingTxs(tx2, tx4, tx6) @@ -54,15 +54,15 @@ func TestTxsReplacement(t *testing.T) { name: "single queued tx %s", actions: []func(s TestSuite){ func(s TestSuite) { - _, err := s.SendTx(t, s.Node(0), "acc0", 1, s.BaseFee(), nil) + _, err := s.SendTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFee()), nil) require.NoError(t, err, "failed to send tx") - tx2, err := s.SendTx(t, s.Node(0), "acc0", 1, s.BaseFeeX2(), big.NewInt(1)) + tx2, err := s.SendTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(1)) require.NoError(t, err, "failed to send tx") s.SetExpQueuedTxs(tx2) }, func(s TestSuite) { - txHash, err := s.SendTx(t, s.Node(1), "acc0", 0, s.BaseFee(), nil) + txHash, err := s.SendTx(t, s.Node(1), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), nil) require.NoError(t, err, "failed to send tx") s.SetExpPendingTxs(txHash) @@ -74,25 +74,25 @@ func TestTxsReplacement(t *testing.T) { name: "multiple queued txs %s", actions: []func(s TestSuite){ func(s TestSuite) { - _, err := s.SendTx(t, s.Node(0), "acc0", 1, s.BaseFee(), nil) + _, err := s.SendTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFee()), nil) require.NoError(t, err, "failed to send tx") - tx2, err := s.SendTx(t, s.Node(0), "acc0", 1, s.BaseFeeX2(), big.NewInt(1)) + tx2, err := s.SendTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(1)) require.NoError(t, err, "failed to send tx") - _, err = s.SendTx(t, s.Node(1), "acc0", 2, s.BaseFee(), nil) + _, err = s.SendTx(t, s.Node(1), "acc0", 2, s.GetTxGasPrice(s.BaseFee()), nil) require.NoError(t, err, "failed to send tx") - tx4, err := s.SendTx(t, s.Node(1), "acc0", 2, s.BaseFeeX2(), big.NewInt(1)) + tx4, err := s.SendTx(t, s.Node(1), "acc0", 2, s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(1)) require.NoError(t, err, "failed to send tx") - _, err = s.SendTx(t, s.Node(2), "acc0", 3, s.BaseFee(), nil) + _, err = s.SendTx(t, s.Node(2), "acc0", 3, s.GetTxGasPrice(s.BaseFee()), nil) require.NoError(t, err, "failed to send tx") - tx6, err := s.SendTx(t, s.Node(2), "acc0", 3, s.BaseFeeX2(), big.NewInt(1)) + tx6, err := s.SendTx(t, s.Node(2), "acc0", 3, s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(1)) require.NoError(t, err, "failed to send tx") s.SetExpQueuedTxs(tx2, tx4, tx6) }, func(s TestSuite) { - tx, err := s.SendTx(t, s.Node(3), "acc0", 0, s.BaseFee(), nil) + tx, err := s.SendTx(t, s.Node(3), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), nil) require.NoError(t, err, "failed to send tx") s.SetExpPendingTxs(tx) @@ -147,9 +147,9 @@ func TestTxsReplacementWithCosmosTx(t *testing.T) { // It is because of CheckTxHandler cannot handle errors from SigVerificationDecorator properly. // After modifying CheckTxHandler, we can also modify this test case // : high prio cosmos tx should replace low prio evm tx. - tx1, err := s.SendTx(t, s.Node(0), "acc0", 0, s.BaseFee(), nil) + tx1, err := s.SendTx(t, s.Node(0), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), nil) require.NoError(t, err, "failed to send tx") - _, err = s.SendTx(t, s.Node(1), "acc0", 0, s.BaseFeeX2(), big.NewInt(1)) + _, err = s.SendTx(t, s.Node(1), "acc0", 0, s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(1)) require.NoError(t, err, "failed to send tx") s.SetExpPendingTxs(tx1) @@ -164,19 +164,19 @@ func TestTxsReplacementWithCosmosTx(t *testing.T) { // It is because of CheckTxHandler cannot handle errors from SigVerificationDecorator properly. // After modifying CheckTxHandler, we can also modify this test case // : high prio cosmos tx should replace low prio evm tx. - tx1, err := s.SendTx(t, s.Node(0), "acc0", 0, s.BaseFee(), nil) + tx1, err := s.SendTx(t, s.Node(0), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), nil) require.NoError(t, err, "failed to send tx") - _, err = s.SendTx(t, s.Node(1), "acc0", 0, s.BaseFeeX2(), big.NewInt(1)) + _, err = s.SendTx(t, s.Node(1), "acc0", 0, s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(1)) require.NoError(t, err, "failed to send tx") - tx3, err := s.SendTx(t, s.Node(0), "acc0", 1, s.BaseFee(), nil) + tx3, err := s.SendTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFee()), nil) require.NoError(t, err, "failed to send tx") - _, err = s.SendTx(t, s.Node(1), "acc0", 1, s.BaseFeeX2(), big.NewInt(1)) + _, err = s.SendTx(t, s.Node(1), "acc0", 1, s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(1)) require.NoError(t, err, "failed to send tx") - tx5, err := s.SendTx(t, s.Node(0), "acc0", 2, s.BaseFee(), nil) + tx5, err := s.SendTx(t, s.Node(0), "acc0", 2, s.GetTxGasPrice(s.BaseFee()), nil) require.NoError(t, err, "failed to send tx") - _, err = s.SendTx(t, s.Node(1), "acc0", 2, s.BaseFeeX2(), big.NewInt(1)) + _, err = s.SendTx(t, s.Node(1), "acc0", 2, s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(1)) require.NoError(t, err, "failed to send tx") s.SetExpPendingTxs(tx1, tx3, tx5) @@ -188,13 +188,13 @@ func TestTxsReplacementWithCosmosTx(t *testing.T) { actions: []func(s TestSuite){ func(s TestSuite) { // Cosmos txs are not queued in local mempool - _, err := s.SendTx(t, s.Node(0), "acc0", 1, s.BaseFee(), nil) + _, err := s.SendTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFee()), nil) require.NoError(t, err, "failed to send tx") - _, err = s.SendTx(t, s.Node(0), "acc0", 1, s.BaseFeeX2(), big.NewInt(1)) + _, err = s.SendTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(1)) require.NoError(t, err, "failed to send tx") }, func(s TestSuite) { - txHash, err := s.SendTx(t, s.Node(1), "acc0", 0, s.BaseFee(), nil) + txHash, err := s.SendTx(t, s.Node(1), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), nil) require.NoError(t, err, "failed to send tx") s.SetExpPendingTxs(txHash) @@ -238,10 +238,10 @@ func TestMixedTxsReplacementEVMAndCosmos(t *testing.T) { name: "single pending tx (low prio evm tx first) %s", actions: []func(s TestSuite){ func(s TestSuite) { - tx1, err := s.SendEthTx(t, s.Node(0), "acc0", 0, s.BaseFee(), s.BaseFee()) + tx1, err := s.SendEthTx(t, s.Node(0), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), s.GetTxGasPrice(s.BaseFee())) require.NoError(t, err, "failed to send tx") - baseFeeX20 := new(big.Int).Mul(s.BaseFeeX2(), big.NewInt(1000000000000000000)) + baseFeeX20 := new(big.Int).Mul(s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(1000000000000000000)) _, err = s.SendCosmosTx(t, s.Node(1), "acc0", 0, baseFeeX20, nil) require.NoError(t, err, "failed to send tx") @@ -253,9 +253,9 @@ func TestMixedTxsReplacementEVMAndCosmos(t *testing.T) { name: "single pending tx (high prio evm tx first) %s", actions: []func(s TestSuite){ func(s TestSuite) { - tx1, err := s.SendEthTx(t, s.Node(0), "acc0", 0, s.BaseFeeX2(), s.BaseFeeX2()) + tx1, err := s.SendEthTx(t, s.Node(0), "acc0", 0, s.GetTxGasPrice(s.BaseFeeX2()), s.GetTxGasPrice(s.BaseFeeX2())) require.NoError(t, err, "failed to send tx") - _, err = s.SendCosmosTx(t, s.Node(1), "acc0", 0, s.BaseFee(), nil) + _, err = s.SendCosmosTx(t, s.Node(1), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), nil) require.NoError(t, err, "failed to send tx") s.SetExpPendingTxs(tx1) @@ -266,9 +266,9 @@ func TestMixedTxsReplacementEVMAndCosmos(t *testing.T) { name: "single pending tx (low prio cosmos tx first) %s", actions: []func(s TestSuite){ func(s TestSuite) { - _, err := s.SendCosmosTx(t, s.Node(0), "acc0", 0, s.BaseFee(), nil) + _, err := s.SendCosmosTx(t, s.Node(0), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), nil) require.NoError(t, err, "failed to send tx") - tx2, err := s.SendEthTx(t, s.Node(1), "acc0", 0, s.BaseFeeX2(), s.BaseFeeX2()) + tx2, err := s.SendEthTx(t, s.Node(1), "acc0", 0, s.GetTxGasPrice(s.BaseFeeX2()), s.GetTxGasPrice(s.BaseFeeX2())) require.NoError(t, err, "failed to send tx") s.SetExpPendingTxs(tx2) @@ -279,10 +279,10 @@ func TestMixedTxsReplacementEVMAndCosmos(t *testing.T) { name: "single pending tx (high prio cosmos tx first) %s", actions: []func(s TestSuite){ func(s TestSuite) { - baseFeeX20 := new(big.Int).Mul(s.BaseFeeX2(), big.NewInt(10)) + baseFeeX20 := new(big.Int).Mul(s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(10)) tx1, err := s.SendCosmosTx(t, s.Node(0), "acc0", 0, baseFeeX20, nil) require.NoError(t, err, "failed to send tx") - _, err = s.SendEthTx(t, s.Node(0), "acc0", 0, s.BaseFee(), nil) + _, err = s.SendEthTx(t, s.Node(0), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), nil) require.NoError(t, err, "failed to send tx") s.SetExpPendingTxs(tx1) @@ -293,16 +293,16 @@ func TestMixedTxsReplacementEVMAndCosmos(t *testing.T) { name: "single queued tx (low prio evm tx first) %s", actions: []func(s TestSuite){ func(s TestSuite) { - tx1, err := s.SendEthTx(t, s.Node(0), "acc0", 1, s.BaseFee(), nil) + tx1, err := s.SendEthTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFee()), nil) require.NoError(t, err, "failed to send tx") - _, err = s.SendCosmosTx(t, s.Node(0), "acc0", 1, s.BaseFeeX2(), big.NewInt(1)) + _, err = s.SendCosmosTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(1)) require.NoError(t, err, "failed to send tx") // CosmosTx is not queued in local mempool s.SetExpQueuedTxs(tx1) }, func(s TestSuite) { - tx3, err := s.SendEthTx(t, s.Node(1), "acc0", 0, s.BaseFee(), nil) + tx3, err := s.SendEthTx(t, s.Node(1), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), nil) require.NoError(t, err, "failed to send tx") s.SetExpPendingTxs(tx3) @@ -314,16 +314,16 @@ func TestMixedTxsReplacementEVMAndCosmos(t *testing.T) { name: "single queued tx (high prio evm tx first) %s", actions: []func(s TestSuite){ func(s TestSuite) { - tx1, err := s.SendEthTx(t, s.Node(0), "acc0", 1, s.BaseFeeX2(), big.NewInt(1)) + tx1, err := s.SendEthTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(1)) require.NoError(t, err, "failed to send tx") - _, err = s.SendCosmosTx(t, s.Node(0), "acc0", 1, s.BaseFee(), nil) + _, err = s.SendCosmosTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFee()), nil) require.NoError(t, err, "failed to send tx") // CosmosTx is not queued in local mempool s.SetExpQueuedTxs(tx1) }, func(s TestSuite) { - tx3, err := s.SendEthTx(t, s.Node(1), "acc0", 0, s.BaseFee(), nil) + tx3, err := s.SendEthTx(t, s.Node(1), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), nil) require.NoError(t, err, "failed to send tx") s.SetExpPendingTxs(tx3) @@ -335,16 +335,16 @@ func TestMixedTxsReplacementEVMAndCosmos(t *testing.T) { name: "single queued tx (low prio cosmos tx first) %s", actions: []func(s TestSuite){ func(s TestSuite) { - _, err := s.SendCosmosTx(t, s.Node(0), "acc0", 1, s.BaseFee(), nil) + _, err := s.SendCosmosTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFee()), nil) require.NoError(t, err, "failed to send tx") - tx2, err := s.SendEthTx(t, s.Node(0), "acc0", 1, s.BaseFeeX2(), s.BaseFeeX2()) + tx2, err := s.SendEthTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFeeX2()), s.GetTxGasPrice(s.BaseFeeX2())) require.NoError(t, err, "failed to send tx") // CosmosTx is not queued in local mempool s.SetExpQueuedTxs(tx2) }, func(s TestSuite) { - tx3, err := s.SendEthTx(t, s.Node(1), "acc0", 0, s.BaseFee(), nil) + tx3, err := s.SendEthTx(t, s.Node(1), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), nil) require.NoError(t, err, "failed to send tx") s.SetExpPendingTxs(tx3) @@ -356,16 +356,16 @@ func TestMixedTxsReplacementEVMAndCosmos(t *testing.T) { name: "single queued tx (high prio cosmos tx first) %s", actions: []func(s TestSuite){ func(s TestSuite) { - _, err := s.SendCosmosTx(t, s.Node(0), "acc0", 1, s.BaseFeeX2(), big.NewInt(1)) + _, err := s.SendCosmosTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(1)) require.NoError(t, err, "failed to send tx") - tx2, err := s.SendEthTx(t, s.Node(0), "acc0", 1, s.BaseFee(), nil) + tx2, err := s.SendEthTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFee()), nil) require.NoError(t, err, "failed to send tx") // CosmosTx is not queued in local mempool s.SetExpQueuedTxs(tx2) }, func(s TestSuite) { - tx3, err := s.SendEthTx(t, s.Node(1), "acc0", 0, s.BaseFee(), nil) + tx3, err := s.SendEthTx(t, s.Node(1), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), nil) require.NoError(t, err, "failed to send tx") s.SetExpPendingTxs(tx3) @@ -413,17 +413,17 @@ func TestMixedTxsReplacementLegacyAndDynamicFee(t *testing.T) { name: "dynamic fee tx should not replace legacy tx", actions: []func(s TestSuite){ func(s TestSuite) { - tx1, err := s.SendEthLegacyTx(t, s.Node(0), s.Acc(0), 1, s.BaseFee()) + tx1, err := s.SendEthLegacyTx(t, s.Node(0), s.Acc(0), 1, s.GetTxGasPrice(s.BaseFee())) require.NoError(t, err, "failed to send eth legacy tx") - _, err = s.SendEthDynamicFeeTx(t, s.Node(0), s.Acc(0), 1, s.BaseFeeX2(), big.NewInt(1)) + _, err = s.SendEthDynamicFeeTx(t, s.Node(0), s.Acc(0), 1, s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(1)) require.Error(t, err) require.Contains(t, err.Error(), "replacement transaction underpriced") s.SetExpQueuedTxs(tx1) }, func(s TestSuite) { - txHash, err := s.SendEthLegacyTx(t, s.Node(0), s.Acc(0), 0, s.BaseFee()) + txHash, err := s.SendEthLegacyTx(t, s.Node(0), s.Acc(0), 0, s.GetTxGasPrice(s.BaseFee())) require.NoError(t, err, "failed to send tx") s.SetExpPendingTxs(txHash) @@ -435,19 +435,19 @@ func TestMixedTxsReplacementLegacyAndDynamicFee(t *testing.T) { name: "dynamic fee tx should replace legacy tx", actions: []func(s TestSuite){ func(s TestSuite) { - _, err := s.SendEthLegacyTx(t, s.Node(0), s.Acc(0), 1, s.BaseFee()) + _, err := s.SendEthLegacyTx(t, s.Node(0), s.Acc(0), 1, s.GetTxGasPrice(s.BaseFee())) require.NoError(t, err, "failed to send eth legacy tx") tx2, err := s.SendEthDynamicFeeTx(t, s.Node(0), s.Acc(0), 1, - s.BaseFeeX2(), - s.BaseFeeX2(), + s.GetTxGasPrice(s.BaseFeeX2()), + s.GetTxGasPrice(s.BaseFeeX2()), ) require.NoError(t, err) s.SetExpQueuedTxs(tx2) }, func(s TestSuite) { - txHash, err := s.SendEthLegacyTx(t, s.Node(0), s.Acc(0), 0, s.BaseFee()) + txHash, err := s.SendEthLegacyTx(t, s.Node(0), s.Acc(0), 0, s.GetTxGasPrice(s.BaseFee())) require.NoError(t, err, "failed to send tx") s.SetExpPendingTxs(txHash) @@ -459,11 +459,11 @@ func TestMixedTxsReplacementLegacyAndDynamicFee(t *testing.T) { name: "legacy should never replace dynamic fee tx", actions: []func(s TestSuite){ func(s TestSuite) { - tx1, err := s.SendEthDynamicFeeTx(t, s.Node(0), s.Acc(0), 1, s.BaseFeeX2(), - new(big.Int).Sub(s.BaseFee(), big.NewInt(1))) + tx1, err := s.SendEthDynamicFeeTx(t, s.Node(0), s.Acc(0), 1, s.GetTxGasPrice(s.BaseFeeX2()), + new(big.Int).Sub(s.GetTxGasPrice(s.BaseFee()), big.NewInt(1))) require.NoError(t, err) - _, err = s.SendEthLegacyTx(t, s.Node(0), s.Acc(0), 1, s.BaseFee()) + _, err = s.SendEthLegacyTx(t, s.Node(0), s.Acc(0), 1, s.GetTxGasPrice(s.BaseFee())) require.Error(t, err, "failed to send eth legacy tx") require.Contains(t, err.Error(), "replacement transaction underpriced") @@ -471,7 +471,7 @@ func TestMixedTxsReplacementLegacyAndDynamicFee(t *testing.T) { s.SetExpQueuedTxs(tx1) }, func(s TestSuite) { - txHash, err := s.SendEthLegacyTx(t, s.Node(0), s.Acc(0), 0, s.BaseFee()) + txHash, err := s.SendEthLegacyTx(t, s.Node(0), s.Acc(0), 0, s.GetTxGasPrice(s.BaseFee())) require.NoError(t, err, "failed to send tx") s.SetExpPendingTxs(txHash) diff --git a/tests/systemtests/suite/test_helpers.go b/tests/systemtests/suite/test_helpers.go index 59d8a6ea3..064034758 100644 --- a/tests/systemtests/suite/test_helpers.go +++ b/tests/systemtests/suite/test_helpers.go @@ -18,6 +18,10 @@ func (s *SystemTestSuite) BaseFeeX2() *big.Int { return new(big.Int).Mul(s.baseFee, big.NewInt(2)) } +func (s *SystemTestSuite) GetTxGasPrice(baseFee *big.Int) *big.Int { + return new(big.Int).Mul(baseFee, big.NewInt(10)) +} + // GetExpPendingTxs returns the expected pending transactions func (s *SystemTestSuite) GetExpPendingTxs() []*TxInfo { return s.expPendingTxs From e4dc780204f2e895d0a028bb69a0cbd14bbfbacd Mon Sep 17 00:00:00 2001 From: Vlad Date: Mon, 13 Oct 2025 14:35:09 -0400 Subject: [PATCH 3/8] add debug logging to cosmos sends --- tests/systemtests/clients/cosmosclient.go | 3 +++ tests/systemtests/eip712/eip712_utils.go | 3 +++ 2 files changed, 6 insertions(+) diff --git a/tests/systemtests/clients/cosmosclient.go b/tests/systemtests/clients/cosmosclient.go index 7dc84e273..6e0e85b04 100644 --- a/tests/systemtests/clients/cosmosclient.go +++ b/tests/systemtests/clients/cosmosclient.go @@ -105,6 +105,9 @@ func (c *CosmosClient) BankSend(nodeID, accID string, from, to sdk.AccAddress, a return nil, fmt.Errorf("failed to broadcast tx: %v", err) } + // This debug string is useful for transactions that don't yield an error until after they're broadcasted to the chain + fmt.Printf("DEBUG: CosmosClient BankSend: %s\n", resp.String()) + return resp, nil } diff --git a/tests/systemtests/eip712/eip712_utils.go b/tests/systemtests/eip712/eip712_utils.go index 8eae01c6d..49dbbe074 100644 --- a/tests/systemtests/eip712/eip712_utils.go +++ b/tests/systemtests/eip712/eip712_utils.go @@ -51,6 +51,9 @@ func BankSendWithEIP712( return nil, fmt.Errorf("failed to broadcast tx: %v", err) } + // This debug string is useful for transactions that don't yield an error until after they're broadcasted to the chain + fmt.Printf("DEBUG: CosmosClient BankSend: %s\n", resp.String()) + return resp, nil } From 95a67bb89dc67067f58ab59d298060e934bfeb2b Mon Sep 17 00:00:00 2001 From: Vlad Date: Mon, 13 Oct 2025 15:01:11 -0400 Subject: [PATCH 4/8] Remove Cosmos replacement --- tests/systemtests/mempool/test_replacement.go | 95 ------------------- 1 file changed, 95 deletions(-) diff --git a/tests/systemtests/mempool/test_replacement.go b/tests/systemtests/mempool/test_replacement.go index f468a1128..85aa583c5 100644 --- a/tests/systemtests/mempool/test_replacement.go +++ b/tests/systemtests/mempool/test_replacement.go @@ -134,101 +134,6 @@ func TestTxsReplacement(t *testing.T) { } } -func TestTxsReplacementWithCosmosTx(t *testing.T) { - testCases := []struct { - name string - actions []func(s TestSuite) - }{ - { - name: "single pending tx submitted to same nodes %s", - actions: []func(s TestSuite){ - func(s TestSuite) { - // NOTE: Currently EVMD cannot handle tx reordering correctly when cosmos tx is used. - // It is because of CheckTxHandler cannot handle errors from SigVerificationDecorator properly. - // After modifying CheckTxHandler, we can also modify this test case - // : high prio cosmos tx should replace low prio evm tx. - tx1, err := s.SendTx(t, s.Node(0), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), nil) - require.NoError(t, err, "failed to send tx") - _, err = s.SendTx(t, s.Node(1), "acc0", 0, s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(1)) - require.NoError(t, err, "failed to send tx") - - s.SetExpPendingTxs(tx1) - }, - }, - }, - { - name: "multiple pending txs submitted to same nodes %s", - actions: []func(s TestSuite){ - func(s TestSuite) { - // NOTE: Currently EVMD cannot handle tx reordering correctly when cosmos tx is used. - // It is because of CheckTxHandler cannot handle errors from SigVerificationDecorator properly. - // After modifying CheckTxHandler, we can also modify this test case - // : high prio cosmos tx should replace low prio evm tx. - tx1, err := s.SendTx(t, s.Node(0), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), nil) - require.NoError(t, err, "failed to send tx") - _, err = s.SendTx(t, s.Node(1), "acc0", 0, s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(1)) - require.NoError(t, err, "failed to send tx") - - tx3, err := s.SendTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFee()), nil) - require.NoError(t, err, "failed to send tx") - _, err = s.SendTx(t, s.Node(1), "acc0", 1, s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(1)) - require.NoError(t, err, "failed to send tx") - - tx5, err := s.SendTx(t, s.Node(0), "acc0", 2, s.GetTxGasPrice(s.BaseFee()), nil) - require.NoError(t, err, "failed to send tx") - _, err = s.SendTx(t, s.Node(1), "acc0", 2, s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(1)) - require.NoError(t, err, "failed to send tx") - - s.SetExpPendingTxs(tx1, tx3, tx5) - }, - }, - }, - { - name: "single queued tx %s", - actions: []func(s TestSuite){ - func(s TestSuite) { - // Cosmos txs are not queued in local mempool - _, err := s.SendTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFee()), nil) - require.NoError(t, err, "failed to send tx") - _, err = s.SendTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(1)) - require.NoError(t, err, "failed to send tx") - }, - func(s TestSuite) { - txHash, err := s.SendTx(t, s.Node(1), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), nil) - require.NoError(t, err, "failed to send tx") - - s.SetExpPendingTxs(txHash) - }, - }, - }, - } - - testOptions := []*suite.TestOptions{ - { - Description: "Cosmos LegacyTx", - TxType: suite.TxTypeCosmos, - }, - } - - s := suite.NewSystemTestSuite(t) - s.SetupTest(t) - - for _, to := range testOptions { - s.SetOptions(to) - for _, tc := range testCases { - testName := fmt.Sprintf(tc.name, to.Description) - t.Run(testName, func(t *testing.T) { - s.BeforeEachCase(t) - for _, action := range tc.actions { - action(s) - s.AfterEachAction(t) - } - s.AfterEachCase(t) - }) - } - } -} - func TestMixedTxsReplacementEVMAndCosmos(t *testing.T) { testCases := []struct { name string From 23d60f18a998e52f8ac78a6b27889cf1cd6e5c77 Mon Sep 17 00:00:00 2001 From: Vlad Date: Mon, 13 Oct 2025 15:02:47 -0400 Subject: [PATCH 5/8] remove evm and cosmos replacement --- tests/systemtests/mempool/test_replacement.go | 175 ------------------ 1 file changed, 175 deletions(-) diff --git a/tests/systemtests/mempool/test_replacement.go b/tests/systemtests/mempool/test_replacement.go index 85aa583c5..5ca640184 100644 --- a/tests/systemtests/mempool/test_replacement.go +++ b/tests/systemtests/mempool/test_replacement.go @@ -134,181 +134,6 @@ func TestTxsReplacement(t *testing.T) { } } -func TestMixedTxsReplacementEVMAndCosmos(t *testing.T) { - testCases := []struct { - name string - actions []func(s TestSuite) - }{ - { - name: "single pending tx (low prio evm tx first) %s", - actions: []func(s TestSuite){ - func(s TestSuite) { - tx1, err := s.SendEthTx(t, s.Node(0), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), s.GetTxGasPrice(s.BaseFee())) - require.NoError(t, err, "failed to send tx") - - baseFeeX20 := new(big.Int).Mul(s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(1000000000000000000)) - _, err = s.SendCosmosTx(t, s.Node(1), "acc0", 0, baseFeeX20, nil) - require.NoError(t, err, "failed to send tx") - - s.SetExpPendingTxs(tx1) - }, - }, - }, - { - name: "single pending tx (high prio evm tx first) %s", - actions: []func(s TestSuite){ - func(s TestSuite) { - tx1, err := s.SendEthTx(t, s.Node(0), "acc0", 0, s.GetTxGasPrice(s.BaseFeeX2()), s.GetTxGasPrice(s.BaseFeeX2())) - require.NoError(t, err, "failed to send tx") - _, err = s.SendCosmosTx(t, s.Node(1), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), nil) - require.NoError(t, err, "failed to send tx") - - s.SetExpPendingTxs(tx1) - }, - }, - }, - { - name: "single pending tx (low prio cosmos tx first) %s", - actions: []func(s TestSuite){ - func(s TestSuite) { - _, err := s.SendCosmosTx(t, s.Node(0), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), nil) - require.NoError(t, err, "failed to send tx") - tx2, err := s.SendEthTx(t, s.Node(1), "acc0", 0, s.GetTxGasPrice(s.BaseFeeX2()), s.GetTxGasPrice(s.BaseFeeX2())) - require.NoError(t, err, "failed to send tx") - - s.SetExpPendingTxs(tx2) - }, - }, - }, - { - name: "single pending tx (high prio cosmos tx first) %s", - actions: []func(s TestSuite){ - func(s TestSuite) { - baseFeeX20 := new(big.Int).Mul(s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(10)) - tx1, err := s.SendCosmosTx(t, s.Node(0), "acc0", 0, baseFeeX20, nil) - require.NoError(t, err, "failed to send tx") - _, err = s.SendEthTx(t, s.Node(0), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), nil) - require.NoError(t, err, "failed to send tx") - - s.SetExpPendingTxs(tx1) - }, - }, - }, - { - name: "single queued tx (low prio evm tx first) %s", - actions: []func(s TestSuite){ - func(s TestSuite) { - tx1, err := s.SendEthTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFee()), nil) - require.NoError(t, err, "failed to send tx") - _, err = s.SendCosmosTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(1)) - require.NoError(t, err, "failed to send tx") - - // CosmosTx is not queued in local mempool - s.SetExpQueuedTxs(tx1) - }, - func(s TestSuite) { - tx3, err := s.SendEthTx(t, s.Node(1), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), nil) - require.NoError(t, err, "failed to send tx") - - s.SetExpPendingTxs(tx3) - s.PromoteExpTxs(1) - }, - }, - }, - { - name: "single queued tx (high prio evm tx first) %s", - actions: []func(s TestSuite){ - func(s TestSuite) { - tx1, err := s.SendEthTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(1)) - require.NoError(t, err, "failed to send tx") - _, err = s.SendCosmosTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFee()), nil) - require.NoError(t, err, "failed to send tx") - - // CosmosTx is not queued in local mempool - s.SetExpQueuedTxs(tx1) - }, - func(s TestSuite) { - tx3, err := s.SendEthTx(t, s.Node(1), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), nil) - require.NoError(t, err, "failed to send tx") - - s.SetExpPendingTxs(tx3) - s.PromoteExpTxs(1) - }, - }, - }, - { - name: "single queued tx (low prio cosmos tx first) %s", - actions: []func(s TestSuite){ - func(s TestSuite) { - _, err := s.SendCosmosTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFee()), nil) - require.NoError(t, err, "failed to send tx") - tx2, err := s.SendEthTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFeeX2()), s.GetTxGasPrice(s.BaseFeeX2())) - require.NoError(t, err, "failed to send tx") - - // CosmosTx is not queued in local mempool - s.SetExpQueuedTxs(tx2) - }, - func(s TestSuite) { - tx3, err := s.SendEthTx(t, s.Node(1), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), nil) - require.NoError(t, err, "failed to send tx") - - s.SetExpPendingTxs(tx3) - s.PromoteExpTxs(1) - }, - }, - }, - { - name: "single queued tx (high prio cosmos tx first) %s", - actions: []func(s TestSuite){ - func(s TestSuite) { - _, err := s.SendCosmosTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(1)) - require.NoError(t, err, "failed to send tx") - tx2, err := s.SendEthTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFee()), nil) - require.NoError(t, err, "failed to send tx") - - // CosmosTx is not queued in local mempool - s.SetExpQueuedTxs(tx2) - }, - func(s TestSuite) { - tx3, err := s.SendEthTx(t, s.Node(1), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), nil) - require.NoError(t, err, "failed to send tx") - - s.SetExpPendingTxs(tx3) - s.PromoteExpTxs(1) - }, - }, - }, - } - - testOptions := []*suite.TestOptions{ - { - Description: "EVM LegacyTx & Cosmos LegacyTx", - }, - { - Description: "EVM DynamicTx & Cosmos LegacyTx", - IsDynamicFeeTx: true, - }, - } - - s := suite.NewSystemTestSuite(t) - s.SetupTest(t) - - for _, to := range testOptions { - s.SetOptions(to) - for _, tc := range testCases { - testName := fmt.Sprintf(tc.name, to.Description) - t.Run(testName, func(t *testing.T) { - s.BeforeEachCase(t) - for _, action := range tc.actions { - action(s) - s.AfterEachAction(t) - } - s.AfterEachCase(t) - }) - } - } -} - func TestMixedTxsReplacementLegacyAndDynamicFee(t *testing.T) { testCases := []struct { name string From 24cfb613a07245270fdf6054eb0e9675a8efd929 Mon Sep 17 00:00:00 2001 From: Vlad Date: Mon, 13 Oct 2025 15:07:58 -0400 Subject: [PATCH 6/8] re-add tests and remove the second transaction submission --- tests/systemtests/mempool/test_replacement.go | 270 ++++++++++++++++++ 1 file changed, 270 insertions(+) diff --git a/tests/systemtests/mempool/test_replacement.go b/tests/systemtests/mempool/test_replacement.go index 5ca640184..9a88a182b 100644 --- a/tests/systemtests/mempool/test_replacement.go +++ b/tests/systemtests/mempool/test_replacement.go @@ -134,6 +134,276 @@ func TestTxsReplacement(t *testing.T) { } } +func TestTxsReplacementWithCosmosTx(t *testing.T) { + testCases := []struct { + name string + actions []func(s TestSuite) + }{ + { + name: "single pending tx submitted to same nodes %s", + actions: []func(s TestSuite){ + func(s TestSuite) { + // NOTE: Currently EVMD cannot handle tx reordering correctly when cosmos tx is used. + // It is because of CheckTxHandler cannot handle errors from SigVerificationDecorator properly. + // After modifying CheckTxHandler, we can also modify this test case + // : high prio cosmos tx should replace low prio evm tx. + tx1, err := s.SendTx(t, s.Node(0), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), nil) + require.NoError(t, err, "failed to send tx") + //_, err = s.SendTx(t, s.Node(1), "acc0", 0, s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(1)) + //require.NoError(t, err, "failed to send tx") + + s.SetExpPendingTxs(tx1) + }, + }, + }, + { + name: "multiple pending txs submitted to same nodes %s", + actions: []func(s TestSuite){ + func(s TestSuite) { + // NOTE: Currently EVMD cannot handle tx reordering correctly when cosmos tx is used. + // It is because of CheckTxHandler cannot handle errors from SigVerificationDecorator properly. + // After modifying CheckTxHandler, we can also modify this test case + // : high prio cosmos tx should replace low prio evm tx. + tx1, err := s.SendTx(t, s.Node(0), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), nil) + require.NoError(t, err, "failed to send tx") + //_, err = s.SendTx(t, s.Node(1), "acc0", 0, s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(1)) + //require.NoError(t, err, "failed to send tx") + + tx3, err := s.SendTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFee()), nil) + require.NoError(t, err, "failed to send tx") + //_, err = s.SendTx(t, s.Node(1), "acc0", 1, s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(1)) + //require.NoError(t, err, "failed to send tx") + + tx5, err := s.SendTx(t, s.Node(0), "acc0", 2, s.GetTxGasPrice(s.BaseFee()), nil) + require.NoError(t, err, "failed to send tx") + //_, err = s.SendTx(t, s.Node(1), "acc0", 2, s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(1)) + //require.NoError(t, err, "failed to send tx") + + s.SetExpPendingTxs(tx1, tx3, tx5) + }, + }, + }, + { + name: "single queued tx %s", + actions: []func(s TestSuite){ + func(s TestSuite) { + // Cosmos txs are not queued in local mempool + _, err := s.SendTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFee()), nil) + require.NoError(t, err, "failed to send tx") + _, err = s.SendTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(1)) + require.NoError(t, err, "failed to send tx") + }, + func(s TestSuite) { + txHash, err := s.SendTx(t, s.Node(1), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), nil) + require.NoError(t, err, "failed to send tx") + + s.SetExpPendingTxs(txHash) + }, + }, + }, + } + + testOptions := []*suite.TestOptions{ + { + Description: "Cosmos LegacyTx", + TxType: suite.TxTypeCosmos, + }, + } + + s := suite.NewSystemTestSuite(t) + s.SetupTest(t) + + for _, to := range testOptions { + s.SetOptions(to) + for _, tc := range testCases { + testName := fmt.Sprintf(tc.name, to.Description) + t.Run(testName, func(t *testing.T) { + s.BeforeEachCase(t) + for _, action := range tc.actions { + action(s) + s.AfterEachAction(t) + } + s.AfterEachCase(t) + }) + } + } +} + +func TestMixedTxsReplacementEVMAndCosmos(t *testing.T) { + testCases := []struct { + name string + actions []func(s TestSuite) + }{ + { + name: "single pending tx (low prio evm tx first) %s", + actions: []func(s TestSuite){ + func(s TestSuite) { + tx1, err := s.SendEthTx(t, s.Node(0), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), s.GetTxGasPrice(s.BaseFee())) + require.NoError(t, err, "failed to send tx") + + baseFeeX20 := new(big.Int).Mul(s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(1000000000000000000)) + _, err = s.SendCosmosTx(t, s.Node(1), "acc0", 0, baseFeeX20, nil) + require.NoError(t, err, "failed to send tx") + + s.SetExpPendingTxs(tx1) + }, + }, + }, + { + name: "single pending tx (high prio evm tx first) %s", + actions: []func(s TestSuite){ + func(s TestSuite) { + tx1, err := s.SendEthTx(t, s.Node(0), "acc0", 0, s.GetTxGasPrice(s.BaseFeeX2()), s.GetTxGasPrice(s.BaseFeeX2())) + require.NoError(t, err, "failed to send tx") + _, err = s.SendCosmosTx(t, s.Node(1), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), nil) + require.NoError(t, err, "failed to send tx") + + s.SetExpPendingTxs(tx1) + }, + }, + }, + { + name: "single pending tx (low prio cosmos tx first) %s", + actions: []func(s TestSuite){ + func(s TestSuite) { + _, err := s.SendCosmosTx(t, s.Node(0), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), nil) + require.NoError(t, err, "failed to send tx") + tx2, err := s.SendEthTx(t, s.Node(1), "acc0", 0, s.GetTxGasPrice(s.BaseFeeX2()), s.GetTxGasPrice(s.BaseFeeX2())) + require.NoError(t, err, "failed to send tx") + + s.SetExpPendingTxs(tx2) + }, + }, + }, + { + name: "single pending tx (high prio cosmos tx first) %s", + actions: []func(s TestSuite){ + func(s TestSuite) { + baseFeeX20 := new(big.Int).Mul(s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(10)) + tx1, err := s.SendCosmosTx(t, s.Node(0), "acc0", 0, baseFeeX20, nil) + require.NoError(t, err, "failed to send tx") + _, err = s.SendEthTx(t, s.Node(0), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), nil) + require.NoError(t, err, "failed to send tx") + + s.SetExpPendingTxs(tx1) + }, + }, + }, + { + name: "single queued tx (low prio evm tx first) %s", + actions: []func(s TestSuite){ + func(s TestSuite) { + tx1, err := s.SendEthTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFee()), nil) + require.NoError(t, err, "failed to send tx") + _, err = s.SendCosmosTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(1)) + require.NoError(t, err, "failed to send tx") + + // CosmosTx is not queued in local mempool + s.SetExpQueuedTxs(tx1) + }, + func(s TestSuite) { + tx3, err := s.SendEthTx(t, s.Node(1), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), nil) + require.NoError(t, err, "failed to send tx") + + s.SetExpPendingTxs(tx3) + s.PromoteExpTxs(1) + }, + }, + }, + { + name: "single queued tx (high prio evm tx first) %s", + actions: []func(s TestSuite){ + func(s TestSuite) { + tx1, err := s.SendEthTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(1)) + require.NoError(t, err, "failed to send tx") + _, err = s.SendCosmosTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFee()), nil) + require.NoError(t, err, "failed to send tx") + + // CosmosTx is not queued in local mempool + s.SetExpQueuedTxs(tx1) + }, + func(s TestSuite) { + tx3, err := s.SendEthTx(t, s.Node(1), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), nil) + require.NoError(t, err, "failed to send tx") + + s.SetExpPendingTxs(tx3) + s.PromoteExpTxs(1) + }, + }, + }, + { + name: "single queued tx (low prio cosmos tx first) %s", + actions: []func(s TestSuite){ + func(s TestSuite) { + _, err := s.SendCosmosTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFee()), nil) + require.NoError(t, err, "failed to send tx") + tx2, err := s.SendEthTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFeeX2()), s.GetTxGasPrice(s.BaseFeeX2())) + require.NoError(t, err, "failed to send tx") + + // CosmosTx is not queued in local mempool + s.SetExpQueuedTxs(tx2) + }, + func(s TestSuite) { + tx3, err := s.SendEthTx(t, s.Node(1), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), nil) + require.NoError(t, err, "failed to send tx") + + s.SetExpPendingTxs(tx3) + s.PromoteExpTxs(1) + }, + }, + }, + { + name: "single queued tx (high prio cosmos tx first) %s", + actions: []func(s TestSuite){ + func(s TestSuite) { + _, err := s.SendCosmosTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(1)) + require.NoError(t, err, "failed to send tx") + tx2, err := s.SendEthTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFee()), nil) + require.NoError(t, err, "failed to send tx") + + // CosmosTx is not queued in local mempool + s.SetExpQueuedTxs(tx2) + }, + func(s TestSuite) { + tx3, err := s.SendEthTx(t, s.Node(1), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), nil) + require.NoError(t, err, "failed to send tx") + + s.SetExpPendingTxs(tx3) + s.PromoteExpTxs(1) + }, + }, + }, + } + + testOptions := []*suite.TestOptions{ + { + Description: "EVM LegacyTx & Cosmos LegacyTx", + }, + { + Description: "EVM DynamicTx & Cosmos LegacyTx", + IsDynamicFeeTx: true, + }, + } + + s := suite.NewSystemTestSuite(t) + s.SetupTest(t) + + for _, to := range testOptions { + s.SetOptions(to) + for _, tc := range testCases { + testName := fmt.Sprintf(tc.name, to.Description) + t.Run(testName, func(t *testing.T) { + s.BeforeEachCase(t) + for _, action := range tc.actions { + action(s) + s.AfterEachAction(t) + } + s.AfterEachCase(t) + }) + } + } +} + func TestMixedTxsReplacementLegacyAndDynamicFee(t *testing.T) { testCases := []struct { name string From 79df45c3db24665e2151bc2fc1d22ed7e5a6f5b2 Mon Sep 17 00:00:00 2001 From: Vlad Date: Mon, 13 Oct 2025 15:08:23 -0400 Subject: [PATCH 7/8] remove invalid test case --- tests/systemtests/mempool/test_replacement.go | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/tests/systemtests/mempool/test_replacement.go b/tests/systemtests/mempool/test_replacement.go index 9a88a182b..3230f1f33 100644 --- a/tests/systemtests/mempool/test_replacement.go +++ b/tests/systemtests/mempool/test_replacement.go @@ -183,24 +183,6 @@ func TestTxsReplacementWithCosmosTx(t *testing.T) { }, }, }, - { - name: "single queued tx %s", - actions: []func(s TestSuite){ - func(s TestSuite) { - // Cosmos txs are not queued in local mempool - _, err := s.SendTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFee()), nil) - require.NoError(t, err, "failed to send tx") - _, err = s.SendTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(1)) - require.NoError(t, err, "failed to send tx") - }, - func(s TestSuite) { - txHash, err := s.SendTx(t, s.Node(1), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), nil) - require.NoError(t, err, "failed to send tx") - - s.SetExpPendingTxs(txHash) - }, - }, - }, } testOptions := []*suite.TestOptions{ From a295d95ee190df20ab77980c082bea88313260a4 Mon Sep 17 00:00:00 2001 From: Vlad Date: Mon, 13 Oct 2025 15:34:11 -0400 Subject: [PATCH 8/8] remove non-functional tests --- tests/systemtests/main_test.go | 1 - tests/systemtests/mempool/test_replacement.go | 175 ------------------ 2 files changed, 176 deletions(-) diff --git a/tests/systemtests/main_test.go b/tests/systemtests/main_test.go index f61a4afb0..0d1900521 100644 --- a/tests/systemtests/main_test.go +++ b/tests/systemtests/main_test.go @@ -23,7 +23,6 @@ func TestTxsOrdering(t *testing.T) { func TestTxsReplacement(t *testing.T) { mempool.TestTxsReplacement(t) mempool.TestTxsReplacementWithCosmosTx(t) - mempool.TestMixedTxsReplacementEVMAndCosmos(t) mempool.TestMixedTxsReplacementLegacyAndDynamicFee(t) } diff --git a/tests/systemtests/mempool/test_replacement.go b/tests/systemtests/mempool/test_replacement.go index 3230f1f33..c18ae7ef1 100644 --- a/tests/systemtests/mempool/test_replacement.go +++ b/tests/systemtests/mempool/test_replacement.go @@ -211,181 +211,6 @@ func TestTxsReplacementWithCosmosTx(t *testing.T) { } } -func TestMixedTxsReplacementEVMAndCosmos(t *testing.T) { - testCases := []struct { - name string - actions []func(s TestSuite) - }{ - { - name: "single pending tx (low prio evm tx first) %s", - actions: []func(s TestSuite){ - func(s TestSuite) { - tx1, err := s.SendEthTx(t, s.Node(0), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), s.GetTxGasPrice(s.BaseFee())) - require.NoError(t, err, "failed to send tx") - - baseFeeX20 := new(big.Int).Mul(s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(1000000000000000000)) - _, err = s.SendCosmosTx(t, s.Node(1), "acc0", 0, baseFeeX20, nil) - require.NoError(t, err, "failed to send tx") - - s.SetExpPendingTxs(tx1) - }, - }, - }, - { - name: "single pending tx (high prio evm tx first) %s", - actions: []func(s TestSuite){ - func(s TestSuite) { - tx1, err := s.SendEthTx(t, s.Node(0), "acc0", 0, s.GetTxGasPrice(s.BaseFeeX2()), s.GetTxGasPrice(s.BaseFeeX2())) - require.NoError(t, err, "failed to send tx") - _, err = s.SendCosmosTx(t, s.Node(1), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), nil) - require.NoError(t, err, "failed to send tx") - - s.SetExpPendingTxs(tx1) - }, - }, - }, - { - name: "single pending tx (low prio cosmos tx first) %s", - actions: []func(s TestSuite){ - func(s TestSuite) { - _, err := s.SendCosmosTx(t, s.Node(0), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), nil) - require.NoError(t, err, "failed to send tx") - tx2, err := s.SendEthTx(t, s.Node(1), "acc0", 0, s.GetTxGasPrice(s.BaseFeeX2()), s.GetTxGasPrice(s.BaseFeeX2())) - require.NoError(t, err, "failed to send tx") - - s.SetExpPendingTxs(tx2) - }, - }, - }, - { - name: "single pending tx (high prio cosmos tx first) %s", - actions: []func(s TestSuite){ - func(s TestSuite) { - baseFeeX20 := new(big.Int).Mul(s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(10)) - tx1, err := s.SendCosmosTx(t, s.Node(0), "acc0", 0, baseFeeX20, nil) - require.NoError(t, err, "failed to send tx") - _, err = s.SendEthTx(t, s.Node(0), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), nil) - require.NoError(t, err, "failed to send tx") - - s.SetExpPendingTxs(tx1) - }, - }, - }, - { - name: "single queued tx (low prio evm tx first) %s", - actions: []func(s TestSuite){ - func(s TestSuite) { - tx1, err := s.SendEthTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFee()), nil) - require.NoError(t, err, "failed to send tx") - _, err = s.SendCosmosTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(1)) - require.NoError(t, err, "failed to send tx") - - // CosmosTx is not queued in local mempool - s.SetExpQueuedTxs(tx1) - }, - func(s TestSuite) { - tx3, err := s.SendEthTx(t, s.Node(1), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), nil) - require.NoError(t, err, "failed to send tx") - - s.SetExpPendingTxs(tx3) - s.PromoteExpTxs(1) - }, - }, - }, - { - name: "single queued tx (high prio evm tx first) %s", - actions: []func(s TestSuite){ - func(s TestSuite) { - tx1, err := s.SendEthTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(1)) - require.NoError(t, err, "failed to send tx") - _, err = s.SendCosmosTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFee()), nil) - require.NoError(t, err, "failed to send tx") - - // CosmosTx is not queued in local mempool - s.SetExpQueuedTxs(tx1) - }, - func(s TestSuite) { - tx3, err := s.SendEthTx(t, s.Node(1), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), nil) - require.NoError(t, err, "failed to send tx") - - s.SetExpPendingTxs(tx3) - s.PromoteExpTxs(1) - }, - }, - }, - { - name: "single queued tx (low prio cosmos tx first) %s", - actions: []func(s TestSuite){ - func(s TestSuite) { - _, err := s.SendCosmosTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFee()), nil) - require.NoError(t, err, "failed to send tx") - tx2, err := s.SendEthTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFeeX2()), s.GetTxGasPrice(s.BaseFeeX2())) - require.NoError(t, err, "failed to send tx") - - // CosmosTx is not queued in local mempool - s.SetExpQueuedTxs(tx2) - }, - func(s TestSuite) { - tx3, err := s.SendEthTx(t, s.Node(1), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), nil) - require.NoError(t, err, "failed to send tx") - - s.SetExpPendingTxs(tx3) - s.PromoteExpTxs(1) - }, - }, - }, - { - name: "single queued tx (high prio cosmos tx first) %s", - actions: []func(s TestSuite){ - func(s TestSuite) { - _, err := s.SendCosmosTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFeeX2()), big.NewInt(1)) - require.NoError(t, err, "failed to send tx") - tx2, err := s.SendEthTx(t, s.Node(0), "acc0", 1, s.GetTxGasPrice(s.BaseFee()), nil) - require.NoError(t, err, "failed to send tx") - - // CosmosTx is not queued in local mempool - s.SetExpQueuedTxs(tx2) - }, - func(s TestSuite) { - tx3, err := s.SendEthTx(t, s.Node(1), "acc0", 0, s.GetTxGasPrice(s.BaseFee()), nil) - require.NoError(t, err, "failed to send tx") - - s.SetExpPendingTxs(tx3) - s.PromoteExpTxs(1) - }, - }, - }, - } - - testOptions := []*suite.TestOptions{ - { - Description: "EVM LegacyTx & Cosmos LegacyTx", - }, - { - Description: "EVM DynamicTx & Cosmos LegacyTx", - IsDynamicFeeTx: true, - }, - } - - s := suite.NewSystemTestSuite(t) - s.SetupTest(t) - - for _, to := range testOptions { - s.SetOptions(to) - for _, tc := range testCases { - testName := fmt.Sprintf(tc.name, to.Description) - t.Run(testName, func(t *testing.T) { - s.BeforeEachCase(t) - for _, action := range tc.actions { - action(s) - s.AfterEachAction(t) - } - s.AfterEachCase(t) - }) - } - } -} - func TestMixedTxsReplacementLegacyAndDynamicFee(t *testing.T) { testCases := []struct { name string