func (s *Service) SubmitBeaconBlock(ctx context.Context, block *spec.VersionedSignedBeaconBlock) error {
	if block == nil {
		return errors.New("no beacon block supplied")
	}
	started := time.Now()
	err := s.beaconBlockSubmitter.SubmitBeaconBlock(ctx, block)
	if service, isService := s.beaconBlockSubmitter.(eth2client.Service); isService {
		s.clientMonitor.ClientOperation(service.Address(), "submit beacon block", err == nil, time.Since(started))
	} else {
		s.clientMonitor.ClientOperation("<unknown>", "submit beacon block", err == nil, time.Since(started))
	}
	if err != nil {
		return errors.Wrap(err, "failed to submit beacon block")
	}
	if e := log.Trace(); e.Enabled() {
		data, err := json.Marshal(block)
		if err == nil {
			e.Str("block", string(data)).Msg("Submitted beacon block")
		}
	}
	return nil
}
SubmitBeaconBlock submits a block.
package immediate
import (
	"context"
	"encoding/json"
	"time"
	eth2client "github.com/attestantio/go-eth2-client"
	api "github.com/attestantio/go-eth2-client/api/v1"
	"github.com/attestantio/go-eth2-client/spec"
	"github.com/attestantio/go-eth2-client/spec/altair"
	"github.com/attestantio/go-eth2-client/spec/phase0"
	"github.com/attestantio/vouch/services/metrics"
	"github.com/pkg/errors"
	"github.com/rs/zerolog"
	zerologger "github.com/rs/zerolog/log"
)
type Service struct {
	clientMonitor                         metrics.ClientMonitor
	attestationsSubmitter                 eth2client.AttestationsSubmitter
	beaconBlockSubmitter                  eth2client.BeaconBlockSubmitter
	beaconCommitteeSubscriptionsSubmitter eth2client.BeaconCommitteeSubscriptionsSubmitter
	aggregateAttestationsSubmitter        eth2client.AggregateAttestationsSubmitter
	syncCommitteeMessagesSubmitter        eth2client.SyncCommitteeMessagesSubmitter
	syncCommitteeSubscriptionsSubmitter   eth2client.SyncCommitteeSubscriptionsSubmitter
	syncCommitteeContributionsSubmitter   eth2client.SyncCommitteeContributionsSubmitter
}
var log zerolog.Logger
func New(ctx context.Context, params ...Parameter) (*Service, error) {
	parameters, err := parseAndCheckParameters(params...)
	if err != nil {
		return nil, errors.Wrap(err, "problem with parameters")
	}
	log = zerologger.With().Str("service", "submitter").Str("impl", "immediate").Logger()
	if parameters.logLevel != log.GetLevel() {
		log = log.Level(parameters.logLevel)
	}
	s := &Service{
		clientMonitor:                         parameters.clientMonitor,
		attestationsSubmitter:                 parameters.attestationsSubmitter,
		beaconBlockSubmitter:                  parameters.beaconBlockSubmitter,
		beaconCommitteeSubscriptionsSubmitter: parameters.beaconCommitteeSubscriptionsSubmitter,
		aggregateAttestationsSubmitter:        parameters.aggregateAttestationsSubmitter,
		syncCommitteeMessagesSubmitter:        parameters.syncCommitteeMessagesSubmitter,
		syncCommitteeSubscriptionsSubmitter:   parameters.syncCommitteeSubscriptionsSubmitter,
		syncCommitteeContributionsSubmitter:   parameters.syncCommitteeContributionsSubmitter,
	}
	return s, nil
}