Skip to content

Commit

Permalink
add logs for debugging erigon p2p
Browse files Browse the repository at this point in the history
  • Loading branch information
manav2401 committed Oct 6, 2023
1 parent d521b8e commit 63d3166
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions consensus/bor/bor.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,8 @@ func (c *Bor) verifyHeader(chain consensus.ChainHeaderReader, header *types.Head

number := header.Number.Uint64()

log.Info("***** Verifying header", "number", number)

// Don't waste time checking blocks from the future
if header.Time > uint64(time.Now().Unix()) {
return consensus.ErrFutureBlock
Expand Down Expand Up @@ -667,6 +669,7 @@ func (c *Bor) verifySeal(chain consensus.ChainHeaderReader, header *types.Header
}

if !snap.ValidatorSet.HasAddress(signer) {
log.Info("***** Got unauthorised signer error", "signer", signer, "valset", fmt.Sprintf("%+v", snap.ValidatorSet))
// Check the UnauthorizedSignerError.Error() msg to see why we pass number-1
return &UnauthorizedSignerError{number - 1, signer.Bytes()}
}
Expand Down
4 changes: 3 additions & 1 deletion eth/protocols/eth/dispatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"fmt"
"time"

"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/p2p"
)

Expand Down Expand Up @@ -215,7 +216,8 @@ func (p *Peer) dispatcher() {
}
// Stop tracking the request
delete(pending, cancelOp.id)
requestTracker.Fulfil(p.id, p.version, req.code, cancelOp.id)
log.Info("***** Cancelled request", "peer.id", p.id, "version", p.version, "code", req.code, "req.id", req.id)
requestTracker.Fulfil(p.id, p.version, req.code, req.id)
cancelOp.fail <- nil

case resOp := <-p.resDispatch:
Expand Down
4 changes: 4 additions & 0 deletions eth/protocols/eth/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/p2p/enode"
Expand Down Expand Up @@ -154,6 +155,7 @@ func nodeInfo(chain *core.BlockChain, network uint64) *NodeInfo {
// the protocol handshake. This method will keep processing messages until the
// connection is torn down.
func Handle(backend Backend, peer *Peer) error {
log.Info("***** In handle message", "peer.id", peer.id)
for {
if err := handleMessage(backend, peer); err != nil {
peer.Log().Debug("Message handling failed in `eth`", "err", err)
Expand Down Expand Up @@ -239,6 +241,8 @@ func handleMessage(backend Backend, peer *Peer) error {
handlers = eth68
}

log.Info("***** In handle message", "peer.version", peer.Version())

// Track the amount of time it takes to serve the request and run the handler
if metrics.Enabled {
h := fmt.Sprintf("%s/%s/%d/%#02x", p2p.HandleHistName, ProtocolName, peer.Version(), msg.Code)
Expand Down

0 comments on commit 63d3166

Please sign in to comment.