diff --git a/x/evm/keeper/abci.go b/x/evm/keeper/abci.go index bb6be97f59..118b6a9dd9 100644 --- a/x/evm/keeper/abci.go +++ b/x/evm/keeper/abci.go @@ -17,6 +17,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" + ethcommon "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/tracing" "github.com/ethereum/go-ethereum/core/types" "math/big" @@ -33,15 +34,24 @@ func (k *Keeper) BeginBlock(ctx sdk.Context) error { if k.evmTracer != nil && k.evmTracer.OnBlockStart != nil { b := types.NewBlock(&types.Header{ - Number: big.NewInt(ctx.BlockHeight()), - Time: uint64(ctx.BlockTime().Unix()), + Number: big.NewInt(ctx.BlockHeight()), + Time: uint64(ctx.BlockTime().Unix()), + ParentHash: ethcommon.BytesToHash(ctx.BlockHeader().LastBlockId.Hash), }, nil, nil, nil) + finalizedHeaderNumber := ctx.BlockHeight() - 1 + if ctx.BlockHeight() == 0 { + finalizedHeaderNumber = 0 + } + + finalizedHeader := &types.Header{ + Number: big.NewInt(finalizedHeaderNumber), + } + k.evmTracer.OnBlockStart(tracing.BlockEvent{ - Block: b, - TD: big.NewInt(1), - // Finalized: , // todo: how to set up the header here? - // Safe: , // todo: how to set up the header here? + Block: b, + TD: big.NewInt(1), + Finalized: finalizedHeader, }) } diff --git a/x/evm/tracers/firehose.go b/x/evm/tracers/firehose.go index 8acbc44f63..e731ff8b9c 100644 --- a/x/evm/tracers/firehose.go +++ b/x/evm/tracers/firehose.go @@ -1444,10 +1444,6 @@ func (f *Firehose) printBlockToFirehose(block *pbeth.Block, finalityStatus *Fina } } - if block.Number-libNum >= 200 { - libNum = block.Number - 200 - } - // **Important* The final space in the Sprintf template is mandatory! f.outputBuffer.WriteString(fmt.Sprintf("FIRE BLOCK %d %s %d %s %d %d ", block.Number, hex.EncodeToString(block.Hash), previousNum, previousHash, libNum, block.Time().UnixNano()))