Skip to content

Commit

Permalink
Fixing logs (#921)
Browse files Browse the repository at this point in the history
* Fixing logs

This fixes #914 and fixes #812. (Backport from master)

* Updating to use Kyber with fixed logging in DKG

* Go mod tidy

* Fixing as per Nicolas comments

* Fixing
  • Loading branch information
AnomalRoil committed Mar 24, 2022
1 parent 6405db0 commit d078b6b
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 16 deletions.
26 changes: 17 additions & 9 deletions chain/beacon/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,31 +105,39 @@ func (h *Handler) ProcessPartialBeacon(c context.Context, p *proto.PartialBeacon
}

msg := chain.Message(p.GetRound(), p.GetPreviousSig())
// XXX Remove that evaluation - find another way to show the current dist.
// key being used
shortPub := h.crypto.GetPub().Eval(1).V.String()[14:19]
idx, err := key.Scheme.IndexOf(p.GetPartialSig())
if err != nil || idx < 0 {
return nil, fmt.Errorf("invalid index %d in partial with msg %v", idx, msg)
}
nodeInGroup := h.crypto.GetGroup().Node(uint32(idx))
if nodeInGroup == nil {
return nil, fmt.Errorf("invalid index %d in partial with msg %v", idx, msg)
}
nodeName := nodeInGroup.Identity.Address()
// verify if request is valid
if err := key.Scheme.VerifyPartial(h.crypto.GetPub(), msg, p.GetPartialSig()); err != nil {
h.l.Error("process_partial", addr, "err", err,
h.l.Error("process_partial", addr,
"index", idx,
"err", err,
"prev_sig", shortSigStr(p.GetPreviousSig()),
"curr_round", currentRound,
"msg_sign", shortSigStr(msg),
"short_pub", shortPub)
"from_node", nodeName)
return nil, err
}
idx, _ := key.Scheme.IndexOf(p.GetPartialSig())
h.l.Debug("process_partial_from", addr,
"index", idx,
"prev_sig", shortSigStr(p.GetPreviousSig()),
"curr_round", currentRound, "msg_sign",
shortSigStr(msg), "short_pub", shortPub,
"curr_round", currentRound,
"msg_sign", shortSigStr(msg),
"from_node", nodeName,
"status", "OK")
if idx == h.crypto.Index() {
h.l.Error("process_partial", addr,
"index_got", idx,
"index_our", h.crypto.Index(),
"advance_packet", p.GetRound(),
"pub", shortPub)
"from_node", nodeName)
// XXX error or not ?
return new(proto.Empty), nil
}
Expand Down
4 changes: 2 additions & 2 deletions core/broadcast.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func (b *echoBroadcast) PushDeals(bundle *dkg.DealBundle) {
b.Lock()
defer b.Unlock()
h := hash(bundle.Hash())
b.l.Debug("echoBroadcast", "push", "deal")
b.l.Debug("echoBroadcast", "push", "deal", fmt.Sprintf("%x", h[:5]))
b.sendout(h, bundle, true)
}

Expand All @@ -100,7 +100,7 @@ func (b *echoBroadcast) PushJustifications(bundle *dkg.JustificationBundle) {
b.Lock()
defer b.Unlock()
h := hash(bundle.Hash())
b.l.Debug("echoBroadcast", "push", "justification")
b.l.Debug("echoBroadcast", "push", "justification", fmt.Sprintf("%x", h[:5]))
b.sendout(h, bundle, true)
}

Expand Down
4 changes: 2 additions & 2 deletions core/drand_control.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (d *Drand) leaderRunSetup(newSetup func(d *Drand) (*setupManager, error)) (
// setup the manager
d.state.Lock()
if d.manager != nil {
d.log.Info("reshare", "already_in_progress", "restart", "reshare", "old")
d.log.Info("reshare", "already_in_progress", "reshare", "restart")
d.manager.StopPreemptively()
}
manager, err := newSetup(d)
Expand Down Expand Up @@ -851,7 +851,7 @@ func (d *Drand) StartFollowChain(req *drand.StartFollowRequest, stream drand.Con
cbStore.AddCallback(addr, cb)
defer cbStore.RemoveCallback(addr)
if err := syncer.Follow(ctx, req.GetUpTo(), peers); err != nil {
d.log.Error("start_follow_chain", "syncer_stopped", "err", err, "leaving_sync")
d.log.Error("start_follow_chain", "syncer_stopped", "err", err, "state", "leaving_sync")
return err
}
// wait for all the callbacks to be called and progress sent before returning
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/BurntSushi/toml v0.3.1
github.com/aws/aws-sdk-go v1.32.11
github.com/briandowns/spinner v1.11.1
github.com/drand/kyber v1.1.9
github.com/drand/kyber v1.1.10
github.com/drand/kyber-bls12381 v0.2.1
github.com/go-kit/kit v0.10.0
github.com/gogo/googleapis v1.4.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ github.com/drand/bls12-381 v0.3.2/go.mod h1:dtcLgPtYT38L3NO6mPDYH0nbpc5tjPassDqi
github.com/drand/kyber v1.0.1-0.20200110225416-8de27ed8c0e2/go.mod h1:UpXoA0Upd1N9l4TvRPHr1qAUBBERj6JQ/mnKI3BPEmw=
github.com/drand/kyber v1.0.2/go.mod h1:x6KOpK7avKj0GJ4emhXFP5n7M7W7ChAPmnQh/OL6vRw=
github.com/drand/kyber v1.1.4/go.mod h1:9+IgTq7kadePhZg7eRwSD7+bA+bmvqRK+8DtmoV5a3U=
github.com/drand/kyber v1.1.9 h1:XlKRGLH75of0ehRrX8HSdfcsa1Ld5p5/615Hvq/YCWA=
github.com/drand/kyber v1.1.9/go.mod h1:UkHLsI4W6+jT5PvNxmc0cvQAgppjTUpX+XCsN9TXmRo=
github.com/drand/kyber v1.1.10 h1:nQz5hahL68HDvdtwshZpe/qo3enM8gaL/Ou4Bnkw6iE=
github.com/drand/kyber v1.1.10/go.mod h1:UkHLsI4W6+jT5PvNxmc0cvQAgppjTUpX+XCsN9TXmRo=
github.com/drand/kyber-bls12381 v0.2.0/go.mod h1:zQip/bHdeEB6HFZSU3v+d3cQE0GaBVQw9aR2E7AdoeI=
github.com/drand/kyber-bls12381 v0.2.1 h1:/d5/YAdaCmHpYjF1NZevOEcKGaq6LBbyvkCTIdGqDjs=
github.com/drand/kyber-bls12381 v0.2.1/go.mod h1:JwWn4nHO9Mp4F5qCie5sVIPQZ0X6cw8XAeMRvc/GXBE=
Expand Down

0 comments on commit d078b6b

Please sign in to comment.