Fantom-foundation/go-lachesis

View on GitHub

Showing 829 of 829 total issues

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

func (_Contract *ContractCaller) RewardsStash(opts *bind.CallOpts, arg0 common.Address, arg1 *big.Int) (*big.Int, error) {
    var (
        ret0 = new(*big.Int)
    )
    out := ret0
Severity: Major
Found in gossip/sfc202/contract.go and 6 other locations - About 55 mins to fix
gossip/sfc110/contract.go on lines 1150..1157
gossip/sfc202/contract.go on lines 426..433
gossip/sfc202/contract.go on lines 746..753
gossip/sfc204/contract.go on lines 435..442
gossip/sfc204/contract.go on lines 755..762
gossip/sfc204/contract.go on lines 1251..1258

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 124.

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 ForEachRandFork has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    nodes []idx.StakerID,
    cheatersArr []idx.StakerID,
    eventCount int,
    parentCount int,
    forksCount int,
Severity: Major
Found in inter/common.go - About 50 mins to fix

    Method Emitter.isMyTxTurn has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    func (em *Emitter) isMyTxTurn(txHash common.Hash, sender common.Address, accountNonce uint64, now time.Time, validatorsArr []idx.StakerID, validatorsArrStakes []pos.Stake, me idx.StakerID) bool {
    Severity: Major
    Found in gossip/emitter.go - About 50 mins to fix

      Method Checker.Validate has 8 return statements (exceeds 4 allowed).
      Open

      func (v *Checker) Validate(e *inter.Event, parents []*inter.EventHeaderData) error {
          if len(e.Parents) != len(parents) {
              panic("parentscheck: expected event's parents as an argument")
          }
      
      
      Severity: Major
      Found in eventcheck/parentscheck/parents_check.go - About 50 mins to fix

        Method PublicTransactionPoolAPI.SignTransaction has 8 return statements (exceeds 4 allowed).
        Open

        func (s *PublicTransactionPoolAPI) SignTransaction(ctx context.Context, args SendTxArgs) (*SignTransactionResult, error) {
            if args.Gas == nil {
                return nil, fmt.Errorf("gas not specified")
            }
            if args.GasPrice == nil {
        Severity: Major
        Found in ethapi/api.go - About 50 mins to fix

          Method PublicSfcAPI.addStakerMetricFields has 8 return statements (exceeds 4 allowed).
          Open

          func (s *PublicSfcAPI) addStakerMetricFields(ctx context.Context, res map[string]interface{}, stakerID idx.StakerID) (map[string]interface{}, error) {
              blocks, period, err := s.b.GetDowntime(ctx, idx.StakerID(stakerID))
              if err != nil {
                  return nil, err
              }
          Severity: Major
          Found in ethapi/sfc_api.go - About 50 mins to fix

            Method PublicTransactionPoolAPI.Resend has 8 return statements (exceeds 4 allowed).
            Open

            func (s *PublicTransactionPoolAPI) Resend(ctx context.Context, sendArgs SendTxArgs, gasPrice *hexutil.Big, gasLimit *hexutil.Uint64) (common.Hash, error) {
                if sendArgs.Nonce == nil {
                    return common.Hash{}, fmt.Errorf("missing transaction nonce in transaction spec")
                }
                if err := sendArgs.setDefaults(ctx, s.b); err != nil {
            Severity: Major
            Found in ethapi/api.go - About 50 mins to fix

              Method peer.readStatus has 8 return statements (exceeds 4 allowed).
              Open

              func (p *peer) readStatus(network uint64, status *ethStatusData, genesis common.Hash) (err error) {
                  msg, err := p.rw.ReadMsg()
                  if err != nil {
                      return err
                  }
              Severity: Major
              Found in gossip/peer.go - About 50 mins to fix

                Function lachesisOperaMigrationMain has 8 return statements (exceeds 4 allowed).
                Open

                func lachesisOperaMigrationMain(ctx *cli.Context) error {
                    if args := ctx.Args(); len(args) > 0 {
                        return fmt.Errorf("invalid command: %q", args[0])
                    }
                
                
                Severity: Major
                Found in cmd/lachesis/opera_migration.go - About 50 mins to fix

                  Method row.Position has 8 return statements (exceeds 4 allowed).
                  Open

                  func (r *row) Position(i int) position {
                      // if left
                      if i < r.Self {
                          if i < r.First {
                              return none
                  Severity: Major
                  Found in inter/ascii_scheme.go - About 50 mins to fix

                    Function importFile has 8 return statements (exceeds 4 allowed).
                    Open

                    func importFile(srv *gossip.Service, check bool, fn string) error {
                        // Watch for Ctrl-C while the import is running.
                        // If a signal is received, the import will stop.
                        interrupt := make(chan os.Signal, 1)
                        signal.Notify(interrupt, syscall.SIGINT, syscall.SIGTERM)
                    Severity: Major
                    Found in cmd/lachesis/import.go - About 50 mins to fix

                      Method Emitter.isSynced has 8 return statements (exceeds 4 allowed).
                      Open

                      func (em *Emitter) isSynced() (bool, string, time.Duration) {
                          if em.intervals.SelfForkProtection == 0 {
                              return true, "", 0 // protection disabled
                          }
                          if em.world.PeersNum() == 0 {
                      Severity: Major
                      Found in gossip/emitter.go - About 50 mins to fix

                        Identical blocks of code found in 5 locations. Consider refactoring.
                        Open

                        func NewContract(address common.Address, backend bind.ContractBackend) (*Contract, error) {
                            contract, err := bindContract(address, backend, backend, backend)
                            if err != nil {
                                return nil, err
                            }
                        Severity: Major
                        Found in gossip/sfcproxy/contract.go and 4 other locations - About 50 mins to fix
                        gossip/ballot/contract.go on lines 109..115
                        gossip/sfc110/contract.go on lines 109..115
                        gossip/sfc202/contract.go on lines 109..115
                        gossip/sfc204/contract.go on lines 92..98

                        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 119.

                        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

                        Identical blocks of code found in 5 locations. Consider refactoring.
                        Open

                        func NewContract(address common.Address, backend bind.ContractBackend) (*Contract, error) {
                            contract, err := bindContract(address, backend, backend, backend)
                            if err != nil {
                                return nil, err
                            }
                        Severity: Major
                        Found in gossip/ballot/contract.go and 4 other locations - About 50 mins to fix
                        gossip/sfc110/contract.go on lines 109..115
                        gossip/sfc202/contract.go on lines 109..115
                        gossip/sfc204/contract.go on lines 92..98
                        gossip/sfcproxy/contract.go on lines 109..115

                        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 119.

                        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

                        Identical blocks of code found in 5 locations. Consider refactoring.
                        Open

                        func NewContract(address common.Address, backend bind.ContractBackend) (*Contract, error) {
                            contract, err := bindContract(address, backend, backend, backend)
                            if err != nil {
                                return nil, err
                            }
                        Severity: Major
                        Found in gossip/sfc202/contract.go and 4 other locations - About 50 mins to fix
                        gossip/ballot/contract.go on lines 109..115
                        gossip/sfc110/contract.go on lines 109..115
                        gossip/sfc204/contract.go on lines 92..98
                        gossip/sfcproxy/contract.go on lines 109..115

                        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 119.

                        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

                        Identical blocks of code found in 5 locations. Consider refactoring.
                        Open

                        func NewContract(address common.Address, backend bind.ContractBackend) (*Contract, error) {
                            contract, err := bindContract(address, backend, backend, backend)
                            if err != nil {
                                return nil, err
                            }
                        Severity: Major
                        Found in gossip/sfc110/contract.go and 4 other locations - About 50 mins to fix
                        gossip/ballot/contract.go on lines 109..115
                        gossip/sfc202/contract.go on lines 109..115
                        gossip/sfc204/contract.go on lines 92..98
                        gossip/sfcproxy/contract.go on lines 109..115

                        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 119.

                        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

                        Identical blocks of code found in 5 locations. Consider refactoring.
                        Open

                        func NewContract(address common.Address, backend bind.ContractBackend) (*Contract, error) {
                            contract, err := bindContract(address, backend, backend, backend)
                            if err != nil {
                                return nil, err
                            }
                        Severity: Major
                        Found in gossip/sfc204/contract.go and 4 other locations - About 50 mins to fix
                        gossip/ballot/contract.go on lines 109..115
                        gossip/sfc110/contract.go on lines 109..115
                        gossip/sfc202/contract.go on lines 109..115
                        gossip/sfcproxy/contract.go on lines 109..115

                        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 119.

                        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

                        Identical blocks of code found in 5 locations. Consider refactoring.
                        Open

                        func bindContract(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
                            parsed, err := abi.JSON(strings.NewReader(ContractABI))
                            if err != nil {
                                return nil, err
                            }
                        Severity: Major
                        Found in gossip/sfcproxy/contract.go and 4 other locations - About 50 mins to fix
                        gossip/ballot/contract.go on lines 145..151
                        gossip/sfc110/contract.go on lines 145..151
                        gossip/sfc202/contract.go on lines 145..151
                        gossip/sfc204/contract.go on lines 128..134

                        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 118.

                        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

                        Identical blocks of code found in 5 locations. Consider refactoring.
                        Open

                        func bindContract(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
                            parsed, err := abi.JSON(strings.NewReader(ContractABI))
                            if err != nil {
                                return nil, err
                            }
                        Severity: Major
                        Found in gossip/sfc202/contract.go and 4 other locations - About 50 mins to fix
                        gossip/ballot/contract.go on lines 145..151
                        gossip/sfc110/contract.go on lines 145..151
                        gossip/sfc204/contract.go on lines 128..134
                        gossip/sfcproxy/contract.go on lines 145..151

                        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 118.

                        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

                        Identical blocks of code found in 5 locations. Consider refactoring.
                        Open

                        func bindContract(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
                            parsed, err := abi.JSON(strings.NewReader(ContractABI))
                            if err != nil {
                                return nil, err
                            }
                        Severity: Major
                        Found in gossip/sfc204/contract.go and 4 other locations - About 50 mins to fix
                        gossip/ballot/contract.go on lines 145..151
                        gossip/sfc110/contract.go on lines 145..151
                        gossip/sfc202/contract.go on lines 145..151
                        gossip/sfcproxy/contract.go on lines 145..151

                        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 118.

                        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

                        Severity
                        Category
                        Status
                        Source
                        Language