Skip to content

Commit

Permalink
Node: Add cutover feature flags to heartbeats (#4092)
Browse files Browse the repository at this point in the history
  • Loading branch information
bruce-riley committed Aug 21, 2024
1 parent 6ec30f5 commit a3284d6
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions node/pkg/node/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ func GuardianOptionP2P(
ccqBootstrapPeers,
ccqPort,
ccqAllowedPeers),
p2p.WithProcessorFeaturesFunc(processor.GetFeatures),
)
if err != nil {
return err
Expand Down
9 changes: 9 additions & 0 deletions node/pkg/p2p/p2p.go
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,15 @@ func Run(params *RunParams) func(ctx context.Context) error {
}

features := make([]string, 0)
if GossipCutoverComplete() {
features = append(features, "p2p:new_gossip")
}
if params.processorFeaturesFunc != nil {
flag := params.processorFeaturesFunc()
if flag != "" {
features = append(features, flag)
}
}
if params.gov != nil {
if params.gov.IsFlowCancelEnabled() {
features = append(features, "governor:fc")
Expand Down
9 changes: 9 additions & 0 deletions node/pkg/p2p/run_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ type (
gov *governor.ChainGovernor
components *Components
ibcFeaturesFunc func() string
processorFeaturesFunc func() string
gatewayRelayerEnabled bool
ccqEnabled bool
signedQueryReqC chan<- *gossipv1.SignedQueryRequest
Expand Down Expand Up @@ -108,6 +109,14 @@ func WithComponents(components *Components) RunOpt {
}
}

// WithProcessorFeaturesFunc is used to set the processor features function.
func WithProcessorFeaturesFunc(processorFeaturesFunc func() string) RunOpt {
return func(p *RunParams) error {
p.processorFeaturesFunc = processorFeaturesFunc
return nil
}
}

// WithSignedObservationListener is used to set the channel to receive `SignedObservation` messages.
func WithSignedObservationListener(obsvRecvC chan<- *common.MsgWithTimeStamp[gossipv1.SignedObservation]) RunOpt {
return func(p *RunParams) error {
Expand Down
8 changes: 8 additions & 0 deletions node/pkg/processor/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -471,3 +471,11 @@ func (p *Processor) vaaWriter(ctx context.Context) error {
}
}
}

// GetFeatures returns the processor feature string that can be published in heartbeat messages.
func GetFeatures() string {
if batchCutoverComplete() {
return "processor:batching"
}
return ""
}

0 comments on commit a3284d6

Please sign in to comment.