Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions chaind.config.docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions services/blocks/standard/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
8 changes: 8 additions & 0 deletions services/blocks/standard/parameters.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type parameters struct {
chainTime chaintime.Service
startSlot int64
refetch bool
blobsSaving bool
activitySem *semaphore.Weighted
}

Expand Down Expand Up @@ -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) {
Expand Down
7 changes: 7 additions & 0 deletions services/blocks/standard/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down