mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-23 11:57:18 +00:00
918129cf36
* refactor initialization to blocking startup method * require genesisSetter in blockchain, fix tests * work-around gazelle weirdness * fix dep gazelle ignores * only call SetGenesis once * fix typo * validator test setup and fix to return right error * move waitForChainStart to Start * wire up sync Service.genesisWaiter * fix p2p genesisWaiter plumbing * remove extra clock type, integrate into genesis and rename * use time.Now when no Nower is specified * remove unused ClockSetter * simplify rpc context checking * fix typo * use clock everywhere in sync; [32]byte val root * don't use DeepEqual to compare [32]byte and []byte * don't use clock in init sync, not wired up yet * use clock waiter in blockchain as well * use cancelable contexts in tests with goroutines * missed a reference to WithClockSetter * Update beacon-chain/startup/genesis.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update beacon-chain/blockchain/service_test.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * more clear docs * doc for NewClock * move clock typedef to more logical file name * adding documentation * gaz * fixes for capella * reducing test raciness * fix races in committee cache tests * lint * add tests on Duration slot math helper * startup package test coverage * fix bad merge * set non-zero genesis time in tests that call Start * happy deepsource, happy me-epsource * replace Synced event with channel * remove unused error * remove accidental wip commit * gaz! * remove unused event constants * remove sync statefeed subscription to fix deadlock * remove state notifier * fix build --------- Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com> Co-authored-by: Radosław Kapka <rkapka@wp.pl> Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com> Co-authored-by: nisdas <nishdas93@gmail.com>
146 lines
3.5 KiB
Go
146 lines
3.5 KiB
Go
package sync
|
|
|
|
import (
|
|
"github.com/prysmaticlabs/prysm/v4/async/event"
|
|
blockfeed "github.com/prysmaticlabs/prysm/v4/beacon-chain/core/feed/block"
|
|
"github.com/prysmaticlabs/prysm/v4/beacon-chain/core/feed/operation"
|
|
"github.com/prysmaticlabs/prysm/v4/beacon-chain/db"
|
|
"github.com/prysmaticlabs/prysm/v4/beacon-chain/execution"
|
|
"github.com/prysmaticlabs/prysm/v4/beacon-chain/operations/attestations"
|
|
"github.com/prysmaticlabs/prysm/v4/beacon-chain/operations/blstoexec"
|
|
"github.com/prysmaticlabs/prysm/v4/beacon-chain/operations/slashings"
|
|
"github.com/prysmaticlabs/prysm/v4/beacon-chain/operations/synccommittee"
|
|
"github.com/prysmaticlabs/prysm/v4/beacon-chain/operations/voluntaryexits"
|
|
"github.com/prysmaticlabs/prysm/v4/beacon-chain/p2p"
|
|
"github.com/prysmaticlabs/prysm/v4/beacon-chain/startup"
|
|
"github.com/prysmaticlabs/prysm/v4/beacon-chain/state/stategen"
|
|
)
|
|
|
|
type Option func(s *Service) error
|
|
|
|
func WithAttestationNotifier(notifier operation.Notifier) Option {
|
|
return func(s *Service) error {
|
|
s.cfg.attestationNotifier = notifier
|
|
return nil
|
|
}
|
|
}
|
|
|
|
func WithP2P(p2p p2p.P2P) Option {
|
|
return func(s *Service) error {
|
|
s.cfg.p2p = p2p
|
|
return nil
|
|
}
|
|
}
|
|
|
|
func WithDatabase(db db.NoHeadAccessDatabase) Option {
|
|
return func(s *Service) error {
|
|
s.cfg.beaconDB = db
|
|
return nil
|
|
}
|
|
}
|
|
|
|
func WithAttestationPool(attPool attestations.Pool) Option {
|
|
return func(s *Service) error {
|
|
s.cfg.attPool = attPool
|
|
return nil
|
|
}
|
|
}
|
|
|
|
func WithExitPool(exitPool voluntaryexits.PoolManager) Option {
|
|
return func(s *Service) error {
|
|
s.cfg.exitPool = exitPool
|
|
return nil
|
|
}
|
|
}
|
|
|
|
func WithSlashingPool(slashingPool slashings.PoolManager) Option {
|
|
return func(s *Service) error {
|
|
s.cfg.slashingPool = slashingPool
|
|
return nil
|
|
}
|
|
}
|
|
|
|
func WithSyncCommsPool(syncCommsPool synccommittee.Pool) Option {
|
|
return func(s *Service) error {
|
|
s.cfg.syncCommsPool = syncCommsPool
|
|
return nil
|
|
}
|
|
}
|
|
|
|
func WithBlsToExecPool(blsToExecPool blstoexec.PoolManager) Option {
|
|
return func(s *Service) error {
|
|
s.cfg.blsToExecPool = blsToExecPool
|
|
return nil
|
|
}
|
|
}
|
|
|
|
func WithChainService(chain blockchainService) Option {
|
|
return func(s *Service) error {
|
|
s.cfg.chain = chain
|
|
return nil
|
|
}
|
|
}
|
|
|
|
func WithInitialSync(initialSync Checker) Option {
|
|
return func(s *Service) error {
|
|
s.cfg.initialSync = initialSync
|
|
return nil
|
|
}
|
|
}
|
|
|
|
func WithBlockNotifier(blockNotifier blockfeed.Notifier) Option {
|
|
return func(s *Service) error {
|
|
s.cfg.blockNotifier = blockNotifier
|
|
return nil
|
|
}
|
|
}
|
|
|
|
func WithOperationNotifier(operationNotifier operation.Notifier) Option {
|
|
return func(s *Service) error {
|
|
s.cfg.operationNotifier = operationNotifier
|
|
return nil
|
|
}
|
|
}
|
|
|
|
func WithStateGen(stateGen *stategen.State) Option {
|
|
return func(s *Service) error {
|
|
s.cfg.stateGen = stateGen
|
|
return nil
|
|
}
|
|
}
|
|
|
|
func WithSlasherAttestationsFeed(slasherAttestationsFeed *event.Feed) Option {
|
|
return func(s *Service) error {
|
|
s.cfg.slasherAttestationsFeed = slasherAttestationsFeed
|
|
return nil
|
|
}
|
|
}
|
|
|
|
func WithSlasherBlockHeadersFeed(slasherBlockHeadersFeed *event.Feed) Option {
|
|
return func(s *Service) error {
|
|
s.cfg.slasherBlockHeadersFeed = slasherBlockHeadersFeed
|
|
return nil
|
|
}
|
|
}
|
|
|
|
func WithExecutionPayloadReconstructor(r execution.ExecutionPayloadReconstructor) Option {
|
|
return func(s *Service) error {
|
|
s.cfg.executionPayloadReconstructor = r
|
|
return nil
|
|
}
|
|
}
|
|
|
|
func WithClockWaiter(cw startup.ClockWaiter) Option {
|
|
return func(s *Service) error {
|
|
s.clockWaiter = cw
|
|
return nil
|
|
}
|
|
}
|
|
|
|
func WithInitialSyncComplete(c chan struct{}) Option {
|
|
return func(s *Service) error {
|
|
s.initialSyncComplete = c
|
|
return nil
|
|
}
|
|
}
|