Skip to content

Commit

Permalink
Fix long test.
Browse files Browse the repository at this point in the history
  • Loading branch information
andreibancioiu committed Nov 28, 2024
1 parent 59d7ec7 commit 7eed6f5
Showing 1 changed file with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,11 @@ func TestShardShouldNotProposeAndExecuteTwoBlocksInSameRound(t *testing.T) {
}

// TestShardShouldProposeBlockContainingInvalidTransactions tests the following scenario:
// 1. generate 3 move balance transactions: one that can be executed, one that can not be executed but the account has
// the balance for the fee and one that is completely invalid (no balance left for it)
// 1. generate 3 move balance transactions: one that can be executed, one to be processed as invalid, and one that isn't executable (no balance left for fee).
// 2. proposer will have those 3 transactions in its pools and will propose a block
// 3. another node will be able to sync the proposed block (and request - receive) the 2 transactions that
// will end up in the block (one valid and one invalid)
// 4. the non-executable transaction will be removed from the proposer's pool
// 4. the non-executable transaction will not be immediately removed from the proposer's pool. See MX-16200.
func TestShardShouldProposeBlockContainingInvalidTransactions(t *testing.T) {
if testing.Short() {
t.Skip("this is not a short test")
Expand Down Expand Up @@ -195,7 +194,18 @@ func testStateOnNodes(t *testing.T, nodes []*integrationTests.TestProcessorNode,
testTxIsInMiniblock(t, proposer, hashes[txValidIdx], block.TxBlock)
testTxIsInMiniblock(t, proposer, hashes[txInvalidIdx], block.InvalidBlock)
testTxIsInNotInBody(t, proposer, hashes[txDeletedIdx])
testTxHashNotPresentInPool(t, proposer, hashes[txDeletedIdx])

// Removed from mempool.
_, ok := proposer.DataPool.Transactions().SearchFirstData(hashes[txValidIdx])
assert.False(t, ok)

// Removed from mempool.
_, ok = proposer.DataPool.Transactions().SearchFirstData(hashes[txInvalidIdx])
assert.False(t, ok)

// Not removed from mempool (see MX-16200).
_, ok = proposer.DataPool.Transactions().SearchFirstData(hashes[txDeletedIdx])
assert.True(t, ok)
}

func testSameBlockHeight(t *testing.T, nodes []*integrationTests.TestProcessorNode, idxProposer int, expectedHeight uint64) {
Expand All @@ -208,11 +218,6 @@ func testSameBlockHeight(t *testing.T, nodes []*integrationTests.TestProcessorNo
}
}

func testTxHashNotPresentInPool(t *testing.T, proposer *integrationTests.TestProcessorNode, hash []byte) {
txCache := proposer.DataPool.Transactions()
_, ok := txCache.SearchFirstData(hash)
assert.False(t, ok)
}

func testTxIsInMiniblock(t *testing.T, proposer *integrationTests.TestProcessorNode, hash []byte, bt block.Type) {
hdrHandler := proposer.BlockChain.GetCurrentBlockHeader()
Expand Down

0 comments on commit 7eed6f5

Please sign in to comment.