resolve state transition error log noise

This commit is contained in:
Cassandra Heart 2023-09-29 03:05:30 -05:00
parent 926e6bba22
commit 1a009e3769
No known key found for this signature in database
GPG Key ID: 6352152859385958
2 changed files with 62 additions and 2 deletions

View File

@ -90,8 +90,8 @@ func (e *CeremonyDataClockConsensusEngine) handleMessage(
}
if err := eg.Wait(); err != nil {
e.logger.Error("rejecting invalid message", zap.Error(err))
return errors.Wrap(err, "execution failed")
e.logger.Debug("rejecting invalid message", zap.Error(err))
return nil
}
any := &anypb.Any{}

View File

@ -710,6 +710,18 @@ func (a *CeremonyApplication) ApplyTransition(
return nil, errors.Wrap(err, "apply transition")
}
if currentFrameNumber < join.FrameNumber {
return nil, errors.Wrap(
errors.New("too recent join"), "apply transition",
)
}
if currentFrameNumber-join.FrameNumber > 10 {
return nil, errors.Wrap(
errors.New("outdated join"), "apply transition",
)
}
if err = a.applyLobbyJoin(join); err != nil {
return nil, errors.Wrap(err, "apply transition")
}
@ -747,6 +759,18 @@ func (a *CeremonyApplication) ApplyTransition(
return nil, errors.Wrap(err, "apply transition")
}
if currentFrameNumber < seenProverAtt.LastSeenFrame {
return nil, errors.Wrap(
errors.New("too recent attestation"), "apply transition",
)
}
if currentFrameNumber-seenProverAtt.LastSeenFrame > 10 {
return nil, errors.Wrap(
errors.New("outdated attestation"), "apply transition",
)
}
if err = a.applySeenProverAttestation(seenProverAtt); err != nil {
return nil, errors.Wrap(err, "apply transition")
}
@ -757,6 +781,18 @@ func (a *CeremonyApplication) ApplyTransition(
return nil, errors.Wrap(err, "apply transition")
}
if currentFrameNumber < droppedProverAtt.LastSeenFrame {
return nil, errors.Wrap(
errors.New("too recent attestation"), "apply transition",
)
}
if currentFrameNumber-droppedProverAtt.LastSeenFrame > 10 {
return nil, errors.Wrap(
errors.New("outdated attestation"), "apply transition",
)
}
if err = a.applyDroppedProverAttestation(droppedProverAtt); err != nil {
return nil, errors.Wrap(err, "apply transition")
}
@ -849,6 +885,18 @@ func (a *CeremonyApplication) ApplyTransition(
return nil, errors.Wrap(err, "apply transition")
}
if currentFrameNumber < seenProverAtt.LastSeenFrame {
return nil, errors.Wrap(
errors.New("too recent attestation"), "apply transition",
)
}
if currentFrameNumber-seenProverAtt.LastSeenFrame > 10 {
return nil, errors.Wrap(
errors.New("outdated attestation"), "apply transition",
)
}
if err = a.applySeenProverAttestation(seenProverAtt); err != nil {
return nil, errors.Wrap(err, "apply transition")
}
@ -859,6 +907,18 @@ func (a *CeremonyApplication) ApplyTransition(
return nil, errors.Wrap(err, "apply transition")
}
if currentFrameNumber < droppedProverAtt.LastSeenFrame {
return nil, errors.Wrap(
errors.New("too recent attestation"), "apply transition",
)
}
if currentFrameNumber-droppedProverAtt.LastSeenFrame > 10 {
return nil, errors.Wrap(
errors.New("outdated attestation"), "apply transition",
)
}
if err = a.applyDroppedProverAttestation(droppedProverAtt); err != nil {
return nil, errors.Wrap(err, "apply transition")
}