mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-25 21:17:16 +00:00
Enable prealloc linter (#607)
This commit is contained in:
parent
e40691a4ad
commit
3b0c5f75f8
@ -23,7 +23,7 @@ linters:
|
||||
- bodyclose # go1.18
|
||||
- gosec
|
||||
# - forcetypeassert
|
||||
# - prealloc
|
||||
- prealloc
|
||||
# - contextcheck
|
||||
# - goerr113
|
||||
# - revive
|
||||
|
@ -1426,8 +1426,7 @@ func (cvt *CommitmentValTransform) commitmentValTransform(val, transValBuf commi
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var transAccountPks [][]byte
|
||||
var transStoragePks [][]byte
|
||||
transAccountPks := make([][]byte, 0, len(accountPlainKeys))
|
||||
var apkBuf, spkBuf []byte
|
||||
for _, accountPlainKey := range accountPlainKeys {
|
||||
if len(accountPlainKey) == length.Addr {
|
||||
@ -1463,6 +1462,8 @@ func (cvt *CommitmentValTransform) commitmentValTransform(val, transValBuf commi
|
||||
}
|
||||
transAccountPks = append(transAccountPks, accountPlainKey)
|
||||
}
|
||||
|
||||
transStoragePks := make([][]byte, 0, len(storagePlainKeys))
|
||||
for _, storagePlainKey := range storagePlainKeys {
|
||||
if len(storagePlainKey) == length.Addr+length.Hash {
|
||||
// Non-optimised key originating from a database record
|
||||
|
@ -141,7 +141,7 @@ func Test_BinPatriciaTrie_EmptyState(t *testing.T) {
|
||||
}
|
||||
|
||||
func renderUpdates(branchNodeUpdates map[string]BranchData) {
|
||||
var keys []string
|
||||
keys := make([]string, 0, len(branchNodeUpdates))
|
||||
for key := range branchNodeUpdates {
|
||||
keys = append(keys, key)
|
||||
}
|
||||
|
@ -487,7 +487,7 @@ func (ub *UpdateBuilder) DeleteStorage(addr string, loc string) *UpdateBuilder {
|
||||
// 2. Corresponding hashed keys
|
||||
// 3. Corresponding updates
|
||||
func (ub *UpdateBuilder) Build() (plainKeys, hashedKeys [][]byte, updates []Update) {
|
||||
var hashed []string
|
||||
hashed := make([]string, 0, len(ub.keyset)+len(ub.keyset2))
|
||||
preimages := make(map[string][]byte)
|
||||
preimages2 := make(map[string][]byte)
|
||||
keccak := sha3.NewLegacyKeccak256()
|
||||
|
@ -1003,8 +1003,8 @@ func (c *CompressorSequential) optimiseCodes() error {
|
||||
}
|
||||
//fmt.Printf("[comp] depth=%d, code=[%b], pattern=[%x]\n", p.depth, p.code, p.word)
|
||||
}
|
||||
var positionList PositionList
|
||||
pos2code := make(map[uint64]*Position)
|
||||
positionList := make(PositionList, 0, len(c.posMap))
|
||||
pos2code := make(map[uint64]*Position, len(c.posMap))
|
||||
for pos, uses := range c.posMap {
|
||||
p := &Position{pos: pos, uses: uses, code: pos, codeBits: 0}
|
||||
positionList = append(positionList, p)
|
||||
|
@ -500,7 +500,7 @@ func (c *Coherent) evictRoots() {
|
||||
return
|
||||
}
|
||||
to := c.latestViewID - ViewID(c.cfg.KeepViews)
|
||||
var toDel []ViewID
|
||||
toDel := make([]ViewID, 0, len(c.roots))
|
||||
for txID := range c.roots {
|
||||
if txID > to {
|
||||
continue
|
||||
|
Loading…
Reference in New Issue
Block a user