From cd279a74411670c14eec94282c8c313f980c4825 Mon Sep 17 00:00:00 2001 From: Andrew Davis <1709934+Savid@users.noreply.github.com> Date: Fri, 11 Oct 2024 17:15:40 +1000 Subject: [PATCH] dont hard fail sentry --- .../event/beacon/eth/v2/beacon_block.go | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/pkg/sentry/event/beacon/eth/v2/beacon_block.go b/pkg/sentry/event/beacon/eth/v2/beacon_block.go index c30b860b..f926ef29 100644 --- a/pkg/sentry/event/beacon/eth/v2/beacon_block.go +++ b/pkg/sentry/event/beacon/eth/v2/beacon_block.go @@ -165,18 +165,21 @@ func (e *BeaconBlock) getAdditionalData(_ context.Context) (*xatu.ClientMeta_Add blockMessage, err := getBlockMessage(e.event) if err != nil { - return nil, err - } - - sszData, err := ssz.MarshalSSZ(blockMessage) - if err != nil { - return nil, err + e.log.WithError(err).Warn("Failed to get block message to compute block size. Missing fork version?") + } else { + sszData, err := ssz.MarshalSSZ(blockMessage) + if err != nil { + e.log.WithError(err).Warn("Failed to marshal (SSZ) block message to compute block size") + } else { + dataSize := len(sszData) + compressedData := snappy.Encode(nil, sszData) + compressedDataSize := len(compressedData) + + extra.TotalBytes = wrapperspb.UInt64(uint64(dataSize)) + extra.TotalBytesCompressed = wrapperspb.UInt64(uint64(compressedDataSize)) + } } - dataSize := len(sszData) - compressedData := snappy.Encode(nil, sszData) - compressedDataSize := len(compressedData) - switch e.event.Version { case spec.DataVersionBellatrix: bellatrixTxs := make([][]byte, len(e.event.Bellatrix.Message.Body.ExecutionPayload.Transactions)) @@ -204,8 +207,6 @@ func (e *BeaconBlock) getAdditionalData(_ context.Context) (*xatu.ClientMeta_Add compressedTransactions := snappy.Encode(nil, transactionsBytes) compressedTxSize := len(compressedTransactions) - extra.TotalBytes = wrapperspb.UInt64(uint64(dataSize)) - extra.TotalBytesCompressed = wrapperspb.UInt64(uint64(compressedDataSize)) extra.TransactionsCount = wrapperspb.UInt64(uint64(txCount)) extra.TransactionsTotalBytes = wrapperspb.UInt64(uint64(txSize)) extra.TransactionsTotalBytesCompressed = wrapperspb.UInt64(uint64(compressedTxSize))