From 1f731021ec9f6662f0f64a829246a4d16d206e88 Mon Sep 17 00:00:00 2001 From: Ganesh Vanahalli Date: Thu, 26 Dec 2024 10:23:18 -0600 Subject: [PATCH] fix CI lint and race errors --- execution/gethexec/express_lane_service_test.go | 9 +++++---- system_tests/timeboost_test.go | 6 +++++- timeboost/auctioneer_test.go | 2 ++ timeboost/bid_cache_test.go | 6 +++++- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/execution/gethexec/express_lane_service_test.go b/execution/gethexec/express_lane_service_test.go index 0c69c341a0..736fff53eb 100644 --- a/execution/gethexec/express_lane_service_test.go +++ b/execution/gethexec/express_lane_service_test.go @@ -298,7 +298,7 @@ func makeStubPublisher(els *expressLaneService) *stubPublisher { } func (s *stubPublisher) PublishTimeboostedTransaction(parentCtx context.Context, tx *types.Transaction, options *arbitrum_types.ConditionalOptions) error { - if tx == nil { + if tx.CalldataUnits != 0 { return errors.New("oops, bad tx") } control, _ := s.els.roundControl.Get(0) @@ -394,7 +394,7 @@ func Test_expressLaneService_sequenceExpressLaneSubmission_outOfOrder(t *testing } // We should have only published 2, as we are missing sequence number 3. require.Equal(t, 2, len(stubPublisher.publishedTxOrder)) - require.Equal(t, len(messages), len(els.messagesBySequenceNumber)) + require.Equal(t, 3, len(els.messagesBySequenceNumber)) // Processed txs are deleted err := els.sequenceExpressLaneSubmission(ctx, &timeboost.ExpressLaneSubmission{SequenceNumber: 3, Transaction: &types.Transaction{}}) require.NoError(t, err) @@ -425,15 +425,16 @@ func Test_expressLaneService_sequenceExpressLaneSubmission_erroredTx(t *testing. }, { SequenceNumber: 2, - Transaction: nil, + Transaction: types.NewTx(&types.DynamicFeeTx{}), }, { SequenceNumber: 2, Transaction: &types.Transaction{}, }, } + messages[2].Transaction.CalldataUnits = 1 for _, msg := range messages { - if msg.Transaction == nil { + if msg.Transaction.CalldataUnits != 0 { err := els.sequenceExpressLaneSubmission(ctx, msg) require.ErrorContains(t, err, "oops, bad tx") } else { diff --git a/system_tests/timeboost_test.go b/system_tests/timeboost_test.go index e8b9b57175..f3c0a84b43 100644 --- a/system_tests/timeboost_test.go +++ b/system_tests/timeboost_test.go @@ -836,5 +836,9 @@ func getRandomPort(t testing.TB) int { listener, err := net.Listen("tcp", "localhost:0") require.NoError(t, err) defer listener.Close() - return listener.Addr().(*net.TCPAddr).Port + tcpAddr, ok := listener.Addr().(*net.TCPAddr) + if !ok { + t.Fatalf("failed to cast listener address to *net.TCPAddr") + } + return tcpAddr.Port } diff --git a/timeboost/auctioneer_test.go b/timeboost/auctioneer_test.go index 3e5e24a829..855ec53687 100644 --- a/timeboost/auctioneer_test.go +++ b/timeboost/auctioneer_test.go @@ -153,7 +153,9 @@ func TestBidValidatorAuctioneerRedisStream(t *testing.T) { // We verify that the auctioneer has consumed all validated bids from the single Redis stream. // We also verify the top two bids are those we expect. + am.bidCache.Lock() require.Equal(t, 3, len(am.bidCache.bidsByExpressLaneControllerAddr)) + am.bidCache.Unlock() result := am.bidCache.topTwoBids() require.Equal(t, big.NewInt(7), result.firstPlace.Amount) // Best bid should be Charlie's last bid 7 require.Equal(t, charlieAddr, result.firstPlace.Bidder) diff --git a/timeboost/bid_cache_test.go b/timeboost/bid_cache_test.go index 8266fca202..b28d69dd1c 100644 --- a/timeboost/bid_cache_test.go +++ b/timeboost/bid_cache_test.go @@ -210,5 +210,9 @@ func getRandomPort(t testing.TB) int { listener, err := net.Listen("tcp", "localhost:0") require.NoError(t, err) defer listener.Close() - return listener.Addr().(*net.TCPAddr).Port + tcpAddr, ok := listener.Addr().(*net.TCPAddr) + if !ok { + t.Fatalf("failed to cast listener address to *net.TCPAddr") + } + return tcpAddr.Port }