drand / drand

🎲 A Distributed Randomness Beacon Daemon - Go implementation

Home Page:https://drand.love

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Logger node id is not properly reset during resharing

AnomalRoil opened this issue · comments

We're changing the node's id in the logger during resharing:

bp.log = bp.opts.logger.Named(bp.priv.Public.Addr).Named(bp.getBeaconID()).Named(fmt.Sprint(bp.index))

(we're actually changing it a bit too early, since we change it prior to transition... but that's not the main issue), but we are not changing this logger, which is also passed to the SyncManager nor the one in the discrepancy logger passed here, which means we probably get mangled logs until the next time the node restarts after a ceremony

Originally posted by @AnomalRoil in #1173 (comment)

Also related, the other stores that have now logs need updates as well:
#1173 (comment)

Proposal by Florin would be:

Currently, the logger has a bit of a race condition, which we avoid with properly placed locks, for now. But it doesn't necessarily feel like the right solution.

One approach I see as a solution for this would be to stop the ChainStore and SyncManager and restart them when the values change. That way there is no risk of fixing this problem but leaving other problems lingering, masked by what would seemingly work as expected.

This solution has the advantage of not using locks or adding even more to an already lock-heavy area.