Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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 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
# blob.enable will fetch and save blobs for block
Comment thread
andrey-kozel marked this conversation as resolved.
Outdated
blob:
Comment thread
andrey-kozel marked this conversation as resolved.
Outdated
enable: true
# validators contains configuration for obtaining validator-related information.
validators:
enable: true
Expand Down
2 changes: 2 additions & 0 deletions chaind.config.docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ blocks:
# refetch will refetch block data from a beacon node even if it has already has a block
# in its database.
# refetch: false
blob:
Comment thread
andrey-kozel marked this conversation as resolved.
Outdated
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.blob.enable", true, "Enable saving of block-related blobs")
Comment thread
andrey-kozel marked this conversation as resolved.
Outdated
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.WithBlobEnable(viper.GetBool("blocks.blob.enable")),
Comment thread
andrey-kozel marked this conversation as resolved.
Outdated
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 @@ -714,6 +714,10 @@ func (s *Service) updateBlobSidecarsForBlock(ctx context.Context,
ctx, span := otel.Tracer("wealdtech.chaind.services.blocks.standard").Start(ctx, "updateBlobSidecarsForBlock")
defer span.End()

if !s.blobEnable {
Comment thread
andrey-kozel marked this conversation as resolved.
Outdated
return nil
}

response, err := s.eth2Client.(eth2client.BlobSidecarsProvider).BlobSidecars(ctx, &api.BlobSidecarsOpts{
Block: blockRoot.String(),
})
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
blobEnable bool
Comment thread
andrey-kozel marked this conversation as resolved.
Outdated
activitySem *semaphore.Weighted
}

Expand Down Expand Up @@ -95,6 +96,13 @@ func WithRefetch(refetch bool) Parameter {
})
}

// WithBlobEnable sets the blobEnable flag for this module.
func WithBlobEnable(blobEnable bool) Parameter {
Comment thread
andrey-kozel marked this conversation as resolved.
Outdated
return parameterFunc(func(p *parameters) {
p.blobEnable = blobEnable
Comment thread
andrey-kozel marked this conversation as resolved.
Outdated
})
}

// 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
blobEnable 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,
blobEnable: parameters.blobEnable,
Comment thread
andrey-kozel marked this conversation as resolved.
Outdated
activitySem: parameters.activitySem,
syncCommittees: make(map[uint64]*chaindb.SyncCommittee),
}

log.Info().
Bool("blobEnable", parameters.blobEnable).
Comment thread
andrey-kozel marked this conversation as resolved.
Outdated
Bool("refetch", parameters.refetch).
Int64("startSlot", parameters.startSlot).
Msg("Blocks Service initialized")
Comment thread
andrey-kozel marked this conversation as resolved.
Outdated
// Note the current highest processed block for the monitor.
md, err := s.getMetadata(ctx)
if err != nil {
Expand Down