Skip to content

Commit dd6d0ee

Browse files
authored
Merge pull request #4348 from harmony-one/main
Merge `main` into `dev`
2 parents d04d850 + 20e4892 commit dd6d0ee

File tree

6 files changed

+20
-3
lines changed

6 files changed

+20
-3
lines changed

consensus/quorum/one-node-staked-vote.go

+3
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ func (v *stakedVoteWeight) IsQuorumAchievedByMask(mask *bls_cosi.Mask) bool {
157157
if currentTotalPower == nil {
158158
return false
159159
}
160+
const msg = "[IsQuorumAchievedByMask] Voting power: need %+v, have %+v"
161+
utils.Logger().Debug().
162+
Msgf(msg, threshold, currentTotalPower)
160163
return (*currentTotalPower).GT(threshold)
161164
}
162165

consensus/quorum/quorum.go

+5
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"github.com/harmony-one/harmony/consensus/votepower"
1313
bls_cosi "github.com/harmony-one/harmony/crypto/bls"
1414
shardingconfig "github.com/harmony-one/harmony/internal/configs/sharding"
15+
"github.com/harmony-one/harmony/internal/utils"
1516
"github.com/harmony-one/harmony/multibls"
1617
"github.com/harmony-one/harmony/numeric"
1718
"github.com/harmony-one/harmony/shard"
@@ -224,6 +225,10 @@ func (s *cIdentities) NthNextHmy(instance shardingconfig.Instance, pubKey *bls.P
224225
idx := s.IndexOf(pubKey.Bytes)
225226
if idx != -1 {
226227
found = true
228+
} else {
229+
utils.Logger().Error().
230+
Str("key", pubKey.Bytes.Hex()).
231+
Msg("[NthNextHmy] pubKey not found")
227232
}
228233
numNodes := instance.NumHarmonyOperatedNodesPerShard()
229234
// sanity check to avoid out of bound access

consensus/view_change.go

+4
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ func (consensus *Consensus) getNextViewID() (uint64, time.Duration) {
142142

143143
// timestamp messed up in current validator node
144144
if curTimestamp <= blockTimestamp {
145+
consensus.getLogger().Error().
146+
Int64("curTimestamp", curTimestamp).
147+
Int64("blockTimestamp", blockTimestamp).
148+
Msg("[getNextViewID] timestamp of block too high")
145149
return consensus.fallbackNextViewID()
146150
}
147151
// diff only increases, since view change timeout is shorter than

consensus/view_change_construct.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,8 @@ func (vc *viewChange) InitPayload(
444444
vc.nilBitmap[viewID] = nilBitmap
445445
}
446446
if err := vc.nilBitmap[viewID].SetKey(key.Pub.Bytes, true); err != nil {
447-
vc.getLogger().Warn().Str("key", key.Pub.Bytes.Hex()).Msg("[InitPayload] nilBitmap setkey failed")
447+
vc.getLogger().Warn().Err(err).
448+
Str("key", key.Pub.Bytes.Hex()).Msg("[InitPayload] nilBitmap setkey failed")
448449
continue
449450
}
450451
if _, ok := vc.nilSigs[viewID]; !ok {
@@ -475,7 +476,8 @@ func (vc *viewChange) InitPayload(
475476
vc.viewIDBitmap[viewID] = viewIDBitmap
476477
}
477478
if err := vc.viewIDBitmap[viewID].SetKey(key.Pub.Bytes, true); err != nil {
478-
vc.getLogger().Warn().Str("key", key.Pub.Bytes.Hex()).Msg("[InitPayload] viewIDBitmap setkey failed")
479+
vc.getLogger().Warn().Err(err).
480+
Str("key", key.Pub.Bytes.Hex()).Msg("[InitPayload] viewIDBitmap setkey failed")
479481
continue
480482
}
481483
if _, ok := vc.viewIDSigs[viewID]; !ok {

core/blockchain_impl.go

+1
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,7 @@ func (bc *BlockChainImpl) ValidateNewBlock(block *types.Block, beaconChain Block
428428
bc, block.Header(),
429429
); err != nil {
430430
utils.Logger().Error().
431+
Uint64("blockNum", block.NumberU64()).
431432
Str("blockHash", block.Hash().Hex()).
432433
Err(err).
433434
Msg("[ValidateNewBlock] Cannot verify vrf for the new block")

core/rawdb/accessors_offchain.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ func ReadShardState(
2121
) (*shard.State, error) {
2222
data, err := db.Get(shardStateKey(epoch))
2323
if err != nil {
24-
return nil, errors.New(MsgNoShardStateFromDB)
24+
return nil, errors.Errorf(
25+
MsgNoShardStateFromDB, "epoch: %d", epoch,
26+
)
2527
}
2628
ss, err2 := shard.DecodeWrapper(data)
2729
if err2 != nil {

0 commit comments

Comments
 (0)