Skip to content

Commit 128eb98

Browse files
committed
ut: fix some broken ut;
lint: fix some golang lint;
1 parent 40a6e30 commit 128eb98

50 files changed

Lines changed: 129 additions & 135 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cmd/geth/dbcmd.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,9 @@ func inspectTrie(ctx *cli.Context) error {
429429
return err
430430
}
431431
theInspect, err := trie.NewInspector(trieDB, theTrie, blockNumber, jobnum)
432+
if err != nil {
433+
return err
434+
}
432435
theInspect.Run()
433436
theInspect.DisplayResult()
434437
}

cmd/geth/snapshot.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@ import (
2121
"encoding/json"
2222
"errors"
2323
"fmt"
24-
"github.com/ethereum/go-ethereum/core"
2524
"os"
2625
"path/filepath"
2726
"time"
2827

28+
"github.com/ethereum/go-ethereum/core"
29+
2930
"github.com/prometheus/tsdb/fileutil"
3031

3132
"github.com/ethereum/go-ethereum/cmd/utils"

cmd/utils/flags.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ import (
2323
"encoding/hex"
2424
"errors"
2525
"fmt"
26-
"github.com/ethereum/go-ethereum/core/types"
27-
"github.com/ethereum/go-ethereum/rlp"
2826
"math"
2927
"math/big"
3028
"net"
@@ -37,6 +35,9 @@ import (
3735
"strings"
3836
"time"
3937

38+
"github.com/ethereum/go-ethereum/core/types"
39+
"github.com/ethereum/go-ethereum/rlp"
40+
4041
"github.com/fatih/structs"
4142
pcsclite "github.com/gballet/go-libpcsclite"
4243
gopsutil "github.com/shirou/gopsutil/mem"

core/rawdb/accessors_trie.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ package rawdb
1818

1919
import (
2020
"fmt"
21-
"github.com/ethereum/go-ethereum/core/types"
2221
"sync"
2322

23+
"github.com/ethereum/go-ethereum/core/types"
24+
2425
"github.com/ethereum/go-ethereum/common"
2526
"github.com/ethereum/go-ethereum/crypto"
2627
"github.com/ethereum/go-ethereum/ethdb"

core/state/database.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ package state
1919
import (
2020
"errors"
2121
"fmt"
22-
"github.com/ethereum/go-ethereum/log"
2322
"time"
2423

24+
"github.com/ethereum/go-ethereum/log"
25+
2526
"github.com/ethereum/go-ethereum/common"
2627
"github.com/ethereum/go-ethereum/common/lru"
2728
"github.com/ethereum/go-ethereum/core/rawdb"

core/state/pruner/pruner.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ import (
2222
"encoding/hex"
2323
"errors"
2424
"fmt"
25-
"github.com/ethereum/go-ethereum/params"
26-
bloomfilter "github.com/holiman/bloomfilter/v2"
2725
"math"
2826
"math/big"
2927
"os"
@@ -32,6 +30,9 @@ import (
3230
"sync"
3331
"time"
3432

33+
"github.com/ethereum/go-ethereum/params"
34+
bloomfilter "github.com/holiman/bloomfilter/v2"
35+
3536
"github.com/prometheus/tsdb/fileutil"
3637

3738
"github.com/ethereum/go-ethereum/common"
@@ -683,7 +684,7 @@ func (p *Pruner) Prune(root common.Hash) error {
683684

684685
// find target header
685686
header := p.chainHeader
686-
for header != nil && header.Number.Uint64() >= 0 && header.Root != root {
687+
for header != nil && header.Root != root {
687688
header = rawdb.ReadHeader(p.db, header.ParentHash, header.Number.Uint64()-1)
688689
}
689690
if header == nil || header.Root != root {

core/state/snapshot/conversion.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ func TraverseContractTrie(snaptree *Tree, root common.Hash, pruneExpiredTrieCh c
142142
// Start to feed leaves
143143
for acctIt.Next() {
144144
// Fetch the next account and process it concurrently
145-
account, err = types.FullAccount(acctIt.(AccountIterator).Account())
145+
account, err = types.FullAccount(acctIt.Account())
146146
if err != nil {
147147
break
148148
}

core/state/snapshot/generate_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,6 @@ func testGenerateWithExtraAccounts(t *testing.T, scheme string) {
582582
rawdb.WriteStorageSnapshot(helper.diskdb, key, hashData([]byte("b-key-2")), val)
583583
val, _ = rlp.EncodeToBytes([]byte("b-val-3"))
584584
rawdb.WriteStorageSnapshot(helper.diskdb, key, hashData([]byte("b-key-3")), val)
585-
586585
}
587586
root := helper.Commit()
588587

core/state/snapshot/snapshot_expire_test.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
package snapshot
22

33
import (
4+
"testing"
5+
46
"github.com/ethereum/go-ethereum/common"
57
"github.com/ethereum/go-ethereum/core/rawdb"
68
"github.com/ethereum/go-ethereum/core/types"
79
"github.com/ethereum/go-ethereum/ethdb/memorydb"
810
"github.com/stretchr/testify/assert"
9-
"testing"
1011
)
1112

1213
var (
13-
accountHash = common.HexToHash("0x31b67165f56d0ac50814cafa06748fb3b8fccd3c611a8117350e7a49b44ce130")
14-
storageHash1 = common.HexToHash("0x0bb2f3e66816c6fd12513f053d5ee034b1fa2d448a1dc8ee7f56e4c87d6c53fe")
15-
storageHash2 = common.HexToHash("0x0bb2f3e66816c93e142cd336c411ebd5576a90739bad7ec1ec0d4a63ea0ec1dc")
16-
storageShrink1 = common.FromHex("0x0bb2f3e66816c")
17-
storageNodeHash1 = common.HexToHash("0xcf0e24cb9417a38ff61d11def23fb0ec041257c81c04dec6156d5e6b30f4ec28")
14+
accountHash = common.HexToHash("0x31b67165f56d0ac50814cafa06748fb3b8fccd3c611a8117350e7a49b44ce130")
15+
storageHash1 = common.HexToHash("0x0bb2f3e66816c6fd12513f053d5ee034b1fa2d448a1dc8ee7f56e4c87d6c53fe")
1816
)
1917

2018
func TestShrinkExpiredLeaf(t *testing.T) {

core/state/snapshot/snapshot_value.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package snapshot
33
import (
44
"bytes"
55
"errors"
6+
67
"github.com/ethereum/go-ethereum/core/types"
78
"github.com/ethereum/go-ethereum/rlp"
89
)

0 commit comments

Comments
 (0)