Fantom-foundation/go-lachesis

View on GitHub

Showing 829 of 829 total issues

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

Method Emitter.createEvent has 102 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (em *Emitter) createEvent(poolTxs map[common.Address]types.Transactions) *inter.Event {
    if em.myStakerID == 0 {
        // not a validator
        return nil
    }
Severity: Major
Found in gossip/emitter.go - About 3 hrs to fix

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

    func (_Contract *ContractFilterer) FilterUpdatedStakerSfcAddress(opts *bind.FilterOpts, stakerID []*big.Int, oldSfcAddress []common.Address, newSfcAddress []common.Address) (*ContractUpdatedStakerSfcAddressIterator, error) {
    
        var stakerIDRule []interface{}
        for _, stakerIDItem := range stakerID {
            stakerIDRule = append(stakerIDRule, stakerIDItem)
    Severity: Major
    Found in gossip/sfc110/contract.go and 1 other location - About 3 hrs to fix
    gossip/sfc202/contract.go on lines 6049..6069

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

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

    func (_Contract *ContractFilterer) FilterPartialWithdrawnByRequest(opts *bind.FilterOpts, auth []common.Address, receiver []common.Address, stakerID []*big.Int) (*ContractPartialWithdrawnByRequestIterator, error) {
    
        var authRule []interface{}
        for _, authItem := range auth {
            authRule = append(authRule, authItem)
    Severity: Major
    Found in gossip/sfc110/contract.go and 5 other locations - About 3 hrs to fix
    gossip/sfc110/contract.go on lines 2921..2941
    gossip/sfc202/contract.go on lines 3114..3134
    gossip/sfc202/contract.go on lines 4456..4476
    gossip/sfc204/contract.go on lines 2957..2977
    gossip/sfc204/contract.go on lines 4299..4319

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

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

    func (_Contract *ContractFilterer) FilterPartialWithdrawnByRequest(opts *bind.FilterOpts, auth []common.Address, receiver []common.Address, stakerID []*big.Int) (*ContractPartialWithdrawnByRequestIterator, error) {
    
        var authRule []interface{}
        for _, authItem := range auth {
            authRule = append(authRule, authItem)
    Severity: Major
    Found in gossip/sfc204/contract.go and 5 other locations - About 3 hrs to fix
    gossip/sfc110/contract.go on lines 2921..2941
    gossip/sfc110/contract.go on lines 3831..3851
    gossip/sfc202/contract.go on lines 3114..3134
    gossip/sfc202/contract.go on lines 4456..4476
    gossip/sfc204/contract.go on lines 2957..2977

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

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

    func (_Contract *ContractFilterer) FilterCreatedWithdrawRequest(opts *bind.FilterOpts, auth []common.Address, receiver []common.Address, stakerID []*big.Int) (*ContractCreatedWithdrawRequestIterator, error) {
    
        var authRule []interface{}
        for _, authItem := range auth {
            authRule = append(authRule, authItem)
    Severity: Major
    Found in gossip/sfc110/contract.go and 5 other locations - About 3 hrs to fix
    gossip/sfc110/contract.go on lines 3831..3851
    gossip/sfc202/contract.go on lines 3114..3134
    gossip/sfc202/contract.go on lines 4456..4476
    gossip/sfc204/contract.go on lines 2957..2977
    gossip/sfc204/contract.go on lines 4299..4319

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

    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 *ContractFilterer) FilterUpdatedStakerSfcAddress(opts *bind.FilterOpts, stakerID []*big.Int, oldSfcAddress []common.Address, newSfcAddress []common.Address) (*ContractUpdatedStakerSfcAddressIterator, error) {
    
        var stakerIDRule []interface{}
        for _, stakerIDItem := range stakerID {
            stakerIDRule = append(stakerIDRule, stakerIDItem)
    Severity: Major
    Found in gossip/sfc202/contract.go and 1 other location - About 3 hrs to fix
    gossip/sfc110/contract.go on lines 5157..5177

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

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

    func (_Contract *ContractFilterer) FilterCreatedWithdrawRequest(opts *bind.FilterOpts, auth []common.Address, receiver []common.Address, stakerID []*big.Int) (*ContractCreatedWithdrawRequestIterator, error) {
    
        var authRule []interface{}
        for _, authItem := range auth {
            authRule = append(authRule, authItem)
    Severity: Major
    Found in gossip/sfc204/contract.go and 5 other locations - About 3 hrs to fix
    gossip/sfc110/contract.go on lines 2921..2941
    gossip/sfc110/contract.go on lines 3831..3851
    gossip/sfc202/contract.go on lines 3114..3134
    gossip/sfc202/contract.go on lines 4456..4476
    gossip/sfc204/contract.go on lines 4299..4319

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

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

    func (_Contract *ContractFilterer) FilterPartialWithdrawnByRequest(opts *bind.FilterOpts, auth []common.Address, receiver []common.Address, stakerID []*big.Int) (*ContractPartialWithdrawnByRequestIterator, error) {
    
        var authRule []interface{}
        for _, authItem := range auth {
            authRule = append(authRule, authItem)
    Severity: Major
    Found in gossip/sfc202/contract.go and 5 other locations - About 3 hrs to fix
    gossip/sfc110/contract.go on lines 2921..2941
    gossip/sfc110/contract.go on lines 3831..3851
    gossip/sfc202/contract.go on lines 3114..3134
    gossip/sfc204/contract.go on lines 2957..2977
    gossip/sfc204/contract.go on lines 4299..4319

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

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

    func (_Contract *ContractFilterer) FilterCreatedWithdrawRequest(opts *bind.FilterOpts, auth []common.Address, receiver []common.Address, stakerID []*big.Int) (*ContractCreatedWithdrawRequestIterator, error) {
    
        var authRule []interface{}
        for _, authItem := range auth {
            authRule = append(authRule, authItem)
    Severity: Major
    Found in gossip/sfc202/contract.go and 5 other locations - About 3 hrs to fix
    gossip/sfc110/contract.go on lines 2921..2941
    gossip/sfc110/contract.go on lines 3831..3851
    gossip/sfc202/contract.go on lines 4456..4476
    gossip/sfc204/contract.go on lines 2957..2977
    gossip/sfc204/contract.go on lines 4299..4319

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

    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 *Store) GetSfcStaker(stakerID idx.StakerID) *sfctype.SfcStaker {
        s.mutex.Stakers.Lock()
        defer s.mutex.Stakers.Unlock()
    
        // Get data from LRU cache first.
    Severity: Major
    Found in app/store_sfc_stakers.go and 1 other location - About 3 hrs to fix
    app/store_sfc_delegators.go on lines 84..105

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

    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 *Store) GetSfcDelegation(id sfctype.DelegationID) *sfctype.SfcDelegation {
        s.mutex.Delegations.Lock()
        defer s.mutex.Delegations.Unlock()
    
        // Get data from LRU cache first.
    Severity: Major
    Found in app/store_sfc_delegators.go and 1 other location - About 3 hrs to fix
    app/store_sfc_stakers.go on lines 116..137

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

    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 *Store) MoveDirtyValidationScoresToActive() {
        it := s.table.DirtyValidationScore.NewIterator(nil, nil)
        defer it.Release()
    
        keys := make([][]byte, 0, 500) // don't write during iteration
    Severity: Major
    Found in app/store_scores.go and 1 other location - About 2 hrs to fix
    app/store_scores.go on lines 206..228

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

    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 *Store) MoveDirtyOriginationScoresToActive() {
        it := s.table.DirtyOriginationScore.NewIterator(nil, nil)
        defer it.Release()
    
        keys := make([][]byte, 0, 500) // don't write during iteration
    Severity: Major
    Found in app/store_scores.go and 1 other location - About 2 hrs to fix
    app/store_scores.go on lines 123..145

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

    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 importWallet(ctx *cli.Context) error {
        keyfile := ctx.Args().First()
        if len(keyfile) == 0 {
            utils.Fatalf("keyfile must be given as argument")
        }
    Severity: Major
    Found in cmd/lachesis/accountcmd.go and 1 other location - About 2 hrs to fix
    cmd/lachesis/accountcmd.go on lines 364..385

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

    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 accountImport(ctx *cli.Context) error {
        keyfile := ctx.Args().First()
        if len(keyfile) == 0 {
            utils.Fatalf("keyfile must be given as argument")
        }
    Severity: Major
    Found in cmd/lachesis/accountcmd.go and 1 other location - About 2 hrs to fix
    cmd/lachesis/accountcmd.go on lines 341..362

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

    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

    ContractTransactor has 24 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/sfc110/contract.go - About 2 hrs to fix

      ContractTransactorSession has 24 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/sfc110/contract.go - About 2 hrs to fix

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

        func (s *Store) GetEvent(id hash.Event) *inter.Event {
            key := id.Bytes()
        
            // Get event from LRU cache first.
            if s.cache.Events != nil {
        Severity: Major
        Found in gossip/store_event.go and 1 other location - About 2 hrs to fix
        gossip/store_epoch_stats.go on lines 20..40

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

        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 *Store) GetEpochStats(epoch idx.Epoch) *sfctype.EpochStats {
            key := epoch.Bytes()
        
            // Get data from LRU cache first.
            if s.cache.EpochStats != nil {
        Severity: Major
        Found in gossip/store_epoch_stats.go and 1 other location - About 2 hrs to fix
        gossip/store_event.go on lines 48..68

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

        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