Fantom-foundation/go-lachesis

View on GitHub

Showing 829 of 829 total issues

Method Service.processEvent has 6 return statements (exceeds 4 allowed).
Open

func (s *Service) processEvent(realEngine Consensus, e *inter.Event) error {
    // s.engineMu is locked here
    if s.stopped {
        return errStopped
    }
Severity: Major
Found in gossip/consensus_callbacks.go - About 40 mins to fix

    Method PeerPacksDownloader.binarySearchReq has 6 return statements (exceeds 4 allowed).
    Open

    func (d *PeerPacksDownloader) binarySearchReq() (requestIndex idx.Pack, requestFull bool, syncedUp bool) {
        it := d.packInfos.Iterator()
        var prevIdx *idx.Pack
    
        for it.End(); it.Prev(); {
    Severity: Major
    Found in gossip/packsdownloader/peer_downloader.go - About 40 mins to fix

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      func (s *PublicBlockChainAPI) GetUncleCountByBlockNumber(ctx context.Context, blockNr rpc.BlockNumber) *hexutil.Uint {
          if block, _ := s.b.BlockByNumber(ctx, blockNr); block != nil {
              n := hexutil.Uint(len(noUncles))
              return &n
          }
      Severity: Minor
      Found in ethapi/api.go and 1 other location - About 40 mins to fix
      ethapi/api.go on lines 738..744

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 110.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      func (s *PublicBlockChainAPI) GetUncleCountByBlockHash(ctx context.Context, blockHash common.Hash) *hexutil.Uint {
          if block, _ := s.b.BlockByHash(ctx, blockHash); block != nil {
              n := hexutil.Uint(len(noUncles))
              return &n
          }
      Severity: Minor
      Found in ethapi/api.go and 1 other location - About 40 mins to fix
      ethapi/api.go on lines 729..735

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 110.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      func (p *peer) AsyncSendTransactions(txs []*types.Transaction) {
          select {
          case p.queuedTxs <- txs:
              // Mark all the transactions as known, but ensure we don't overflow our limits
              for _, tx := range txs {
      Severity: Minor
      Found in gossip/peer.go and 1 other location - About 40 mins to fix
      gossip/peer.go on lines 279..292

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 108.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      func (h *HandlerT) GoTrace(file string, nsec uint) error {
          if err := h.StartGoTrace(file); err != nil {
              return err
          }
          time.Sleep(time.Duration(nsec) * time.Second)
      Severity: Minor
      Found in debug/api.go and 1 other location - About 40 mins to fix
      debug/api.go on lines 88..95

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 108.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      func (b HighestBeforeTime) Get(i idx.Validator) inter.Timestamp {
          for int(i) >= b.Size() {
              return 0
          }
          return inter.Timestamp(binary.LittleEndian.Uint64(b[i*8 : (i+1)*8]))
      Severity: Minor
      Found in vector/vector.go and 1 other location - About 40 mins to fix
      vector/vector.go on lines 53..58

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 108.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      func (b LowestAfterSeq) Get(i idx.Validator) idx.Event {
          for int(i) >= b.Size() {
              return 0
          }
          return idx.Event(binary.LittleEndian.Uint32(b[i*4 : (i+1)*4]))
      Severity: Minor
      Found in vector/vector.go and 1 other location - About 40 mins to fix
      vector/vector.go on lines 76..81

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 108.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      func (h *HandlerT) CpuProfile(file string, nsec uint) error {
          if err := h.StartCPUProfile(file); err != nil {
              return err
          }
          time.Sleep(time.Duration(nsec) * time.Second)
      Severity: Minor
      Found in debug/api.go and 1 other location - About 40 mins to fix
      debug/api.go on lines 135..142

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 108.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      func (p *peer) AsyncSendEvents(events inter.Events) {
          select {
          case p.queuedProps <- events:
              // Mark all the event hash as known, but ensure we don't overflow our limits
              for _, event := range events {
      Severity: Minor
      Found in gossip/peer.go and 1 other location - About 40 mins to fix
      gossip/peer.go on lines 200..213

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 108.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Function DoEstimateGas has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      func DoEstimateGas(ctx context.Context, b Backend, args CallArgs, blockNrOrHash rpc.BlockNumberOrHash, gasCap uint64) (hexutil.Uint64, error) {
      Severity: Minor
      Found in ethapi/api.go - About 35 mins to fix

        Method ContractFilterer.WatchCreatedWithdrawRequest has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        func (_Contract *ContractFilterer) WatchCreatedWithdrawRequest(opts *bind.WatchOpts, sink chan<- *ContractCreatedWithdrawRequest, auth []common.Address, receiver []common.Address, stakerID []*big.Int) (event.Subscription, error) {
        Severity: Minor
        Found in gossip/sfc110/contract.go - About 35 mins to fix

          Function NewBlock has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          func NewBlock(index idx.Block, time Timestamp, atropos hash.Event, prevHash hash.Event, events hash.Events) *Block {
          Severity: Minor
          Found in inter/block.go - About 35 mins to fix

            Method ContractCaller.CalcDelegationEpochReward has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            func (_Contract *ContractCaller) CalcDelegationEpochReward(opts *bind.CallOpts, stakerID *big.Int, epoch *big.Int, delegationAmount *big.Int, commission *big.Int) (*big.Int, error) {
            Severity: Minor
            Found in gossip/sfc110/contract.go - About 35 mins to fix

              Function GenerateChain has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              func GenerateChain(config *params.ChainConfig, parent *EvmBlock, db ethdb.Database, n int, gen func(int, *BlockGen)) ([]*EvmBlock, []types.Receipts, DummyChain) {
              Severity: Minor
              Found in evmcore/chain_makers.go - About 35 mins to fix

                Method ContractFilterer.WatchPartialWithdrawnByRequest has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                func (_Contract *ContractFilterer) WatchPartialWithdrawnByRequest(opts *bind.WatchOpts, sink chan<- *ContractPartialWithdrawnByRequest, auth []common.Address, receiver []common.Address, stakerID []*big.Int) (event.Subscription, error) {
                Severity: Minor
                Found in gossip/sfc110/contract.go - About 35 mins to fix

                  Method PublicDebugAPI.BlocksTTF has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  func (s *PublicDebugAPI) BlocksTTF(ctx context.Context, untilBlock rpc.BlockNumber, maxBlocks hexutil.Uint64, mode string, verbosity hexutil.Uint64) (map[string]interface{}, error) {
                  Severity: Minor
                  Found in ethapi/dag_api.go - About 35 mins to fix

                    Method Oracle.getBlockPrices has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    func (gpo *Oracle) getBlockPrices(ctx context.Context, blockNum uint64, limit int, result chan getBlockPricesResult, quit chan struct{}) {
                    Severity: Minor
                    Found in gossip/gasprice/gasprice.go - About 35 mins to fix

                      Function ForEachRandEvent has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          nodes []idx.StakerID,
                          eventCount int,
                          parentCount int,
                          r *rand.Rand,
                          callback ForEachEvent,
                      Severity: Minor
                      Found in inter/common.go - About 35 mins to fix

                        Method ContractFilterer.WatchUpdatedDelegation has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        func (_Contract *ContractFilterer) WatchUpdatedDelegation(opts *bind.WatchOpts, sink chan<- *ContractUpdatedDelegation, delegator []common.Address, oldStakerID []*big.Int, newStakerID []*big.Int) (event.Subscription, error) {
                        Severity: Minor
                        Found in gossip/sfc110/contract.go - About 35 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language