Skip to content

Commit

Permalink
Extra debugging info hacks
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelsproul committed Feb 10, 2023
1 parent 0c9eb8c commit 6139415
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core/block_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (v *BlockValidator) ValidateBody(block *types.Block) error {
if header.WithdrawalsHash != nil {
// Withdrawals list must be present in body after Shanghai.
if block.Withdrawals() == nil {
return fmt.Errorf("missing withdrawals in block body")
return fmt.Errorf("missing withdrawals in block body. withdrawals hash is %x, header hash is %x", header.WithdrawalsHash, header.Hash())
}
if hash := types.DeriveSha(block.Withdrawals(), trie.NewStackTrie(nil)); hash != *header.WithdrawalsHash {
return fmt.Errorf("withdrawals root hash mismatch (header value %x, calculated %x)", *header.WithdrawalsHash, hash)
Expand Down
2 changes: 1 addition & 1 deletion eth/downloader/downloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ func (d *Downloader) syncWithPeer(p *peerConnection, hash common.Hash, td, ttd *
if !beaconMode {
log.Debug("Synchronising with the network", "peer", p.id, "eth", p.version, "head", hash, "td", td, "mode", mode)
} else {
log.Debug("Backfilling with the network", "mode", mode)
log.Info("Backfilling with the network", "mode", mode)
}
defer func(start time.Time) {
log.Debug("Synchronisation terminated", "elapsed", common.PrettyDuration(time.Since(start)))
Expand Down
4 changes: 2 additions & 2 deletions eth/downloader/fetchers_concurrent_bodies.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ func (q *bodyQueue) deliver(peer *peerConnection, packet *eth.Response) (int, er
accepted, err := q.queue.DeliverBodies(peer.id, txs, hashsets[0], uncles, hashsets[1], withdrawals, hashsets[2])
switch {
case err == nil && len(txs) == 0:
peer.log.Trace("Requested bodies delivered")
peer.log.Info("Requested bodies delivered")
case err == nil:
peer.log.Trace("Delivered new batch of bodies", "count", len(txs), "accepted", accepted)
peer.log.Info("Delivered new batch of bodies", "count", len(txs), "accepted", accepted)
default:
peer.log.Debug("Failed to deliver retrieved bodies", "err", err)
}
Expand Down
13 changes: 13 additions & 0 deletions eth/downloader/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,19 @@ func (q *queue) DeliverBodies(id string, txLists [][]*types.Transaction, txListH
defer q.lock.Unlock()

validate := func(index int, header *types.Header) error {
log.Info("Delivering block body", "number", header.Number)
if header.WithdrawalsHash == nil {
log.Info("Header withdrawals hash is nil")
} else {
log.Info("Header withdrawals hash is not nil", "headerWithdrawalsHash", header.WithdrawalsHash)
}
if withdrawalLists[index] == nil {
log.Info("Withdrawal body is nil")
} else {
log.Info("Withdrawal body is not nil")
}
log.Info("Withdrawal body hash", "withdrawalListHash", withdrawalListHashes[index])

if txListHashes[index] != header.TxHash {
return errInvalidBody
}
Expand Down

0 comments on commit 6139415

Please sign in to comment.