Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 0 additions & 5 deletions data/txHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"errors"
"fmt"
"io"
"reflect"
"sync"
"time"

Expand Down Expand Up @@ -145,10 +144,6 @@ func MakeTxHandler(opts TxHandlerOpts) (*TxHandler, error) {
if opts.TxPool == nil {
return nil, ErrInvalidTxPool
}
txPoolValue := reflect.ValueOf(opts.TxPool)
if txPoolValue.Kind() == reflect.Ptr && txPoolValue.IsNil() {
return nil, ErrInvalidTxPool
}

if opts.Ledger == nil {
return nil, ErrInvalidLedger
Expand Down
11 changes: 6 additions & 5 deletions data/txHandler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3247,11 +3247,12 @@ func TestTxHandlerNilTxPool(t *testing.T) {
})
require.ErrorIs(t, err, ErrInvalidTxPool)

var nilPoll2 *mockTxPool
_, err = MakeTxHandler(TxHandlerOpts{
TxPool: nilPoll2,
})
require.ErrorIs(t, err, ErrInvalidTxPool)
// This case not handled in MakeTxHandler
Comment thread
algorandskiy marked this conversation as resolved.
// var nilPoll2 *mockTxPool
// _, err = MakeTxHandler(TxHandlerOpts{
// TxPool: nilPoll2,
// })
// require.ErrorIs(t, err, ErrInvalidTxPool)

_, err = MakeTxHandler(TxHandlerOpts{
TxPool: &mockTxPool{},
Expand Down
5 changes: 3 additions & 2 deletions ledger/boxtxn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -513,9 +513,10 @@ assert
for i := 0; i < 330; i++ {
dl.fullBlock()
}
time.Sleep(5 * time.Second) // balancesFlushInterval, so commit happens
dl.fullBlock(call.Args("check", "x", string(make([]byte, 16))))
time.Sleep(100 * time.Millisecond) // give commit time to run, and prune au caches
// commit au deltas so the box app is executed on of data from ledger, not trackers
commitRoundLookback(0, dl.generator)
commitRoundLookback(0, dl.validator)
Comment thread
jannotti marked this conversation as resolved.
dl.fullBlock(call.Args("check", "x", string(make([]byte, 16))))

// Still the same after caches are flushed
Expand Down
5 changes: 1 addition & 4 deletions ledger/ledger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1514,10 +1514,6 @@ func benchLedgerCache(b *testing.B, startRound basics.Round) {

// triggerTrackerFlush is based in the commit flow but executed it in a single (this) goroutine.
func triggerTrackerFlush(t *testing.T, l *Ledger) {
l.trackers.mu.Lock()
dbRound := l.trackers.dbRound
l.trackers.mu.Unlock()

rnd := l.Latest()
minBlock := rnd
maxLookback := basics.Round(0)
Expand All @@ -1538,6 +1534,7 @@ func triggerTrackerFlush(t *testing.T, l *Ledger) {
}

l.trackers.mu.RLock()
dbRound := l.trackers.dbRound
cdr := l.trackers.produceCommittingTask(rnd, dbRound, &dcc.deferredCommitRange)
if cdr != nil {
dcc.deferredCommitRange = *cdr
Expand Down
27 changes: 14 additions & 13 deletions network/p2pNetwork_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ import (
"fmt"
"io"
"net/http"
"os"
"slices"
"strings"
"sync"
"sync/atomic"
"testing"
Expand Down Expand Up @@ -864,9 +862,10 @@ func TestP2PHTTPHandlerAllInterfaces(t *testing.T) {
func TestP2PRelay(t *testing.T) {
partitiontest.PartitionTest(t)

if strings.ToUpper(os.Getenv("CIRCLECI")) == "TRUE" {
t.Skip("Flaky on CIRCLECI")
}
// Speed up heartbeat to reduce test flakiness from mesh establishment timing
oldHeartbeatInterval := pubsub.GossipSubHeartbeatInterval
Comment thread
cce marked this conversation as resolved.
pubsub.GossipSubHeartbeatInterval = 200 * time.Millisecond
defer func() { pubsub.GossipSubHeartbeatInterval = oldHeartbeatInterval }()

cfg := config.GetDefaultLocal()
cfg.DNSBootstrapID = "" // disable DNS lookups since the test uses phonebook addresses
Expand Down Expand Up @@ -994,6 +993,11 @@ func TestP2PRelay(t *testing.T) {
netA.hasPeer(netB.service.ID()) && netA.hasPeer(netC.service.ID())
}, 2*time.Second, 50*time.Millisecond)

// Wait for gossipsub heartbeat to establish mesh links.
// ListPeersForTopic returns subscribed peers but mesh links are established
// asynchronously via HEARTBEAT.
time.Sleep(pubsub.GossipSubHeartbeatInterval + 100*time.Millisecond)

const expectedMsgs = 10
counter.Store(0)
var msgsSink logMessages
Expand Down Expand Up @@ -1594,15 +1598,12 @@ func TestP2PMetainfoV1vsV22(t *testing.T) {
require.NoError(t, err)
defer netB.Stop()

// Wait for wsPeer objects to be established on both sides
require.Eventually(t, func() bool {
return len(netA.service.Conns()) > 0 && len(netB.service.Conns()) > 0
return len(netA.GetPeers(PeersConnectedIn)) > 0 && len(netB.GetPeers(PeersConnectedOut)) > 0
}, 2*time.Second, 50*time.Millisecond)

var peers []Peer
require.Eventually(t, func() bool {
peers = netA.GetPeers(PeersConnectedIn)
return len(peers) > 0
}, 2*time.Second, 50*time.Millisecond)
peers := netA.GetPeers(PeersConnectedIn)
require.Len(t, peers, 1)
peer := peers[0].(*wsPeer)
require.False(t, peer.features&pfCompressedProposal != 0)
Expand Down Expand Up @@ -1686,9 +1687,9 @@ func TestP2PVoteCompression(t *testing.T) {
counterDone := matcher.done
netB.RegisterHandlers([]TaggedMessageHandler{{Tag: protocol.AgreementVoteTag, MessageHandler: matcher}})

// Wait for peers to connect
// Wait for wsPeer objects to be established on both sides
require.Eventually(t, func() bool {
return len(netA.service.Conns()) > 0 && len(netB.service.Conns()) > 0
return len(netA.GetPeers(PeersConnectedIn)) > 0 && len(netB.GetPeers(PeersConnectedOut)) > 0
}, 2*time.Second, 50*time.Millisecond)

for _, msg := range messages {
Expand Down
4 changes: 3 additions & 1 deletion test/scripts/e2e_subs/absentee.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
pblock = goal.algod.block_info(txinfo['confirmed-round'])['block']
assert pblock["prp"] != "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ"
prp_info = goal.algod.account_info(pblock["prp"])
assert prp_info["round"] == pblock["rnd"], pblock
# account_info returns data at the latest round, which may advance
# beyond the block round by the time we query it.
assert prp_info["round"] >= pblock["rnd"], (prp_info["round"], pblock["rnd"], pblock)
assert "last-proposed" in prp_info, prp_info # they just did!
assert prp_info["last-proposed"] > 0
assert "last-heartbeat" not in prp_info, prp_info # was a genesis account
Expand Down
Loading