prysm-pulse/beacon-chain/sync/fuzz_exports.go
Raul Jordan 5aac06f04e
Move EthereumAPIs Into Prysm (#8968)
* begin move

* use same import path

* imports

* regen protos

* regen

* no rename

* generate ssz

* gaz

* fmt

* edit build file

* imports

* modify

* remove generated files

* remove protos

* edit imports in prysm

* beacon chain all builds

* edit script

* add generated pbs

* add replace rules

* license for ethereumapis protos

* change visibility

* fmt

* update build files to gaz ignore

* use proper form

* edit imports

* wrap block

* revert scripts

* revert go mod
2021-06-02 18:49:52 -05:00

46 lines
1.4 KiB
Go

// +build libfuzzer
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/proto/eth/v1alpha1"
"google.golang.org/protobuf/proto"
)
// NewRegularSyncFuzz service without registering handlers.
func NewRegularSyncFuzz(cfg *Config) *Service {
rLimiter := newRateLimiter(cfg.P2P)
ctx, cancel := context.WithCancel(context.Background())
r := &Service{
cfg: cfg,
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),
rateLimiter: rLimiter,
}
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 {
return s.validateBeaconBlockPubSub(ctx, pid, msg)
}
// 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() error {
return s.initCaches()
}