This commit is contained in:
Cassandra Heart 2024-02-22 21:23:26 -06:00 committed by GitHub
parent 012156e072
commit 96490478ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 44 additions and 32 deletions

View File

@ -886,11 +886,11 @@ func logoVersion(width int) string {
out += " ####################################### ########\n" out += " ####################################### ########\n"
out += " ############################# ##\n" 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 += " \n"
out += " DB Console\n" out += " DB Console\n"
} else { } else {
out = "Quilibrium Node - v1.2.13 Dawn - DB Console\n" out = "Quilibrium Node - v1.2.14 Dawn - DB Console\n"
} }
return out return out
} }

View File

@ -410,10 +410,15 @@ func (e *CeremonyDataClockConsensusEngine) runLoop() {
case dataFrame := <-dataFrameCh: case dataFrame := <-dataFrameCh:
if latestFrame, err = e.collect(dataFrame); err != nil { if latestFrame, err = e.collect(dataFrame); err != nil {
e.logger.Error("could not collect", zap.Error(err)) e.logger.Error("could not collect", zap.Error(err))
continue
} }
dataFrame, err := e.dataTimeReel.Head()
if err != nil {
panic(err)
}
go func() { go func() {
e.frameChan <- latestFrame e.frameChan <- dataFrame
}() }()
if bytes.Equal( if bytes.Equal(
@ -421,7 +426,7 @@ func (e *CeremonyDataClockConsensusEngine) runLoop() {
e.provingKeyAddress, e.provingKeyAddress,
) { ) {
var nextFrame *protobufs.ClockFrame 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.logger.Error("could not prove", zap.Error(err))
e.state = consensus.EngineStateCollecting e.state = consensus.EngineStateCollecting
continue continue
@ -445,6 +450,15 @@ func (e *CeremonyDataClockConsensusEngine) runLoop() {
e.logger.Error("could not collect", zap.Error(err)) e.logger.Error("could not collect", zap.Error(err))
continue continue
} }
if latestFrame == nil ||
latestFrame.FrameNumber < dataFrame.FrameNumber {
latestFrame, err = e.dataTimeReel.Head()
if err != nil {
panic(err)
}
}
go func() { go func() {
e.frameChan <- latestFrame e.frameChan <- latestFrame
}() }()

View File

@ -233,8 +233,6 @@ func (e *CeremonyDataClockConsensusEngine) sync(
return latest, errors.Wrap(err, "sync") return latest, errors.Wrap(err, "sync")
} }
firstPass := true
var syncMsg *protobufs.CeremonyCompressedSync var syncMsg *protobufs.CeremonyCompressedSync
for syncMsg, err = s.Recv(); err == nil; syncMsg, err = s.Recv() { for syncMsg, err = s.Recv(); err == nil; syncMsg, err = s.Recv() {
e.logger.Info( e.logger.Info(
@ -251,21 +249,11 @@ func (e *CeremonyDataClockConsensusEngine) sync(
// so let's not penalize their score and make everyone else suffer, // so let's not penalize their score and make everyone else suffer,
// let's just move on: // let's just move on:
if syncMsg.FromFrameNumber == 0 && if syncMsg.FromFrameNumber == 0 &&
syncMsg.ToFrameNumber == 0 && syncMsg.ToFrameNumber == 0 {
firstPass {
if err := cc.Close(); err != nil { if err := cc.Close(); err != nil {
e.logger.Error("error while closing connection", zap.Error(err)) 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") return currentLatest, errors.Wrap(ErrNoNewFrames, "sync")
} }
@ -273,7 +261,6 @@ func (e *CeremonyDataClockConsensusEngine) sync(
if next, err = e.decompressAndStoreCandidates( if next, err = e.decompressAndStoreCandidates(
peerId, peerId,
syncMsg, syncMsg,
e.logger.Info,
); err != nil && !errors.Is(err, ErrNoNewFrames) { ); err != nil && !errors.Is(err, ErrNoNewFrames) {
e.logger.Error( e.logger.Error(
"could not decompress and store candidate", "could not decompress and store candidate",

View File

@ -7,7 +7,6 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
"go.uber.org/zap" "go.uber.org/zap"
"go.uber.org/zap/zapcore"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/protobuf/proto" "google.golang.org/protobuf/proto"
"google.golang.org/protobuf/types/known/anypb" "google.golang.org/protobuf/types/known/anypb"
@ -184,7 +183,6 @@ func (e *CeremonyDataClockConsensusEngine) GetCompressedSyncFrames(
func (e *CeremonyDataClockConsensusEngine) decompressAndStoreCandidates( func (e *CeremonyDataClockConsensusEngine) decompressAndStoreCandidates(
peerId []byte, peerId []byte,
syncMsg *protobufs.CeremonyCompressedSync, syncMsg *protobufs.CeremonyCompressedSync,
loggerFunc func(msg string, fields ...zapcore.Field),
) (*protobufs.ClockFrame, error) { ) (*protobufs.ClockFrame, error) {
if len(syncMsg.TruncatedClockFrames) == 0 { if len(syncMsg.TruncatedClockFrames) == 0 {
return nil, ErrNoNewFrames return nil, ErrNoNewFrames
@ -207,13 +205,13 @@ func (e *CeremonyDataClockConsensusEngine) decompressAndStoreCandidates(
for _, frame := range syncMsg.TruncatedClockFrames { for _, frame := range syncMsg.TruncatedClockFrames {
frame := frame frame := frame
commits := (len(frame.Input) - 516) / 74 commits := (len(frame.Input) - 516) / 74
loggerFunc( e.logger.Info(
"processing frame", "processing frame",
zap.Uint64("frame_number", frame.FrameNumber), zap.Uint64("frame_number", frame.FrameNumber),
zap.Int("aggregate_commits", commits), zap.Int("aggregate_commits", commits),
) )
for j := 0; j < commits; j++ { for j := 0; j < commits; j++ {
loggerFunc( e.logger.Info(
"processing commit", "processing commit",
zap.Uint64("frame_number", frame.FrameNumber), zap.Uint64("frame_number", frame.FrameNumber),
zap.Int("commit_index", j), zap.Int("commit_index", j),
@ -223,7 +221,7 @@ func (e *CeremonyDataClockConsensusEngine) decompressAndStoreCandidates(
for _, a := range syncMsg.Proofs { for _, a := range syncMsg.Proofs {
a := a a := a
if bytes.Equal(a.FrameCommit, commit) { if bytes.Equal(a.FrameCommit, commit) {
loggerFunc( e.logger.Info(
"found matching proof", "found matching proof",
zap.Uint64("frame_number", frame.FrameNumber), zap.Uint64("frame_number", frame.FrameNumber),
zap.Int("commit_index", j), zap.Int("commit_index", j),
@ -254,7 +252,7 @@ func (e *CeremonyDataClockConsensusEngine) decompressAndStoreCandidates(
for k, c := range aggregateProof.Commitments { for k, c := range aggregateProof.Commitments {
k := k k := k
c := c c := c
loggerFunc( e.logger.Info(
"adding inclusion commitment", "adding inclusion commitment",
zap.Uint64("frame_number", frame.FrameNumber), zap.Uint64("frame_number", frame.FrameNumber),
zap.Int("commit_index", j), zap.Int("commit_index", j),
@ -283,7 +281,7 @@ func (e *CeremonyDataClockConsensusEngine) decompressAndStoreCandidates(
if bytes.Equal(s.Hash, h) { if bytes.Equal(s.Hash, h) {
if output != nil { if output != nil {
if l == 0 { if l == 0 {
loggerFunc( e.logger.Info(
"found first half of matching segment data", "found first half of matching segment data",
zap.Uint64("frame_number", frame.FrameNumber), zap.Uint64("frame_number", frame.FrameNumber),
zap.Int("commit_index", j), zap.Int("commit_index", j),
@ -293,7 +291,7 @@ func (e *CeremonyDataClockConsensusEngine) decompressAndStoreCandidates(
output.Address = s.Data[:32] output.Address = s.Data[:32]
output.Output = s.Data[32:] output.Output = s.Data[32:]
} else { } else {
loggerFunc( e.logger.Info(
"found second half of matching segment data", "found second half of matching segment data",
zap.Uint64("frame_number", frame.FrameNumber), zap.Uint64("frame_number", frame.FrameNumber),
zap.Int("commit_index", j), zap.Int("commit_index", j),
@ -312,7 +310,7 @@ func (e *CeremonyDataClockConsensusEngine) decompressAndStoreCandidates(
break break
} }
} else { } else {
loggerFunc( e.logger.Info(
"found matching segment data", "found matching segment data",
zap.Uint64("frame_number", frame.FrameNumber), zap.Uint64("frame_number", frame.FrameNumber),
zap.Int("commit_index", j), zap.Int("commit_index", j),
@ -357,10 +355,11 @@ func (e *CeremonyDataClockConsensusEngine) decompressAndStoreCandidates(
); err != nil { ); err != nil {
return nil, errors.Wrap(err, "decompress and store candidates") return nil, errors.Wrap(err, "decompress and store candidates")
} }
final = frame final = frame
} }
loggerFunc( e.logger.Info(
"decompressed and stored sync for range", "decompressed and stored sync for range",
zap.Uint64("from", syncMsg.FromFrameNumber), zap.Uint64("from", syncMsg.FromFrameNumber),
zap.Uint64("to", syncMsg.ToFrameNumber), zap.Uint64("to", syncMsg.ToFrameNumber),

View File

@ -59,5 +59,5 @@ func GetMinimumVersion() []byte {
} }
func GetVersion() []byte { func GetVersion() []byte {
return []byte{0x01, 0x02, 0x0D} return []byte{0x01, 0x02, 0x0E}
} }

View File

@ -732,6 +732,14 @@ func (d *DataTimeReel) forkChoice(
true, true,
) )
if err != nil { 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) panic(err)
} }

View File

@ -1386,7 +1386,11 @@ func (e *CeremonyExecutionEngine) VerifyExecution(
parent, err := e.clockStore.GetParentDataClockFrame( parent, err := e.clockStore.GetParentDataClockFrame(
append( append(
p2p.GetBloomFilter(application.CEREMONY_ADDRESS, 256, 3), 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.FrameNumber-1,
frame.ParentSelector, frame.ParentSelector,

View File

@ -307,5 +307,5 @@ func printLogo() {
func printVersion() { func printVersion() {
fmt.Println(" ") fmt.Println(" ")
fmt.Println(" Quilibrium Node - v1.2.13 Dawn") fmt.Println(" Quilibrium Node - v1.2.14 Dawn")
} }