Skip to content

Commit

Permalink
dont hard fail sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
Savid committed Oct 11, 2024
1 parent 0339ec0 commit cd279a7
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions pkg/sentry/event/beacon/eth/v2/beacon_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit cd279a7

Please sign in to comment.