Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

all: drop x/exp direct dependency #30558

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
5 changes: 2 additions & 3 deletions core/txpool/blobpool/evictheap.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -54,8 +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)
slices.SortFunc(heap.addrs, common.Address.Cmp)
heap.addrs = slices.SortedFunc(maps.Keys(index), common.Address.Cmp)
for i, addr := range heap.addrs {
heap.index[addr] = i
}
Expand Down
5 changes: 3 additions & 2 deletions core/txpool/legacypool/legacypool.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ package legacypool

import (
"errors"
"maps"
"math"
"math/big"
"slices"
"sort"
"sync"
"sync/atomic"
Expand All @@ -38,7 +40,6 @@ import (
"github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/params"
"github.com/holiman/uint256"
"golang.org/x/exp/maps"
)

const (
Expand Down Expand Up @@ -1766,7 +1767,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
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ require (
github.com/urfave/cli/v2 v2.25.7
go.uber.org/automaxprocs v1.5.2
golang.org/x/crypto v0.22.0
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa
golang.org/x/sync v0.7.0
golang.org/x/sys v0.22.0
golang.org/x/text v0.14.0
Expand Down Expand Up @@ -142,6 +141,7 @@ require (
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/net v0.24.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand Down
6 changes: 2 additions & 4 deletions p2p/netutil/net.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@ import (
"bytes"
"errors"
"fmt"
"maps"
"net"
"net/netip"
"slices"
"strings"

"golang.org/x/exp/maps"
)

var special4, special6 Netlist
Expand Down Expand Up @@ -324,8 +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)
slices.SortFunc(keys, func(a, b netip.Prefix) int {
keys := slices.SortedFunc(maps.Keys(s.members), func(a, b netip.Prefix) int {
return strings.Compare(a.String(), b.String())
})

Expand Down
9 changes: 3 additions & 6 deletions triedb/pathdb/history.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"encoding/binary"
"errors"
"fmt"
"maps"
"slices"
"time"

Expand All @@ -29,7 +30,6 @@ import (
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/trie/triestate"
"golang.org/x/exp/maps"
)

// State history records the state changes involved in executing a block. The
Expand Down Expand Up @@ -245,15 +245,12 @@ type history struct {
// newHistory constructs the state history object with provided state change set.
func newHistory(root common.Hash, parent common.Hash, block uint64, states *triestate.Set) *history {
var (
accountList = maps.Keys(states.Accounts)
accountList = slices.SortedFunc(maps.Keys(states.Accounts), common.Address.Cmp)
storageList = make(map[common.Address][]common.Hash)
)
slices.SortFunc(accountList, common.Address.Cmp)

for addr, slots := range states.Storages {
slist := maps.Keys(slots)
slices.SortFunc(slist, common.Hash.Cmp)
storageList[addr] = slist
storageList[addr] = slices.SortedFunc(maps.Keys(slots), common.Hash.Cmp)
}
return &history{
meta: &meta{
Expand Down