diff --git a/node/app/db_console.go b/node/app/db_console.go index 8fef0c4..8cb44e6 100644 --- a/node/app/db_console.go +++ b/node/app/db_console.go @@ -886,11 +886,11 @@ func logoVersion(width int) string { out += " ####################################### ########\n" out += " ############################# ##\n" out += " \n" - out += " Quilibrium Node - v1.2.13 – Dawn\n" + out += " Quilibrium Node - v1.2.14 – Dawn\n" out += " \n" out += " DB Console\n" } else { - out = "Quilibrium Node - v1.2.13 – Dawn - DB Console\n" + out = "Quilibrium Node - v1.2.14 – Dawn - DB Console\n" } return out } diff --git a/node/consensus/ceremony/ceremony_data_clock_consensus_engine.go b/node/consensus/ceremony/ceremony_data_clock_consensus_engine.go index 395739d..e078dc0 100644 --- a/node/consensus/ceremony/ceremony_data_clock_consensus_engine.go +++ b/node/consensus/ceremony/ceremony_data_clock_consensus_engine.go @@ -410,10 +410,15 @@ func (e *CeremonyDataClockConsensusEngine) runLoop() { case dataFrame := <-dataFrameCh: if latestFrame, err = e.collect(dataFrame); err != nil { e.logger.Error("could not collect", zap.Error(err)) - continue } + + dataFrame, err := e.dataTimeReel.Head() + if err != nil { + panic(err) + } + go func() { - e.frameChan <- latestFrame + e.frameChan <- dataFrame }() if bytes.Equal( @@ -421,7 +426,7 @@ func (e *CeremonyDataClockConsensusEngine) runLoop() { e.provingKeyAddress, ) { var nextFrame *protobufs.ClockFrame - if nextFrame, err = e.prove(latestFrame); err != nil { + if nextFrame, err = e.prove(dataFrame); err != nil { e.logger.Error("could not prove", zap.Error(err)) e.state = consensus.EngineStateCollecting continue @@ -445,6 +450,15 @@ func (e *CeremonyDataClockConsensusEngine) runLoop() { e.logger.Error("could not collect", zap.Error(err)) continue } + + if latestFrame == nil || + latestFrame.FrameNumber < dataFrame.FrameNumber { + latestFrame, err = e.dataTimeReel.Head() + if err != nil { + panic(err) + } + } + go func() { e.frameChan <- latestFrame }() diff --git a/node/consensus/ceremony/consensus_frames.go b/node/consensus/ceremony/consensus_frames.go index 5f947b0..008659d 100644 --- a/node/consensus/ceremony/consensus_frames.go +++ b/node/consensus/ceremony/consensus_frames.go @@ -233,8 +233,6 @@ func (e *CeremonyDataClockConsensusEngine) sync( return latest, errors.Wrap(err, "sync") } - firstPass := true - var syncMsg *protobufs.CeremonyCompressedSync for syncMsg, err = s.Recv(); err == nil; syncMsg, err = s.Recv() { e.logger.Info( @@ -251,21 +249,11 @@ func (e *CeremonyDataClockConsensusEngine) sync( // so let's not penalize their score and make everyone else suffer, // let's just move on: if syncMsg.FromFrameNumber == 0 && - syncMsg.ToFrameNumber == 0 && - firstPass { + syncMsg.ToFrameNumber == 0 { if err := cc.Close(); err != nil { e.logger.Error("error while closing connection", zap.Error(err)) } - e.peerMapMx.Lock() - if _, ok := e.peerMap[string(peerId)]; ok { - e.uncooperativePeersMap[string(peerId)] = e.peerMap[string(peerId)] - e.uncooperativePeersMap[string(peerId)].timestamp = time.Now(). - UnixMilli() - delete(e.peerMap, string(peerId)) - } - e.peerMapMx.Unlock() - return currentLatest, errors.Wrap(ErrNoNewFrames, "sync") } @@ -273,7 +261,6 @@ func (e *CeremonyDataClockConsensusEngine) sync( if next, err = e.decompressAndStoreCandidates( peerId, syncMsg, - e.logger.Info, ); err != nil && !errors.Is(err, ErrNoNewFrames) { e.logger.Error( "could not decompress and store candidate", diff --git a/node/consensus/ceremony/peer_messaging.go b/node/consensus/ceremony/peer_messaging.go index 30fa572..7f1f9d3 100644 --- a/node/consensus/ceremony/peer_messaging.go +++ b/node/consensus/ceremony/peer_messaging.go @@ -7,7 +7,6 @@ import ( "github.com/pkg/errors" "go.uber.org/zap" - "go.uber.org/zap/zapcore" "google.golang.org/grpc" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/known/anypb" @@ -184,7 +183,6 @@ func (e *CeremonyDataClockConsensusEngine) GetCompressedSyncFrames( func (e *CeremonyDataClockConsensusEngine) decompressAndStoreCandidates( peerId []byte, syncMsg *protobufs.CeremonyCompressedSync, - loggerFunc func(msg string, fields ...zapcore.Field), ) (*protobufs.ClockFrame, error) { if len(syncMsg.TruncatedClockFrames) == 0 { return nil, ErrNoNewFrames @@ -207,13 +205,13 @@ func (e *CeremonyDataClockConsensusEngine) decompressAndStoreCandidates( for _, frame := range syncMsg.TruncatedClockFrames { frame := frame commits := (len(frame.Input) - 516) / 74 - loggerFunc( + e.logger.Info( "processing frame", zap.Uint64("frame_number", frame.FrameNumber), zap.Int("aggregate_commits", commits), ) for j := 0; j < commits; j++ { - loggerFunc( + e.logger.Info( "processing commit", zap.Uint64("frame_number", frame.FrameNumber), zap.Int("commit_index", j), @@ -223,7 +221,7 @@ func (e *CeremonyDataClockConsensusEngine) decompressAndStoreCandidates( for _, a := range syncMsg.Proofs { a := a if bytes.Equal(a.FrameCommit, commit) { - loggerFunc( + e.logger.Info( "found matching proof", zap.Uint64("frame_number", frame.FrameNumber), zap.Int("commit_index", j), @@ -254,7 +252,7 @@ func (e *CeremonyDataClockConsensusEngine) decompressAndStoreCandidates( for k, c := range aggregateProof.Commitments { k := k c := c - loggerFunc( + e.logger.Info( "adding inclusion commitment", zap.Uint64("frame_number", frame.FrameNumber), zap.Int("commit_index", j), @@ -283,7 +281,7 @@ func (e *CeremonyDataClockConsensusEngine) decompressAndStoreCandidates( if bytes.Equal(s.Hash, h) { if output != nil { if l == 0 { - loggerFunc( + e.logger.Info( "found first half of matching segment data", zap.Uint64("frame_number", frame.FrameNumber), zap.Int("commit_index", j), @@ -293,7 +291,7 @@ func (e *CeremonyDataClockConsensusEngine) decompressAndStoreCandidates( output.Address = s.Data[:32] output.Output = s.Data[32:] } else { - loggerFunc( + e.logger.Info( "found second half of matching segment data", zap.Uint64("frame_number", frame.FrameNumber), zap.Int("commit_index", j), @@ -312,7 +310,7 @@ func (e *CeremonyDataClockConsensusEngine) decompressAndStoreCandidates( break } } else { - loggerFunc( + e.logger.Info( "found matching segment data", zap.Uint64("frame_number", frame.FrameNumber), zap.Int("commit_index", j), @@ -357,10 +355,11 @@ func (e *CeremonyDataClockConsensusEngine) decompressAndStoreCandidates( ); err != nil { return nil, errors.Wrap(err, "decompress and store candidates") } + final = frame } - loggerFunc( + e.logger.Info( "decompressed and stored sync for range", zap.Uint64("from", syncMsg.FromFrameNumber), zap.Uint64("to", syncMsg.ToFrameNumber), diff --git a/node/consensus/consensus_engine.go b/node/consensus/consensus_engine.go index 62a6465..4e90673 100644 --- a/node/consensus/consensus_engine.go +++ b/node/consensus/consensus_engine.go @@ -59,5 +59,5 @@ func GetMinimumVersion() []byte { } func GetVersion() []byte { - return []byte{0x01, 0x02, 0x0D} + return []byte{0x01, 0x02, 0x0E} } diff --git a/node/consensus/time/data_time_reel.go b/node/consensus/time/data_time_reel.go index 4a31245..93b4521 100644 --- a/node/consensus/time/data_time_reel.go +++ b/node/consensus/time/data_time_reel.go @@ -732,6 +732,14 @@ func (d *DataTimeReel) forkChoice( true, ) if err != nil { + d.logger.Error( + "store corruption: a discontinuity has been found in your time reel", + zap.String( + "selector", + hex.EncodeToString(leftIndex.ParentSelector), + ), + zap.Uint64("frame_number", leftIndex.FrameNumber-1), + ) panic(err) } diff --git a/node/execution/intrinsics/ceremony/ceremony_execution_engine.go b/node/execution/intrinsics/ceremony/ceremony_execution_engine.go index 3d4b99d..3cf1661 100644 --- a/node/execution/intrinsics/ceremony/ceremony_execution_engine.go +++ b/node/execution/intrinsics/ceremony/ceremony_execution_engine.go @@ -1386,7 +1386,11 @@ func (e *CeremonyExecutionEngine) VerifyExecution( parent, err := e.clockStore.GetParentDataClockFrame( append( p2p.GetBloomFilter(application.CEREMONY_ADDRESS, 256, 3), - p2p.GetBloomFilterIndices(application.CEREMONY_ADDRESS, 65536, 24)..., + p2p.GetBloomFilterIndices( + application.CEREMONY_ADDRESS, + 65536, + 24, + )..., ), frame.FrameNumber-1, frame.ParentSelector, diff --git a/node/main.go b/node/main.go index b86dedd..14e4872 100644 --- a/node/main.go +++ b/node/main.go @@ -307,5 +307,5 @@ func printLogo() { func printVersion() { fmt.Println(" ") - fmt.Println(" Quilibrium Node - v1.2.13 – Dawn") + fmt.Println(" Quilibrium Node - v1.2.14 – Dawn") }