From 0011d0d5f7563fcb5ebd322b516436e317235255 Mon Sep 17 00:00:00 2001 From: Manav Darji Date: Fri, 6 Dec 2024 15:28:07 +0530 Subject: [PATCH] more debug logs --- consensus/bor/bor.go | 5 +++-- eth/api_backend.go | 9 +++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/consensus/bor/bor.go b/consensus/bor/bor.go index 448a2016bf..a09619452f 100644 --- a/consensus/bor/bor.go +++ b/consensus/bor/bor.go @@ -468,10 +468,11 @@ func (c *Bor) verifyCascadingFields(chain consensus.ChainHeaderReader, header *t // Verify the validator list match the local contract if IsSprintStart(number+1, c.config.CalculateSprint(number)) { - log.Info("[debugging] number in consensus", "number-1", number-1) + log.Info("[debugging] number in consensus", "number-1", number-1, "current hash", header.Hash()) newValidators, err := c.spanner.GetCurrentValidatorsByBlockNrOrHash( context.Background(), - rpc.BlockNumberOrHashWithNumber(rpc.BlockNumber(number-1)), + rpc.BlockNumberOrHashWithHash(header.ParentHash, false), + // rpc.BlockNumberOrHashWithNumber(rpc.LatestBlockNumber), number+1, ) if err != nil { diff --git a/eth/api_backend.go b/eth/api_backend.go index 23869e48c2..151611f746 100644 --- a/eth/api_backend.go +++ b/eth/api_backend.go @@ -248,21 +248,26 @@ func (b *EthAPIBackend) StateAndHeaderByNumberOrHash(ctx context.Context, blockN } if hash, ok := blockNrOrHash.Hash(); ok { + log.Info("[debugging] get state by hash", "hash", hash) header, err := b.HeaderByHash(ctx, hash) if err != nil { + log.Info("[debugging] unable to find header", "err", err) return nil, nil, err } if header == nil { + log.Info("[debugging] unable to find header") return nil, nil, errors.New("header for hash not found") } - if blockNrOrHash.RequireCanonical && b.eth.blockchain.GetCanonicalHash(header.Number.Uint64()) != hash { - return nil, nil, errors.New("hash is not currently canonical") + if chash := b.eth.blockchain.GetCanonicalHash(header.Number.Uint64()); chash != hash { + log.Info("[debugging] canonical hash found but not matching", "chash", chash, "hash", hash) + // return nil, nil, errors.New("hash is not currently canonical") } stateDb, err := b.eth.BlockChain().StateAt(header.Root) if err != nil { + log.Info("[debugging] failed to get state at this header", "err", err) return nil, nil, err } return stateDb, header, nil