mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 23:26:44 +00:00
all: remove exp dependency
This commit is contained in:
parent
02ee623548
commit
157c76db2c
6 changed files with 12 additions and 18 deletions
|
|
@ -24,6 +24,7 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"maps"
|
||||||
"math/big"
|
"math/big"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
@ -40,7 +41,6 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/eth/protocols/eth"
|
"github.com/ethereum/go-ethereum/eth/protocols/eth"
|
||||||
"github.com/ethereum/go-ethereum/params"
|
"github.com/ethereum/go-ethereum/params"
|
||||||
"github.com/ethereum/go-ethereum/rlp"
|
"github.com/ethereum/go-ethereum/rlp"
|
||||||
"golang.org/x/exp/maps"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Chain is a lightweight blockchain-like store which can read a hivechain
|
// Chain is a lightweight blockchain-like store which can read a hivechain
|
||||||
|
|
@ -162,8 +162,8 @@ func (c *Chain) RootAt(height int) common.Hash {
|
||||||
// GetSender returns the address associated with account at the index in the
|
// GetSender returns the address associated with account at the index in the
|
||||||
// pre-funded accounts list.
|
// pre-funded accounts list.
|
||||||
func (c *Chain) GetSender(idx int) (common.Address, uint64) {
|
func (c *Chain) GetSender(idx int) (common.Address, uint64) {
|
||||||
accounts := maps.Keys(c.senders)
|
accounts := slices.SortedFunc(maps.Keys(c.senders), common.Address.Cmp)
|
||||||
slices.SortFunc(accounts, common.Address.Cmp)
|
|
||||||
addr := accounts[idx]
|
addr := accounts[idx]
|
||||||
return addr, c.senders[addr].Nonce
|
return addr, c.senders[addr].Nonce
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"maps"
|
||||||
"os"
|
"os"
|
||||||
"regexp"
|
"regexp"
|
||||||
"slices"
|
"slices"
|
||||||
|
|
@ -28,7 +29,6 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/core/rawdb"
|
"github.com/ethereum/go-ethereum/core/rawdb"
|
||||||
"github.com/ethereum/go-ethereum/tests"
|
"github.com/ethereum/go-ethereum/tests"
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
"golang.org/x/exp/maps"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var blockTestCommand = &cli.Command{
|
var blockTestCommand = &cli.Command{
|
||||||
|
|
@ -80,8 +80,7 @@ func runBlockTest(ctx *cli.Context, fname string) ([]testResult, error) {
|
||||||
tracer := tracerFromFlags(ctx)
|
tracer := tracerFromFlags(ctx)
|
||||||
|
|
||||||
// Pull out keys to sort and ensure tests are run in order.
|
// Pull out keys to sort and ensure tests are run in order.
|
||||||
keys := maps.Keys(tests)
|
keys := slices.Sorted(maps.Keys(tests))
|
||||||
slices.Sort(keys)
|
|
||||||
|
|
||||||
// Run all the tests.
|
// Run all the tests.
|
||||||
var results []testResult
|
var results []testResult
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ package snapshot
|
||||||
import (
|
import (
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"maps"
|
||||||
"math"
|
"math"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"slices"
|
"slices"
|
||||||
|
|
@ -30,7 +31,6 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
"github.com/ethereum/go-ethereum/rlp"
|
"github.com/ethereum/go-ethereum/rlp"
|
||||||
bloomfilter "github.com/holiman/bloomfilter/v2"
|
bloomfilter "github.com/holiman/bloomfilter/v2"
|
||||||
"golang.org/x/exp/maps"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
@ -431,8 +431,7 @@ func (dl *diffLayer) AccountList() []common.Hash {
|
||||||
dl.lock.Lock()
|
dl.lock.Lock()
|
||||||
defer dl.lock.Unlock()
|
defer dl.lock.Unlock()
|
||||||
|
|
||||||
dl.accountList = maps.Keys(dl.accountData)
|
dl.accountList = slices.SortedFunc(maps.Keys(dl.accountData), common.Hash.Cmp)
|
||||||
slices.SortFunc(dl.accountList, common.Hash.Cmp)
|
|
||||||
dl.memory += uint64(len(dl.accountList) * common.HashLength)
|
dl.memory += uint64(len(dl.accountList) * common.HashLength)
|
||||||
return dl.accountList
|
return dl.accountList
|
||||||
}
|
}
|
||||||
|
|
@ -464,8 +463,7 @@ func (dl *diffLayer) StorageList(accountHash common.Hash) []common.Hash {
|
||||||
dl.lock.Lock()
|
dl.lock.Lock()
|
||||||
defer dl.lock.Unlock()
|
defer dl.lock.Unlock()
|
||||||
|
|
||||||
storageList := maps.Keys(dl.storageData[accountHash])
|
storageList := slices.SortedFunc(maps.Keys(dl.storageData[accountHash]), common.Hash.Cmp)
|
||||||
slices.SortFunc(storageList, common.Hash.Cmp)
|
|
||||||
dl.storageList[accountHash] = storageList
|
dl.storageList[accountHash] = storageList
|
||||||
dl.memory += uint64(len(dl.storageList)*common.HashLength + common.HashLength)
|
dl.memory += uint64(len(dl.storageList)*common.HashLength + common.HashLength)
|
||||||
return storageList
|
return storageList
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/log"
|
"github.com/ethereum/go-ethereum/log"
|
||||||
"github.com/ethereum/go-ethereum/metrics"
|
"github.com/ethereum/go-ethereum/metrics"
|
||||||
"github.com/ethereum/go-ethereum/params"
|
"github.com/ethereum/go-ethereum/params"
|
||||||
"golang.org/x/exp/slices"
|
"slices"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
||||||
1
go.mod
1
go.mod
|
|
@ -65,7 +65,6 @@ require (
|
||||||
go.uber.org/automaxprocs v1.5.2
|
go.uber.org/automaxprocs v1.5.2
|
||||||
go.uber.org/goleak v1.3.0
|
go.uber.org/goleak v1.3.0
|
||||||
golang.org/x/crypto v0.32.0
|
golang.org/x/crypto v0.32.0
|
||||||
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa
|
|
||||||
golang.org/x/sync v0.10.0
|
golang.org/x/sync v0.10.0
|
||||||
golang.org/x/sys v0.29.0
|
golang.org/x/sys v0.29.0
|
||||||
golang.org/x/text v0.21.0
|
golang.org/x/text v0.21.0
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ package pathdb
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"maps"
|
||||||
"slices"
|
"slices"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
|
@ -27,7 +28,6 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/log"
|
"github.com/ethereum/go-ethereum/log"
|
||||||
"github.com/ethereum/go-ethereum/metrics"
|
"github.com/ethereum/go-ethereum/metrics"
|
||||||
"github.com/ethereum/go-ethereum/rlp"
|
"github.com/ethereum/go-ethereum/rlp"
|
||||||
"golang.org/x/exp/maps"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// counter helps in tracking items and their corresponding sizes.
|
// counter helps in tracking items and their corresponding sizes.
|
||||||
|
|
@ -174,8 +174,7 @@ func (s *stateSet) accountList() []common.Hash {
|
||||||
s.listLock.Lock()
|
s.listLock.Lock()
|
||||||
defer s.listLock.Unlock()
|
defer s.listLock.Unlock()
|
||||||
|
|
||||||
list = maps.Keys(s.accountData)
|
list = slices.SortedFunc(maps.Keys(s.accountData), common.Hash.Cmp)
|
||||||
slices.SortFunc(list, common.Hash.Cmp)
|
|
||||||
s.accountListSorted = list
|
s.accountListSorted = list
|
||||||
return list
|
return list
|
||||||
}
|
}
|
||||||
|
|
@ -205,8 +204,7 @@ func (s *stateSet) storageList(accountHash common.Hash) []common.Hash {
|
||||||
s.listLock.Lock()
|
s.listLock.Lock()
|
||||||
defer s.listLock.Unlock()
|
defer s.listLock.Unlock()
|
||||||
|
|
||||||
list := maps.Keys(s.storageData[accountHash])
|
list := slices.SortedFunc(maps.Keys(s.storageData[accountHash]), common.Hash.Cmp)
|
||||||
slices.SortFunc(list, common.Hash.Cmp)
|
|
||||||
s.storageListSorted[accountHash] = list
|
s.storageListSorted[accountHash] = list
|
||||||
return list
|
return list
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue