synapsecns/sanguine

View on GitHub

Showing 1,971 of 13,422 total issues

Method Store.GetTimestampForMessage has 6 return statements (exceeds 4 allowed).
Open

func (s Store) GetTimestampForMessage(ctx context.Context, chainID, destination, nonce uint32) (*uint64, error) {
    statesTableName, err := dbcommon.GetModelName(s.DB(), &State{})
    if err != nil {
        return nil, fmt.Errorf("failed to get states table name: %w", err)
    }
Severity: Major
Found in agents/agents/executor/db/sql/base/crosstable.go - About 40 mins to fix

    Function main has 6 return statements (exceeds 4 allowed).
    Open

    func main() {
        fmt.Println("Enter Sending Chain URL (eg https://polygon-rpc.com, https://api.avax.network/ext/bc/C/rpc, https://optimism-mainnet.public.blastapi.io): ")
        var sendingChainURL string
        fmt.Scanln(&sendingChainURL)
    
    
    Severity: Major
    Found in agents/testcli/main.go - About 40 mins to fix

      Function CopyFile has 6 return statements (exceeds 4 allowed).
      Open

      func CopyFile(fileToCopy, dest, packageName string) error {
          // first things first, pkger operates on go modules, so we need to trim
          modulePath := path.Dir(fileToCopy)
          fileName := path.Base(fileToCopy)
      
      
      Severity: Major
      Found in tools/modulecopier/internal/copy.go - About 40 mins to fix

        Method Guard.verifyState has 6 return statements (exceeds 4 allowed).
        Open

        func (g Guard) verifyState(ctx context.Context, state types.State, stateIndex int, data types.StateValidationData) (err error) {
            var submitFunc func(transactor *bind.TransactOpts) (tx *ethTypes.Transaction, err error)
            if types.HasAttestation(data) {
                submitFunc = func(transactor *bind.TransactOpts) (tx *ethTypes.Transaction, err error) {
                    tx, err = g.domains[state.Origin()].LightInbox().VerifyStateWithAttestation(
        Severity: Major
        Found in agents/agents/guard/calls.go - About 40 mins to fix

          Method Guard.handleAttestationAccepted has 6 return statements (exceeds 4 allowed).
          Open

          func (g Guard) handleAttestationAccepted(ctx context.Context, log ethTypes.Log) error {
              attestationData, err := g.lightInboxParser.ParseAttestationAccepted(log)
              if err != nil {
                  return fmt.Errorf("could not parse attestation accepted: %w", err)
              }
          Severity: Major
          Found in agents/agents/guard/fraud.go - About 40 mins to fix

            Method Store.GetEarliestStateInRange has 6 return statements (exceeds 4 allowed).
            Open

            func (s Store) GetEarliestStateInRange(ctx context.Context, chainID, destination, startNonce, endNonce uint32) (*agentsTypes.State, error) {
                statesTableName, err := dbcommon.GetModelName(s.DB(), &State{})
                if err != nil {
                    return nil, fmt.Errorf("failed to get states table name: %w", err)
                }
            Severity: Major
            Found in agents/agents/executor/db/sql/base/crosstable.go - About 40 mins to fix

              Function InitExecutorDB has 6 return statements (exceeds 4 allowed).
              Open

              func InitExecutorDB(parentCtx context.Context, database string, path string, tablePrefix string, handler metrics.Handler) (_ db.ExecutorDB, err error) {
                  ctx, span := handler.Tracer().Start(parentCtx, "InitExecutorDB", trace.WithAttributes(
                      attribute.String("database", database),
                      attribute.String("path", path),
                      attribute.String("tablePrefix", tablePrefix),
              Severity: Major
              Found in agents/agents/executor/cmd/commands.go - About 40 mins to fix

                Method Store.GetRelayableAgentStatuses has 6 return statements (exceeds 4 allowed).
                Open

                func (s Store) GetRelayableAgentStatuses(ctx context.Context, chainID uint32) ([]agentTypes.AgentTree, error) {
                    agentTreesTableName, err := dbcommon.GetModelName(s.DB(), &AgentTree{})
                    if err != nil {
                        return nil, fmt.Errorf("failed to get agent trees table name: %w", err)
                    }
                Severity: Major
                Found in agents/agents/guard/db/sql/base/crosstable.go - About 40 mins to fix

                  Function InitGuardDB has 6 return statements (exceeds 4 allowed).
                  Open

                  func InitGuardDB(parentCtx context.Context, database string, path string, tablePrefix string, handler metrics.Handler) (_ db.GuardDB, err error) {
                      ctx, span := handler.Tracer().Start(parentCtx, "InitGuardDB", trace.WithAttributes(
                          attribute.String("database", database),
                          attribute.String("path", path),
                          attribute.String("tablePrefix", tablePrefix),
                  Severity: Major
                  Found in agents/agents/guard/cmd/commands.go - About 40 mins to fix

                    Method Guard.streamLogs has 6 return statements (exceeds 4 allowed).
                    Open

                    func (g Guard) streamLogs(ctx context.Context, chainID uint32, address string) error {
                        // TODO: Get last block number to define starting point for streamLogs.
                        fromBlock := strconv.FormatUint(0, 16)
                        toBlock := "latest"
                        stream, err := g.grpcClient.StreamLogs(ctx, &pbscribe.StreamLogsRequest{
                    Severity: Major
                    Found in agents/agents/guard/guard.go - About 40 mins to fix

                      Method Guard.ensureAgentActive has 6 return statements (exceeds 4 allowed).
                      Open

                      func (g Guard) ensureAgentActive(ctx context.Context, agent common.Address, chainID uint32) (ok bool, err error) {
                          agentStatus, err := g.getAgentStatus(ctx, chainID, agent)
                          if err != nil {
                              return false, fmt.Errorf("could not get agent status: %w", err)
                          }
                      Severity: Major
                      Found in agents/agents/guard/calls.go - About 40 mins to fix

                        Method Guard.handleValidAttestation has 6 return statements (exceeds 4 allowed).
                        Open

                        func (g Guard) handleValidAttestation(ctx context.Context, attestationData *types.AttestationWithMetadata) error {
                            // Fetch the attested snapshot.
                            var snapshot types.Snapshot
                            var err error
                            contractCall := func(ctx context.Context) error {
                        Severity: Major
                        Found in agents/agents/guard/fraud.go - About 40 mins to fix

                          Method Relayer.getDecimalsFromBridgeTx has 6 return statements (exceeds 4 allowed).
                          Open

                          func (r *Relayer) getDecimalsFromBridgeTx(parentCtx context.Context, bridgeTx fastbridge.IFastBridgeBridgeTransaction) (originDecimals *uint8, destDecimals *uint8, err error) {
                              ctx, span := r.metrics.Tracer().Start(parentCtx, "getDecimals", trace.WithAttributes(
                                  attribute.String("sender", bridgeTx.OriginSender.String()),
                              ))
                          
                          
                          Severity: Major
                          Found in services/rfq/relayer/service/chainindexer.go - About 40 mins to fix

                            Method Relayer.getDecimals has 6 return statements (exceeds 4 allowed).
                            Open

                            func (r *Relayer) getDecimals(ctx context.Context, addr common.Address, chainID uint32) (decimals *uint8, err error) {
                                // attempt to load decimal from cache
                                key := getDecimalsKey(addr, chainID)
                                decimals, ok := r.decimalsCache.Load(key)
                                if ok {
                            Severity: Major
                            Found in services/rfq/relayer/service/chainindexer.go - About 40 mins to fix

                              Method finalizedProxyImpl.checkShouldRequest has 6 return statements (exceeds 4 allowed).
                              Open

                              func (r *finalizedProxyImpl) checkShouldRequest(parentCtx context.Context, req rpc.Request) bool {
                                  // only apply to sendRawTransaction
                                  // ignore if maxSubmitAhead is 0
                                  if client.RPCMethod(req.Method) != client.SendRawTransactionMethod && r.maxSubmitAhead > 0 {
                                      return true
                              Severity: Major
                              Found in services/omnirpc/modules/confirmedtofinalized/finalizedproxy.go - About 40 mins to fix

                                Method Forwarder.forwardRequest has 6 return statements (exceeds 4 allowed).
                                Open

                                func (f *Forwarder) forwardRequest(parentCtx context.Context, endpoint string) (_ *rawResponse, err error) {
                                    ctx, span := f.tracer.Start(parentCtx, "forwardRequest",
                                        trace.WithAttributes(attribute.String("endpoint", endpoint)),
                                    )
                                
                                
                                Severity: Major
                                Found in services/omnirpc/proxy/forward.go - About 40 mins to fix

                                  Method Manager.prepareAndSubmitQuotes has 6 return statements (exceeds 4 allowed).
                                  Open

                                  func (m *Manager) prepareAndSubmitQuotes(ctx context.Context, inv map[int]map[common.Address]*big.Int) (err error) {
                                      ctx, span := m.metricsHandler.Tracer().Start(ctx, "prepareAndSubmitQuotes")
                                      defer func() {
                                          span.SetAttributes(attribute.Bool("relay_paused", m.relayPaused.Load()))
                                          metrics.EndSpanWithErr(span, err)
                                  Severity: Major
                                  Found in services/rfq/relayer/quoter/quoter.go - About 40 mins to fix

                                    Method Manager.getOriginAmount has 6 return statements (exceeds 4 allowed).
                                    Open

                                    func (m *Manager) getOriginAmount(parentCtx context.Context, input QuoteInput) (quoteAmount *big.Int, err error) {
                                        ctx, span := m.metricsHandler.Tracer().Start(parentCtx, "getOriginAmount", trace.WithAttributes(
                                            attribute.Int(metrics.Origin, input.OriginChainID),
                                            attribute.Int(metrics.Destination, input.DestChainID),
                                            attribute.String("dest_address", input.DestTokenAddr.String()),
                                    Severity: Major
                                    Found in services/rfq/relayer/quoter/quoter.go - About 40 mins to fix

                                      Method rebalanceManagerCircleCCTP.listenMessageReceived has 6 return statements (exceeds 4 allowed).
                                      Open

                                      func (c *rebalanceManagerCircleCCTP) listenMessageReceived(parentCtx context.Context, chainID int, ethClient client.EVM) (err error) {
                                          listener, ok := c.transmitterListeners[chainID]
                                          if !ok {
                                              return fmt.Errorf("could not find listener for chain %d", chainID)
                                          }
                                      Severity: Major
                                      Found in services/rfq/relayer/inventory/circle.go - About 40 mins to fix

                                        Method rebalanceManagerCircleCCTP.listenDepositForBurn has 6 return statements (exceeds 4 allowed).
                                        Open

                                        func (c *rebalanceManagerCircleCCTP) listenDepositForBurn(parentCtx context.Context, chainID int, ethClient client.EVM) (err error) {
                                            listener, ok := c.messengerListeners[chainID]
                                            if !ok {
                                                return fmt.Errorf("could not find listener for chain %d", chainID)
                                            }
                                        Severity: Major
                                        Found in services/rfq/relayer/inventory/circle.go - About 40 mins to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language