@@ -199,8 +199,8 @@ func (cnc *CosignerNonceCache) getUuids(n int) []uuid.UUID {
199
199
}
200
200
201
201
func (cnc * CosignerNonceCache ) target (noncesPerMinute float64 ) int {
202
- // Calculate for 10s window ( nonce expiration period)
203
- activeBlocksPer10s := 20 // (10 seconds / 0.5 second blocks)
202
+ // Calculate for nonce expiration window
203
+ blocksPerExpirationWindow := int ( cnc . nonceExpiration . Seconds () / 0.5 ) // 0.5 second blocks
204
204
205
205
// Nonces needed per block:
206
206
// - 1 for proposal
@@ -209,17 +209,16 @@ func (cnc *CosignerNonceCache) target(noncesPerMinute float64) int {
209
209
// - 1 for vote extension (if enabled)
210
210
noncesPerBlock := 4 // proposal + prevote + precommit + extension
211
211
212
- // Total nonces needed for 10s window with overallocation
213
- activeNoncesPer10s := int (float64 (activeBlocksPer10s ) *
212
+ // Total nonces needed for expiration window with overallocation
213
+ activeNoncesPerWindow := int (float64 (blocksPerExpirationWindow ) *
214
214
float64 (noncesPerBlock ) *
215
- nonceOverallocation ) // Using the standard 1.5 overallocation
215
+ nonceOverallocation )
216
216
217
- // Calculate based on current usage with buffer (adjusted for 10s window)
218
- currentUsageTarget := int ((noncesPerMinute / 6 ) * // Convert per-minute to per-10-seconds
219
- ((cnc .getNoncesInterval .Seconds () * nonceOverallocation ) +
220
- cnc .getNoncesTimeout .Seconds ()))
217
+ // Calculate based on current usage with buffer
218
+ currentUsageTarget := int ((noncesPerMinute / 60 ) *
219
+ ((cnc .getNoncesInterval .Seconds () * nonceOverallocation ) + cnc .getNoncesTimeout .Seconds ()))
221
220
222
- return max (currentUsageTarget , activeNoncesPer10s )
221
+ return max (currentUsageTarget , activeNoncesPerWindow )
223
222
}
224
223
225
224
func (cnc * CosignerNonceCache ) reconcile (ctx context.Context ) {
0 commit comments