fix: handle total distance comparison bug, reduce log noise

This commit is contained in:
Cassandra Heart 2024-03-16 04:29:20 -05:00
parent ea120d9c31
commit 128ffc020c
No known key found for this signature in database
GPG Key ID: 6352152859385958
3 changed files with 9 additions and 8 deletions

View File

@ -451,8 +451,13 @@ func (e *CeremonyDataClockConsensusEngine) runLoop() {
panic(err) panic(err)
} }
if latestFrame != nil &&
dataFrame.FrameNumber > latestFrame.FrameNumber {
latestFrame = dataFrame
}
go func() { go func() {
e.frameChan <- dataFrame e.frameChan <- latestFrame
}() }()
if bytes.Equal( if bytes.Equal(
@ -460,7 +465,7 @@ func (e *CeremonyDataClockConsensusEngine) runLoop() {
e.provingKeyAddress, e.provingKeyAddress,
) { ) {
var nextFrame *protobufs.ClockFrame var nextFrame *protobufs.ClockFrame
if nextFrame, err = e.prove(dataFrame); err != nil { if nextFrame, err = e.prove(latestFrame); err != nil {
e.logger.Error("could not prove", zap.Error(err)) e.logger.Error("could not prove", zap.Error(err))
e.state = consensus.EngineStateCollecting e.state = consensus.EngineStateCollecting
continue continue

View File

@ -4,7 +4,6 @@ import (
"bytes" "bytes"
"context" "context"
"io" "io"
"math/big"
"time" "time"
"source.quilibrium.com/quilibrium/monorepo/node/config" "source.quilibrium.com/quilibrium/monorepo/node/config"
@ -167,10 +166,7 @@ func (e *CeremonyDataClockConsensusEngine) GetMostAheadPeer() (
_, ok := e.uncooperativePeersMap[string(v.peerId)] _, ok := e.uncooperativePeersMap[string(v.peerId)]
if v.maxFrame > max && if v.maxFrame > max &&
v.timestamp > config.GetMinimumVersionCutoff().UnixMilli() && v.timestamp > config.GetMinimumVersionCutoff().UnixMilli() &&
bytes.Compare(v.version, config.GetMinimumVersion()) >= 0 && bytes.Compare(v.version, config.GetMinimumVersion()) >= 0 && !ok {
new(big.Int).SetBytes(
v.totalDistance,
).Cmp(e.dataTimeReel.GetTotalDistance()) < 0 && !ok {
peer = v.peerId peer = v.peerId
max = v.maxFrame max = v.maxFrame
} }

View File

@ -472,7 +472,7 @@ func (e *CeremonyExecutionEngine) ProcessMessage(
message *protobufs.Message, message *protobufs.Message,
) ([]*protobufs.Message, error) { ) ([]*protobufs.Message, error) {
if bytes.Equal(address, e.GetSupportedApplications()[0].Address) { if bytes.Equal(address, e.GetSupportedApplications()[0].Address) {
e.logger.Info("processing execution message") e.logger.Debug("processing execution message")
any := &anypb.Any{} any := &anypb.Any{}
if err := proto.Unmarshal(message.Payload, any); err != nil { if err := proto.Unmarshal(message.Payload, any); err != nil {
return nil, errors.Wrap(err, "process message") return nil, errors.Wrap(err, "process message")