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-05-31 14:54:59 +00:00
|
|
|
k.WithContext(ctx)
|
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())
|
2021-07-21 11:57:30 +00:00
|
|
|
k.WithContext(infCtx)
|
2020-10-20 17:53:13 +00:00
|
|
|
|
2021-08-25 14:45:51 +00:00
|
|
|
bloom := ethtypes.BytesToBloom(k.GetBlockBloomTransient().Bytes())
|
2021-09-15 09:45:03 +00:00
|
|
|
k.EmitBlockBloomEvent(infCtx, bloom)
|
2021-08-25 14:45:51 +00:00
|
|
|
|
2021-06-08 17:10:29 +00:00
|
|
|
k.WithContext(ctx)
|
2020-10-20 17:53:13 +00:00
|
|
|
|
|
|
|
return []abci.ValidatorUpdate{}
|
|
|
|
}
|