Skip to content

Commit

Permalink
Adding logs of disqualified nodes during DKG (#1058)
Browse files Browse the repository at this point in the history
* Adding logs of disqualified nodes during DKG
* adding index to echoBroadcast reception logs
  • Loading branch information
AnomalRoil committed Sep 6, 2022
1 parent 12c12d5 commit 44c1117
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core/broadcast.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func (b *echoBroadcast) BroadcastDKG(c context.Context, p *drand.DKGPacket) (*dr
}

b.l.Debugw("", "echoBroadcast",
"received new packet to echoBroadcast", "from", addr, "type", fmt.Sprintf("%T", dkgPacket))
"received new packet to echoBroadcast", "from", addr, "index", dkgPacket.Index(), "type", fmt.Sprintf("%T", dkgPacket))
b.sendout(hash, dkgPacket, false) // we're using the rate limiting
b.passToApplication(dkgPacket)
return new(drand.Empty), nil
Expand Down
7 changes: 7 additions & 0 deletions core/drand_beacon.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,18 @@ func (bp *BeaconProcess) WaitDKG() (*key.Group, error) {
// filter the nodes that are not present in the target group
var qualNodes []*key.Node
for _, node := range bp.dkgInfo.target.Nodes {
found := false
for _, qualNode := range res.Result.QUAL {
if qualNode.Index == node.Index {
qualNodes = append(qualNodes, node)
found = true
break
}
}

if !found {
bp.log.Debugw("disqualified node during DKG", "node", node)
}
}

s := key.Share(*res.Result.Key)
Expand Down
2 changes: 1 addition & 1 deletion core/drand_beacon_control.go
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,7 @@ func (bp *BeaconProcess) getPhaser(timeout uint32) *dkg.TimePhaser {
logger := bp.log
return dkg.NewTimePhaserFunc(func(phase dkg.Phase) {
bp.opts.clock.Sleep(tDuration)
logger.Debugw("", "phaser_finished", phase)
logger.Debugw("phaser timeout", "phaser_finished", phase)
})
}

Expand Down
5 changes: 3 additions & 2 deletions core/drand_beacon_public.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ func (bp *BeaconProcess) BroadcastDKG(c context.Context, in *drand.DKGPacket) (*
bp.state.Lock()
defer bp.state.Unlock()

addr := net.RemoteAddress(c)

if bp.dkgInfo == nil {
return nil, errors.New("drand: no dkg running")
return nil, fmt.Errorf("drand: no dkg running and yet received a DKGPacket for beacon %s from node %s", bp.beaconID, addr)
}
addr := net.RemoteAddress(c)

if !bp.dkgInfo.started {
bp.log.Infow("", "init_dkg", "START DKG",
Expand Down

0 comments on commit 44c1117

Please sign in to comment.