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)
}
if latestFrame != nil &&
dataFrame.FrameNumber > latestFrame.FrameNumber {
latestFrame = dataFrame
}
go func() {
e.frameChan <- dataFrame
e.frameChan <- latestFrame
}()
if bytes.Equal(
@ -460,7 +465,7 @@ func (e *CeremonyDataClockConsensusEngine) runLoop() {
e.provingKeyAddress,
) {
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.state = consensus.EngineStateCollecting
continue

View File

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

View File

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