Skip to content

Commit

Permalink
Merge pull request #2910 from OffchainLabs/block_metadate_dontfetch
Browse files Browse the repository at this point in the history
TransactionStreamer: dont fetch block metadata when unnecessary
  • Loading branch information
tsahee authored Jan 30, 2025
2 parents d1162ae + 7dfb491 commit 1d9c68d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions arbnode/transaction_streamer.go
Original file line number Diff line number Diff line change
Expand Up @@ -1141,6 +1141,10 @@ func (s *TransactionStreamer) BlockMetadataAtCount(count arbutil.MessageIndex) (
}
pos := count - 1

if s.trackBlockMetadataFrom == 0 || pos < s.trackBlockMetadataFrom {
return nil, nil
}

key := dbKey(blockMetadataInputFeedPrefix, uint64(pos))
blockMetadata, err := s.db.Get(key)
if err != nil {
Expand Down
4 changes: 4 additions & 0 deletions system_tests/timeboost_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,7 @@ func TestTimeboostBulkBlockMetadataFetcher(t *testing.T) {
defer cancel()

builder := NewNodeBuilder(ctx).DefaultConfig(t, true)
builder.nodeConfig.TransactionStreamer.TrackBlockMetadataFrom = 1
httpConfig := genericconf.HTTPConfigDefault
httpConfig.Addr = "127.0.0.1"
httpConfig.Apply(builder.l2StackConfig)
Expand Down Expand Up @@ -630,6 +631,7 @@ func TestTimeboostedFieldInReceiptsObject(t *testing.T) {
defer cancel()

builder := NewNodeBuilder(ctx).DefaultConfig(t, false)
builder.nodeConfig.TransactionStreamer.TrackBlockMetadataFrom = 1
builder.execConfig.BlockMetadataApiCacheSize = 0 // Caching is disabled
cleanup := builder.Build(t)
defer cleanup()
Expand Down Expand Up @@ -738,6 +740,7 @@ func TestTimeboostBulkBlockMetadataAPI(t *testing.T) {
defer cancel()

builder := NewNodeBuilder(ctx).DefaultConfig(t, false)
builder.nodeConfig.TransactionStreamer.TrackBlockMetadataFrom = 1
builder.execConfig.BlockMetadataApiCacheSize = 0 // Caching is disabled
cleanup := builder.Build(t)
defer cleanup()
Expand Down Expand Up @@ -1334,6 +1337,7 @@ func setupExpressLaneAuction(
nodeConfig := arbnode.ConfigDefaultL1NonSequencerTest()
nodeConfig.Feed.Input = *newBroadcastClientConfigTest(port)
nodeConfig.Feed.Input.Timeout = broadcastclient.DefaultConfig.Timeout
nodeConfig.TransactionStreamer.TrackBlockMetadataFrom = 1
extraNode, cleanupExtraNode = builderSeq.Build2ndNode(t, &SecondNodeParams{nodeConfig: nodeConfig, stackConfig: testhelpers.CreateStackConfigForTest(t.TempDir())})
}

Expand Down

0 comments on commit 1d9c68d

Please sign in to comment.