mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-23 11:57:18 +00:00
d077483577
* v3 import renamings * tidy * fmt * rev * Update beacon-chain/core/epoch/precompute/reward_penalty_test.go * Update beacon-chain/core/helpers/validators_test.go * Update beacon-chain/db/alias.go * Update beacon-chain/db/alias.go * Update beacon-chain/db/alias.go * Update beacon-chain/db/iface/BUILD.bazel * Update beacon-chain/db/kv/kv.go * Update beacon-chain/db/kv/state.go * Update beacon-chain/rpc/prysm/v1alpha1/validator/attester_test.go * Update beacon-chain/rpc/prysm/v1alpha1/validator/attester_test.go * Update beacon-chain/sync/initial-sync/service.go * fix deps * fix bad replacements * fix bad replacements * change back * gohashtree version * fix deps Co-authored-by: Nishant Das <nishdas93@gmail.com> Co-authored-by: Potuz <potuz@prysmaticlabs.com>
47 lines
1.4 KiB
Go
47 lines
1.4 KiB
Go
//go:build fuzz
|
|
|
|
package sync
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"github.com/libp2p/go-libp2p-core/peer"
|
|
pubsub "github.com/libp2p/go-libp2p-pubsub"
|
|
gcache "github.com/patrickmn/go-cache"
|
|
ethpb "github.com/prysmaticlabs/prysm/v3/proto/prysm/v1alpha1"
|
|
"google.golang.org/protobuf/proto"
|
|
)
|
|
|
|
// NewRegularSyncFuzz service without registering handlers.
|
|
func NewRegularSyncFuzz(opts ...Option) *Service {
|
|
ctx, cancel := context.WithCancel(context.Background())
|
|
r := &Service{
|
|
cfg: &config{},
|
|
ctx: ctx,
|
|
cancel: cancel,
|
|
slotToPendingBlocks: gcache.New(time.Second, 2*time.Second),
|
|
seenPendingBlocks: make(map[[32]byte]bool),
|
|
blkRootToPendingAtts: make(map[[32]byte][]*ethpb.SignedAggregateAttestationAndProof),
|
|
}
|
|
r.rateLimiter = newRateLimiter(r.cfg.p2p)
|
|
|
|
return r
|
|
}
|
|
|
|
// FuzzValidateBeaconBlockPubSub exports private method validateBeaconBlockPubSub for fuzz testing.
|
|
func (s *Service) FuzzValidateBeaconBlockPubSub(ctx context.Context, pid peer.ID, msg *pubsub.Message) pubsub.ValidationResult {
|
|
res, err := s.validateBeaconBlockPubSub(ctx, pid, msg)
|
|
_ = err
|
|
return res
|
|
}
|
|
|
|
// FuzzBeaconBlockSubscriber exports private method beaconBlockSubscriber for fuzz testing.
|
|
func (s *Service) FuzzBeaconBlockSubscriber(ctx context.Context, msg proto.Message) error {
|
|
return s.beaconBlockSubscriber(ctx, msg)
|
|
}
|
|
|
|
func (s *Service) InitCaches() {
|
|
s.initCaches()
|
|
}
|