From aaea061766d4b155b32783fcb417ae9388328e95 Mon Sep 17 00:00:00 2001 From: Tanmay Date: Thu, 15 Feb 2024 14:12:33 -0500 Subject: [PATCH] resolve comments --- common/address.go | 2 +- x/crosschain/keeper/evm_hooks.go | 16 +++++----------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/common/address.go b/common/address.go index b3a432ea8c..c79a4c5c9f 100644 --- a/common/address.go +++ b/common/address.go @@ -73,7 +73,7 @@ func DecodeBtcAddress(inputAddress string, chainID int64) (address btcutil.Addre } address, err = btcutil.DecodeAddress(inputAddress, chainParams) if err != nil { - return nil, fmt.Errorf("decode address failed: %s", err.Error()) + return nil, fmt.Errorf("decode address failed: %s , for input address %s", err.Error(), inputAddress) } ok := address.IsForNet(chainParams) if !ok { diff --git a/x/crosschain/keeper/evm_hooks.go b/x/crosschain/keeper/evm_hooks.go index 02ed057752..6294a3ade4 100644 --- a/x/crosschain/keeper/evm_hooks.go +++ b/x/crosschain/keeper/evm_hooks.go @@ -73,11 +73,10 @@ func (k Keeper) ProcessLogs(ctx sdk.Context, logs []*ethtypes.Log, emittingContr if err := k.ProcessZRC20WithdrawalEvent(ctx, eventWithdrawal, emittingContract, txOrigin); err != nil { return err } - } - // We were able to parse the ZRC20 withdrawal event. However, we were unable to process it as the information was incorrect - // This means that there are some funds locked in the contract which cannot have an outbound , this can be a candidate for a refund - // TODO : Consider returning error or auto refunding the funds to the user - if eventWithdrawal != nil { + // We were able to parse the ZRC20 withdrawal event. However, we were unable to process it as the information was incorrect + // This means that there are some funds locked in the contract which cannot have an outbound , this can be a candidate for a refund + // TODO : Consider returning error or auto refunding the funds to the user + } else if eventWithdrawal != nil { ctx.Logger().Error(fmt.Sprintf("Error processing ZRC20 withdrawal event , from Address: %s m ,to : %s,value %s,gasfee %s, protocolfee %s, err %s", eventWithdrawal.From.Hex(), string(eventWithdrawal.To), eventWithdrawal.Value.String(), eventWithdrawal.Gasfee.String(), eventWithdrawal.ProtocolFlatFee.String(), err.Error())) } @@ -88,11 +87,6 @@ func (k Keeper) ProcessLogs(ctx sdk.Context, logs []*ethtypes.Log, emittingContr return err } } - // We were able to parse the ZetaSent event. However, we were unable to process it as the information was incorrect - if eZeta != nil { - ctx.Logger().Error(fmt.Sprintf("Error processing Zeta Sent event , from Address: %s ,to : %s,value %s, err %s", - eZeta.Raw.Address.Hex(), string(eZeta.DestinationAddress), eZeta.ZetaValueAndGas.String(), err.Error())) - } } return nil } @@ -310,7 +304,7 @@ func ParseZetaSentEvent(log ethtypes.Log, connectorZEVM ethcommon.Address) (*con } if event.Raw.Address != connectorZEVM { - return event, fmt.Errorf("ParseZetaSentEvent: event address %s does not match connectorZEVM %s", event.Raw.Address.Hex(), connectorZEVM.Hex()) + return nil, fmt.Errorf("ParseZetaSentEvent: event address %s does not match connectorZEVM %s", event.Raw.Address.Hex(), connectorZEVM.Hex()) } return event, nil }