From d54663c0b892db5fc5bb0c42bf71ed16014f5e99 Mon Sep 17 00:00:00 2001 From: yihuang Date: Wed, 21 Jul 2021 19:57:30 +0800 Subject: [PATCH] evm: fix infinite context usage on `EndBlock` (#329) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous code is not incorrect since the method `SetBlockBloom` use the `ctx` passed in rather than the `k.ctx`. It's confusing that sometimes methods use ctx in parameter, sometimes use `k.ctx`, but that's another issue. Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> --- x/evm/keeper/abci.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/evm/keeper/abci.go b/x/evm/keeper/abci.go index 98c5b9d4..c422ce12 100644 --- a/x/evm/keeper/abci.go +++ b/x/evm/keeper/abci.go @@ -29,7 +29,7 @@ func (k *Keeper) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.Vali // Gas costs are handled within msg handler so costs should be ignored infCtx := ctx.WithGasMeter(sdk.NewInfiniteGasMeter()) - k.WithContext(ctx) + k.WithContext(infCtx) k.SetBlockBloom(infCtx, req.Height, ethtypes.BytesToBloom(k.GetBlockBloomTransient().Bytes())) k.WithContext(ctx)