From 1a009e3769e816abdaa4cbfff8fdb2af3a7852d9 Mon Sep 17 00:00:00 2001 From: Cassandra Heart Date: Fri, 29 Sep 2023 03:05:30 -0500 Subject: [PATCH] resolve state transition error log noise --- .../consensus/ceremony/broadcast_messaging.go | 4 +- .../application/ceremony_application.go | 60 +++++++++++++++++++ 2 files changed, 62 insertions(+), 2 deletions(-) diff --git a/node/consensus/ceremony/broadcast_messaging.go b/node/consensus/ceremony/broadcast_messaging.go index 27f7e28..1d8c872 100644 --- a/node/consensus/ceremony/broadcast_messaging.go +++ b/node/consensus/ceremony/broadcast_messaging.go @@ -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{} diff --git a/node/execution/ceremony/application/ceremony_application.go b/node/execution/ceremony/application/ceremony_application.go index 9e75c85..a3384e7 100644 --- a/node/execution/ceremony/application/ceremony_application.go +++ b/node/execution/ceremony/application/ceremony_application.go @@ -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") }