mirror of
https://source.quilibrium.com/quilibrium/ceremonyclient.git
synced 2024-11-13 03:35:17 +00:00
v1.2.3 (#36)
This commit is contained in:
parent
916a1514f1
commit
196588cbe6
@ -818,11 +818,11 @@ func logoVersion(width int) string {
|
|||||||
out += " ####################################### ########\n"
|
out += " ####################################### ########\n"
|
||||||
out += " ############################# ##\n"
|
out += " ############################# ##\n"
|
||||||
out += " \n"
|
out += " \n"
|
||||||
out += " Quilibrium Node - v1.2.2 – Dawn\n"
|
out += " Quilibrium Node - v1.2.3 – Dawn\n"
|
||||||
out += " \n"
|
out += " \n"
|
||||||
out += " DB Console\n"
|
out += " DB Console\n"
|
||||||
} else {
|
} else {
|
||||||
out = "Quilibrium Node - v1.2.2 – Dawn - DB Console\n"
|
out = "Quilibrium Node - v1.2.3 – Dawn - DB Console\n"
|
||||||
}
|
}
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
@ -213,6 +213,17 @@ func (e *CeremonyDataClockConsensusEngine) Start() <-chan error {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
candidateLatestFrame, err := e.clockStore.GetLatestCandidateDataClockFrame(
|
||||||
|
e.filter,
|
||||||
|
)
|
||||||
|
if err != nil && !errors.Is(err, store.ErrNotFound) {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if candidateLatestFrame != nil {
|
||||||
|
latestFrame = candidateLatestFrame
|
||||||
|
}
|
||||||
|
|
||||||
if latestFrame != nil {
|
if latestFrame != nil {
|
||||||
e.setFrame(latestFrame)
|
e.setFrame(latestFrame)
|
||||||
} else {
|
} else {
|
||||||
|
@ -972,7 +972,7 @@ func (e *CeremonyDataClockConsensusEngine) sync(
|
|||||||
grpc.MaxCallRecvMsgSize(600*1024*1024),
|
grpc.MaxCallRecvMsgSize(600*1024*1024),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
e.logger.Error(
|
e.logger.Debug(
|
||||||
"received error from peer",
|
"received error from peer",
|
||||||
zap.Error(err),
|
zap.Error(err),
|
||||||
)
|
)
|
||||||
@ -1052,7 +1052,7 @@ func (e *CeremonyDataClockConsensusEngine) sync(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err != nil && err != io.EOF && !errors.Is(err, ErrNoNewFrames) {
|
if err != nil && err != io.EOF && !errors.Is(err, ErrNoNewFrames) {
|
||||||
e.logger.Error("error while receiving sync", zap.Error(err))
|
e.logger.Debug("error while receiving sync", zap.Error(err))
|
||||||
|
|
||||||
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))
|
||||||
|
@ -51,13 +51,13 @@ type DataConsensusEngine interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetMinimumVersionCutoff() time.Time {
|
func GetMinimumVersionCutoff() time.Time {
|
||||||
return time.Date(2024, time.January, 3, 7, 0, 0, 0, time.UTC)
|
return time.Date(2024, time.January, 14, 7, 0, 0, 0, time.UTC)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetMinimumVersion() []byte {
|
func GetMinimumVersion() []byte {
|
||||||
return []byte{0x01, 0x02, 0x00}
|
return []byte{0x01, 0x02, 0x03}
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetVersion() []byte {
|
func GetVersion() []byte {
|
||||||
return []byte{0x01, 0x02, 0x02}
|
return []byte{0x01, 0x02, 0x03}
|
||||||
}
|
}
|
||||||
|
@ -646,8 +646,33 @@ func MaterializeApplicationFromFrame(
|
|||||||
roundCount--
|
roundCount--
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stateCount := uint64(0)
|
||||||
|
setCount := false
|
||||||
|
|
||||||
|
if len(inProgress.DroppedParticipantAttestations) > 0 {
|
||||||
|
stateCount = frame.FrameNumber -
|
||||||
|
inProgress.DroppedParticipantAttestations[len(inProgress.DroppedParticipantAttestations)-1].LastSeenFrame
|
||||||
|
setCount = true
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(inProgress.LatestSeenProverAttestations) > 0 {
|
||||||
|
seenCount := frame.FrameNumber -
|
||||||
|
inProgress.LatestSeenProverAttestations[len(inProgress.LatestSeenProverAttestations)-1].LastSeenFrame
|
||||||
|
if !setCount || seenCount < stateCount {
|
||||||
|
stateCount = seenCount
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(inProgress.ActiveParticipants) > 0 {
|
||||||
|
lastStateCount := frame.FrameNumber -
|
||||||
|
inProgress.ActiveParticipants[len(inProgress.ActiveParticipants)-1].FrameNumber
|
||||||
|
if !setCount || (lastStateCount < stateCount && lastStateCount > 20) {
|
||||||
|
stateCount = lastStateCount - 20
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return &CeremonyApplication{
|
return &CeremonyApplication{
|
||||||
StateCount: 0,
|
StateCount: stateCount,
|
||||||
RoundCount: uint64(roundCount),
|
RoundCount: uint64(roundCount),
|
||||||
LobbyState: CEREMONY_APPLICATION_STATE_IN_PROGRESS,
|
LobbyState: CEREMONY_APPLICATION_STATE_IN_PROGRESS,
|
||||||
NextRoundPreferredParticipants: inProgress.NextRoundParticipants,
|
NextRoundPreferredParticipants: inProgress.NextRoundParticipants,
|
||||||
@ -667,8 +692,33 @@ func MaterializeApplicationFromFrame(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stateCount := uint64(0)
|
||||||
|
setCount := false
|
||||||
|
|
||||||
|
if len(finalizing.DroppedParticipantAttestations) > 0 {
|
||||||
|
stateCount = frame.FrameNumber -
|
||||||
|
finalizing.DroppedParticipantAttestations[len(finalizing.DroppedParticipantAttestations)-1].LastSeenFrame
|
||||||
|
setCount = true
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(finalizing.LatestSeenProverAttestations) > 0 {
|
||||||
|
seenCount := frame.FrameNumber -
|
||||||
|
finalizing.LatestSeenProverAttestations[len(finalizing.LatestSeenProverAttestations)-1].LastSeenFrame
|
||||||
|
if !setCount || seenCount < stateCount {
|
||||||
|
stateCount = seenCount
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(finalizing.ActiveParticipants) > 0 {
|
||||||
|
lastStateCount := frame.FrameNumber -
|
||||||
|
finalizing.ActiveParticipants[len(finalizing.ActiveParticipants)-1].FrameNumber
|
||||||
|
if !setCount || (lastStateCount < stateCount && lastStateCount > 200) {
|
||||||
|
stateCount = lastStateCount - 200
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return &CeremonyApplication{
|
return &CeremonyApplication{
|
||||||
StateCount: 0,
|
StateCount: stateCount,
|
||||||
RoundCount: 0,
|
RoundCount: 0,
|
||||||
LobbyState: CEREMONY_APPLICATION_STATE_FINALIZING,
|
LobbyState: CEREMONY_APPLICATION_STATE_FINALIZING,
|
||||||
ActiveParticipants: finalizing.ActiveParticipants,
|
ActiveParticipants: finalizing.ActiveParticipants,
|
||||||
|
@ -398,6 +398,7 @@ func (e *CeremonyExecutionEngine) RunWorker() {
|
|||||||
),
|
),
|
||||||
zap.Bool("in_round", inRound),
|
zap.Bool("in_round", inRound),
|
||||||
zap.Uint64("current_sub_round", app.RoundCount),
|
zap.Uint64("current_sub_round", app.RoundCount),
|
||||||
|
zap.Uint64("stale_state_count", app.StateCount),
|
||||||
)
|
)
|
||||||
|
|
||||||
shouldConnect := false
|
shouldConnect := false
|
||||||
|
@ -249,5 +249,5 @@ func printLogo() {
|
|||||||
|
|
||||||
func printVersion() {
|
func printVersion() {
|
||||||
fmt.Println(" ")
|
fmt.Println(" ")
|
||||||
fmt.Println(" Quilibrium Node - v1.2.2 – Dawn")
|
fmt.Println(" Quilibrium Node - v1.2.3 – Dawn")
|
||||||
}
|
}
|
||||||
|
@ -328,7 +328,7 @@ func initDHT(
|
|||||||
go func() {
|
go func() {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
if err := h.Connect(ctx, *peerinfo); err != nil {
|
if err := h.Connect(ctx, *peerinfo); err != nil {
|
||||||
logger.Warn("error while connecting to dht peer", zap.Error(err))
|
logger.Debug("error while connecting to dht peer", zap.Error(err))
|
||||||
}
|
}
|
||||||
logger.Info(
|
logger.Info(
|
||||||
"connected to peer",
|
"connected to peer",
|
||||||
@ -517,7 +517,7 @@ func discoverPeers(
|
|||||||
logger.Info("found peer", zap.String("peer_id", peer.ID.Pretty()))
|
logger.Info("found peer", zap.String("peer_id", peer.ID.Pretty()))
|
||||||
err := h.Connect(ctx, peer)
|
err := h.Connect(ctx, peer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Warn(
|
logger.Debug(
|
||||||
"error while connecting to blossomsub peer",
|
"error while connecting to blossomsub peer",
|
||||||
zap.String("peer_id", peer.ID.Pretty()),
|
zap.String("peer_id", peer.ID.Pretty()),
|
||||||
zap.Error(err),
|
zap.Error(err),
|
||||||
|
@ -34,6 +34,9 @@ type ClockStore interface {
|
|||||||
filter []byte,
|
filter []byte,
|
||||||
proverTrie *tries.RollingFrecencyCritbitTrie,
|
proverTrie *tries.RollingFrecencyCritbitTrie,
|
||||||
) (*protobufs.ClockFrame, error)
|
) (*protobufs.ClockFrame, error)
|
||||||
|
GetLatestCandidateDataClockFrame(
|
||||||
|
filter []byte,
|
||||||
|
) (*protobufs.ClockFrame, error)
|
||||||
GetEarliestDataClockFrame(filter []byte) (*protobufs.ClockFrame, error)
|
GetEarliestDataClockFrame(filter []byte) (*protobufs.ClockFrame, error)
|
||||||
GetDataClockFrame(
|
GetDataClockFrame(
|
||||||
filter []byte,
|
filter []byte,
|
||||||
@ -324,6 +327,8 @@ const CLOCK_MASTER_FRAME_INDEX_PARENT = 0x30 | CLOCK_MASTER_FRAME_DATA
|
|||||||
const CLOCK_DATA_FRAME_INDEX_EARLIEST = 0x10 | CLOCK_DATA_FRAME_DATA
|
const CLOCK_DATA_FRAME_INDEX_EARLIEST = 0x10 | CLOCK_DATA_FRAME_DATA
|
||||||
const CLOCK_DATA_FRAME_INDEX_LATEST = 0x20 | CLOCK_DATA_FRAME_DATA
|
const CLOCK_DATA_FRAME_INDEX_LATEST = 0x20 | CLOCK_DATA_FRAME_DATA
|
||||||
const CLOCK_DATA_FRAME_INDEX_PARENT = 0x30 | CLOCK_DATA_FRAME_DATA
|
const CLOCK_DATA_FRAME_INDEX_PARENT = 0x30 | CLOCK_DATA_FRAME_DATA
|
||||||
|
const CLOCK_DATA_FRAME_CANDIDATE_INDEX_LATEST = 0x20 |
|
||||||
|
CLOCK_DATA_FRAME_CANDIDATE_DATA
|
||||||
|
|
||||||
//
|
//
|
||||||
// DB Keys
|
// DB Keys
|
||||||
@ -384,6 +389,10 @@ func clockDataLatestIndex(filter []byte) []byte {
|
|||||||
return clockLatestIndex(filter, CLOCK_DATA_FRAME_INDEX_LATEST)
|
return clockLatestIndex(filter, CLOCK_DATA_FRAME_INDEX_LATEST)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func clockDataCandidateLatestIndex(filter []byte) []byte {
|
||||||
|
return clockLatestIndex(filter, CLOCK_DATA_FRAME_CANDIDATE_INDEX_LATEST)
|
||||||
|
}
|
||||||
|
|
||||||
func clockEarliestIndex(filter []byte, frameType byte) []byte {
|
func clockEarliestIndex(filter []byte, frameType byte) []byte {
|
||||||
key := []byte{CLOCK_FRAME, frameType}
|
key := []byte{CLOCK_FRAME, frameType}
|
||||||
key = append(key, filter...)
|
key = append(key, filter...)
|
||||||
@ -801,6 +810,33 @@ func (p *PebbleClockStore) GetLatestDataClockFrame(
|
|||||||
return frame, nil
|
return frame, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *PebbleClockStore) GetLatestCandidateDataClockFrame(
|
||||||
|
filter []byte,
|
||||||
|
) (*protobufs.ClockFrame, error) {
|
||||||
|
idxValue, closer, err := p.db.Get(clockDataCandidateLatestIndex(filter))
|
||||||
|
if err != nil {
|
||||||
|
if errors.Is(err, pebble.ErrNotFound) {
|
||||||
|
return nil, ErrNotFound
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil, errors.Wrap(err, "get latest candidate data clock frame")
|
||||||
|
}
|
||||||
|
|
||||||
|
frameNumber := binary.BigEndian.Uint64(idxValue)
|
||||||
|
frames, err := p.GetCandidateDataClockFrames(filter, frameNumber)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.Wrap(err, "get latest candidate data clock frame")
|
||||||
|
}
|
||||||
|
|
||||||
|
closer.Close()
|
||||||
|
|
||||||
|
if len(frames) == 0 {
|
||||||
|
return nil, ErrNotFound
|
||||||
|
}
|
||||||
|
|
||||||
|
return frames[0], nil
|
||||||
|
}
|
||||||
|
|
||||||
// GetLeadingCandidateDataClockFrame implements ClockStore.
|
// GetLeadingCandidateDataClockFrame implements ClockStore.
|
||||||
func (p *PebbleClockStore) GetLeadingCandidateDataClockFrame(
|
func (p *PebbleClockStore) GetLeadingCandidateDataClockFrame(
|
||||||
filter []byte,
|
filter []byte,
|
||||||
@ -907,6 +943,29 @@ func (p *PebbleClockStore) PutCandidateDataClockFrame(
|
|||||||
return errors.Wrap(err, "put candidate data clock frame")
|
return errors.Wrap(err, "put candidate data clock frame")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
numberBytes, closer, err := p.db.Get(clockDataCandidateLatestIndex(frame.Filter))
|
||||||
|
if err != nil && !errors.Is(err, pebble.ErrNotFound) {
|
||||||
|
return errors.Wrap(err, "put candidate data clock frame")
|
||||||
|
}
|
||||||
|
|
||||||
|
existingNumber := uint64(0)
|
||||||
|
|
||||||
|
if numberBytes != nil {
|
||||||
|
existingNumber = binary.BigEndian.Uint64(numberBytes)
|
||||||
|
closer.Close()
|
||||||
|
}
|
||||||
|
|
||||||
|
if frame.FrameNumber > existingNumber {
|
||||||
|
frameNumberBytes := make([]byte, 8)
|
||||||
|
binary.BigEndian.PutUint64(frameNumberBytes, frame.FrameNumber)
|
||||||
|
if err = txn.Set(
|
||||||
|
clockDataCandidateLatestIndex(frame.Filter),
|
||||||
|
frameNumberBytes,
|
||||||
|
); err != nil {
|
||||||
|
return errors.Wrap(err, "put candidate data clock frame")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1685,6 +1744,24 @@ func (p *PebbleClockStore) DeleteCandidateDataClockFrameRange(
|
|||||||
return errors.Wrap(err, "delete candidate data clock frame range")
|
return errors.Wrap(err, "delete candidate data clock frame range")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *PebbleClockStore) DeleteDataClockFrameRange(
|
||||||
|
filter []byte,
|
||||||
|
fromFrameNumber uint64,
|
||||||
|
toFrameNumber uint64,
|
||||||
|
) error {
|
||||||
|
err := p.db.DeleteRange(
|
||||||
|
clockDataFrameKey(
|
||||||
|
filter,
|
||||||
|
fromFrameNumber,
|
||||||
|
),
|
||||||
|
clockDataFrameKey(
|
||||||
|
filter,
|
||||||
|
toFrameNumber,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
return errors.Wrap(err, "delete data clock frame range")
|
||||||
|
}
|
||||||
|
|
||||||
func (p *PebbleClockStore) GetHighestCandidateDataClockFrame(
|
func (p *PebbleClockStore) GetHighestCandidateDataClockFrame(
|
||||||
filter []byte,
|
filter []byte,
|
||||||
) (*protobufs.ClockFrame, error) {
|
) (*protobufs.ClockFrame, error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user