Skip to content

Commit

Permalink
fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
shotasilagadzetaal committed Feb 13, 2025
1 parent c66acd4 commit 62e0fd0
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 34 deletions.
3 changes: 1 addition & 2 deletions erigon-lib/commitment/hex_patricia_hashed.go
Original file line number Diff line number Diff line change
Expand Up @@ -2666,7 +2666,7 @@ func (p *ParallelPatriciaHashed) RootTrie() *HexPatriciaHashed {

func (p *ParallelPatriciaHashed) foldNibble(nib int) error {
// prevbyte - can we avoid it?
c, d, err := p.mounts[nib].foldMounted(int(nib))
c, d, err := p.mounts[nib].foldMounted(nib)
if err != nil {
return err
}
Expand Down Expand Up @@ -2772,7 +2772,6 @@ func (t *Updates) ParallelHashSort(ctx context.Context, pph *ParallelPatriciaHas
for n := 0; n < len(t.nibbles); n++ {
nib := t.nibbles[n]
phnib := pph.mounts[n]
n = n

//g.Go(func() error {
//n = n
Expand Down
64 changes: 32 additions & 32 deletions erigon-lib/state/domain_shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,7 @@ func (sd *SharedDomains) Tx() kv.Tx { return sd.roTx }

type ConcurrentSDCommitmentContext struct {
*SharedDomainsCommitmentContext
trie *commitment.ParallelPatriciaHashed
// trie *commitment.ParallelPatriciaHashed
accMu sync.Mutex // since code domain is queried during fetching account data, code is also behind this mutex
stoMu sync.Mutex
comMu sync.RWMutex
Expand Down Expand Up @@ -1151,43 +1151,43 @@ func (ctx *ConcurrentSDCommitmentContext) Storage(plainKey []byte) (u *commitmen

func (ctx *ConcurrentSDCommitmentContext) ComputeCommitment(ct context.Context, saveState bool, blockNum uint64, logPrefix string) (rootHash []byte, err error) {
panic("nope")
if dbg.DiscardCommitment() {
ctx.updates.Reset()
return nil, nil
}
ctx.ResetBranchCache()
defer ctx.ResetBranchCache()
// if dbg.DiscardCommitment() {
// ctx.updates.Reset()
// return nil, nil
// }
// ctx.ResetBranchCache()
// defer ctx.ResetBranchCache()

mxCommitmentRunning.Inc()
defer mxCommitmentRunning.Dec()
defer func(s time.Time) { mxCommitmentTook.ObserveDuration(s) }(time.Now())
// mxCommitmentRunning.Inc()
// defer mxCommitmentRunning.Dec()
// defer func(s time.Time) { mxCommitmentTook.ObserveDuration(s) }(time.Now())

updateCount := ctx.updates.Size()
if ctx.sharedDomains.trace {
defer ctx.sharedDomains.logger.Trace("ComputeCommitment", "block", blockNum, "keys", updateCount, "mode", ctx.updates.Mode())
}
if updateCount == 0 {
rootHash, err = ctx.patriciaTrie.RootHash()
return rootHash, err
}
// updateCount := ctx.updates.Size()
// if ctx.sharedDomains.trace {
// defer ctx.sharedDomains.logger.Trace("ComputeCommitment", "block", blockNum, "keys", updateCount, "mode", ctx.updates.Mode())
// }
// if updateCount == 0 {
// rootHash, err = ctx.patriciaTrie.RootHash()
// return rootHash, err
// }

// data accessing functions should be set when domain is opened/shared context updated
ctx.trie.SetTrace(ctx.sharedDomains.trace)
ctx.Reset()
// // data accessing functions should be set when domain is opened/shared context updated
// ctx.trie.SetTrace(ctx.sharedDomains.trace)
// ctx.Reset()

rootHash, err = ctx.trie.Process(ct, ctx.updates, logPrefix)
if err != nil {
return nil, err
}
ctx.justRestored.Store(false)
// rootHash, err = ctx.trie.Process(ct, ctx.updates, logPrefix)
// if err != nil {
// return nil, err
// }
// ctx.justRestored.Store(false)

if saveState {
if err := ctx.storeCommitmentState(blockNum, rootHash); err != nil {
return nil, err
}
}
// if saveState {
// if err := ctx.storeCommitmentState(blockNum, rootHash); err != nil {
// return nil, err
// }
// }

return rootHash, err
// return rootHash, err
}

type SharedDomainsCommitmentContext struct {
Expand Down

0 comments on commit 62e0fd0

Please sign in to comment.