Skip to content

Commit

Permalink
more debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
manav2401 committed Dec 6, 2024
1 parent 42ae744 commit 0011d0d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 3 additions & 2 deletions consensus/bor/bor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
9 changes: 7 additions & 2 deletions eth/api_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0011d0d

Please sign in to comment.