diff --git a/plugin/evm/gossiper_atomic_gossiping_test.go b/plugin/evm/gossiper_atomic_gossiping_test.go index c2aadeb575..6ab4b429b9 100644 --- a/plugin/evm/gossiper_atomic_gossiping_test.go +++ b/plugin/evm/gossiper_atomic_gossiping_test.go @@ -170,19 +170,13 @@ func TestMempoolAtmTxsAppGossipHandlingDiscardedTx(t *testing.T) { assert.False(mempool.has(txID)) - // Gossip the transaction that conflicts with the originally - // discarded tx and ensure it is accepted into the mempool and gossipped - // to the network. - nodeID = ids.GenerateTestNodeID() - msg = message.AtomicTxGossip{ - Tx: conflictingTx.SignedBytes(), - } - msgBytes, err = message.BuildGossipMessage(vm.networkCodec, msg) - assert.NoError(err) - vm.ctx.Lock.Unlock() - assert.NoError(vm.AppGossip(context.Background(), nodeID, msgBytes)) + // Conflicting tx must be submitted over the API to be included in push gossip. + // (i.e., txs received via p2p are not included in push gossip) + // This test adds it directly to the mempool + gossiper to simulate that. + vm.mempool.AddTx(conflictingTx) + vm.atomicTxPushGossiper.Add(&GossipAtomicTx{conflictingTx}) time.Sleep(500 * time.Millisecond) vm.ctx.Lock.Lock() diff --git a/plugin/evm/gossiper_eth_gossiping_test.go b/plugin/evm/gossiper_eth_gossiping_test.go index 21b9bc6620..dfcf80666f 100644 --- a/plugin/evm/gossiper_eth_gossiping_test.go +++ b/plugin/evm/gossiper_eth_gossiping_test.go @@ -21,14 +21,12 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/rlp" "github.com/stretchr/testify/assert" "github.com/ava-labs/coreth/core" "github.com/ava-labs/coreth/core/types" "github.com/ava-labs/coreth/params" - "github.com/ava-labs/coreth/plugin/evm/message" ) func fundAddressByGenesis(addrs []common.Address) (string, error) { @@ -115,17 +113,9 @@ func TestMempoolEthTxsAppGossipHandling(t *testing.T) { // prepare a tx tx := getValidEthTxs(key, 1, common.Big1)[0] - // show that unknown coreth hashes is requested - txBytes, err := rlp.EncodeToBytes([]*types.Transaction{tx}) - assert.NoError(err) - msg := message.EthTxsGossip{ - Txs: txBytes, - } - msgBytes, err := message.BuildGossipMessage(vm.networkCodec, msg) - assert.NoError(err) - - nodeID := ids.GenerateTestNodeID() - err = vm.AppGossip(context.Background(), nodeID, msgBytes) + // Txs must be submitted over the API to be included in push gossip. + // (i.e., txs received via p2p are not included in push gossip) + err = vm.eth.APIBackend.SendTx(context.Background(), tx) assert.NoError(err) assert.False(txRequested, "tx should not be requested") diff --git a/plugin/evm/vm_test.go b/plugin/evm/vm_test.go index 1137774f1e..05574fdbf8 100644 --- a/plugin/evm/vm_test.go +++ b/plugin/evm/vm_test.go @@ -311,7 +311,6 @@ func GenesisVMWithClock( *enginetest.Sender, ) { vm := &VM{clock: clock} - vm.p2pSender = &enginetest.SenderStub{} ctx, dbManager, genesisBytes, issuer, m := setupGenesis(t, genesisJSON) appSender := &enginetest.Sender{T: t} appSender.CantSendAppGossip = true