Skip to content

Commit

Permalink
add log
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgao001 committed Jul 30, 2024
1 parent c3e370c commit 2b2d04e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions core/data_availability.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"sync"
"time"

"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/metrics"

"github.com/ethereum/go-ethereum/common"
Expand Down Expand Up @@ -71,8 +72,11 @@ func IsDataAvailable(chain consensus.ChainHeaderReader, block *types.Block) (err
if highest == nil || highest.Number.Cmp(current.Number) < 0 {
highest = current
}
log.Info("Checking data availability", "block", block.Number(), "highest", highest.Number)

if block.NumberU64()+params.MinBlocksForBlobRequests < highest.Number.Uint64() {
// if we needn't check DA of this block, just clean it
log.Info("Cleaning sidecars", "block", block.Number())
block.CleanSidecars()
return nil
}
Expand Down Expand Up @@ -114,12 +118,15 @@ func IsDataAvailable(chain consensus.ChainHeaderReader, block *types.Block) (err
for i, tx := range blobTxs {
// check sidecar tx related
if sidecars[i].TxHash != tx.Hash() {
log.Info("TxHash mismatch", "sidecar", sidecars[i].TxHash, "tx", tx.Hash())
return fmt.Errorf("sidecar's TxHash mismatch with expected transaction, want: %v, have: %v", sidecars[i].TxHash, tx.Hash())
}
if sidecars[i].TxIndex != blobTxIndexes[i] {
log.Info("TxIndex mismatch 2", "sidecar", sidecars[i].TxIndex, "tx", blobTxIndexes[i])
return fmt.Errorf("sidecar's TxIndex mismatch with expected transaction, want: %v, have: %v", sidecars[i].TxIndex, blobTxIndexes[i])
}
if err := validateBlobSidecar(tx.BlobHashes(), sidecars[i]); err != nil {
log.Info("validateBlobSidecar error", "block", block.Number().String(), "err", err)
return err
}
}
Expand Down

0 comments on commit 2b2d04e

Please sign in to comment.