mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 23:26:44 +00:00
all: drop x/exp direct dependency
This commit is contained in:
parent
fa16d497bc
commit
49ef93ea1c
4 changed files with 9 additions and 10 deletions
|
|
@ -18,12 +18,12 @@ package blobpool
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"container/heap"
|
"container/heap"
|
||||||
|
"maps"
|
||||||
"math"
|
"math"
|
||||||
"slices"
|
"slices"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/holiman/uint256"
|
"github.com/holiman/uint256"
|
||||||
"golang.org/x/exp/maps"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// evictHeap is a helper data structure to keep track of the cheapest bottleneck
|
// 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,
|
// Populate the heap in account sort order. Not really needed in practice,
|
||||||
// but it makes the heap initialization deterministic and less annoying to
|
// but it makes the heap initialization deterministic and less annoying to
|
||||||
// test in unit tests.
|
// test in unit tests.
|
||||||
heap.addrs = maps.Keys(index)
|
heap.addrs = slices.Collect(maps.Keys(index))
|
||||||
slices.SortFunc(heap.addrs, common.Address.Cmp)
|
slices.SortFunc(heap.addrs, common.Address.Cmp)
|
||||||
for i, addr := range heap.addrs {
|
for i, addr := range heap.addrs {
|
||||||
heap.index[addr] = i
|
heap.index[addr] = i
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ package legacypool
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"maps"
|
||||||
"math"
|
"math"
|
||||||
"math/big"
|
"math/big"
|
||||||
"slices"
|
"slices"
|
||||||
|
|
@ -40,7 +41,6 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/metrics"
|
"github.com/ethereum/go-ethereum/metrics"
|
||||||
"github.com/ethereum/go-ethereum/params"
|
"github.com/ethereum/go-ethereum/params"
|
||||||
"github.com/holiman/uint256"
|
"github.com/holiman/uint256"
|
||||||
"golang.org/x/exp/maps"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
@ -1674,7 +1674,7 @@ func (as *accountSet) addTx(tx *types.Transaction) {
|
||||||
// reuse. The returned slice should not be changed!
|
// reuse. The returned slice should not be changed!
|
||||||
func (as *accountSet) flatten() []common.Address {
|
func (as *accountSet) flatten() []common.Address {
|
||||||
if as.cache == nil {
|
if as.cache == nil {
|
||||||
as.cache = maps.Keys(as.accounts)
|
as.cache = slices.Collect(maps.Keys(as.accounts))
|
||||||
}
|
}
|
||||||
return as.cache
|
return as.cache
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,12 +21,11 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"maps"
|
||||||
"net"
|
"net"
|
||||||
"net/netip"
|
"net/netip"
|
||||||
"slices"
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"golang.org/x/exp/maps"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var special4, special6 Netlist
|
var special4, special6 Netlist
|
||||||
|
|
@ -324,7 +323,7 @@ func (s *DistinctNetSet) key(ip netip.Addr) netip.Prefix {
|
||||||
|
|
||||||
// String implements fmt.Stringer
|
// String implements fmt.Stringer
|
||||||
func (s DistinctNetSet) String() string {
|
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 {
|
slices.SortFunc(keys, func(a, b netip.Prefix) int {
|
||||||
return strings.Compare(a.String(), b.String())
|
return strings.Compare(a.String(), b.String())
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ import (
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"maps"
|
||||||
"slices"
|
"slices"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
|
@ -29,7 +30,6 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/crypto"
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
"github.com/ethereum/go-ethereum/ethdb"
|
"github.com/ethereum/go-ethereum/ethdb"
|
||||||
"github.com/ethereum/go-ethereum/log"
|
"github.com/ethereum/go-ethereum/log"
|
||||||
"golang.org/x/exp/maps"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// State history records the state changes involved in executing a block. The
|
// 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.
|
// 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 {
|
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 (
|
var (
|
||||||
accountList = maps.Keys(accounts)
|
accountList = slices.Collect(maps.Keys(accounts))
|
||||||
storageList = make(map[common.Address][]common.Hash)
|
storageList = make(map[common.Address][]common.Hash)
|
||||||
)
|
)
|
||||||
slices.SortFunc(accountList, common.Address.Cmp)
|
slices.SortFunc(accountList, common.Address.Cmp)
|
||||||
|
|
||||||
for addr, slots := range storages {
|
for addr, slots := range storages {
|
||||||
slist := maps.Keys(slots)
|
slist := slices.Collect(maps.Keys(slots))
|
||||||
slices.SortFunc(slist, common.Hash.Cmp)
|
slices.SortFunc(slist, common.Hash.Cmp)
|
||||||
storageList[addr] = slist
|
storageList[addr] = slist
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue