synapsecns/sanguine

View on GitHub
services/cctp-relayer/relayer/circle.go

Summary

Maintainability
C
7 hrs
Test Coverage

Method circleCCTPHandler.handleDepositForBurn has 61 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (c *circleCCTPHandler) handleDepositForBurn(parentCtx context.Context, log *types.Log, chainID uint32) (msg *relayTypes.Message, err error) {
    ctx, span := c.handler.Tracer().Start(parentCtx, "handleDepositForBurn", trace.WithAttributes(
        attribute.String(metrics.TxHash, log.TxHash.Hex()),
        attribute.Int(metrics.ChainID, int(chainID)),
        attribute.Int("block_number", int(log.BlockNumber)),
Severity: Minor
Found in services/cctp-relayer/relayer/circle.go - About 1 hr to fix

    Method circleCCTPHandler.handleDepositForBurn has 9 return statements (exceeds 4 allowed).
    Open

    func (c *circleCCTPHandler) handleDepositForBurn(parentCtx context.Context, log *types.Log, chainID uint32) (msg *relayTypes.Message, err error) {
        ctx, span := c.handler.Tracer().Start(parentCtx, "handleDepositForBurn", trace.WithAttributes(
            attribute.String(metrics.TxHash, log.TxHash.Hex()),
            attribute.Int(metrics.ChainID, int(chainID)),
            attribute.Int("block_number", int(log.BlockNumber)),
    Severity: Major
    Found in services/cctp-relayer/relayer/circle.go - About 55 mins to fix

      Method circleCCTPHandler.HandleLog has 7 return statements (exceeds 4 allowed).
      Open

      func (c *circleCCTPHandler) HandleLog(ctx context.Context, log *types.Log, chainID uint32) (processQueue bool, err error) {
          if log == nil {
              return false, fmt.Errorf("log is nil")
          }
      
      
      Severity: Major
      Found in services/cctp-relayer/relayer/circle.go - About 45 mins to fix

        Method circleCCTPHandler.getMessagePayload has 7 return statements (exceeds 4 allowed).
        Open

        func (c *circleCCTPHandler) getMessagePayload(ctx context.Context, txHash common.Hash, chainID uint32, ethClient client.EVM) (message []byte, err error) {
            chainCfg, err := c.cfg.GetChainConfig(chainID)
            if err != nil {
                return nil, fmt.Errorf("could not get chain config: %w", err)
            }
        Severity: Major
        Found in services/cctp-relayer/relayer/circle.go - About 45 mins to fix

          Method circleCCTPHandler.handleMessageReceived has 7 return statements (exceeds 4 allowed).
          Open

          func (c *circleCCTPHandler) handleMessageReceived(parentCtx context.Context, log *types.Log, chainID uint32) (err error) {
              ctx, span := c.handler.Tracer().Start(parentCtx, "handleMessageReceived", trace.WithAttributes(
                  attribute.String(metrics.TxHash, log.TxHash.Hex()),
                  attribute.Int(metrics.ChainID, int(chainID)),
                  attribute.Int("block_number", int(log.BlockNumber)),
          Severity: Major
          Found in services/cctp-relayer/relayer/circle.go - About 45 mins to fix

            Method circleCCTPHandler.FetchAndProcessSentEvent has 7 return statements (exceeds 4 allowed).
            Open

            func (c *circleCCTPHandler) FetchAndProcessSentEvent(parentCtx context.Context, txHash common.Hash, chainID uint32) (msg *relayTypes.Message, err error) {
                ctx, span := c.handler.Tracer().Start(parentCtx, "FetchAndProcessSentEvent", trace.WithAttributes(
                    attribute.String(metrics.TxHash, txHash.String()),
                    attribute.Int(metrics.ChainID, int(chainID)),
                ))
            Severity: Major
            Found in services/cctp-relayer/relayer/circle.go - About 45 mins to fix

              Function NewCircleCCTPHandler has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              func NewCircleCCTPHandler(ctx context.Context, cfg config.Config, db db2.CCTPRelayerDB, omniRPCClient omniClient.RPCClient, txSubmitter submitter.TransactionSubmitter, handler metrics.Handler) (CCTPHandler, error) {
              Severity: Minor
              Found in services/cctp-relayer/relayer/circle.go - About 45 mins to fix

                Method circleCCTPHandler.SubmitReceiveMessage has 6 return statements (exceeds 4 allowed).
                Open

                func (c *circleCCTPHandler) SubmitReceiveMessage(parentCtx context.Context, msg *relayTypes.Message) (err error) {
                    ctx, span := c.handler.Tracer().Start(parentCtx, "SubmitReceiveMessage", trace.WithAttributes(
                        attribute.String("message_hash", msg.MessageHash),
                        attribute.Int(metrics.ChainID, int(msg.DestChainID)),
                    ))
                Severity: Major
                Found in services/cctp-relayer/relayer/circle.go - About 40 mins to fix

                  Function NewCircleCCTPHandler has 5 return statements (exceeds 4 allowed).
                  Open

                  func NewCircleCCTPHandler(ctx context.Context, cfg config.Config, db db2.CCTPRelayerDB, omniRPCClient omniClient.RPCClient, txSubmitter submitter.TransactionSubmitter, handler metrics.Handler) (CCTPHandler, error) {
                      boundMessageTransmitters := make(map[uint32]*messagetransmitter.MessageTransmitter)
                      for _, chain := range cfg.Chains {
                          cl, err := omniRPCClient.GetConfirmationsClient(ctx, int(chain.ChainID), 1)
                          if err != nil {
                  Severity: Major
                  Found in services/cctp-relayer/relayer/circle.go - About 35 mins to fix

                    There are no issues that match your filters.

                    Category
                    Status