cherrypick log level change

pull/3068/head
Rongjian Lan 5 years ago committed by Leo Chen
parent e442b523d1
commit 819500aa70
  1. 2
      api/service/syncing/downloader/client.go
  2. 2
      api/service/syncing/syncing.go
  3. 2
      consensus/consensus_service.go
  4. 9
      consensus/leader.go
  5. 2
      consensus/threshold.go
  6. 4
      consensus/validator.go
  7. 5
      core/offchain.go
  8. 4
      node/node.go
  9. 4
      node/node_cross_link.go
  10. 4
      node/node_cross_shard.go
  11. 8
      node/node_explorer.go
  12. 6
      node/node_newblock.go

@ -27,7 +27,7 @@ func ClientSetup(ip, port string) *Client {
utils.Logger().Error().Err(err).Str("ip", ip).Msg("[SYNC] client.go:ClientSetup fail to dial")
return nil
}
utils.Logger().Info().Str("ip", ip).Msg("[SYNC] grpc connect successfully")
utils.Logger().Debug().Str("ip", ip).Msg("[SYNC] grpc connect successfully")
client.dlClient = pb.NewDownloaderClient(client.conn)
return &client
}

@ -780,7 +780,7 @@ func (ss *StateSync) SyncLoop(bc *core.BlockChain, worker *worker.Worker, isBeac
isBeacon, bc.ShardID(), otherHeight, currentHeight)
return
}
utils.Logger().Debug().
utils.Logger().Info().
Msgf("[SYNC] Node is OUT OF SYNC (isBeacon: %t, ShardID: %d, otherHeight: %d, currentHeight: %d)",
isBeacon, bc.ShardID(), otherHeight, currentHeight)

@ -93,7 +93,7 @@ func (consensus *Consensus) UpdatePublicKeys(pubKeys []*bls.PublicKey) int64 {
consensus.Decider.UpdateParticipants(pubKeys)
utils.Logger().Info().Msg("My Committee updated")
for i := range pubKeys {
utils.Logger().Info().
utils.Logger().Debug().
Int("index", i).
Str("BLSPubKey", pubKeys[i].SerializeToHexStr()).
Msg("Member")

@ -164,7 +164,7 @@ func (consensus *Consensus) onPrepare(msg *msg_pb.Message) {
logger = logger.With().
Int64("NumReceivedSoFar", consensus.Decider.SignersCount(quorum.Prepare)).
Int64("PublicKeys", consensus.Decider.ParticipantsCount()).Logger()
logger.Info().Msg("[OnPrepare] Received New Prepare Signature")
logger.Debug().Msg("[OnPrepare] Received New Prepare Signature")
if _, err := consensus.Decider.SubmitVote(
quorum.Prepare, validatorPubKey,
&sign, recvMsg.BlockHash,
@ -224,7 +224,7 @@ func (consensus *Consensus) onCommit(msg *msg_pb.Message) {
// Must have the corresponding block to verify committed message.
blockObj := consensus.FBFTLog.GetBlockByHash(recvMsg.BlockHash)
if blockObj == nil {
consensus.getLogger().Debug().
consensus.getLogger().Info().
Uint64("blockNum", recvMsg.BlockNum).
Uint64("viewID", recvMsg.ViewID).
Str("blockHash", recvMsg.BlockHash.Hex()).
@ -246,7 +246,7 @@ func (consensus *Consensus) onCommit(msg *msg_pb.Message) {
logger = logger.With().
Int64("numReceivedSoFar", consensus.Decider.SignersCount(quorum.Commit)).
Logger()
logger.Info().Msg("[OnCommit] Received new commit message")
logger.Debug().Msg("[OnCommit] Received new commit message")
if _, err := consensus.Decider.SubmitVote(
quorum.Commit, validatorPubKey,
@ -267,9 +267,12 @@ func (consensus *Consensus) onCommit(msg *msg_pb.Message) {
quorumIsMet := consensus.Decider.IsQuorumAchieved(quorum.Commit)
if !quorumWasMet && quorumIsMet {
logger.Info().Msg("[OnCommit] 2/3 Enough commits received")
next := consensus.NextBlockDue
consensus.getLogger().Info().Msg("[OnCommit] Starting Grace Period")
time.AfterFunc(2*time.Second, func() {
<-time.After(time.Until(next))
logger.Info().Msg("[OnCommit] Commit Grace Period Ended")
consensus.commitFinishChan <- viewID
})

@ -13,7 +13,7 @@ import (
func (consensus *Consensus) didReachPrepareQuorum() error {
logger := utils.Logger()
logger.Debug().Msg("[OnPrepare] Received Enough Prepare Signatures")
logger.Info().Msg("[OnPrepare] Received Enough Prepare Signatures")
leaderPriKey, err := consensus.GetConsensusLeaderPrivateKey()
if err != nil {
utils.Logger().Warn().Err(err).Msg("[OnPrepare] leader not found")

@ -286,7 +286,7 @@ func (consensus *Consensus) onCommitted(msg *msg_pb.Message) {
consensus.commitBitmap = mask
if recvMsg.BlockNum-consensus.blockNum > consensusBlockNumBuffer {
consensus.getLogger().Debug().Uint64("MsgBlockNum", recvMsg.BlockNum).Msg("[OnCommitted] OUT OF SYNC")
consensus.getLogger().Info().Uint64("MsgBlockNum", recvMsg.BlockNum).Msg("[OnCommitted] OUT OF SYNC")
go func() {
select {
case consensus.BlockNumLowChan <- struct{}{}:
@ -302,7 +302,7 @@ func (consensus *Consensus) onCommitted(msg *msg_pb.Message) {
consensus.tryCatchup()
if consensus.current.Mode() == ViewChanging {
consensus.getLogger().Debug().Msg("[OnCommitted] Still in ViewChanging mode, Exiting!!")
consensus.getLogger().Info().Msg("[OnCommitted] Still in ViewChanging mode, Exiting!!")
return
}

@ -186,10 +186,7 @@ func (bc *BlockChain) CommitOffChainData(
for i, c := uint32(0), shard.Schedule.InstanceForEpoch(
epoch,
).NumShards(); i < c; i++ {
if err := bc.LastContinuousCrossLink(batch, i); err != nil {
utils.Logger().Info().
Err(err).Msg("Could not roll up last continuous crosslink")
}
bc.LastContinuousCrossLink(batch, i)
}
}

@ -225,10 +225,11 @@ func (node *Node) addPendingTransactions(newTxs types.Transactions) []error {
pendingCount, queueCount := node.TxPool.Stats()
utils.Logger().Info().
Interface("err", errs).
Int("length of newTxs", len(newTxs)).
Int("totalPending", pendingCount).
Int("totalQueued", queueCount).
Msg("Got more transactions")
Msg("[addPendingTransactions] Adding more transactions")
return errs
}
@ -276,6 +277,7 @@ func (node *Node) AddPendingTransaction(newTx *types.Transaction) error {
errs := node.addPendingTransactions(types.Transactions{newTx})
for i := range errs {
if errs[i] != nil {
utils.Logger().Info().Err(errs[i]).Msg("[AddPendingTransaction] Failed adding new transaction")
return errs[i]
}
}

@ -96,7 +96,7 @@ func (node *Node) ProcessCrossLinkMessage(msgPayload []byte) {
}
if _, ok := existingCLs[cl.Hash()]; ok {
utils.Logger().Err(err).
utils.Logger().Debug().Err(err).
Msgf("[ProcessingCrossLink] Cross Link already exists in pending queue, pass. Beacon Epoch: %d, Block num: %d, Epoch: %d, shardID %d",
node.Blockchain().CurrentHeader().Epoch(), cl.Number(), cl.Epoch(), cl.ShardID())
continue
@ -104,7 +104,7 @@ func (node *Node) ProcessCrossLinkMessage(msgPayload []byte) {
exist, err := node.Blockchain().ReadCrossLink(cl.ShardID(), cl.Number().Uint64())
if err == nil && exist != nil {
utils.Logger().Err(err).
utils.Logger().Debug().Err(err).
Msgf("[ProcessingCrossLink] Cross Link already exists, pass. Beacon Epoch: %d, Block num: %d, Epoch: %d, shardID %d", node.Blockchain().CurrentHeader().Epoch(), cl.Number(), cl.Epoch(), cl.ShardID())
continue
}

@ -46,7 +46,7 @@ func (node *Node) BroadcastCXReceipts(newBlock *types.Block) {
// BroadcastCXReceiptsWithShardID broadcasts cross shard receipts to given ToShardID
func (node *Node) BroadcastCXReceiptsWithShardID(block *types.Block, commitSig []byte, commitBitmap []byte, toShardID uint32) {
myShardID := node.Consensus.ShardID
utils.Logger().Info().
utils.Logger().Debug().
Uint32("toShardID", toShardID).
Uint32("myShardID", myShardID).
Uint64("blockNum", block.NumberU64()).
@ -54,7 +54,7 @@ func (node *Node) BroadcastCXReceiptsWithShardID(block *types.Block, commitSig [
cxReceipts, err := node.Blockchain().ReadCXReceipts(toShardID, block.NumberU64(), block.Hash())
if err != nil || len(cxReceipts) == 0 {
utils.Logger().Info().Uint32("ToShardID", toShardID).
utils.Logger().Debug().Uint32("ToShardID", toShardID).
Int("numCXReceipts", len(cxReceipts)).
Msg("[CXMerkleProof] No receipts found for the destination shard")
return

@ -118,7 +118,7 @@ func (node *Node) ExplorerMessageHandler(payload []byte) {
// AddNewBlockForExplorer add new block for explorer.
func (node *Node) AddNewBlockForExplorer(block *types.Block) {
utils.Logger().Debug().Uint64("blockHeight", block.NumberU64()).Msg("[Explorer] Adding new block for explorer node")
utils.Logger().Info().Uint64("blockHeight", block.NumberU64()).Msg("[Explorer] Adding new block for explorer node")
if _, err := node.Blockchain().InsertChain([]*types.Block{block}, true); err == nil {
if len(block.Header().ShardState()) > 0 {
node.Consensus.UpdateConsensusInformation()
@ -165,7 +165,8 @@ func (node *Node) GetTransactionsHistory(address, txType, order string) ([]commo
key := explorer.GetAddressKey(address)
bytes, err := explorer.GetStorageInstance(node.SelfPeer.IP, node.SelfPeer.Port, false).GetDB().Get([]byte(key), nil)
if err != nil {
utils.Logger().Error().Err(err).Msg("[Explorer] Cannot get storage db instance")
utils.Logger().Debug().Err(err).
Msgf("[Explorer] Error retrieving transaction history for address %s", address)
return make([]common.Hash, 0), nil
}
if err = rlp.DecodeBytes(bytes, &addressData); err != nil {
@ -197,7 +198,8 @@ func (node *Node) GetStakingTransactionsHistory(address, txType, order string) (
key := explorer.GetAddressKey(address)
bytes, err := explorer.GetStorageInstance(node.SelfPeer.IP, node.SelfPeer.Port, false).GetDB().Get([]byte(key), nil)
if err != nil {
utils.Logger().Error().Err(err).Msg("[Explorer] Cannot get storage db instance")
utils.Logger().Debug().Err(err).
Msgf("[Explorer] Staking transaction history for address %s not found", address)
return make([]common.Hash, 0), nil
}
if err = rlp.DecodeBytes(bytes, &addressData); err != nil {

@ -45,7 +45,7 @@ func (node *Node) WaitForConsensusReadyV2(readySignal chan struct{}, stopChan ch
for node.Consensus != nil && node.Consensus.IsLeader() {
time.Sleep(SleepPeriod)
utils.Logger().Debug().
utils.Logger().Info().
Uint64("blockNum", node.Blockchain().CurrentBlock().NumberU64()+1).
Msg("PROPOSING NEW BLOCK ------------------------------------------------")
@ -56,7 +56,7 @@ func (node *Node) WaitForConsensusReadyV2(readySignal chan struct{}, stopChan ch
err = node.Blockchain().Validator().ValidateHeader(newBlock, true)
if err == nil {
utils.Logger().Debug().
utils.Logger().Info().
Uint64("blockNum", newBlock.NumberU64()).
Uint64("epoch", newBlock.Epoch().Uint64()).
Uint64("viewID", newBlock.Header().ViewID().Uint64()).
@ -197,7 +197,7 @@ func (node *Node) proposeNewBlock() (*types.Block, error) {
crossLinksToPropose = append(crossLinksToPropose, pending)
}
utils.Logger().Debug().
utils.Logger().Info().
Msgf("[proposeNewBlock] Proposed %d crosslinks from %d pending crosslinks",
len(crossLinksToPropose), len(allPending),
)

Loading…
Cancel
Save