diff --git a/core/txpool/blobpool/evictheap.go b/core/txpool/blobpool/evictheap.go index 5e285e6c53..0792fdf388 100644 --- a/core/txpool/blobpool/evictheap.go +++ b/core/txpool/blobpool/evictheap.go @@ -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 diff --git a/core/txpool/legacypool/legacypool.go b/core/txpool/legacypool/legacypool.go index 0fda56986e..fb10060496 100644 --- a/core/txpool/legacypool/legacypool.go +++ b/core/txpool/legacypool/legacypool.go @@ -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 } diff --git a/p2p/netutil/net.go b/p2p/netutil/net.go index 7d8da88670..f98f2ba14f 100644 --- a/p2p/netutil/net.go +++ b/p2p/netutil/net.go @@ -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()) }) diff --git a/triedb/pathdb/history.go b/triedb/pathdb/history.go index 6ba9aaf1bb..d0460855ef 100644 --- a/triedb/pathdb/history.go +++ b/triedb/pathdb/history.go @@ -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 }