hotstuff
hotstuff copied to clipboard
Configuring the Synchronizer's view duration
We currently do something like this (in other code):
var sync modules.Synchronizer
if opts.GetLeaderRotation() == "fixed" {
// fixed leader rotation uses the fixed view duration synchronizer
sync = synchronizer.New(synchronizer.NewFixedViewDuration(opts.GetInitialTimeout().AsDuration()))
} else {
sync = synchronizer.New(synchronizer.NewViewDuration(
uint64(opts.GetTimeoutSamples()),
float64(opts.GetInitialTimeout().AsDuration().Nanoseconds())/float64(time.Millisecond),
float64(opts.GetMaxTimeout().AsDuration().Nanoseconds())/float64(time.Millisecond),
float64(opts.GetTimeoutMultiplier()),
))
}
Perhaps a better design would be to augment the LeaderRotation
interface with a method that returns a ViewDuration
that fits the specific leader rotation approach. But I'm not sure if it is easy to configure the leader rotation approach with the appropriate timeout values. Opening this issue to discuss and think more about this.
Alternatively, the LeaderRotation
interface could return a Synchronizer
directly.