Skip to content

Commit

Permalink
Revert "add(exporter): expand el payload exporter logging"
Browse files Browse the repository at this point in the history
This reverts commit d4d3b18.
  • Loading branch information
invis-bitfly committed Jan 14, 2025
1 parent b16c30f commit 9043d22
Showing 1 changed file with 7 additions and 25 deletions.
32 changes: 7 additions & 25 deletions backend/pkg/exporter/modules/execution_payloads_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ func (d *executionPayloadsExporter) maintainTable() (err error) {
blockChan := make(chan *types.Eth1BlockIndexed, 1000)
type Result struct {
BlockHash []byte
BlockNumber uint64
FeeRecipientReward decimal.Decimal
}
resData := make([]Result, 0, maxBlock-minBlock+1)
Expand Down Expand Up @@ -139,7 +138,7 @@ func (d *executionPayloadsExporter) maintainTable() (err error) {
if err != nil {
return fmt.Errorf("error converting tx reward to decimal for block %v: %w", block.Number, err)
}
resData = append(resData, Result{BlockHash: hash, FeeRecipientReward: dec, BlockNumber: block.Number})
resData = append(resData, Result{BlockHash: hash, FeeRecipientReward: dec})
}
})

Expand All @@ -157,40 +156,23 @@ func (d *executionPayloadsExporter) maintainTable() (err error) {
return fmt.Errorf("error processing blocks: %w", err)
}
// sanity checks: check if any block hashes are 0x0000000000000000000000000000000000000000000000000000000000000000 or duplicate, check if count matches expected
if uint64(len(resData)) != maxBlock-minBlock+1 {
return fmt.Errorf("error processing blocks: expected %v blocks, got %v", maxBlock-minBlock+1, len(resData))
}
seen := make(map[string]bool)
emptyBlockHash := bytes.Repeat([]byte{0}, 32)
err = error(nil)
counter := 0
for _, r := range resData {
if counter > 25 {
err = fmt.Errorf("too many errors, aborting")
log.Error(err, "error processing blocks", 0)
break
}
if len(r.BlockHash) == 0 {
err = fmt.Errorf("error processing blocks: block hash is empty, block number: %v", r.BlockNumber)
log.Error(err, "error processing blocks", 0)
counter++
return fmt.Errorf("error processing blocks: block hash is empty")
}
if bytes.Equal(r.BlockHash, emptyBlockHash) {
err = fmt.Errorf("error processing blocks: block hash is all zeros, block number: %v", r.BlockNumber)
log.Error(err, "error processing blocks", 0)
counter++
return fmt.Errorf("error processing blocks: block hash is all zeros")
}
if _, ok := seen[string(r.BlockHash)]; ok {
err = fmt.Errorf("error processing blocks: duplicate block hash, block number: %v", r.BlockNumber)
log.Error(err, "error processing blocks", 0)
counter++
return fmt.Errorf("error processing blocks: duplicate block hash")
}
seen[string(r.BlockHash)] = true
}
if err != nil {
return err
}

if uint64(len(resData)) != maxBlock-minBlock+1 {
return fmt.Errorf("error processing blocks: expected %v blocks, got %v", maxBlock-minBlock+1, len(resData))
}

// update the execution_payloads table
log.Infof("preparing copy update to temp table")
Expand Down

0 comments on commit 9043d22

Please sign in to comment.