laconicd-deprecated/x/evm/keeper/abci.go
yihuang 116de54617
evm: remove tx logs and block bloom from chain state (#556)
Closes #452

fix unit tests

changelog and fix lint

fix unit test

Update ethereum/rpc/backend/backend.go

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>

Update ethereum/rpc/backend/utils.go

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>

changelog

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2021-09-15 09:45:03 +00:00

32 lines
977 B
Go

package keeper
import (
abci "github.com/tendermint/tendermint/abci/types"
sdk "github.com/cosmos/cosmos-sdk/types"
ethtypes "github.com/ethereum/go-ethereum/core/types"
)
// BeginBlock sets the sdk Context and EIP155 chain id to the Keeper.
func (k *Keeper) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) {
k.WithContext(ctx)
k.WithChainID(ctx)
}
// 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
// an empty slice.
func (k *Keeper) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.ValidatorUpdate {
// Gas costs are handled within msg handler so costs should be ignored
infCtx := ctx.WithGasMeter(sdk.NewInfiniteGasMeter())
k.WithContext(infCtx)
bloom := ethtypes.BytesToBloom(k.GetBlockBloomTransient().Bytes())
k.EmitBlockBloomEvent(infCtx, bloom)
k.WithContext(ctx)
return []abci.ValidatorUpdate{}
}