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
12 changes: 6 additions & 6 deletions pkg/store/store_adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,13 +445,13 @@ func (a *StoreAdapter[H]) Get(ctx context.Context, hash header.Hash) (H, error)
// First try the store
item, err := a.getter.GetByHash(ctx, hash)
if err == nil {
a.applyDAHint(item)
a.applyDAHint(ctx, item)
return item, nil
}

// Check pending items using hash index for O(1) lookup
if pendingItem, ok := a.pending.getByHash(hash); ok {
a.applyDAHint(pendingItem)
a.applyDAHint(ctx, pendingItem)
return pendingItem, nil
}

Expand Down Expand Up @@ -485,21 +485,21 @@ func (a *StoreAdapter[H]) getByHeightNoWait(ctx context.Context, height uint64)
// First try the store
item, err := a.getter.GetByHeight(ctx, height)
if err == nil {
a.applyDAHint(item)
a.applyDAHint(ctx, item)
return item, nil
}

// Check pending items
if pendingItem, ok := a.pending.get(height); ok {
a.applyDAHint(pendingItem)
a.applyDAHint(ctx, pendingItem)
return pendingItem, nil
}

return zero, header.ErrNotFound
}

// applyDAHint sets the DA hint on the item from cache or disk.
func (a *StoreAdapter[H]) applyDAHint(item H) {
func (a *StoreAdapter[H]) applyDAHint(ctx context.Context, item H) {
if item.IsZero() {
return
}
Expand All @@ -513,7 +513,7 @@ func (a *StoreAdapter[H]) applyDAHint(item H) {
}

// Try to load from disk
if diskHint, err := a.getter.GetDAHint(context.Background(), height); err == nil && diskHint > 0 {
if diskHint, err := a.getter.GetDAHint(ctx, height); err == nil && diskHint > 0 {
a.pending.setDAHint(height, diskHint)
item.SetDAHint(diskHint)
}
Expand Down
7 changes: 4 additions & 3 deletions test/e2e/evm_test_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package e2e

import (
"cmp"
"context"
"flag"
"fmt"
Expand All @@ -23,7 +24,7 @@ import (
"os"
"path/filepath"
"regexp"
"sort"
"slices"
"strconv"
"strings"
"testing"
Expand Down Expand Up @@ -904,8 +905,8 @@ func PrintTraceReport(t testing.TB, label string, spans []TraceSpan) {
for name := range m {
names = append(names, name)
}
sort.Slice(names, func(i, j int) bool {
return m[names[i]].Total > m[names[j]].Total
slices.SortFunc(names, func(a, b string) int {
return cmp.Compare(m[b].Total, m[a].Total)
})

var overallTotal time.Duration
Expand Down
Loading