Skip to content

Commit

Permalink
increase init back off time
Browse files Browse the repository at this point in the history
  • Loading branch information
buddh0 committed Mar 3, 2025
1 parent 80b3a95 commit ab82c97
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions consensus/parlia/parlia.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ const (
validatorBytesLength = common.AddressLength + types.BLSPublicKeyLength
validatorNumberSize = 1 // Fixed number of extra prefix bytes reserved for validator number after Luban

wiggleTime = uint64(1000) // milliseconds, Random delay (per signer) to allow concurrent signers
initialBackOffTime = uint64(1000) // milliseconds, Default backoff time for the second validator permitted to produce blocks
wiggleTime = uint64(1000) // milliseconds, Random delay (per signer) to allow concurrent signers
defaultInitialBackOffTime = uint64(1000) // milliseconds, Default backoff time for the second validator permitted to produce blocks
lorentzInitialBackOffTime = uint64(2000) // milliseconds, Backoff time for the second validator permitted to produce blocks from the Lorentz hard fork

systemRewardPercent = 4 // it means 1/2^4 = 1/16 percentage of gas fee incoming will be distributed to system

Expand Down Expand Up @@ -2129,7 +2130,10 @@ func (p *Parlia) backOffTime(snap *Snapshot, header *types.Header, val common.Ad
log.Debug("backOffTime", "blockNumber", header.Number, "in turn validator", val)
return 0
} else {
delay := initialBackOffTime
delay := defaultInitialBackOffTime
if p.chainConfig.IsLorentz(header.Number, header.Time) {
delay = lorentzInitialBackOffTime
}
validators := snap.validators()
if p.chainConfig.IsPlanck(header.Number) {
counts := snap.countRecents()
Expand Down Expand Up @@ -2194,6 +2198,9 @@ func (p *Parlia) backOffTime(snap *Snapshot, header *types.Header, val common.Ad
backOffSteps[i], backOffSteps[j] = backOffSteps[j], backOffSteps[i]
})

if delay == 0 && p.chainConfig.IsLorentz(header.Number, header.Time) && backOffSteps[idx] > 0 {
return lorentzInitialBackOffTime + (backOffSteps[idx]-1)*wiggleTime
}
delay += backOffSteps[idx] * wiggleTime
return delay
}
Expand Down

0 comments on commit ab82c97

Please sign in to comment.