From e381165568f614c24c68b029d956e812bcb27a5e Mon Sep 17 00:00:00 2001 From: Cassandra Heart <7929478+CassOnMars@users.noreply.github.com> Date: Fri, 1 Dec 2023 23:44:24 -0600 Subject: [PATCH] v1.1.8 (#27) --- node/app/db_console.go | 4 ++-- .../ceremony_data_clock_consensus_engine.go | 2 ++ node/consensus/ceremony/consensus_frames.go | 2 +- node/consensus/consensus_engine.go | 6 ++--- .../application/ceremony_application.go | 20 ++++++++++++++++ node/main.go | 2 +- node/p2p/blossomsub.go | 23 +++++++++++-------- 7 files changed, 43 insertions(+), 16 deletions(-) diff --git a/node/app/db_console.go b/node/app/db_console.go index c4e27b9..ed93749 100644 --- a/node/app/db_console.go +++ b/node/app/db_console.go @@ -812,11 +812,11 @@ func logoVersion(width int) string { out += " ####################################### ########\n" out += " ############################# ##\n" out += " \n" - out += " Quilibrium Node - v1.1.7 – Dawn\n" + out += " Quilibrium Node - v1.1.8 – Dawn\n" out += " \n" out += " DB Console\n" } else { - out = "Quilibrium Node - v1.1.7 – Dawn - DB Console\n" + out = "Quilibrium Node - v1.1.8 – 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 38fe857..5ce1f30 100644 --- a/node/consensus/ceremony/ceremony_data_clock_consensus_engine.go +++ b/node/consensus/ceremony/ceremony_data_clock_consensus_engine.go @@ -332,6 +332,8 @@ func (e *CeremonyDataClockConsensusEngine) Start( panic(err) } } + + latest = e.performSanityCheck(latest) } } }() diff --git a/node/consensus/ceremony/consensus_frames.go b/node/consensus/ceremony/consensus_frames.go index 39ad0c6..ab679d1 100644 --- a/node/consensus/ceremony/consensus_frames.go +++ b/node/consensus/ceremony/consensus_frames.go @@ -704,7 +704,7 @@ func (e *CeremonyDataClockConsensusEngine) commitLongestPath( zap.Int("commit_depth", len(runningFrames[0])), ) - for _, s := range runningFrames[0][1:] { + for _, s := range runningFrames[0][0:] { s := s txn, err := e.clockStore.NewTransaction() if err != nil { diff --git a/node/consensus/consensus_engine.go b/node/consensus/consensus_engine.go index 132f09f..d9f0fb4 100644 --- a/node/consensus/consensus_engine.go +++ b/node/consensus/consensus_engine.go @@ -52,13 +52,13 @@ type DataConsensusEngine interface { } func GetMinimumVersionCutoff() time.Time { - return time.Date(2023, time.November, 3, 0, 0, 0, 0, time.UTC) + return time.Date(2023, time.December, 2, 7, 0, 0, 0, time.UTC) } func GetMinimumVersion() []byte { - return []byte{0x01, 0x01, 0x05} + return []byte{0x01, 0x01, 0x08} } func GetVersion() []byte { - return []byte{0x01, 0x01, 0x06} + return []byte{0x01, 0x01, 0x08} } diff --git a/node/execution/ceremony/application/ceremony_application.go b/node/execution/ceremony/application/ceremony_application.go index fd3c815..0819a39 100644 --- a/node/execution/ceremony/application/ceremony_application.go +++ b/node/execution/ceremony/application/ceremony_application.go @@ -14,6 +14,8 @@ var ErrInvalidStateTransition = errors.New("invalid state transition") type CeremonyApplicationState int +const V118_CUTOFF = uint64(45000) + var CEREMONY_ADDRESS = []byte{ // SHA3-256("q_kzg_ceremony") 0x34, 0x00, 0x1b, 0xe7, 0x43, 0x2c, 0x2e, 0x66, @@ -750,6 +752,7 @@ func (a *CeremonyApplication) ApplyTransition( return a, nil case CEREMONY_APPLICATION_STATE_IN_PROGRESS: + a.StateCount++ for i, url := range transition.TypeUrls { switch url { case protobufs.CeremonySeenProverAttestationType: @@ -774,6 +777,7 @@ func (a *CeremonyApplication) ApplyTransition( if err = a.applySeenProverAttestation(seenProverAtt); err != nil { return nil, errors.Wrap(err, "apply transition") } + a.StateCount = 0 case protobufs.CeremonyDroppedProverAttestationType: droppedProverAtt := &protobufs.CeremonyDroppedProverAttestation{} err := proto.Unmarshal(transition.TransitionInputs[i], droppedProverAtt) @@ -796,6 +800,7 @@ func (a *CeremonyApplication) ApplyTransition( if err = a.applyDroppedProverAttestation(droppedProverAtt); err != nil { return nil, errors.Wrap(err, "apply transition") } + a.StateCount = 0 case protobufs.CeremonyTranscriptCommitType: transcriptCommit := &protobufs.CeremonyTranscriptCommit{} err := proto.Unmarshal(transition.TransitionInputs[i], transcriptCommit) @@ -806,6 +811,7 @@ func (a *CeremonyApplication) ApplyTransition( if err = a.applyTranscriptCommit(transcriptCommit); err != nil { return nil, errors.Wrap(err, "apply transition") } + a.StateCount = 0 default: return a, nil } @@ -850,6 +856,10 @@ func (a *CeremonyApplication) ApplyTransition( } } + if currentFrameNumber > V118_CUTOFF && a.StateCount > 100 { + shouldReset = true + } + if shouldReset { a.LobbyState = CEREMONY_APPLICATION_STATE_OPEN a.StateCount = 0 @@ -877,6 +887,7 @@ func (a *CeremonyApplication) ApplyTransition( return a, nil case CEREMONY_APPLICATION_STATE_FINALIZING: + a.StateCount++ for i, url := range transition.TypeUrls { switch url { case protobufs.CeremonySeenProverAttestationType: @@ -901,6 +912,7 @@ func (a *CeremonyApplication) ApplyTransition( if err = a.applySeenProverAttestation(seenProverAtt); err != nil { return nil, errors.Wrap(err, "apply transition") } + a.StateCount = 0 case protobufs.CeremonyDroppedProverAttestationType: droppedProverAtt := &protobufs.CeremonyDroppedProverAttestation{} err := proto.Unmarshal(transition.TransitionInputs[i], droppedProverAtt) @@ -923,6 +935,7 @@ func (a *CeremonyApplication) ApplyTransition( if err = a.applyDroppedProverAttestation(droppedProverAtt); err != nil { return nil, errors.Wrap(err, "apply transition") } + a.StateCount = 0 case protobufs.CeremonyTranscriptShareType: transcriptShare := &protobufs.CeremonyTranscriptShare{} err := proto.Unmarshal(transition.TransitionInputs[i], transcriptShare) @@ -933,6 +946,7 @@ func (a *CeremonyApplication) ApplyTransition( if err = a.applyTranscriptShare(transcriptShare); err != nil { return nil, errors.Wrap(err, "apply transition") } + a.StateCount = 0 default: return a, nil } @@ -970,6 +984,10 @@ func (a *CeremonyApplication) ApplyTransition( } } + if currentFrameNumber > V118_CUTOFF && a.StateCount > 100 { + shouldReset = true + } + if shouldReset { a.LobbyState = CEREMONY_APPLICATION_STATE_OPEN a.StateCount = 0 @@ -999,6 +1017,7 @@ func (a *CeremonyApplication) ApplyTransition( return a, nil case CEREMONY_APPLICATION_STATE_VALIDATING: + a.StateCount++ for i, url := range transition.TypeUrls { switch url { case protobufs.CeremonyTranscriptType: @@ -1011,6 +1030,7 @@ func (a *CeremonyApplication) ApplyTransition( if err = a.applyTranscript(transcript); err != nil { return nil, errors.Wrap(err, "apply transition") } + a.StateCount = 0 default: return a, nil } diff --git a/node/main.go b/node/main.go index 39902c6..7e7769e 100644 --- a/node/main.go +++ b/node/main.go @@ -233,5 +233,5 @@ func printLogo() { func printVersion() { fmt.Println(" ") - fmt.Println(" Quilibrium Node - v1.1.7 – Dawn") + fmt.Println(" Quilibrium Node - v1.1.8 – Dawn") } diff --git a/node/p2p/blossomsub.go b/node/p2p/blossomsub.go index b590c92..f5dc4c4 100644 --- a/node/p2p/blossomsub.go +++ b/node/p2p/blossomsub.go @@ -117,20 +117,22 @@ func NewBlossomSub( } } - blossomOpts := []blossomsub.Option{} + blossomOpts := []blossomsub.Option{ + blossomsub.WithPeerExchange(true), + } if tracer != nil { blossomOpts = append(blossomOpts, blossomsub.WithEventTracer(tracer)) } blossomOpts = append(blossomOpts, blossomsub.WithPeerScore( &blossomsub.PeerScoreParams{ SkipAtomicValidation: false, - BitmaskScoreCap: 0, + BitmaskScoreCap: 100, IPColocationFactorWeight: -1, IPColocationFactorThreshold: 6, - BehaviourPenaltyWeight: -1, + BehaviourPenaltyWeight: -80, BehaviourPenaltyThreshold: 100, BehaviourPenaltyDecay: .5, - DecayInterval: time.Minute, + DecayInterval: 10 * time.Second, DecayToZero: .1, RetainScore: 5 * time.Minute, AppSpecificScore: func(p peer.ID) float64 { @@ -140,10 +142,10 @@ func NewBlossomSub( }, &blossomsub.PeerScoreThresholds{ SkipAtomicValidation: false, - GossipThreshold: -100, - PublishThreshold: -100, - GraylistThreshold: -100, - AcceptPXThreshold: 1, + GossipThreshold: -2000, + PublishThreshold: -5000, + GraylistThreshold: -10000, + AcceptPXThreshold: 100, OpportunisticGraftThreshold: 2, })) @@ -533,7 +535,10 @@ func discoverPeers( go func() { for { time.Sleep(30 * time.Second) - discover() + if len(h.Network().Peers()) == 0 { + logger.Info("reinitiating discovery") + discover() + } } }()