Skip to content

Commit

Permalink
fix linter
Browse files Browse the repository at this point in the history
  • Loading branch information
antonis19 committed Dec 3, 2024
1 parent d95499f commit 9b78454
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 81 deletions.
8 changes: 4 additions & 4 deletions erigon-lib/commitment/hex_patricia_hashed.go
Original file line number Diff line number Diff line change
Expand Up @@ -1194,7 +1194,7 @@ func (hph *HexPatriciaHashed) createAccountNode(c *cell, row int, hashedKey []by
return accountNode, nil
}

func (hph *HexPatriciaHashed) nCellsInRow(row int) int {
func (hph *HexPatriciaHashed) nCellsInRow(row int) int { //nolint:unused
count := 0
for col := 0; col < 16; col++ {
c := &hph.grid[row][col]
Expand Down Expand Up @@ -1260,7 +1260,7 @@ func (hph *HexPatriciaHashed) ToTrie(hashedKey []byte, codeReads map[libcommon.H
return nil, err
}
storageValueNode := trie.ValueNode(storageUpdate.Storage[:storageUpdate.StorageLen])
nextNode = &storageValueNode
nextNode = &storageValueNode //nolint:ineffassign, wastedassign
break
} else if cellToExpand.accountAddrLen > 0 { // account cell
accNode, err := hph.createAccountNode(cellToExpand, row, hashedKey, codeReads)
Expand Down Expand Up @@ -1296,7 +1296,7 @@ func (hph *HexPatriciaHashed) ToTrie(hashedKey []byte, codeReads map[libcommon.H
fullNode.Children[currentNibble] = nextNode // ready to expand next nibble in the path
} else if accNode, ok := currentNode.(*trie.AccountNode); ok {
if len(hashedKey) <= 64 { // no storage, stop here
nextNode = nil
nextNode = nil // nolint:ineffassign, wastedassign
break
}
// there is storage so we need to expand further
Expand Down Expand Up @@ -2634,7 +2634,7 @@ func (hph *HexPatriciaHashed) HashAndNibblizeKey(key []byte) []byte {
return nibblized
}

func nibblize(key []byte) []byte {
func nibblize(key []byte) []byte { // nolint:unused
nibblized := make([]byte, len(key)*2)
for i, b := range key {
nibblized[i*2] = (b >> 4) & 0xf
Expand Down
1 change: 1 addition & 0 deletions erigon-lib/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ require (
github.com/spaolacci/murmur3 v1.1.0
github.com/stretchr/testify v1.9.0
github.com/tidwall/btree v1.6.0
github.com/ugorji/go/codec v1.2.12
go.uber.org/mock v0.5.0
golang.org/x/crypto v0.29.0
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c
Expand Down
2 changes: 2 additions & 0 deletions erigon-lib/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,8 @@ github.com/tklauser/go-sysconf v0.3.14 h1:g5vzr9iPFFz24v2KZXs/pvpvh8/V9Fw6vQK5ZZ
github.com/tklauser/go-sysconf v0.3.14/go.mod h1:1ym4lWMLUOhuBOPGtRcJm7tEGX4SCYNEEEtghGG/8uY=
github.com/tklauser/numcpus v0.8.0 h1:Mx4Wwe/FjZLeQsK/6kt2EOepwwSl7SmJrK5bV/dXYgY=
github.com/tklauser/numcpus v0.8.0/go.mod h1:ZJZlAY+dmR4eut8epnzf0u/VwodKmryxR8txiloSqBE=
github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=
github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
github.com/willf/bitset v1.1.9/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
github.com/willf/bitset v1.1.10/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
Expand Down
1 change: 1 addition & 0 deletions erigon-lib/trie/retain_list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ func FakePreimage(hash libcommon.Hash) libcommon.Hash {
// especially useful for tests which want to manually manipulate the hash
// databases without worrying about generating and tracking pre-images.
func NewManualProofRetainer(t *testing.T, acc *accounts.Account, rl *RetainList, keys [][]byte) *DefaultProofRetainer {
t.Helper()
var accHexKey []byte
var storageKeys []libcommon.Hash
var storageHexKeys [][]byte
Expand Down
75 changes: 0 additions & 75 deletions erigon-lib/trie/trie_transform.go

This file was deleted.

2 changes: 1 addition & 1 deletion erigon-lib/trie/witness.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func NewWitnessFromReader(input io.Reader, trace bool) (*Witness, error) {
if trace {
fmt.Println("end of read ***** ")
}
if err != nil && err != io.EOF {
if err != nil && !errors.Is(err, io.EOF) {
return nil, err
}

Expand Down
2 changes: 1 addition & 1 deletion erigon-lib/trie/witness_operators.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ type OperatorHash struct {

func (o *OperatorHash) WriteTo(output *OperatorMarshaller) error {
if err := output.WriteOpCode(OpHash); err != nil {
return nil
return err
}
return output.WriteHash(o.Hash)
}
Expand Down

0 comments on commit 9b78454

Please sign in to comment.