Fantom-foundation/go-lachesis

View on GitHub

Showing 829 of 829 total issues

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

func (_Contract *ContractFilterer) WatchUpdatedOfflinePenaltyThreshold(opts *bind.WatchOpts, sink chan<- *ContractUpdatedOfflinePenaltyThreshold) (event.Subscription, error) {

    logs, sub, err := _Contract.contract.WatchLogs(opts, "UpdatedOfflinePenaltyThreshold")
    if err != nil {
        return nil, err
Severity: Major
Found in gossip/sfc202/contract.go and 12 other locations - About 3 hrs to fix
gossip/sfc110/contract.go on lines 4450..4482
gossip/sfc110/contract.go on lines 4746..4778
gossip/sfc202/contract.go on lines 4178..4210
gossip/sfc202/contract.go on lines 5075..5107
gossip/sfc202/contract.go on lines 5371..5403
gossip/sfc202/contract.go on lines 5504..5536
gossip/sfc204/contract.go on lines 4021..4053
gossip/sfc204/contract.go on lines 4918..4950
gossip/sfc204/contract.go on lines 5214..5246
gossip/sfc204/contract.go on lines 5347..5379
gossip/sfc204/contract.go on lines 5481..5513
gossip/sfcproxy/contract.go on lines 416..448

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

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 13 locations. Consider refactoring.
Open

func (_Contract *ContractFilterer) WatchNetworkUpgradeActivated(opts *bind.WatchOpts, sink chan<- *ContractNetworkUpgradeActivated) (event.Subscription, error) {

    logs, sub, err := _Contract.contract.WatchLogs(opts, "NetworkUpgradeActivated")
    if err != nil {
        return nil, err
Severity: Major
Found in gossip/sfc204/contract.go and 12 other locations - About 3 hrs to fix
gossip/sfc110/contract.go on lines 4450..4482
gossip/sfc110/contract.go on lines 4746..4778
gossip/sfc202/contract.go on lines 4178..4210
gossip/sfc202/contract.go on lines 5075..5107
gossip/sfc202/contract.go on lines 5371..5403
gossip/sfc202/contract.go on lines 5504..5536
gossip/sfc202/contract.go on lines 5638..5670
gossip/sfc204/contract.go on lines 4918..4950
gossip/sfc204/contract.go on lines 5214..5246
gossip/sfc204/contract.go on lines 5347..5379
gossip/sfc204/contract.go on lines 5481..5513
gossip/sfcproxy/contract.go on lines 416..448

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

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 13 locations. Consider refactoring.
Open

func (_Contract *ContractFilterer) WatchUpdatedBaseRewardPerSec(opts *bind.WatchOpts, sink chan<- *ContractUpdatedBaseRewardPerSec) (event.Subscription, error) {

    logs, sub, err := _Contract.contract.WatchLogs(opts, "UpdatedBaseRewardPerSec")
    if err != nil {
        return nil, err
Severity: Major
Found in gossip/sfc204/contract.go and 12 other locations - About 3 hrs to fix
gossip/sfc110/contract.go on lines 4450..4482
gossip/sfc110/contract.go on lines 4746..4778
gossip/sfc202/contract.go on lines 4178..4210
gossip/sfc202/contract.go on lines 5075..5107
gossip/sfc202/contract.go on lines 5371..5403
gossip/sfc202/contract.go on lines 5504..5536
gossip/sfc202/contract.go on lines 5638..5670
gossip/sfc204/contract.go on lines 4021..4053
gossip/sfc204/contract.go on lines 5214..5246
gossip/sfc204/contract.go on lines 5347..5379
gossip/sfc204/contract.go on lines 5481..5513
gossip/sfcproxy/contract.go on lines 416..448

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

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 13 locations. Consider refactoring.
Open

func (_Contract *ContractFilterer) WatchUpdatedBaseRewardPerSec(opts *bind.WatchOpts, sink chan<- *ContractUpdatedBaseRewardPerSec) (event.Subscription, error) {

    logs, sub, err := _Contract.contract.WatchLogs(opts, "UpdatedBaseRewardPerSec")
    if err != nil {
        return nil, err
Severity: Major
Found in gossip/sfc202/contract.go and 12 other locations - About 3 hrs to fix
gossip/sfc110/contract.go on lines 4450..4482
gossip/sfc110/contract.go on lines 4746..4778
gossip/sfc202/contract.go on lines 4178..4210
gossip/sfc202/contract.go on lines 5371..5403
gossip/sfc202/contract.go on lines 5504..5536
gossip/sfc202/contract.go on lines 5638..5670
gossip/sfc204/contract.go on lines 4021..4053
gossip/sfc204/contract.go on lines 4918..4950
gossip/sfc204/contract.go on lines 5214..5246
gossip/sfc204/contract.go on lines 5347..5379
gossip/sfc204/contract.go on lines 5481..5513
gossip/sfcproxy/contract.go on lines 416..448

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

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 13 locations. Consider refactoring.
Open

func (_Contract *ContractFilterer) WatchUpdatedGasPowerAllocationRate(opts *bind.WatchOpts, sink chan<- *ContractUpdatedGasPowerAllocationRate) (event.Subscription, error) {

    logs, sub, err := _Contract.contract.WatchLogs(opts, "UpdatedGasPowerAllocationRate")
    if err != nil {
        return nil, err
Severity: Major
Found in gossip/sfc204/contract.go and 12 other locations - About 3 hrs to fix
gossip/sfc110/contract.go on lines 4450..4482
gossip/sfc110/contract.go on lines 4746..4778
gossip/sfc202/contract.go on lines 4178..4210
gossip/sfc202/contract.go on lines 5075..5107
gossip/sfc202/contract.go on lines 5371..5403
gossip/sfc202/contract.go on lines 5504..5536
gossip/sfc202/contract.go on lines 5638..5670
gossip/sfc204/contract.go on lines 4021..4053
gossip/sfc204/contract.go on lines 4918..4950
gossip/sfc204/contract.go on lines 5347..5379
gossip/sfc204/contract.go on lines 5481..5513
gossip/sfcproxy/contract.go on lines 416..448

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

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 13 locations. Consider refactoring.
Open

func (_Contract *ContractFilterer) WatchAdminChanged(opts *bind.WatchOpts, sink chan<- *ContractAdminChanged) (event.Subscription, error) {

    logs, sub, err := _Contract.contract.WatchLogs(opts, "AdminChanged")
    if err != nil {
        return nil, err
Severity: Major
Found in gossip/sfcproxy/contract.go and 12 other locations - About 3 hrs to fix
gossip/sfc110/contract.go on lines 4450..4482
gossip/sfc110/contract.go on lines 4746..4778
gossip/sfc202/contract.go on lines 4178..4210
gossip/sfc202/contract.go on lines 5075..5107
gossip/sfc202/contract.go on lines 5371..5403
gossip/sfc202/contract.go on lines 5504..5536
gossip/sfc202/contract.go on lines 5638..5670
gossip/sfc204/contract.go on lines 4021..4053
gossip/sfc204/contract.go on lines 4918..4950
gossip/sfc204/contract.go on lines 5214..5246
gossip/sfc204/contract.go on lines 5347..5379
gossip/sfc204/contract.go on lines 5481..5513

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

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 13 locations. Consider refactoring.
Open

func (_Contract *ContractFilterer) WatchUpdatedMinGasPrice(opts *bind.WatchOpts, sink chan<- *ContractUpdatedMinGasPrice) (event.Subscription, error) {

    logs, sub, err := _Contract.contract.WatchLogs(opts, "UpdatedMinGasPrice")
    if err != nil {
        return nil, err
Severity: Major
Found in gossip/sfc202/contract.go and 12 other locations - About 3 hrs to fix
gossip/sfc110/contract.go on lines 4450..4482
gossip/sfc110/contract.go on lines 4746..4778
gossip/sfc202/contract.go on lines 4178..4210
gossip/sfc202/contract.go on lines 5075..5107
gossip/sfc202/contract.go on lines 5371..5403
gossip/sfc202/contract.go on lines 5638..5670
gossip/sfc204/contract.go on lines 4021..4053
gossip/sfc204/contract.go on lines 4918..4950
gossip/sfc204/contract.go on lines 5214..5246
gossip/sfc204/contract.go on lines 5347..5379
gossip/sfc204/contract.go on lines 5481..5513
gossip/sfcproxy/contract.go on lines 416..448

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

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 13 locations. Consider refactoring.
Open

func (_Contract *ContractFilterer) WatchNetworkUpgradeActivated(opts *bind.WatchOpts, sink chan<- *ContractNetworkUpgradeActivated) (event.Subscription, error) {

    logs, sub, err := _Contract.contract.WatchLogs(opts, "NetworkUpgradeActivated")
    if err != nil {
        return nil, err
Severity: Major
Found in gossip/sfc202/contract.go and 12 other locations - About 3 hrs to fix
gossip/sfc110/contract.go on lines 4450..4482
gossip/sfc110/contract.go on lines 4746..4778
gossip/sfc202/contract.go on lines 5075..5107
gossip/sfc202/contract.go on lines 5371..5403
gossip/sfc202/contract.go on lines 5504..5536
gossip/sfc202/contract.go on lines 5638..5670
gossip/sfc204/contract.go on lines 4021..4053
gossip/sfc204/contract.go on lines 4918..4950
gossip/sfc204/contract.go on lines 5214..5246
gossip/sfc204/contract.go on lines 5347..5379
gossip/sfc204/contract.go on lines 5481..5513
gossip/sfcproxy/contract.go on lines 416..448

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

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 13 locations. Consider refactoring.
Open

func (_Contract *ContractFilterer) WatchUpdatedMinGasPrice(opts *bind.WatchOpts, sink chan<- *ContractUpdatedMinGasPrice) (event.Subscription, error) {

    logs, sub, err := _Contract.contract.WatchLogs(opts, "UpdatedMinGasPrice")
    if err != nil {
        return nil, err
Severity: Major
Found in gossip/sfc204/contract.go and 12 other locations - About 3 hrs to fix
gossip/sfc110/contract.go on lines 4450..4482
gossip/sfc110/contract.go on lines 4746..4778
gossip/sfc202/contract.go on lines 4178..4210
gossip/sfc202/contract.go on lines 5075..5107
gossip/sfc202/contract.go on lines 5371..5403
gossip/sfc202/contract.go on lines 5504..5536
gossip/sfc202/contract.go on lines 5638..5670
gossip/sfc204/contract.go on lines 4021..4053
gossip/sfc204/contract.go on lines 4918..4950
gossip/sfc204/contract.go on lines 5214..5246
gossip/sfc204/contract.go on lines 5481..5513
gossip/sfcproxy/contract.go on lines 416..448

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

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

File opera_export_state.go has 557 lines of code (exceeds 500 allowed). Consider refactoring.
Open

package main

import (
    "bytes"
    "context"
Severity: Minor
Found in cmd/lachesis/opera_export_state.go - About 3 hrs to fix

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

    func (_Contract *ContractCaller) Delegations(opts *bind.CallOpts, arg0 common.Address, arg1 *big.Int) (struct {
        CreatedEpoch     *big.Int
        CreatedTime      *big.Int
        DeactivatedEpoch *big.Int
        DeactivatedTime  *big.Int
    Severity: Major
    Found in gossip/sfc202/contract.go and 1 other location - About 3 hrs to fix
    gossip/sfc204/contract.go on lines 513..534

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

    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 2 locations. Consider refactoring.
    Open

    func (_Contract *ContractCaller) Delegations(opts *bind.CallOpts, arg0 common.Address, arg1 *big.Int) (struct {
        CreatedEpoch     *big.Int
        CreatedTime      *big.Int
        DeactivatedEpoch *big.Int
        DeactivatedTime  *big.Int
    Severity: Major
    Found in gossip/sfc204/contract.go and 1 other location - About 3 hrs to fix
    gossip/sfc202/contract.go on lines 504..525

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

    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

    Method Fetcher.loop has 105 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (f *Fetcher) loop() {
        defer f.wg.Done()
        // Iterate the event fetching until a quit is requested
        fetchTimer := time.NewTimer(0)
        defer fetchTimer.Stop()
    Severity: Major
    Found in gossip/fetcher/fetcher.go - About 3 hrs to fix

      ContractTransactorSession has 27 methods (exceeds 20 allowed). Consider refactoring.
      Open

      type ContractTransactorSession struct {
          Contract     *ContractTransactor // Generic contract transactor binding to set the session for
          TransactOpts bind.TransactOpts   // Transaction auth options to use throughout this session
      }
      Severity: Minor
      Found in gossip/sfc204/contract.go - About 3 hrs to fix

        ContractTransactor has 27 methods (exceeds 20 allowed). Consider refactoring.
        Open

        type ContractTransactor struct {
            contract *bind.BoundContract // Generic contract wrapper for the low level calls
        }
        Severity: Minor
        Found in gossip/sfc204/contract.go - About 3 hrs to fix

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

          func (_Contract *ContractCaller) LegacyDelegations(opts *bind.CallOpts, arg0 common.Address) (struct {
              CreatedEpoch     *big.Int
              CreatedTime      *big.Int
              DeactivatedEpoch *big.Int
              DeactivatedTime  *big.Int
          Severity: Major
          Found in gossip/sfc202/contract.go and 1 other location - About 3 hrs to fix
          gossip/sfc110/contract.go on lines 622..643

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

          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 (_Contract *ContractCaller) Delegations(opts *bind.CallOpts, arg0 common.Address) (struct {
              CreatedEpoch     *big.Int
              CreatedTime      *big.Int
              DeactivatedEpoch *big.Int
              DeactivatedTime  *big.Int
          Severity: Major
          Found in gossip/sfc110/contract.go and 1 other location - About 3 hrs to fix
          gossip/sfc202/contract.go on lines 902..923

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

          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 a Cognitive Complexity of 37 (exceeds 20 allowed). Consider refactoring.
          Open

          func ForEachRandFork(
              nodes []idx.StakerID,
              cheatersArr []idx.StakerID,
              eventCount int,
              parentCount int,
          Severity: Minor
          Found in inter/common.go - About 3 hrs 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

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

          func (_Contract *ContractFilterer) FilterUpdatedDelegation(opts *bind.FilterOpts, delegator []common.Address, oldStakerID []*big.Int, newStakerID []*big.Int) (*ContractUpdatedDelegationIterator, error) {
          
              var delegatorRule []interface{}
              for _, delegatorItem := range delegator {
                  delegatorRule = append(delegatorRule, delegatorItem)
          Severity: Major
          Found in gossip/sfc202/contract.go and 2 other locations - About 3 hrs to fix
          gossip/sfc110/contract.go on lines 4574..4594
          gossip/sfc204/contract.go on lines 5042..5062

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

          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 3 locations. Consider refactoring.
          Open

          func (_Contract *ContractFilterer) FilterUpdatedDelegation(opts *bind.FilterOpts, delegator []common.Address, oldStakerID []*big.Int, newStakerID []*big.Int) (*ContractUpdatedDelegationIterator, error) {
          
              var delegatorRule []interface{}
              for _, delegatorItem := range delegator {
                  delegatorRule = append(delegatorRule, delegatorItem)
          Severity: Major
          Found in gossip/sfc204/contract.go and 2 other locations - About 3 hrs to fix
          gossip/sfc110/contract.go on lines 4574..4594
          gossip/sfc202/contract.go on lines 5199..5219

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

          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