Skip to content

Commit

Permalink
fix feesplit innertx bug (#3099)
Browse files Browse the repository at this point in the history
* fix feesplit innertx bug

* disable ibc and feesplit hook in checktx
  • Loading branch information
BananaLF authored Apr 12, 2023
1 parent 2c238c2 commit ef775ac
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions x/erc20/keeper/evm_log_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
7 changes: 6 additions & 1 deletion x/feesplit/keeper/evm_hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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{
Expand Down

0 comments on commit ef775ac

Please sign in to comment.