Skip to content

Commit

Permalink
consensus, core/rawdb, miner: downgrade logs (#1662)
Browse files Browse the repository at this point in the history
  • Loading branch information
weiihann committed May 31, 2023
1 parent b8dbf59 commit e802c73
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
12 changes: 7 additions & 5 deletions consensus/parlia/parlia.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ var (
errBlockHashInconsistent = errors.New("the block hash is inconsistent")

// errUnauthorizedValidator is returned if a header is signed by a non-authorized entity.
errUnauthorizedValidator = errors.New("unauthorized validator")
errUnauthorizedValidator = func(val string) error {
return errors.New("unauthorized validator: " + val)
}

// errCoinBaseMisMatch is returned if a header's coinbase do not match with signature
errCoinBaseMisMatch = errors.New("coinbase do not match with signature")
Expand Down Expand Up @@ -773,7 +775,7 @@ func (p *Parlia) verifySeal(chain consensus.ChainHeaderReader, header *types.Hea
}

if _, ok := snap.Validators[signer]; !ok {
return errUnauthorizedValidator
return errUnauthorizedValidator(signer.String())
}

if snap.SignRecently(signer) {
Expand Down Expand Up @@ -1319,7 +1321,7 @@ func (p *Parlia) Seal(chain consensus.ChainHeaderReader, block *types.Block, res

// Bail out if we're unauthorized to sign a block
if _, authorized := snap.Validators[val]; !authorized {
return errUnauthorizedValidator
return errUnauthorizedValidator(val.String())
}

// If we're amongst the recent signers, wait for the next block
Expand Down Expand Up @@ -1429,7 +1431,7 @@ func (p *Parlia) SignRecently(chain consensus.ChainReader, parent *types.Block)

// Bail out if we're unauthorized to sign a block
if _, authorized := snap.Validators[p.val]; !authorized {
return true, errUnauthorizedValidator
return true, errUnauthorizedValidator(p.val.String())
}

return snap.SignRecently(p.val), nil
Expand Down Expand Up @@ -1869,7 +1871,7 @@ func (p *Parlia) backOffTime(snap *Snapshot, header *types.Header, val common.Ad
}
}
if idx < 0 {
log.Info("The validator is not authorized", "addr", val)
log.Debug("The validator is not authorized", "addr", val)
return 0
}

Expand Down
2 changes: 1 addition & 1 deletion consensus/parlia/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ func (s *Snapshot) apply(headers []*types.Header, chain consensus.ChainHeaderRea
return nil, err
}
if _, ok := snap.Validators[validator]; !ok {
return nil, errUnauthorizedValidator
return nil, errUnauthorizedValidator(validator.String())
}
for _, recent := range snap.Recents {
if recent == validator {
Expand Down
2 changes: 1 addition & 1 deletion core/rawdb/chain_iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ func unindexTransactions(db ethdb.Database, from uint64, to uint64, interrupt ch
case <-interrupt:
log.Debug("Transaction unindexing interrupted", "blocks", blocks, "txs", txs, "tail", to, "elapsed", common.PrettyDuration(time.Since(start)))
default:
log.Info("Unindexed transactions", "blocks", blocks, "txs", txs, "tail", to, "elapsed", common.PrettyDuration(time.Since(start)))
log.Debug("Unindexed transactions", "blocks", blocks, "txs", txs, "tail", to, "elapsed", common.PrettyDuration(time.Since(start)))
}
}

Expand Down
2 changes: 1 addition & 1 deletion miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ func (w *worker) newWorkLoop(recommit time.Duration) {
if p, ok := w.engine.(*parlia.Parlia); ok {
signedRecent, err := p.SignRecently(w.chain, head.Block)
if err != nil {
log.Info("Not allowed to propose block", "err", err)
log.Debug("Not allowed to propose block", "err", err)
continue
}
if signedRecent {
Expand Down

0 comments on commit e802c73

Please sign in to comment.