Skip to content

Commit

Permalink
Rename from QualityDurationMultiplier to QualityDeltaMultiplier
Browse files Browse the repository at this point in the history
Signed-off-by: Jakub Sztandera <[email protected]>
  • Loading branch information
Kubuxu committed Dec 20, 2024
1 parent c1fb3f8 commit 4d2d802
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion gpbft/gpbft.go
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ func (i *instance) beginQuality() error {
// Broadcast input value and wait to receive from others.
i.current.Phase = QUALITY_PHASE
i.participant.progression.NotifyProgress(i.current)
i.phaseTimeout = i.alarmAfterSynchronyWithMulti(i.participant.qualityDurationMulti)
i.phaseTimeout = i.alarmAfterSynchronyWithMulti(i.participant.qualityDeltaMulti)
i.resetRebroadcastParams()
i.broadcast(i.current.Round, QUALITY_PHASE, i.proposal, false, nil)
metrics.phaseCounter.Add(context.TODO(), 1, metric.WithAttributes(attrQualityPhase))
Expand Down
8 changes: 4 additions & 4 deletions gpbft/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type options struct {
delta time.Duration
deltaBackOffExponent float64

qualityDurationMulti float64
qualityDeltaMulti float64

committeeLookback uint64
maxLookaheadRounds uint64
Expand All @@ -40,7 +40,7 @@ func newOptions(o ...Option) (*options, error) {
opts := &options{
delta: defaultDelta,
deltaBackOffExponent: defaultDeltaBackOffExponent,
qualityDurationMulti: 1.0,
qualityDeltaMulti: 1.0,
committeeLookback: defaultCommitteeLookback,
rebroadcastAfter: defaultRebroadcastAfter,
maxCachedInstances: defaultMaxCachedInstances,
Expand Down Expand Up @@ -85,12 +85,12 @@ func WithDeltaBackOffExponent(e float64) Option {
}
}

func WithQualityDurationMultiplier(m float64) Option {
func WithQualityDeltaMultiplier(m float64) Option {
return func(o *options) error {
if m < 0 {
return errors.New("quality duration multiplier cannot be less than zero")
}
o.qualityDurationMulti = m
o.qualityDeltaMulti = m
return nil
}
}
Expand Down
16 changes: 8 additions & 8 deletions manifest/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var (
DefaultGpbftConfig = GpbftConfig{
Delta: 6 * time.Second,
DeltaBackOffExponent: 2.0,
QualityDurationMultiplier: 1.0,
QualityDeltaMultiplier: 1.0,
MaxLookaheadRounds: 5,
ChainProposedLength: gpbft.ChainDefaultLen,
RebroadcastBackoffBase: 6 * time.Second,
Expand Down Expand Up @@ -99,10 +99,10 @@ func (c *CxConfig) Validate() error {
}

type GpbftConfig struct {
Delta time.Duration
DeltaBackOffExponent float64
QualityDurationMultiplier float64
MaxLookaheadRounds uint64
Delta time.Duration
DeltaBackOffExponent float64
QualityDeltaMultiplier float64
MaxLookaheadRounds uint64

ChainProposedLength int

Expand All @@ -120,8 +120,8 @@ func (g *GpbftConfig) Validate() error {
return fmt.Errorf("gpbft backoff exponent must be at least 1.0, was %f", g.DeltaBackOffExponent)
}

if g.QualityDurationMultiplier < 0 {
return fmt.Errorf("gpbft quality duration multiplier is negative: %f", g.QualityDurationMultiplier)
if g.QualityDeltaMultiplier < 0 {
return fmt.Errorf("gpbft quality duration multiplier is negative: %f", g.QualityDeltaMultiplier)
}

if g.ChainProposedLength < 1 {
Expand All @@ -148,7 +148,7 @@ func (g *GpbftConfig) ToOptions() []gpbft.Option {
return []gpbft.Option{
gpbft.WithDelta(g.Delta),
gpbft.WithDeltaBackOffExponent(g.DeltaBackOffExponent),
gpbft.WithQualityDurationMultiplier(g.QualityDurationMultiplier),
gpbft.WithQualityDeltaMultiplier(g.QualityDeltaMultiplier),
gpbft.WithMaxLookaheadRounds(g.MaxLookaheadRounds),
gpbft.WithRebroadcastBackoff(
DefaultGpbftConfig.RebroadcastBackoffExponent,
Expand Down
2 changes: 1 addition & 1 deletion manifest/manifest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var base = manifest.Manifest{
Gpbft: manifest.GpbftConfig{
Delta: 10,
DeltaBackOffExponent: 1.2,
QualityDurationMultiplier: 1.0,
QualityDeltaMultiplier: 1.0,
MaxLookaheadRounds: 5,
ChainProposedLength: gpbft.ChainDefaultLen,
RebroadcastBackoffBase: 10,
Expand Down

0 comments on commit 4d2d802

Please sign in to comment.