2022-12-16 09:48:38 +00:00
|
|
|
// Copyright 2021 Evmos Foundation
|
|
|
|
// This file is part of Evmos' Ethermint library.
|
|
|
|
//
|
|
|
|
// The Ethermint library is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// The Ethermint library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE
|
2020-10-20 17:53:13 +00:00
|
|
|
package keeper
|
|
|
|
|
|
|
|
import (
|
2021-04-18 15:54:18 +00:00
|
|
|
abci "github.com/tendermint/tendermint/abci/types"
|
2021-05-14 21:44:58 +00:00
|
|
|
|
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
|
|
|
2021-06-30 07:37:03 +00:00
|
|
|
ethtypes "github.com/ethereum/go-ethereum/core/types"
|
2020-10-20 17:53:13 +00:00
|
|
|
)
|
|
|
|
|
2021-08-05 16:24:06 +00:00
|
|
|
// BeginBlock sets the sdk Context and EIP155 chain id to the Keeper.
|
2020-10-20 17:53:13 +00:00
|
|
|
func (k *Keeper) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) {
|
2021-06-15 11:53:19 +00:00
|
|
|
k.WithChainID(ctx)
|
2020-10-20 17:53:13 +00:00
|
|
|
}
|
|
|
|
|
2021-08-05 16:24:06 +00:00
|
|
|
// EndBlock also retrieves the bloom filter value from the transient store and commits it to the
|
|
|
|
// KVStore. The EVM end block logic doesn't update the validator set, thus it returns
|
2020-10-20 17:53:13 +00:00
|
|
|
// an empty slice.
|
2021-06-08 17:10:29 +00:00
|
|
|
func (k *Keeper) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.ValidatorUpdate {
|
2020-10-20 17:53:13 +00:00
|
|
|
// Gas costs are handled within msg handler so costs should be ignored
|
2021-06-08 17:10:29 +00:00
|
|
|
infCtx := ctx.WithGasMeter(sdk.NewInfiniteGasMeter())
|
2020-10-20 17:53:13 +00:00
|
|
|
|
2022-01-05 07:28:27 +00:00
|
|
|
bloom := ethtypes.BytesToBloom(k.GetBlockBloomTransient(infCtx).Bytes())
|
2021-09-15 09:45:03 +00:00
|
|
|
k.EmitBlockBloomEvent(infCtx, bloom)
|
2021-08-25 14:45:51 +00:00
|
|
|
|
2020-10-20 17:53:13 +00:00
|
|
|
return []abci.ValidatorUpdate{}
|
|
|
|
}
|