synapsecns/sanguine

View on GitHub

Showing 1,971 of 13,422 total issues

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

func Run(args []string, buildInfo config.BuildInfo) {
    app := cli.NewApp()
    app.Name = buildInfo.Name()
    app.Version = buildInfo.Version()
    app.Description = buildInfo.VersionString() + "This is used for copying files out of modules in order to export unused fields. This should only be used for unit testing"
Severity: Major
Found in tools/modulecopier/cmd/main.go - About 35 mins to fix

    Method Notary.Start has 5 return statements (exceeds 4 allowed).
    Open

    func (n *Notary) Start(parentCtx context.Context) error {
        g, ctx := errgroup.WithContext(parentCtx)
    
        logger.Info("Starting the notary")
    
    
    Severity: Major
    Found in agents/agents/notary/notary.go - About 35 mins to fix

      Method Executor.checkIfExecuted has 5 return statements (exceeds 4 allowed).
      Open

      func (e Executor) checkIfExecuted(parentCtx context.Context, message types.Message) (_ bool, err error) {
          ctx, span := e.handler.Tracer().Start(parentCtx, "checkIfExecuted", trace.WithAttributes(
              attribute.Int(metrics.Origin, int(message.OriginDomain())),
              attribute.Int(metrics.Destination, int(message.DestinationDomain())),
              attribute.Int(metrics.Nonce, int(message.Nonce())),
      Severity: Major
      Found in agents/agents/executor/executor.go - About 35 mins to fix

        Method Executor.verifyStateMerkleProof has 5 return statements (exceeds 4 allowed).
        Open

        func (e Executor) verifyStateMerkleProof(parentCtx context.Context, state types.State) (_ bool, err error) {
            stateRoot := state.Root()
            root := common.BytesToHash(stateRoot[:]).String()
            chainID := state.Origin()
        
        
        Severity: Major
        Found in agents/agents/executor/executor.go - About 35 mins to fix

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

          func NewNotary(ctx context.Context, cfg config.AgentConfig, omniRPCClient omnirpcClient.RPCClient, txDB db.NotaryDB, handler metrics.Handler) (_ Notary, err error) {
              notary := Notary{
                  refreshInterval: time.Second * time.Duration(cfg.RefreshIntervalSeconds),
              }
              notary.domains = []domains.DomainClient{}
          Severity: Major
          Found in agents/agents/notary/notary.go - About 35 mins to fix

            Method AgentsIntegrationSuite.TestAgentsE2E has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
            Open

            func (u *AgentsIntegrationSuite) TestAgentsE2E() {
                testDone := false
                defer func() {
                    testDone = true
                }()
            Severity: Minor
            Found in agents/agents/agentsintegration/agentsintegration_test.go - About 35 mins to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Method DeployManager.InitializeRemoteDeployedHarnessContracts has 5 return statements (exceeds 4 allowed).
            Open

            func (d *DeployManager) InitializeRemoteDeployedHarnessContracts(
                ctx context.Context,
                backend backends.SimulatedTestBackend,
                bondingManagerHarnessAgentRoot [32]byte) error {
                d.T().Helper()
            Severity: Major
            Found in agents/testutil/typecast.go - About 35 mins to fix

              Function main has 5 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/pingpongtestcli/main.go - About 35 mins to fix

                Method Guard.handleSnapshot has 5 return statements (exceeds 4 allowed).
                Open

                func (g Guard) handleSnapshot(ctx context.Context, snapshot types.Snapshot, data types.StateValidationData) error {
                    // Process each state in the snapshot.
                    for si, s := range snapshot.States() {
                        stateIndex, state := si, s
                        isSlashable, err := g.isStateSlashable(ctx, state)
                Severity: Major
                Found in agents/agents/guard/fraud.go - About 35 mins to fix

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

                  func NewMysqlStore(parentCtx context.Context, dbURL string, handler metrics.Handler, skipMigrations bool) (_ *Store, err error) {
                      logger.Debug("creating mysql store")
                  
                      ctx, span := handler.Tracer().Start(parentCtx, "start-mysql")
                      defer func() {
                  Severity: Major
                  Found in agents/agents/executor/db/sql/mysql/store.go - About 35 mins to fix

                    Method ExecutorSuite.TestSendManagerMessage has 5 return statements (exceeds 4 allowed).
                    Open

                    func (e *ExecutorSuite) TestSendManagerMessage() {
                        // This test requires a call to anvil's evm.IncreaseTime() cheat code, so we should
                        // set up the backends with anvil.
                    
                        testDone := false
                    Severity: Major
                    Found in agents/agents/executor/executor_test.go - About 35 mins to fix

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

                      func DecodeTokenID(id string) (chainID int, addr common.Address, err error) {
                          // defensive coding, first check if the token ID is valid
                          _, err = SanitizeTokenID(id)
                          if err != nil {
                              return chainID, addr, err
                      Severity: Major
                      Found in services/rfq/relayer/relconfig/config.go - About 35 mins to fix

                        Method Config.GetMaxRelayAmount has 5 return statements (exceeds 4 allowed).
                        Open

                        func (c Config) GetMaxRelayAmount(chainID int, addr common.Address) *big.Int {
                            chainCfg, ok := c.Chains[chainID]
                            if !ok {
                                return defaultMaxRelayAmount
                            }
                        Severity: Major
                        Found in services/rfq/relayer/relconfig/getters.go - About 35 mins to fix

                          Method rebalanceManagerSynapseCCTP.Start has 5 return statements (exceeds 4 allowed).
                          Open

                          func (c *rebalanceManagerSynapseCCTP) Start(ctx context.Context) (err error) {
                              err = c.initContracts(ctx)
                              if err != nil {
                                  return fmt.Errorf("could not initialize contracts: %w", err)
                              }
                          Severity: Major
                          Found in services/rfq/relayer/inventory/synapse.go - About 35 mins to fix

                            Method Manager.generateQuotes has 5 return statements (exceeds 4 allowed).
                            Open

                            func (m *Manager) generateQuotes(parentCtx context.Context, chainID int, address common.Address, balance *big.Int, inv map[int]map[common.Address]*big.Int) (quotes []model.PutRelayerQuoteRequest, err error) {
                                ctx, span := m.metricsHandler.Tracer().Start(parentCtx, "generateQuotes", trace.WithAttributes(
                                    attribute.Int(metrics.Origin, chainID),
                                    attribute.String("address", address.String()),
                                    attribute.String("balance", balance.String()),
                            Severity: Major
                            Found in services/rfq/relayer/quoter/quoter.go - About 35 mins to fix

                              Method Manager.recordQuoteAmounts has 5 return statements (exceeds 4 allowed).
                              Open

                              func (m *Manager) recordQuoteAmounts(_ context.Context, observer metric.Observer) (err error) {
                                  if m.meter == nil || m.quoteAmountGauge == nil || m.currentQuotes == nil {
                                      return nil
                                  }
                              
                              
                              Severity: Major
                              Found in services/rfq/relayer/quoter/quoter.go - About 35 mins to fix

                                Method DeployManager.LoadContractsOnChains has 5 return statements (exceeds 4 allowed).
                                Open

                                func (d *DeployManager) LoadContractsOnChains(
                                    ctx context.Context,
                                    synChainBackend backends.SimulatedTestBackend,
                                    backends []backends.SimulatedTestBackend,
                                    agents []common.Address,
                                Severity: Major
                                Found in agents/testutil/typecast.go - About 35 mins to fix

                                  Method rpcClient.GetChainIDs has 5 return statements (exceeds 4 allowed).
                                  Open

                                  func (c *rpcClient) GetChainIDs(ctx context.Context) (chainIDs []int, err error) {
                                      req, err := http.NewRequestWithContext(ctx, http.MethodGet, fmt.Sprintf("%s/chain-ids", c.endpoint), nil)
                                      if err != nil {
                                          return nil, fmt.Errorf("could not create request: %w", err)
                                      }
                                  Severity: Major
                                  Found in services/omnirpc/client/client.go - About 35 mins to fix

                                    Method Config.GetMaxBalance has 5 return statements (exceeds 4 allowed).
                                    Open

                                    func (c Config) GetMaxBalance(chainID int, addr common.Address) *big.Int {
                                        chainCfg, ok := c.Chains[chainID]
                                        if !ok {
                                            return defaultMaxBalance
                                        }
                                    Severity: Major
                                    Found in services/rfq/relayer/relconfig/getters.go - About 35 mins to fix

                                      Method Manager.IsProfitable has 5 return statements (exceeds 4 allowed).
                                      Open

                                      func (m *Manager) IsProfitable(parentCtx context.Context, quote reldb.QuoteRequest) (isProfitable bool, err error) {
                                          ctx, span := m.metricsHandler.Tracer().Start(parentCtx, "IsProfitable")
                                      
                                          defer func() {
                                              span.AddEvent("result", trace.WithAttributes(attribute.Bool("result", isProfitable)))
                                      Severity: Major
                                      Found in services/rfq/relayer/quoter/quoter.go - About 35 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language