mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-03 00:27:38 +00:00
Add errcheck and gosimple linters (#9729)
* Add errcheck linter * Check unchecked error * Add gosimple linter * Remove type assertion to same type * Omit nil check len() for nil slices is defined as zero * Revert "Remove type assertion to same type" This reverts commit af69ca1ac8a4f0243a5ccaf5042dbebad6d2cf1c. * Revert "Revert "Remove type assertion to same type"" This reverts commit 5fe8931504fa22347d04d3d06558e5f478f5bf50. Co-authored-by: Raul Jordan <raul@prysmaticlabs.com> Co-authored-by: Radosław Kapka <rkapka@wp.pl>
This commit is contained in:
parent
5b3375638a
commit
7f3ec4221f
2
.github/workflows/go.yml
vendored
2
.github/workflows/go.yml
vendored
@ -39,7 +39,7 @@ jobs:
|
|||||||
- name: Golangci-lint
|
- name: Golangci-lint
|
||||||
uses: golangci/golangci-lint-action@v2
|
uses: golangci/golangci-lint-action@v2
|
||||||
with:
|
with:
|
||||||
args: --print-issued-lines --sort-results --no-config --timeout=10m --disable-all -E deadcode --skip-files=validator/web/site_data.go
|
args: --print-issued-lines --sort-results --no-config --timeout=10m --disable-all -E deadcode -E errcheck -E gosimple --skip-files=validator/web/site_data.go
|
||||||
|
|
||||||
build:
|
build:
|
||||||
name: Build
|
name: Build
|
||||||
|
@ -9,7 +9,6 @@ import (
|
|||||||
"github.com/prysmaticlabs/prysm/beacon-chain/core/altair"
|
"github.com/prysmaticlabs/prysm/beacon-chain/core/altair"
|
||||||
"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
|
"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
|
||||||
"github.com/prysmaticlabs/prysm/beacon-chain/core/time"
|
"github.com/prysmaticlabs/prysm/beacon-chain/core/time"
|
||||||
"github.com/prysmaticlabs/prysm/beacon-chain/state"
|
|
||||||
stateAltair "github.com/prysmaticlabs/prysm/beacon-chain/state/v2"
|
stateAltair "github.com/prysmaticlabs/prysm/beacon-chain/state/v2"
|
||||||
"github.com/prysmaticlabs/prysm/config/params"
|
"github.com/prysmaticlabs/prysm/config/params"
|
||||||
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
||||||
@ -79,8 +78,6 @@ func TestUpgradeToAltair(t *testing.T) {
|
|||||||
preForkState := st.Copy()
|
preForkState := st.Copy()
|
||||||
aState, err := altair.UpgradeToAltair(context.Background(), st)
|
aState, err := altair.UpgradeToAltair(context.Background(), st)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
_, ok := aState.(state.BeaconStateAltair)
|
|
||||||
require.Equal(t, true, ok)
|
|
||||||
|
|
||||||
require.Equal(t, preForkState.GenesisTime(), aState.GenesisTime())
|
require.Equal(t, preForkState.GenesisTime(), aState.GenesisTime())
|
||||||
require.DeepSSZEqual(t, preForkState.GenesisValidatorRoot(), aState.GenesisValidatorRoot())
|
require.DeepSSZEqual(t, preForkState.GenesisValidatorRoot(), aState.GenesisValidatorRoot())
|
||||||
|
@ -9,6 +9,7 @@ import (
|
|||||||
"github.com/prysmaticlabs/prysm/config/params"
|
"github.com/prysmaticlabs/prysm/config/params"
|
||||||
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
||||||
aggtesting "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/attestation/aggregation/testing"
|
aggtesting "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/attestation/aggregation/testing"
|
||||||
|
"github.com/prysmaticlabs/prysm/testing/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func BenchmarkProposerAtts_sortByProfitability(b *testing.B) {
|
func BenchmarkProposerAtts_sortByProfitability(b *testing.B) {
|
||||||
@ -49,7 +50,8 @@ func BenchmarkProposerAtts_sortByProfitability(b *testing.B) {
|
|||||||
for i, att := range atts {
|
for i, att := range atts {
|
||||||
attsCopy[i] = ethpb.CopyAttestation(att)
|
attsCopy[i] = ethpb.CopyAttestation(att)
|
||||||
}
|
}
|
||||||
attsCopy.sortByProfitability()
|
_, err := attsCopy.sortByProfitability()
|
||||||
|
require.NoError(b, err, "Could not sort attestations by profitability")
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
|
@ -79,7 +79,7 @@ func (s *Service) validateWithBatchVerifier(ctx context.Context, message string,
|
|||||||
}
|
}
|
||||||
|
|
||||||
func verifyBatch(verifierBatch []*signatureVerifier) {
|
func verifyBatch(verifierBatch []*signatureVerifier) {
|
||||||
if verifierBatch == nil || len(verifierBatch) == 0 {
|
if len(verifierBatch) == 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
aggSet := verifierBatch[0].set
|
aggSet := verifierBatch[0].set
|
||||||
|
@ -57,7 +57,7 @@ func AggregatePublicKeys(pubs [][]byte) (common.PublicKey, error) {
|
|||||||
if features.Get().SkipBLSVerify {
|
if features.Get().SkipBLSVerify {
|
||||||
return &PublicKey{}, nil
|
return &PublicKey{}, nil
|
||||||
}
|
}
|
||||||
if pubs == nil || len(pubs) == 0 {
|
if len(pubs) == 0 {
|
||||||
return nil, errors.New("nil or empty public keys")
|
return nil, errors.New("nil or empty public keys")
|
||||||
}
|
}
|
||||||
agg := new(blstAggregatePublicKey)
|
agg := new(blstAggregatePublicKey)
|
||||||
|
Loading…
Reference in New Issue
Block a user