From ef775acf7f36a11003d1fd08a075c42efdead7df Mon Sep 17 00:00:00 2001 From: BananaLF <864685021@qq.com> Date: Thu, 13 Apr 2023 00:23:20 +0800 Subject: [PATCH] fix feesplit innertx bug (#3099) * fix feesplit innertx bug * disable ibc and feesplit hook in checktx --- x/erc20/keeper/evm_log_handler.go | 6 ++++++ x/feesplit/keeper/evm_hooks.go | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/x/erc20/keeper/evm_log_handler.go b/x/erc20/keeper/evm_log_handler.go index 5d77e9b9f2..664a78f003 100644 --- a/x/erc20/keeper/evm_log_handler.go +++ b/x/erc20/keeper/evm_log_handler.go @@ -100,6 +100,9 @@ func (h SendToIbcEventHandler) EventID() common.Hash { // Handle Process the log func (h SendToIbcEventHandler) Handle(ctx sdk.Context, contract common.Address, data []byte) error { h.Logger(ctx).Info("trigger evm event", "event", SendToIbcEvent.Name, "contract", contract) + if ctx.IsCheckTx() { + return nil + } // first confirm that the contract address and denom are registered, // to avoid unpacking any contract '__OKCSendToIbc' event, which consumes performance denom, found := h.Keeper.GetDenomByContract(ctx, contract) @@ -160,6 +163,9 @@ func (h SendNative20ToIbcEventHandler) EventID() common.Hash { // Handle Process the log func (h SendNative20ToIbcEventHandler) Handle(ctx sdk.Context, contract common.Address, data []byte) error { h.Logger(ctx).Info("trigger evm event", "event", SendNative20ToIbcEvent.Name, "contract", contract) + if ctx.IsCheckTx() { + return nil + } // first confirm that the contract address and denom are registered, // to avoid unpacking any contract '__OKCSendNative20ToIbc' event, which consumes performance denom, found := h.Keeper.GetDenomByContract(ctx, contract) diff --git a/x/feesplit/keeper/evm_hooks.go b/x/feesplit/keeper/evm_hooks.go index bad301cc14..f02cf3f976 100644 --- a/x/feesplit/keeper/evm_hooks.go +++ b/x/feesplit/keeper/evm_hooks.go @@ -38,6 +38,9 @@ func (k Keeper) PostTxProcessing( st *evmtypes.StateTransition, receipt *ethtypes.Receipt, ) error { + if ctx.IsCheckTx() { + return nil + } // This is different from ibc and wasm, evm tx exists at all times. // in Venus3 height store takes effect, // in Venus3+1 height initGenesis takes effect, @@ -101,7 +104,9 @@ func (k Keeper) PostTxProcessing( f.HasFee = true // add innertx - k.addFeesplitInnerTx(receipt.TxHash.Hex(), withdrawer.String(), fees.String()) + if !ctx.IsCheckTx() { + k.addFeesplitInnerTx(receipt.TxHash.Hex(), withdrawer.String(), fees.String()) + } ctx.EventManager().EmitEvents( sdk.Events{