mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 15:37:56 -05:00
Cleanup From Deepsource (#9961)
* ds cleanup * fix Co-authored-by: Radosław Kapka <rkapka@wp.pl> Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
@@ -47,7 +47,7 @@ func TestFuzzProcessBlockHeader_10000(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFuzzverifyDepositDataSigningRoot_10000(t *testing.T) {
|
func TestFuzzverifyDepositDataSigningRoot_10000(_ *testing.T) {
|
||||||
fuzzer := fuzz.NewWithSeed(0)
|
fuzzer := fuzz.NewWithSeed(0)
|
||||||
var ba []byte
|
var ba []byte
|
||||||
pubkey := [48]byte{}
|
pubkey := [48]byte{}
|
||||||
@@ -85,7 +85,7 @@ func TestFuzzProcessEth1DataInBlock_10000(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFuzzareEth1DataEqual_10000(t *testing.T) {
|
func TestFuzzareEth1DataEqual_10000(_ *testing.T) {
|
||||||
fuzzer := fuzz.NewWithSeed(0)
|
fuzzer := fuzz.NewWithSeed(0)
|
||||||
eth1data := ð.Eth1Data{}
|
eth1data := ð.Eth1Data{}
|
||||||
eth1data2 := ð.Eth1Data{}
|
eth1data2 := ð.Eth1Data{}
|
||||||
@@ -227,7 +227,7 @@ func TestFuzzVerifyAttesterSlashing_10000(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFuzzIsSlashableAttestationData_10000(t *testing.T) {
|
func TestFuzzIsSlashableAttestationData_10000(_ *testing.T) {
|
||||||
fuzzer := fuzz.NewWithSeed(0)
|
fuzzer := fuzz.NewWithSeed(0)
|
||||||
attestationData := ð.AttestationData{}
|
attestationData := ð.AttestationData{}
|
||||||
attestationData2 := ð.AttestationData{}
|
attestationData2 := ð.AttestationData{}
|
||||||
@@ -239,7 +239,7 @@ func TestFuzzIsSlashableAttestationData_10000(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFuzzslashableAttesterIndices_10000(t *testing.T) {
|
func TestFuzzslashableAttesterIndices_10000(_ *testing.T) {
|
||||||
fuzzer := fuzz.NewWithSeed(0)
|
fuzzer := fuzz.NewWithSeed(0)
|
||||||
attesterSlashing := ð.AttesterSlashing{}
|
attesterSlashing := ð.AttesterSlashing{}
|
||||||
|
|
||||||
@@ -397,7 +397,7 @@ func TestFuzzProcessVoluntaryExitsNoVerify_10000(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFuzzVerifyExit_10000(t *testing.T) {
|
func TestFuzzVerifyExit_10000(_ *testing.T) {
|
||||||
fuzzer := fuzz.NewWithSeed(0)
|
fuzzer := fuzz.NewWithSeed(0)
|
||||||
ve := ð.SignedVoluntaryExit{}
|
ve := ð.SignedVoluntaryExit{}
|
||||||
rawVal := ðpb.Validator{}
|
rawVal := ðpb.Validator{}
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ func TotalActiveBalance(s state.ReadOnlyBeaconState) (uint64, error) {
|
|||||||
case err == nil:
|
case err == nil:
|
||||||
return bal, nil
|
return bal, nil
|
||||||
case errors.Is(err, cache.ErrNotFound):
|
case errors.Is(err, cache.ErrNotFound):
|
||||||
break
|
// Do nothing if we receive a not found error.
|
||||||
default:
|
default:
|
||||||
// In the event, we encounter another error we return it.
|
// In the event, we encounter another error we return it.
|
||||||
return 0, err
|
return 0, err
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import (
|
|||||||
// PruneAttestationsAtEpoch deletes all attestations from the slasher DB with target epoch
|
// PruneAttestationsAtEpoch deletes all attestations from the slasher DB with target epoch
|
||||||
// less than or equal to the specified epoch.
|
// less than or equal to the specified epoch.
|
||||||
func (s *Store) PruneAttestationsAtEpoch(
|
func (s *Store) PruneAttestationsAtEpoch(
|
||||||
ctx context.Context, maxEpoch types.Epoch,
|
_ context.Context, maxEpoch types.Epoch,
|
||||||
) (numPruned uint, err error) {
|
) (numPruned uint, err error) {
|
||||||
// We can prune everything less than the current epoch - history length.
|
// We can prune everything less than the current epoch - history length.
|
||||||
encodedEndPruneEpoch := fssz.MarshalUint64([]byte{}, uint64(maxEpoch))
|
encodedEndPruneEpoch := fssz.MarshalUint64([]byte{}, uint64(maxEpoch))
|
||||||
@@ -85,7 +85,7 @@ func (s *Store) PruneAttestationsAtEpoch(
|
|||||||
// PruneProposalsAtEpoch deletes all proposals from the slasher DB with epoch
|
// PruneProposalsAtEpoch deletes all proposals from the slasher DB with epoch
|
||||||
// less than or equal to the specified epoch.
|
// less than or equal to the specified epoch.
|
||||||
func (s *Store) PruneProposalsAtEpoch(
|
func (s *Store) PruneProposalsAtEpoch(
|
||||||
ctx context.Context, maxEpoch types.Epoch,
|
_ context.Context, maxEpoch types.Epoch,
|
||||||
) (numPruned uint, err error) {
|
) (numPruned uint, err error) {
|
||||||
var endPruneSlot types.Slot
|
var endPruneSlot types.Slot
|
||||||
endPruneSlot, err = slots.EpochEnd(maxEpoch)
|
endPruneSlot, err = slots.EpochEnd(maxEpoch)
|
||||||
|
|||||||
@@ -394,7 +394,7 @@ func (s *Store) SaveBlockProposals(
|
|||||||
|
|
||||||
// HighestAttestations retrieves the last attestation data from the database for all indices.
|
// HighestAttestations retrieves the last attestation data from the database for all indices.
|
||||||
func (s *Store) HighestAttestations(
|
func (s *Store) HighestAttestations(
|
||||||
ctx context.Context,
|
_ context.Context,
|
||||||
indices []types.ValidatorIndex,
|
indices []types.ValidatorIndex,
|
||||||
) ([]*slashpb.HighestAttestation, error) {
|
) ([]*slashpb.HighestAttestation, error) {
|
||||||
if len(indices) == 0 {
|
if len(indices) == 0 {
|
||||||
|
|||||||
@@ -36,11 +36,11 @@ func (m *PoolMock) InsertProposerSlashing(_ context.Context, _ state.ReadOnlyBea
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MarkIncludedAttesterSlashing --
|
// MarkIncludedAttesterSlashing --
|
||||||
func (_ *PoolMock) MarkIncludedAttesterSlashing(_ *ethpb.AttesterSlashing) {
|
func (*PoolMock) MarkIncludedAttesterSlashing(_ *ethpb.AttesterSlashing) {
|
||||||
panic("implement me")
|
panic("implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarkIncludedProposerSlashing --
|
// MarkIncludedProposerSlashing --
|
||||||
func (_ *PoolMock) MarkIncludedProposerSlashing(_ *ethpb.ProposerSlashing) {
|
func (*PoolMock) MarkIncludedProposerSlashing(_ *ethpb.ProposerSlashing) {
|
||||||
panic("implement me")
|
panic("implement me")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ func TestCorrect_ActiveValidatorsCount(t *testing.T) {
|
|||||||
assert.Equal(t, int(params.BeaconConfig().MinGenesisActiveValidatorCount)+100, int(vals), "mainnet genesis active count isn't accurate")
|
assert.Equal(t, int(params.BeaconConfig().MinGenesisActiveValidatorCount)+100, int(vals), "mainnet genesis active count isn't accurate")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestLoggingParameters(t *testing.T) {
|
func TestLoggingParameters(_ *testing.T) {
|
||||||
logGossipParameters("testing", nil)
|
logGossipParameters("testing", nil)
|
||||||
logGossipParameters("testing", &pubsub.TopicScoreParams{})
|
logGossipParameters("testing", &pubsub.TopicScoreParams{})
|
||||||
// Test out actual gossip parameters.
|
// Test out actual gossip parameters.
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ func (bs *Server) ListBlocks(
|
|||||||
|
|
||||||
switch q := req.QueryFilter.(type) {
|
switch q := req.QueryFilter.(type) {
|
||||||
case *ethpb.ListBlocksRequest_Epoch:
|
case *ethpb.ListBlocksRequest_Epoch:
|
||||||
ctrs, numBlks, nextPageToken, err := bs.ListBlocksForEpoch(ctx, req, q)
|
ctrs, numBlks, nextPageToken, err := bs.listBlocksForEpoch(ctx, req, q)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -63,7 +63,7 @@ func (bs *Server) ListBlocks(
|
|||||||
NextPageToken: nextPageToken,
|
NextPageToken: nextPageToken,
|
||||||
}, nil
|
}, nil
|
||||||
case *ethpb.ListBlocksRequest_Root:
|
case *ethpb.ListBlocksRequest_Root:
|
||||||
ctrs, numBlks, nextPageToken, err := bs.ListBlocksForRoot(ctx, req, q)
|
ctrs, numBlks, nextPageToken, err := bs.listBlocksForRoot(ctx, req, q)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -79,7 +79,7 @@ func (bs *Server) ListBlocks(
|
|||||||
}, nil
|
}, nil
|
||||||
|
|
||||||
case *ethpb.ListBlocksRequest_Slot:
|
case *ethpb.ListBlocksRequest_Slot:
|
||||||
ctrs, numBlks, nextPageToken, err := bs.ListBlocksForSlot(ctx, req, q)
|
ctrs, numBlks, nextPageToken, err := bs.listBlocksForSlot(ctx, req, q)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -94,7 +94,7 @@ func (bs *Server) ListBlocks(
|
|||||||
NextPageToken: nextPageToken,
|
NextPageToken: nextPageToken,
|
||||||
}, nil
|
}, nil
|
||||||
case *ethpb.ListBlocksRequest_Genesis:
|
case *ethpb.ListBlocksRequest_Genesis:
|
||||||
ctrs, numBlks, nextPageToken, err := bs.ListBlocksForGenesis(ctx, req, q)
|
ctrs, numBlks, nextPageToken, err := bs.listBlocksForGenesis(ctx, req, q)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -128,7 +128,7 @@ func (bs *Server) ListBeaconBlocks(
|
|||||||
|
|
||||||
switch q := req.QueryFilter.(type) {
|
switch q := req.QueryFilter.(type) {
|
||||||
case *ethpb.ListBlocksRequest_Epoch:
|
case *ethpb.ListBlocksRequest_Epoch:
|
||||||
ctrs, numBlks, nextPageToken, err := bs.ListBlocksForEpoch(ctx, req, q)
|
ctrs, numBlks, nextPageToken, err := bs.listBlocksForEpoch(ctx, req, q)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -142,7 +142,7 @@ func (bs *Server) ListBeaconBlocks(
|
|||||||
NextPageToken: nextPageToken,
|
NextPageToken: nextPageToken,
|
||||||
}, nil
|
}, nil
|
||||||
case *ethpb.ListBlocksRequest_Root:
|
case *ethpb.ListBlocksRequest_Root:
|
||||||
ctrs, numBlks, nextPageToken, err := bs.ListBlocksForRoot(ctx, req, q)
|
ctrs, numBlks, nextPageToken, err := bs.listBlocksForRoot(ctx, req, q)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -157,7 +157,7 @@ func (bs *Server) ListBeaconBlocks(
|
|||||||
}, nil
|
}, nil
|
||||||
|
|
||||||
case *ethpb.ListBlocksRequest_Slot:
|
case *ethpb.ListBlocksRequest_Slot:
|
||||||
ctrs, numBlks, nextPageToken, err := bs.ListBlocksForSlot(ctx, req, q)
|
ctrs, numBlks, nextPageToken, err := bs.listBlocksForSlot(ctx, req, q)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -171,7 +171,7 @@ func (bs *Server) ListBeaconBlocks(
|
|||||||
NextPageToken: nextPageToken,
|
NextPageToken: nextPageToken,
|
||||||
}, nil
|
}, nil
|
||||||
case *ethpb.ListBlocksRequest_Genesis:
|
case *ethpb.ListBlocksRequest_Genesis:
|
||||||
ctrs, numBlks, nextPageToken, err := bs.ListBlocksForGenesis(ctx, req, q)
|
ctrs, numBlks, nextPageToken, err := bs.listBlocksForGenesis(ctx, req, q)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -224,8 +224,8 @@ func convertToBlockContainer(blk block.SignedBeaconBlock, root [32]byte, isCanon
|
|||||||
return ctr, nil
|
return ctr, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListBlocksForEpoch retrieves all blocks for the provided epoch.
|
// listBlocksForEpoch retrieves all blocks for the provided epoch.
|
||||||
func (bs *Server) ListBlocksForEpoch(ctx context.Context, req *ethpb.ListBlocksRequest, q *ethpb.ListBlocksRequest_Epoch) ([]blockContainer, int, string, error) {
|
func (bs *Server) listBlocksForEpoch(ctx context.Context, req *ethpb.ListBlocksRequest, q *ethpb.ListBlocksRequest_Epoch) ([]blockContainer, int, string, error) {
|
||||||
blks, _, err := bs.BeaconDB.Blocks(ctx, filters.NewFilter().SetStartEpoch(q.Epoch).SetEndEpoch(q.Epoch))
|
blks, _, err := bs.BeaconDB.Blocks(ctx, filters.NewFilter().SetStartEpoch(q.Epoch).SetEndEpoch(q.Epoch))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, 0, strconv.Itoa(0), status.Errorf(codes.Internal, "Could not get blocks: %v", err)
|
return nil, 0, strconv.Itoa(0), status.Errorf(codes.Internal, "Could not get blocks: %v", err)
|
||||||
@@ -262,8 +262,8 @@ func (bs *Server) ListBlocksForEpoch(ctx context.Context, req *ethpb.ListBlocksR
|
|||||||
return containers, numBlks, nextPageToken, nil
|
return containers, numBlks, nextPageToken, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListBlocksForRoot retrieves the block for the provided root.
|
// listBlocksForRoot retrieves the block for the provided root.
|
||||||
func (bs *Server) ListBlocksForRoot(ctx context.Context, _ *ethpb.ListBlocksRequest, q *ethpb.ListBlocksRequest_Root) ([]blockContainer, int, string, error) {
|
func (bs *Server) listBlocksForRoot(ctx context.Context, _ *ethpb.ListBlocksRequest, q *ethpb.ListBlocksRequest_Root) ([]blockContainer, int, string, error) {
|
||||||
blk, err := bs.BeaconDB.Block(ctx, bytesutil.ToBytes32(q.Root))
|
blk, err := bs.BeaconDB.Block(ctx, bytesutil.ToBytes32(q.Root))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, 0, strconv.Itoa(0), status.Errorf(codes.Internal, "Could not retrieve block: %v", err)
|
return nil, 0, strconv.Itoa(0), status.Errorf(codes.Internal, "Could not retrieve block: %v", err)
|
||||||
@@ -286,8 +286,8 @@ func (bs *Server) ListBlocksForRoot(ctx context.Context, _ *ethpb.ListBlocksRequ
|
|||||||
}}, 1, strconv.Itoa(0), nil
|
}}, 1, strconv.Itoa(0), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListBlocksForSlot retrieves all blocks for the provided slot.
|
// listBlocksForSlot retrieves all blocks for the provided slot.
|
||||||
func (bs *Server) ListBlocksForSlot(ctx context.Context, req *ethpb.ListBlocksRequest, q *ethpb.ListBlocksRequest_Slot) ([]blockContainer, int, string, error) {
|
func (bs *Server) listBlocksForSlot(ctx context.Context, req *ethpb.ListBlocksRequest, q *ethpb.ListBlocksRequest_Slot) ([]blockContainer, int, string, error) {
|
||||||
hasBlocks, blks, err := bs.BeaconDB.BlocksBySlot(ctx, q.Slot)
|
hasBlocks, blks, err := bs.BeaconDB.BlocksBySlot(ctx, q.Slot)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, 0, strconv.Itoa(0), status.Errorf(codes.Internal, "Could not retrieve blocks for slot %d: %v", q.Slot, err)
|
return nil, 0, strconv.Itoa(0), status.Errorf(codes.Internal, "Could not retrieve blocks for slot %d: %v", q.Slot, err)
|
||||||
@@ -323,8 +323,8 @@ func (bs *Server) ListBlocksForSlot(ctx context.Context, req *ethpb.ListBlocksRe
|
|||||||
return containers, numBlks, nextPageToken, nil
|
return containers, numBlks, nextPageToken, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListBlocksForGenesis retrieves the genesis block.
|
// listBlocksForGenesis retrieves the genesis block.
|
||||||
func (bs *Server) ListBlocksForGenesis(ctx context.Context, _ *ethpb.ListBlocksRequest, _ *ethpb.ListBlocksRequest_Genesis) ([]blockContainer, int, string, error) {
|
func (bs *Server) listBlocksForGenesis(ctx context.Context, _ *ethpb.ListBlocksRequest, _ *ethpb.ListBlocksRequest_Genesis) ([]blockContainer, int, string, error) {
|
||||||
genBlk, err := bs.BeaconDB.GenesisBlock(ctx)
|
genBlk, err := bs.BeaconDB.GenesisBlock(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, 0, strconv.Itoa(0), status.Errorf(codes.Internal, "Could not retrieve blocks for genesis slot: %v", err)
|
return nil, 0, strconv.Itoa(0), status.Errorf(codes.Internal, "Could not retrieve blocks for genesis slot: %v", err)
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ func (s *MockSlashingChecker) HighestAttestations(
|
|||||||
return atts, nil
|
return atts, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *MockSlashingChecker) IsSlashableBlock(ctx context.Context, proposal *ethpb.SignedBeaconBlockHeader) (*ethpb.ProposerSlashing, error) {
|
func (s *MockSlashingChecker) IsSlashableBlock(_ context.Context, _ *ethpb.SignedBeaconBlockHeader) (*ethpb.ProposerSlashing, error) {
|
||||||
if s.ProposerSlashingFound {
|
if s.ProposerSlashingFound {
|
||||||
return ðpb.ProposerSlashing{
|
return ðpb.ProposerSlashing{
|
||||||
Header_1: ðpb.SignedBeaconBlockHeader{
|
Header_1: ðpb.SignedBeaconBlockHeader{
|
||||||
@@ -56,7 +56,7 @@ func (s *MockSlashingChecker) IsSlashableBlock(ctx context.Context, proposal *et
|
|||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *MockSlashingChecker) IsSlashableAttestation(ctx context.Context, attestation *ethpb.IndexedAttestation) ([]*ethpb.AttesterSlashing, error) {
|
func (s *MockSlashingChecker) IsSlashableAttestation(_ context.Context, _ *ethpb.IndexedAttestation) ([]*ethpb.AttesterSlashing, error) {
|
||||||
if s.AttesterSlashingFound {
|
if s.AttesterSlashingFound {
|
||||||
return []*ethpb.AttesterSlashing{
|
return []*ethpb.AttesterSlashing{
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,17 +6,17 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// AppendCurrentParticipationBits is not supported for phase 0 beacon state.
|
// AppendCurrentParticipationBits is not supported for phase 0 beacon state.
|
||||||
func (b *BeaconState) AppendCurrentParticipationBits(val byte) error {
|
func (*BeaconState) AppendCurrentParticipationBits(_ byte) error {
|
||||||
return errors.New("AppendCurrentParticipationBits is not supported for phase 0 beacon state")
|
return errors.New("AppendCurrentParticipationBits is not supported for phase 0 beacon state")
|
||||||
}
|
}
|
||||||
|
|
||||||
// AppendPreviousParticipationBits is not supported for phase 0 beacon state.
|
// AppendPreviousParticipationBits is not supported for phase 0 beacon state.
|
||||||
func (b *BeaconState) AppendPreviousParticipationBits(val byte) error {
|
func (*BeaconState) AppendPreviousParticipationBits(_ byte) error {
|
||||||
return errors.New("AppendPreviousParticipationBits is not supported for phase 0 beacon state")
|
return errors.New("AppendPreviousParticipationBits is not supported for phase 0 beacon state")
|
||||||
}
|
}
|
||||||
|
|
||||||
// AppendInactivityScore is not supported for phase 0 beacon state.
|
// AppendInactivityScore is not supported for phase 0 beacon state.
|
||||||
func (b *BeaconState) AppendInactivityScore(s uint64) error {
|
func (*BeaconState) AppendInactivityScore(_ uint64) error {
|
||||||
return errors.New("AppendInactivityScore is not supported for phase 0 beacon state")
|
return errors.New("AppendInactivityScore is not supported for phase 0 beacon state")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,17 +6,17 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// SetPreviousEpochAttestations is not supported for HF1 beacon state.
|
// SetPreviousEpochAttestations is not supported for HF1 beacon state.
|
||||||
func (b *BeaconState) SetPreviousEpochAttestations(val []*ethpb.PendingAttestation) error {
|
func (b *BeaconState) SetPreviousEpochAttestations(_ []*ethpb.PendingAttestation) error {
|
||||||
return errors.New("SetPreviousEpochAttestations is not supported for hard fork 1 beacon state")
|
return errors.New("SetPreviousEpochAttestations is not supported for hard fork 1 beacon state")
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetCurrentEpochAttestations is not supported for HF1 beacon state.
|
// SetCurrentEpochAttestations is not supported for HF1 beacon state.
|
||||||
func (b *BeaconState) SetCurrentEpochAttestations(val []*ethpb.PendingAttestation) error {
|
func (b *BeaconState) SetCurrentEpochAttestations(_ []*ethpb.PendingAttestation) error {
|
||||||
return errors.New("SetCurrentEpochAttestations is not supported for hard fork 1 beacon state")
|
return errors.New("SetCurrentEpochAttestations is not supported for hard fork 1 beacon state")
|
||||||
}
|
}
|
||||||
|
|
||||||
// AppendCurrentEpochAttestations is not supported for HF1 beacon state.
|
// AppendCurrentEpochAttestations is not supported for HF1 beacon state.
|
||||||
func (b *BeaconState) AppendCurrentEpochAttestations(val *ethpb.PendingAttestation) error {
|
func (b *BeaconState) AppendCurrentEpochAttestations(_ *ethpb.PendingAttestation) error {
|
||||||
return errors.New("AppendCurrentEpochAttestations is not supported for hard fork 1 beacon state")
|
return errors.New("AppendCurrentEpochAttestations is not supported for hard fork 1 beacon state")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,17 +6,17 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// SetPreviousEpochAttestations is not supported for HF1 beacon state.
|
// SetPreviousEpochAttestations is not supported for HF1 beacon state.
|
||||||
func (b *BeaconState) SetPreviousEpochAttestations(val []*ethpb.PendingAttestation) error {
|
func (*BeaconState) SetPreviousEpochAttestations(_ []*ethpb.PendingAttestation) error {
|
||||||
return errors.New("SetPreviousEpochAttestations is not supported for version Merge beacon state")
|
return errors.New("SetPreviousEpochAttestations is not supported for version Merge beacon state")
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetCurrentEpochAttestations is not supported for HF1 beacon state.
|
// SetCurrentEpochAttestations is not supported for HF1 beacon state.
|
||||||
func (b *BeaconState) SetCurrentEpochAttestations(val []*ethpb.PendingAttestation) error {
|
func (*BeaconState) SetCurrentEpochAttestations(_ []*ethpb.PendingAttestation) error {
|
||||||
return errors.New("SetCurrentEpochAttestations is not supported for version Merge beacon state")
|
return errors.New("SetCurrentEpochAttestations is not supported for version Merge beacon state")
|
||||||
}
|
}
|
||||||
|
|
||||||
// AppendCurrentEpochAttestations is not supported for HF1 beacon state.
|
// AppendCurrentEpochAttestations is not supported for HF1 beacon state.
|
||||||
func (b *BeaconState) AppendCurrentEpochAttestations(val *ethpb.PendingAttestation) error {
|
func (*BeaconState) AppendCurrentEpochAttestations(_ *ethpb.PendingAttestation) error {
|
||||||
return errors.New("AppendCurrentEpochAttestations is not supported for version Merge beacon state")
|
return errors.New("AppendCurrentEpochAttestations is not supported for version Merge beacon state")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ func (b *BeaconState) HashTreeRoot(ctx context.Context) ([32]byte, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for field := range b.dirtyFields {
|
for field := range b.dirtyFields {
|
||||||
root, err := b.rootSelector(ctx, field)
|
root, err := b.rootSelector(field)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return [32]byte{}, err
|
return [32]byte{}, err
|
||||||
}
|
}
|
||||||
@@ -256,7 +256,7 @@ func (b *BeaconState) IsNil() bool {
|
|||||||
return b == nil || b.state == nil
|
return b == nil || b.state == nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *BeaconState) rootSelector(ctx context.Context, field types.FieldIndex) ([32]byte, error) {
|
func (b *BeaconState) rootSelector(field types.FieldIndex) ([32]byte, error) {
|
||||||
hasher := hash.CustomSHA256Hasher()
|
hasher := hash.CustomSHA256Hasher()
|
||||||
switch field {
|
switch field {
|
||||||
case genesisTime:
|
case genesisTime:
|
||||||
|
|||||||
@@ -717,10 +717,9 @@ func TestBlocksFetcher_requestBlocksFromPeerReturningInvalidBlocks(t *testing.T)
|
|||||||
blk.Block.Slot = req.StartSlot - 1
|
blk.Block.Slot = req.StartSlot - 1
|
||||||
assert.NoError(t, beaconsync.WriteBlockChunk(stream, chain, p1.Encoding(), wrapper.WrappedPhase0SignedBeaconBlock(blk)))
|
assert.NoError(t, beaconsync.WriteBlockChunk(stream, chain, p1.Encoding(), wrapper.WrappedPhase0SignedBeaconBlock(blk)))
|
||||||
break
|
break
|
||||||
} else {
|
|
||||||
blk.Block.Slot = i
|
|
||||||
assert.NoError(t, beaconsync.WriteBlockChunk(stream, chain, p1.Encoding(), wrapper.WrappedPhase0SignedBeaconBlock(blk)))
|
|
||||||
}
|
}
|
||||||
|
blk.Block.Slot = i
|
||||||
|
assert.NoError(t, beaconsync.WriteBlockChunk(stream, chain, p1.Encoding(), wrapper.WrappedPhase0SignedBeaconBlock(blk)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -749,10 +748,9 @@ func TestBlocksFetcher_requestBlocksFromPeerReturningInvalidBlocks(t *testing.T)
|
|||||||
blk.Block.Slot = req.StartSlot.Add(req.Count * req.Step)
|
blk.Block.Slot = req.StartSlot.Add(req.Count * req.Step)
|
||||||
assert.NoError(t, beaconsync.WriteBlockChunk(stream, chain, p1.Encoding(), wrapper.WrappedPhase0SignedBeaconBlock(blk)))
|
assert.NoError(t, beaconsync.WriteBlockChunk(stream, chain, p1.Encoding(), wrapper.WrappedPhase0SignedBeaconBlock(blk)))
|
||||||
break
|
break
|
||||||
} else {
|
|
||||||
blk.Block.Slot = i
|
|
||||||
assert.NoError(t, beaconsync.WriteBlockChunk(stream, chain, p1.Encoding(), wrapper.WrappedPhase0SignedBeaconBlock(blk)))
|
|
||||||
}
|
}
|
||||||
|
blk.Block.Slot = i
|
||||||
|
assert.NoError(t, beaconsync.WriteBlockChunk(stream, chain, p1.Encoding(), wrapper.WrappedPhase0SignedBeaconBlock(blk)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -174,9 +174,8 @@ func main() {
|
|||||||
if k8sConfigMapName != "" {
|
if k8sConfigMapName != "" {
|
||||||
if err := updateKubernetesConfigMap(context.Background(), addr.Hex()); err != nil {
|
if err := updateKubernetesConfigMap(context.Background(), addr.Hex()); err != nil {
|
||||||
log.Fatalf("Failed to update kubernetes config map: %v", err)
|
log.Fatalf("Failed to update kubernetes config map: %v", err)
|
||||||
} else {
|
|
||||||
log.Printf("Updated config map %s", k8sConfigMapName)
|
|
||||||
}
|
}
|
||||||
|
log.Printf("Updated config map %s", k8sConfigMapName)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,10 +28,8 @@ func (km *Keymanager) ImportKeystores(
|
|||||||
return nil, errors.New("no passwords provided for keystores")
|
return nil, errors.New("no passwords provided for keystores")
|
||||||
} else if len(passwords) == 1 {
|
} else if len(passwords) == 1 {
|
||||||
singlePasswordForAll = passwords[0]
|
singlePasswordForAll = passwords[0]
|
||||||
} else {
|
} else if len(passwords) != len(keystores) {
|
||||||
if len(passwords) != len(keystores) {
|
return nil, errors.New("number of passwords does not match number of keystores")
|
||||||
return nil, errors.New("number of passwords does not match number of keystores")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
decryptor := keystorev4.New()
|
decryptor := keystorev4.New()
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ func (s *Server) RecoverWallet(ctx context.Context, req *pb.RecoverWalletRequest
|
|||||||
// we return an empty response with no error. If the password is incorrect for a single keystore,
|
// we return an empty response with no error. If the password is incorrect for a single keystore,
|
||||||
// we return an appropriate error.
|
// we return an appropriate error.
|
||||||
func (s *Server) ValidateKeystores(
|
func (s *Server) ValidateKeystores(
|
||||||
ctx context.Context, req *pb.ValidateKeystoresRequest,
|
_ context.Context, req *pb.ValidateKeystoresRequest,
|
||||||
) (*emptypb.Empty, error) {
|
) (*emptypb.Empty, error) {
|
||||||
if req.KeystoresPassword == "" {
|
if req.KeystoresPassword == "" {
|
||||||
return nil, status.Error(codes.InvalidArgument, "Password required for keystores")
|
return nil, status.Error(codes.InvalidArgument, "Password required for keystores")
|
||||||
|
|||||||
@@ -235,7 +235,7 @@ func parseAttestationsForUniquePublicKeys(data []*format.ProtectionData) (map[[4
|
|||||||
return signedAttestationsByPubKey, nil
|
return signedAttestationsByPubKey, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func filterSlashablePubKeysFromBlocks(ctx context.Context, historyByPubKey map[[48]byte]kv.ProposalHistoryForPubkey) [][48]byte {
|
func filterSlashablePubKeysFromBlocks(_ context.Context, historyByPubKey map[[48]byte]kv.ProposalHistoryForPubkey) [][48]byte {
|
||||||
// Given signing roots are optional in the EIP standard, we behave as follows:
|
// Given signing roots are optional in the EIP standard, we behave as follows:
|
||||||
// For a given block:
|
// For a given block:
|
||||||
// If we have a previous block with the same slot in our history:
|
// If we have a previous block with the same slot in our history:
|
||||||
@@ -311,7 +311,7 @@ func filterSlashablePubKeysFromAttestations(
|
|||||||
return slashablePubKeys, nil
|
return slashablePubKeys, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func transformSignedBlocks(ctx context.Context, signedBlocks []*format.SignedBlock) (*kv.ProposalHistoryForPubkey, error) {
|
func transformSignedBlocks(_ context.Context, signedBlocks []*format.SignedBlock) (*kv.ProposalHistoryForPubkey, error) {
|
||||||
proposals := make([]kv.Proposal, len(signedBlocks))
|
proposals := make([]kv.Proposal, len(signedBlocks))
|
||||||
for i, proposal := range signedBlocks {
|
for i, proposal := range signedBlocks {
|
||||||
slot, err := SlotFromString(proposal.Slot)
|
slot, err := SlotFromString(proposal.Slot)
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ type MockSlasher struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// HighestAttestations will return an empty array of attestations.
|
// HighestAttestations will return an empty array of attestations.
|
||||||
func (_ MockSlasher) HighestAttestations(ctx context.Context, req *eth.HighestAttestationRequest, _ ...grpc.CallOption) (*eth.HighestAttestationResponse, error) {
|
func (MockSlasher) HighestAttestations(ctx context.Context, req *eth.HighestAttestationRequest, _ ...grpc.CallOption) (*eth.HighestAttestationResponse, error) {
|
||||||
return ð.HighestAttestationResponse{
|
return ð.HighestAttestationResponse{
|
||||||
Attestations: nil,
|
Attestations: nil,
|
||||||
}, nil
|
}, nil
|
||||||
|
|||||||
Reference in New Issue
Block a user