all: drop x/exp direct dependency

This commit is contained in:
Martin Holst Swende 2024-10-08 10:10:38 +02:00 committed by Felix Lange
parent fa16d497bc
commit 49ef93ea1c
4 changed files with 9 additions and 10 deletions

View file

@ -18,12 +18,12 @@ package blobpool
import (
"container/heap"
"maps"
"math"
"slices"
"github.com/ethereum/go-ethereum/common"
"github.com/holiman/uint256"
"golang.org/x/exp/maps"
)
// evictHeap is a helper data structure to keep track of the cheapest bottleneck
@ -54,7 +54,7 @@ func newPriceHeap(basefee *uint256.Int, blobfee *uint256.Int, index map[common.A
// Populate the heap in account sort order. Not really needed in practice,
// but it makes the heap initialization deterministic and less annoying to
// test in unit tests.
heap.addrs = maps.Keys(index)
heap.addrs = slices.Collect(maps.Keys(index))
slices.SortFunc(heap.addrs, common.Address.Cmp)
for i, addr := range heap.addrs {
heap.index[addr] = i

View file

@ -19,6 +19,7 @@ package legacypool
import (
"errors"
"maps"
"math"
"math/big"
"slices"
@ -40,7 +41,6 @@ import (
"github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/params"
"github.com/holiman/uint256"
"golang.org/x/exp/maps"
)
const (
@ -1674,7 +1674,7 @@ func (as *accountSet) addTx(tx *types.Transaction) {
// reuse. The returned slice should not be changed!
func (as *accountSet) flatten() []common.Address {
if as.cache == nil {
as.cache = maps.Keys(as.accounts)
as.cache = slices.Collect(maps.Keys(as.accounts))
}
return as.cache
}

View file

@ -21,12 +21,11 @@ import (
"bytes"
"errors"
"fmt"
"maps"
"net"
"net/netip"
"slices"
"strings"
"golang.org/x/exp/maps"
)
var special4, special6 Netlist
@ -324,7 +323,7 @@ func (s *DistinctNetSet) key(ip netip.Addr) netip.Prefix {
// String implements fmt.Stringer
func (s DistinctNetSet) String() string {
keys := maps.Keys(s.members)
keys := slices.Collect(maps.Keys(s.members))
slices.SortFunc(keys, func(a, b netip.Prefix) int {
return strings.Compare(a.String(), b.String())
})

View file

@ -21,6 +21,7 @@ import (
"encoding/binary"
"errors"
"fmt"
"maps"
"slices"
"time"
@ -29,7 +30,6 @@ import (
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/log"
"golang.org/x/exp/maps"
)
// State history records the state changes involved in executing a block. The
@ -250,13 +250,13 @@ type history struct {
// newHistory constructs the state history object with provided state change set.
func newHistory(root common.Hash, parent common.Hash, block uint64, accounts map[common.Address][]byte, storages map[common.Address]map[common.Hash][]byte, rawStorageKey bool) *history {
var (
accountList = maps.Keys(accounts)
accountList = slices.Collect(maps.Keys(accounts))
storageList = make(map[common.Address][]common.Hash)
)
slices.SortFunc(accountList, common.Address.Cmp)
for addr, slots := range storages {
slist := maps.Keys(slots)
slist := slices.Collect(maps.Keys(slots))
slices.SortFunc(slist, common.Hash.Cmp)
storageList[addr] = slist
}