mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 11:32:09 +00:00
Fix staticcheck violations (#13301)
* Fix violations of sa2002 * Fix violations of sa4005 * Fix violations of sa4010 * Fix violations for sa4023 * Comment on commented static checks
This commit is contained in:
parent
f537a98fcd
commit
ff99616833
12
BUILD.bazel
12
BUILD.bazel
@ -104,7 +104,7 @@ STATICCHECK_ANALYZERS = [
|
|||||||
"sa1016",
|
"sa1016",
|
||||||
"sa1017",
|
"sa1017",
|
||||||
"sa1018",
|
"sa1018",
|
||||||
# "sa1019",
|
# "sa1019", # TODO: Fix all uses of deprecated things.
|
||||||
"sa1020",
|
"sa1020",
|
||||||
"sa1021",
|
"sa1021",
|
||||||
"sa1023",
|
"sa1023",
|
||||||
@ -117,7 +117,7 @@ STATICCHECK_ANALYZERS = [
|
|||||||
"sa1030",
|
"sa1030",
|
||||||
"sa2000",
|
"sa2000",
|
||||||
"sa2001",
|
"sa2001",
|
||||||
# "sa2002",
|
"sa2002",
|
||||||
"sa2003",
|
"sa2003",
|
||||||
"sa3000",
|
"sa3000",
|
||||||
"sa3001",
|
"sa3001",
|
||||||
@ -125,11 +125,11 @@ STATICCHECK_ANALYZERS = [
|
|||||||
"sa4001",
|
"sa4001",
|
||||||
"sa4003",
|
"sa4003",
|
||||||
"sa4004",
|
"sa4004",
|
||||||
# "sa4005",
|
"sa4005",
|
||||||
# "sa4006",
|
# "sa4006", # TODO: Fix violations of unused arguments.
|
||||||
"sa4008",
|
"sa4008",
|
||||||
"sa4009",
|
"sa4009",
|
||||||
# "sa4010",
|
"sa4010",
|
||||||
"sa4011",
|
"sa4011",
|
||||||
"sa4012",
|
"sa4012",
|
||||||
"sa4013",
|
"sa4013",
|
||||||
@ -142,7 +142,7 @@ STATICCHECK_ANALYZERS = [
|
|||||||
"sa4020",
|
"sa4020",
|
||||||
"sa4021",
|
"sa4021",
|
||||||
"sa4022",
|
"sa4022",
|
||||||
# "sa4023",
|
"sa4023",
|
||||||
"sa4024",
|
"sa4024",
|
||||||
"sa4025",
|
"sa4025",
|
||||||
"sa4026",
|
"sa4026",
|
||||||
|
@ -314,7 +314,10 @@ func (dc *DepositCache) PruneProofs(ctx context.Context, untilDepositIndex int64
|
|||||||
|
|
||||||
// Deposits returns the cached internal deposit tree.
|
// Deposits returns the cached internal deposit tree.
|
||||||
func (fd *FinalizedDeposits) Deposits() cache.MerkleTree {
|
func (fd *FinalizedDeposits) Deposits() cache.MerkleTree {
|
||||||
return fd.deposits
|
if fd.deposits != nil {
|
||||||
|
return fd.deposits
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// MerkleTrieIndex represents the last finalized index in
|
// MerkleTrieIndex represents the last finalized index in
|
||||||
|
@ -477,11 +477,9 @@ func TestAttestationRewards(t *testing.T) {
|
|||||||
require.NoError(t, st.SetSlot(params.BeaconConfig().SlotsPerEpoch*3-1))
|
require.NoError(t, st.SetSlot(params.BeaconConfig().SlotsPerEpoch*3-1))
|
||||||
validators := make([]*eth.Validator, 0, valCount)
|
validators := make([]*eth.Validator, 0, valCount)
|
||||||
balances := make([]uint64, 0, valCount)
|
balances := make([]uint64, 0, valCount)
|
||||||
secretKeys := make([]bls.SecretKey, 0, valCount)
|
|
||||||
for i := 0; i < valCount; i++ {
|
for i := 0; i < valCount; i++ {
|
||||||
blsKey, err := bls.RandKey()
|
blsKey, err := bls.RandKey()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
secretKeys = append(secretKeys, blsKey)
|
|
||||||
validators = append(validators, ð.Validator{
|
validators = append(validators, ð.Validator{
|
||||||
PublicKey: blsKey.PublicKey().Marshal(),
|
PublicKey: blsKey.PublicKey().Marshal(),
|
||||||
ExitEpoch: params.BeaconConfig().FarFutureEpoch,
|
ExitEpoch: params.BeaconConfig().FarFutureEpoch,
|
||||||
|
@ -212,7 +212,7 @@ func (r *testRunner) testDepositsAndTx(ctx context.Context, g *errgroup.Group,
|
|||||||
// for further deposit testing.
|
// for further deposit testing.
|
||||||
err := r.depositor.SendAndMine(ctx, minGenesisActiveCount, int(e2e.DepositCount), e2etypes.PostGenesisDepositBatch, false)
|
err := r.depositor.SendAndMine(ctx, minGenesisActiveCount, int(e2e.DepositCount), e2etypes.PostGenesisDepositBatch, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
r.t.Fatal(err)
|
r.t.Error(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
r.testTxGeneration(ctx, g, keystorePath, []e2etypes.ComponentRunner{})
|
r.testTxGeneration(ctx, g, keystorePath, []e2etypes.ComponentRunner{})
|
||||||
|
@ -16,19 +16,19 @@ type MockProtector struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CheckAttestationSafety returns bool with allow attestation value.
|
// CheckAttestationSafety returns bool with allow attestation value.
|
||||||
func (mp MockProtector) CheckAttestationSafety(_ context.Context, _ *eth.IndexedAttestation) bool {
|
func (mp *MockProtector) CheckAttestationSafety(_ context.Context, _ *eth.IndexedAttestation) bool {
|
||||||
mp.VerifyAttestationCalled = true // skipcq: RVV-B0006
|
mp.VerifyAttestationCalled = true
|
||||||
return mp.AllowAttestation
|
return mp.AllowAttestation
|
||||||
}
|
}
|
||||||
|
|
||||||
// CheckBlockSafety returns bool with allow block value.
|
// CheckBlockSafety returns bool with allow block value.
|
||||||
func (mp MockProtector) CheckBlockSafety(_ context.Context, _ *eth.SignedBeaconBlockHeader) bool {
|
func (mp *MockProtector) CheckBlockSafety(_ context.Context, _ *eth.SignedBeaconBlockHeader) bool {
|
||||||
mp.VerifyBlockCalled = true // skipcq: RVV-B0006
|
mp.VerifyBlockCalled = true
|
||||||
return mp.AllowBlock
|
return mp.AllowBlock
|
||||||
}
|
}
|
||||||
|
|
||||||
// Status returns nil.
|
// Status returns nil.
|
||||||
func (mp MockProtector) Status() error {
|
func (mp *MockProtector) Status() error {
|
||||||
mp.StatusCalled = true // skipcq: RVV-B0006
|
mp.StatusCalled = true
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user