diff --git a/node/cmd/guardiand/node.go b/node/cmd/guardiand/node.go index 58374e9c01..7244bfe3e1 100644 --- a/node/cmd/guardiand/node.go +++ b/node/cmd/guardiand/node.go @@ -1184,11 +1184,6 @@ func runNode(cmd *cobra.Command, args []string) { components := p2p.DefaultComponents() components.Port = *p2pPort - ccqFeatures := "" - if *ccqEnabled { - ccqFeatures = "ccq" - } - // Run supervisor. supervisor.New(rootCtx, logger, func(ctx context.Context) error { if err := supervisor.Run(ctx, "p2p", p2p.Run( @@ -1211,7 +1206,7 @@ func runNode(cmd *cobra.Command, args []string) { nil, components, &ibc.Features, - &ccqFeatures, + *ccqEnabled, signedQueryReqWriteC, queryResponseReadC)); err != nil { return err diff --git a/node/cmd/guardiand/query.go b/node/cmd/guardiand/query.go index ae41469529..8994ef8696 100644 --- a/node/cmd/guardiand/query.go +++ b/node/cmd/guardiand/query.go @@ -28,7 +28,7 @@ func handleQueryRequests( chainQueryReqC map[vaa.ChainID]chan *gossipv1.SignedQueryRequest, enableFlag bool, ) { - qLogger := logger.With(zap.String("component", "queryHandler")) + qLogger := logger.With(zap.String("component", "ccqhandler")) if enableFlag { qLogger.Info("cross chain queries are enabled") } @@ -39,7 +39,7 @@ func handleQueryRequests( return case signedQueryRequest := <-signedQueryReqC: if !enableFlag { - qLogger.Debug("dropping query request, feature is not enabled") + qLogger.Error("received a query request when the feature is disabled, dropping it") continue } // requestor validation happens here diff --git a/node/cmd/spy/spy.go b/node/cmd/spy/spy.go index a084512d22..64be011451 100644 --- a/node/cmd/spy/spy.go +++ b/node/cmd/spy/spy.go @@ -552,10 +552,10 @@ func runSpy(cmd *cobra.Command, args []string) { nil, nil, components, - nil, // ibc feature string - nil, // cross chain query feature string - nil, // query requests - nil, // query responses + nil, // ibc feature string + false, // ccqEnabled + nil, // query requests + nil, // query responses )); err != nil { return err diff --git a/node/pkg/p2p/p2p.go b/node/pkg/p2p/p2p.go index 3e3affb4d2..2b7906850c 100644 --- a/node/pkg/p2p/p2p.go +++ b/node/pkg/p2p/p2p.go @@ -155,7 +155,7 @@ func Run( signedGovSt chan *gossipv1.SignedChainGovernorStatus, components *Components, ibcFeatures *string, - ccqFeatures *string, + ccqEnabled bool, signedQueryReqC chan<- *gossipv1.SignedQueryRequest, queryResponseReadC <-chan *node_common.QueryResponsePublication, ) func(ctx context.Context) error { @@ -313,8 +313,8 @@ func Run( if ibcFeatures != nil && *ibcFeatures != "" { features = append(features, *ibcFeatures) } - if ccqFeatures != nil && *ccqFeatures != "" { - features = append(features, *ccqFeatures) + if ccqEnabled { + features = append(features, "ccq") } heartbeat := &gossipv1.Heartbeat{ @@ -415,9 +415,13 @@ func Run( logger.Info("published signed observation request", zap.Any("signed_observation_request", sReq)) } case msg := <-queryResponseReadC: + if !ccqEnabled { + logger.Error("received a cross chain query response when the feature is disabled, dropping it", zap.String("component", "ccqp2p")) + continue + } msgBytes, err := msg.Marshal() if err != nil { - logger.Error("failed to marshal query response", zap.Error(err)) + logger.Error("failed to marshal query response", zap.Error(err), zap.String("component", "ccqp2p")) continue } digest := node_common.GetQueryResponseDigestFromBytes(msgBytes) @@ -440,9 +444,9 @@ func Run( err = th.Publish(ctx, b) p2pMessagesSent.Inc() if err != nil { - logger.Error("failed to publish query response", zap.Error(err)) + logger.Error("failed to publish query response", zap.Error(err), zap.String("component", "ccqp2p")) } else { - logger.Info("published signed query response", zap.Any("query_response", msg), zap.Any("signature", sig)) + logger.Info("published signed query response", zap.Any("query_response", msg), zap.Any("signature", sig), zap.String("component", "ccqp2p")) } } } @@ -592,8 +596,12 @@ func Run( } case *gossipv1.GossipMessage_SignedQueryRequest: if signedQueryReqC != nil { - if err := node_common.PostSignedQueryRequest(signedQueryReqC, m.SignedQueryRequest); err != nil { - logger.Warn("failed to handle query request", zap.Error(err)) + if ccqEnabled { + if err := node_common.PostSignedQueryRequest(signedQueryReqC, m.SignedQueryRequest); err != nil { + logger.Warn("failed to handle query request", zap.Error(err), zap.String("component", "ccqp2p")) + } + } else { + logger.Debug("dropping cross chain query request because the feature is not enabled", zap.String("component", "ccqp2p")) } } default: diff --git a/node/pkg/p2p/watermark_test.go b/node/pkg/p2p/watermark_test.go index 921faf4f95..b2513ac22b 100644 --- a/node/pkg/p2p/watermark_test.go +++ b/node/pkg/p2p/watermark_test.go @@ -181,9 +181,9 @@ func startGuardian(t *testing.T, ctx context.Context, g *G) { g.signedGovCfg, g.signedGovSt, g.components, - nil, // ibc feature string - nil, // cross chain query feature string - nil, // signed query request channel - nil, // query response channel + nil, // ibc feature string + false, // ccqEnabled + nil, // signed query request channel + nil, // query response channel )) }