Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix TestMempoolEthTxsAppGossipHandling #629

Merged
merged 4 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 4 additions & 14 deletions plugin/evm/gossiper_eth_gossiping_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -115,22 +113,14 @@ 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")

// wait for transaction to be re-gossiped
attemptAwait(t, &wg, 5*time.Second)
attemptAwait(t, &wg, 5*time.Hour)
darioush marked this conversation as resolved.
Show resolved Hide resolved
}

func attemptAwait(t *testing.T, wg *sync.WaitGroup, delay time.Duration) {
Expand Down
1 change: 0 additions & 1 deletion plugin/evm/vm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading