Node: Fix reobservation limits (#3177)

This commit is contained in:
bruce-riley 2023-07-11 10:59:15 -05:00 committed by GitHub
parent f8e118d07e
commit 83c5893283
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View File

@ -54,8 +54,10 @@ var (
)
const (
settlementTime = time.Second * 30
retryTime = time.Minute * 5
settlementTime = time.Second * 30
retryTime = time.Minute * 5
retryLimitOurs = time.Hour * 24
retryLimitNotOurs = time.Hour
)
// handleCleanup handles periodic retransmissions and cleanup of observations
@ -138,9 +140,9 @@ func (p *Processor) handleCleanup(ctx context.Context) {
p.logger.Debug("expiring submitted observation", zap.String("digest", hash), zap.Duration("delta", delta))
delete(p.state.signatures, hash)
aggregationStateExpiration.Inc()
case !s.submitted && ((s.ourMsg != nil && s.retryCount >= 14400 /* 120 hours */) || (s.ourMsg == nil && s.retryCount >= 10 /* 5 minutes */)):
case !s.submitted && ((s.ourMsg != nil && delta > retryLimitOurs) || (s.ourMsg == nil && delta > retryLimitNotOurs)):
// Clearly, this horse is dead and continued beatings won't bring it closer to quorum.
p.logger.Info("expiring unsubmitted observation after exhausting retries", zap.String("digest", hash), zap.Duration("delta", delta))
p.logger.Info("expiring unsubmitted observation after exhausting retries", zap.String("digest", hash), zap.Duration("delta", delta), zap.Bool("weObserved", s.ourMsg != nil))
delete(p.state.signatures, hash)
aggregationStateTimeout.Inc()
case !s.submitted && delta.Minutes() >= 5 && time.Since(s.lastRetry) >= retryTime:
@ -161,7 +163,8 @@ func (p *Processor) handleCleanup(ctx context.Context) {
p.logger.Info("resubmitting observation",
zap.String("digest", hash),
zap.Duration("delta", delta),
zap.Uint("retry", s.retryCount))
zap.String("firstObserved", s.firstObserved.String()),
)
req := &gossipv1.ObservationRequest{
ChainId: uint32(s.ourObservation.GetEmitterChain()),
TxHash: s.txHash,
@ -170,7 +173,6 @@ func (p *Processor) handleCleanup(ctx context.Context) {
p.logger.Warn("failed to broadcast re-observation request", zap.Error(err))
}
p.gossipSendC <- s.ourMsg
s.retryCount += 1
s.lastRetry = time.Now()
aggregationStateRetries.Inc()
} else {

View File

@ -55,8 +55,6 @@ type (
settled bool
// Human-readable description of the VAA's source, used for metrics.
source string
// Number of times the cleanup service has attempted to retransmit this VAA.
retryCount uint
// Copy of the bytes we submitted (ourObservation, but signed and serialized). Used for retransmissions.
ourMsg []byte
// The hash of the transaction in which the observation was made. Used for re-observation requests.