Fix log levels (#3058)

pull/3061/head
Rongjian Lan 5 years ago committed by GitHub
parent 3c6b574b08
commit e85c1f3064
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      api/service/syncing/downloader/client.go
  2. 2
      api/service/syncing/syncing.go
  3. 2
      consensus/consensus_service.go
  4. 10
      consensus/leader.go
  5. 2
      consensus/threshold.go
  6. 4
      consensus/validator.go
  7. 4
      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") utils.Logger().Error().Err(err).Str("ip", ip).Msg("[SYNC] client.go:ClientSetup fail to dial")
return nil 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) client.dlClient = pb.NewDownloaderClient(client.conn)
return &client return &client
} }

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

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

@ -164,7 +164,7 @@ func (consensus *Consensus) onPrepare(msg *msg_pb.Message) {
logger = logger.With(). logger = logger.With().
Int64("NumReceivedSoFar", consensus.Decider.SignersCount(quorum.Prepare)). Int64("NumReceivedSoFar", consensus.Decider.SignersCount(quorum.Prepare)).
Int64("PublicKeys", consensus.Decider.ParticipantsCount()).Logger() 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( if _, err := consensus.Decider.SubmitVote(
quorum.Prepare, validatorPubKey, quorum.Prepare, validatorPubKey,
&sign, recvMsg.BlockHash, &sign, recvMsg.BlockHash,
@ -224,7 +224,7 @@ func (consensus *Consensus) onCommit(msg *msg_pb.Message) {
// Must have the corresponding block to verify committed message. // Must have the corresponding block to verify committed message.
blockObj := consensus.FBFTLog.GetBlockByHash(recvMsg.BlockHash) blockObj := consensus.FBFTLog.GetBlockByHash(recvMsg.BlockHash)
if blockObj == nil { if blockObj == nil {
consensus.getLogger().Debug(). consensus.getLogger().Info().
Uint64("blockNum", recvMsg.BlockNum). Uint64("blockNum", recvMsg.BlockNum).
Uint64("viewID", recvMsg.ViewID). Uint64("viewID", recvMsg.ViewID).
Str("blockHash", recvMsg.BlockHash.Hex()). Str("blockHash", recvMsg.BlockHash.Hex()).
@ -246,7 +246,7 @@ func (consensus *Consensus) onCommit(msg *msg_pb.Message) {
logger = logger.With(). logger = logger.With().
Int64("numReceivedSoFar", consensus.Decider.SignersCount(quorum.Commit)). Int64("numReceivedSoFar", consensus.Decider.SignersCount(quorum.Commit)).
Logger() Logger()
logger.Info().Msg("[OnCommit] Received new commit message") logger.Debug().Msg("[OnCommit] Received new commit message")
if _, err := consensus.Decider.SubmitVote( if _, err := consensus.Decider.SubmitVote(
quorum.Commit, validatorPubKey, quorum.Commit, validatorPubKey,
@ -266,14 +266,14 @@ func (consensus *Consensus) onCommit(msg *msg_pb.Message) {
if !quorumWasMet && quorumIsMet { if !quorumWasMet && quorumIsMet {
logger.Info().Msg("[OnCommit] 2/3 Enough commits received") logger.Info().Msg("[OnCommit] 2/3 Enough commits received")
go func(viewID uint64) { go func(viewID uint64) {
consensus.getLogger().Debug().Msg("[OnCommit] Starting Grace Period") consensus.getLogger().Info().Msg("[OnCommit] Starting Grace Period")
// Always wait for 2 seconds as minimum grace period // Always wait for 2 seconds as minimum grace period
time.Sleep(2 * time.Second) time.Sleep(2 * time.Second)
if n := time.Now(); n.Before(consensus.NextBlockDue) { if n := time.Now(); n.Before(consensus.NextBlockDue) {
// Sleep to wait for the full block time // Sleep to wait for the full block time
time.Sleep(consensus.NextBlockDue.Sub(n)) time.Sleep(consensus.NextBlockDue.Sub(n))
} }
logger.Debug().Msg("[OnCommit] Commit Grace Period Ended") logger.Info().Msg("[OnCommit] Commit Grace Period Ended")
consensus.commitFinishChan <- viewID consensus.commitFinishChan <- viewID
}(consensus.viewID) }(consensus.viewID)

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

@ -299,7 +299,7 @@ func (consensus *Consensus) onCommitted(msg *msg_pb.Message) {
consensus.commitBitmap = mask consensus.commitBitmap = mask
if recvMsg.BlockNum-consensus.blockNum > consensusBlockNumBuffer { 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() { go func() {
select { select {
case consensus.BlockNumLowChan <- struct{}{}: case consensus.BlockNumLowChan <- struct{}{}:
@ -315,7 +315,7 @@ func (consensus *Consensus) onCommitted(msg *msg_pb.Message) {
consensus.tryCatchup() consensus.tryCatchup()
if consensus.current.Mode() == ViewChanging { 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 return
} }

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

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

@ -96,7 +96,7 @@ func (node *Node) ProcessCrossLinkMessage(msgPayload []byte) {
} }
if _, ok := existingCLs[cl.Hash()]; ok { 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", 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()) node.Blockchain().CurrentHeader().Epoch(), cl.Number(), cl.Epoch(), cl.ShardID())
continue continue
@ -104,7 +104,7 @@ func (node *Node) ProcessCrossLinkMessage(msgPayload []byte) {
exist, err := node.Blockchain().ReadCrossLink(cl.ShardID(), cl.Number().Uint64()) exist, err := node.Blockchain().ReadCrossLink(cl.ShardID(), cl.Number().Uint64())
if err == nil && exist != nil { 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()) 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 continue
} }

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

@ -118,7 +118,7 @@ func (node *Node) ExplorerMessageHandler(payload []byte) {
// AddNewBlockForExplorer add new block for explorer. // AddNewBlockForExplorer add new block for explorer.
func (node *Node) AddNewBlockForExplorer(block *types.Block) { 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 _, err := node.Blockchain().InsertChain([]*types.Block{block}, true); err == nil {
if len(block.Header().ShardState()) > 0 { if len(block.Header().ShardState()) > 0 {
node.Consensus.UpdateConsensusInformation() node.Consensus.UpdateConsensusInformation()
@ -165,7 +165,8 @@ func (node *Node) GetTransactionsHistory(address, txType, order string) ([]commo
key := explorer.GetAddressKey(address) key := explorer.GetAddressKey(address)
bytes, err := explorer.GetStorageInstance(node.SelfPeer.IP, node.SelfPeer.Port, false).GetDB().Get([]byte(key), nil) bytes, err := explorer.GetStorageInstance(node.SelfPeer.IP, node.SelfPeer.Port, false).GetDB().Get([]byte(key), nil)
if err != 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 return make([]common.Hash, 0), nil
} }
if err = rlp.DecodeBytes(bytes, &addressData); err != 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) key := explorer.GetAddressKey(address)
bytes, err := explorer.GetStorageInstance(node.SelfPeer.IP, node.SelfPeer.Port, false).GetDB().Get([]byte(key), nil) bytes, err := explorer.GetStorageInstance(node.SelfPeer.IP, node.SelfPeer.Port, false).GetDB().Get([]byte(key), nil)
if err != 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 return make([]common.Hash, 0), nil
} }
if err = rlp.DecodeBytes(bytes, &addressData); err != 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() { for node.Consensus != nil && node.Consensus.IsLeader() {
time.Sleep(SleepPeriod) time.Sleep(SleepPeriod)
utils.Logger().Debug(). utils.Logger().Info().
Uint64("blockNum", node.Blockchain().CurrentBlock().NumberU64()+1). Uint64("blockNum", node.Blockchain().CurrentBlock().NumberU64()+1).
Msg("PROPOSING NEW BLOCK ------------------------------------------------") Msg("PROPOSING NEW BLOCK ------------------------------------------------")
@ -56,7 +56,7 @@ func (node *Node) WaitForConsensusReadyV2(readySignal chan struct{}, stopChan ch
err = node.Blockchain().Validator().ValidateHeader(newBlock, true) err = node.Blockchain().Validator().ValidateHeader(newBlock, true)
if err == nil { if err == nil {
utils.Logger().Debug(). utils.Logger().Info().
Uint64("blockNum", newBlock.NumberU64()). Uint64("blockNum", newBlock.NumberU64()).
Uint64("epoch", newBlock.Epoch().Uint64()). Uint64("epoch", newBlock.Epoch().Uint64()).
Uint64("viewID", newBlock.Header().ViewID().Uint64()). Uint64("viewID", newBlock.Header().ViewID().Uint64()).
@ -197,7 +197,7 @@ func (node *Node) proposeNewBlock() (*types.Block, error) {
crossLinksToPropose = append(crossLinksToPropose, pending) crossLinksToPropose = append(crossLinksToPropose, pending)
} }
utils.Logger().Debug(). utils.Logger().Info().
Msgf("[proposeNewBlock] Proposed %d crosslinks from %d pending crosslinks", Msgf("[proposeNewBlock] Proposed %d crosslinks from %d pending crosslinks",
len(crossLinksToPropose), len(allPending), len(crossLinksToPropose), len(allPending),
) )

Loading…
Cancel
Save