diff --git a/CHANGELOG.md b/CHANGELOG.md index c2b8686..841f879 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +0.10.2: + - added `blocks.blobs.enable` configuration flag (default: true) to control whether blobs for blocks should be fetched and saved + 0.10.1: - fix block handlers for fulu block event diff --git a/README.md b/README.md index ea2f274..a945869 100644 --- a/README.md +++ b/README.md @@ -203,6 +203,9 @@ blocks: # refetch will refetch block data from a beacon node even if it has already has a block # in its database. # refetch: false + # blobs.enable will fetch and save blobs for block + blobs: + enable: true # validators contains configuration for obtaining validator-related information. validators: enable: true diff --git a/chaind.config.docker-compose.yml b/chaind.config.docker-compose.yml index 229e5fe..2b4a933 100644 --- a/chaind.config.docker-compose.yml +++ b/chaind.config.docker-compose.yml @@ -33,6 +33,9 @@ blocks: # refetch will refetch block data from a beacon node even if it has already has a block # in its database. # refetch: false + # blobs.enable will fetch and save blobs for blocks + blobs: + enable: true # validators contains configuration for obtaining validator-related information. validators: enable: true diff --git a/main.go b/main.go index bb05296..c2e4856 100644 --- a/main.go +++ b/main.go @@ -64,7 +64,7 @@ import ( ) // ReleaseVersion is the release version for the code. -var ReleaseVersion = "0.10.1" +var ReleaseVersion = "0.10.2" func main() { os.Exit(main2()) @@ -161,6 +161,7 @@ func fetchConfig() error { pflag.Bool("blocks.enable", true, "Enable fetching of block-related information") pflag.Int32("blocks.start-slot", -1, "Slot from which to start fetching blocks") pflag.Bool("blocks.refetch", false, "Refetch all blocks even if they are already in the database") + pflag.Bool("blocks.blobs.enable", true, "Enable saving of blobs for block-related information") pflag.Bool("finalizer.enable", true, "Enable additional information on receipt of finality checkpoint") pflag.Bool("summarizer.enable", true, "Enable summary information") pflag.Bool("summarizer.epochs.enable", true, "Enable summary information for epochs") @@ -508,6 +509,7 @@ func startBlocks( standardblocks.WithChainDB(chainDB), standardblocks.WithStartSlot(viper.GetInt64("blocks.start-slot")), standardblocks.WithRefetch(viper.GetBool("blocks.refetch")), + standardblocks.WithBlobsSaving(viper.GetBool("blocks.blobs.enable")), standardblocks.WithActivitySem(activitySem), ) if err != nil { diff --git a/services/blocks/standard/handler.go b/services/blocks/standard/handler.go index c3bc730..7434c44 100644 --- a/services/blocks/standard/handler.go +++ b/services/blocks/standard/handler.go @@ -711,6 +711,10 @@ func (s *Service) updateSyncAggregateForBlock(ctx context.Context, func (s *Service) updateBlobSidecarsForBlock(ctx context.Context, blockRoot phase0.Root, ) error { + if !s.blobsSaving { + return nil + } + ctx, span := otel.Tracer("wealdtech.chaind.services.blocks.standard").Start(ctx, "updateBlobSidecarsForBlock") defer span.End() diff --git a/services/blocks/standard/parameters.go b/services/blocks/standard/parameters.go index 532b119..108c1fb 100644 --- a/services/blocks/standard/parameters.go +++ b/services/blocks/standard/parameters.go @@ -32,6 +32,7 @@ type parameters struct { chainTime chaintime.Service startSlot int64 refetch bool + blobsSaving bool activitySem *semaphore.Weighted } @@ -95,6 +96,13 @@ func WithRefetch(refetch bool) Parameter { }) } +// WithBlobsSaving sets the blobsSaving flag for this module. +func WithBlobsSaving(blobsSaving bool) Parameter { + return parameterFunc(func(p *parameters) { + p.blobsSaving = blobsSaving + }) +} + // WithActivitySem sets the activity semaphore for this module. func WithActivitySem(sem *semaphore.Weighted) Parameter { return parameterFunc(func(p *parameters) { diff --git a/services/blocks/standard/service.go b/services/blocks/standard/service.go index 9a4e46c..d11547d 100644 --- a/services/blocks/standard/service.go +++ b/services/blocks/standard/service.go @@ -47,6 +47,7 @@ type Service struct { consolidationRequestsSetter chaindb.ConsolidationRequestsSetter chainTime chaintime.Service refetch bool + blobsSaving bool lastHandledBlockRoot phase0.Root activitySem *semaphore.Weighted syncCommittees map[uint64]*chaindb.SyncCommittee @@ -152,10 +153,16 @@ func New(ctx context.Context, params ...Parameter) (*Service, error) { consolidationRequestsSetter: consolidationRequestsSetter, chainTime: parameters.chainTime, refetch: parameters.refetch, + blobsSaving: parameters.blobsSaving, activitySem: parameters.activitySem, syncCommittees: make(map[uint64]*chaindb.SyncCommittee), } + log.Trace(). + Bool("blobsSaving", parameters.blobsSaving). + Bool("refetch", parameters.refetch). + Int64("startSlot", parameters.startSlot). + Msg("Blocks Service initialized") // Note the current highest processed block for the monitor. md, err := s.getMetadata(ctx) if err != nil {