diff --git a/x/evm/module.go b/x/evm/module.go index 0e42a94ba0..aca99e0c9d 100644 --- a/x/evm/module.go +++ b/x/evm/module.go @@ -227,6 +227,7 @@ func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.Val TxHashHex: deferredInfo.TxHash.Hex(), TransactionIndex: uint32(deferredInfo.TxIndx), VmError: deferredInfo.Error, + BlockNumber: uint64(ctx.BlockHeight()), }) continue } diff --git a/x/evm/module_test.go b/x/evm/module_test.go index f970e8a144..402825718b 100644 --- a/x/evm/module_test.go +++ b/x/evm/module_test.go @@ -74,7 +74,7 @@ func TestABCI(t *testing.T) { surplus, err := s.Finalize() require.Nil(t, err) require.Equal(t, sdk.ZeroInt(), surplus) - k.AppendToEvmTxDeferredInfo(ctx.WithTxIndex(1), ethtypes.Bloom{}, common.Hash{}, surplus) + k.AppendToEvmTxDeferredInfo(ctx.WithTxIndex(1), ethtypes.Bloom{}, common.Hash{4}, surplus) // 3rd tx s = state.NewDBImpl(ctx.WithTxIndex(3), k, false) s.SubBalance(evmAddr2, big.NewInt(5000000000000), tracing.BalanceChangeUnspecified) @@ -82,7 +82,7 @@ func TestABCI(t *testing.T) { surplus, err = s.Finalize() require.Nil(t, err) require.Equal(t, sdk.ZeroInt(), surplus) - k.AppendToEvmTxDeferredInfo(ctx.WithTxIndex(3), ethtypes.Bloom{}, common.Hash{}, surplus) + k.AppendToEvmTxDeferredInfo(ctx.WithTxIndex(3), ethtypes.Bloom{}, common.Hash{3}, surplus) k.SetTxResults([]*abci.ExecTxResult{{Code: 0}, {Code: 0}, {Code: 0}, {Code: 0}}) m.EndBlock(ctx, abci.RequestEndBlock{}) require.Equal(t, uint64(0), k.BankKeeper().GetBalance(ctx, k.AccountKeeper().GetModuleAddress(types.ModuleName), "usei").Amount.Uint64()) @@ -97,7 +97,7 @@ func TestABCI(t *testing.T) { surplus, err = s.Finalize() require.Nil(t, err) require.Equal(t, sdk.NewInt(1000000000000), surplus) - k.AppendToEvmTxDeferredInfo(ctx.WithTxIndex(2), ethtypes.Bloom{}, common.Hash{}, surplus) + k.AppendToEvmTxDeferredInfo(ctx.WithTxIndex(2), ethtypes.Bloom{}, common.Hash{2}, surplus) k.SetTxResults([]*abci.ExecTxResult{{Code: 0}, {Code: 0}, {Code: 0}}) m.EndBlock(ctx, abci.RequestEndBlock{}) require.Equal(t, uint64(1), k.BankKeeper().GetBalance(ctx, k.AccountKeeper().GetModuleAddress(types.ModuleName), "usei").Amount.Uint64()) @@ -110,6 +110,7 @@ func TestABCI(t *testing.T) { m.EndBlock(ctx, abci.RequestEndBlock{}) receipt, err := k.GetReceipt(ctx, common.Hash{1}) require.Nil(t, err) + require.Equal(t, receipt.BlockNumber, uint64(ctx.BlockHeight())) require.Equal(t, receipt.VmError, "test error") // fourth block with locked tokens in coinbase address