From 70d57d223981ac014a09956586aef494d9309137 Mon Sep 17 00:00:00 2001 From: lumtis Date: Mon, 16 Oct 2023 13:06:09 -0700 Subject: [PATCH 1/3] add comment mismatch --- x/crosschain/keeper/gas_payment.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/x/crosschain/keeper/gas_payment.go b/x/crosschain/keeper/gas_payment.go index 9cd5e0f916..2491453bd1 100644 --- a/x/crosschain/keeper/gas_payment.go +++ b/x/crosschain/keeper/gas_payment.go @@ -223,11 +223,13 @@ func (k Keeper) PayGasInERC20AndUpdateCctx( ) gasObtained := amounts[2] + // FIXME: investigate small mismatches between gasObtained and outTxGasFee + // https://github.com/zeta-chain/node/issues/1303 // check if the final gas received after swap matches the gas fee defined // if not there might be issues with the pool liquidity and it is safer from an accounting perspective to return an error - if gasObtained.Cmp(outTxGasFee.BigInt()) != 0 { - return cosmoserrors.Wrapf(types.ErrInvalidGasAmount, "gas obtained for burn (%s) not equal to gas fee(%s)", gasObtained, outTxGasFee) - } + //if gasObtained.Cmp(outTxGasFee.BigInt()) != 0 { + // return cosmoserrors.Wrapf(types.ErrInvalidGasAmount, "gas obtained for burn (%s) not equal to gas fee(%s)", gasObtained, outTxGasFee) + //} // burn the gas ZRC20 err = k.fungibleKeeper.CallZRC20Burn(ctx, types.ModuleAddressEVM, gasZRC20, gasObtained, noEthereumTxEvent) From 67b7fdd2dbf11ea2357b576fbff6d885f855b0d0 Mon Sep 17 00:00:00 2001 From: lumtis Date: Mon, 16 Oct 2023 13:07:34 -0700 Subject: [PATCH 2/3] add comment --- x/crosschain/keeper/gas_payment.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/x/crosschain/keeper/gas_payment.go b/x/crosschain/keeper/gas_payment.go index 2491453bd1..0ff55ea65a 100644 --- a/x/crosschain/keeper/gas_payment.go +++ b/x/crosschain/keeper/gas_payment.go @@ -335,6 +335,9 @@ func (k Keeper) PayGasInZetaAndUpdateCctx( "zetaAmountIn", amounts[0], "zrc20AmountOut", amounts[1], ) + + // FIXME: investigate small mismatches between amounts[1] and outTxGasFee + // https://github.com/zeta-chain/node/issues/1303 err = k.fungibleKeeper.CallZRC20Burn(ctx, types.ModuleAddressEVM, gasZRC20, amounts[1], noEthereumTxEvent) if err != nil { return cosmoserrors.Wrap(err, "PayGasInZetaAndUpdateCctx: unable to CallZRC20Burn") From ec2b399a8dc35d5b28e53fb497bb8d86353255ec Mon Sep 17 00:00:00 2001 From: lumtis Date: Mon, 16 Oct 2023 13:31:43 -0700 Subject: [PATCH 3/3] change check --- x/crosschain/keeper/gas_payment.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/x/crosschain/keeper/gas_payment.go b/x/crosschain/keeper/gas_payment.go index 0ff55ea65a..a370c7a672 100644 --- a/x/crosschain/keeper/gas_payment.go +++ b/x/crosschain/keeper/gas_payment.go @@ -227,9 +227,9 @@ func (k Keeper) PayGasInERC20AndUpdateCctx( // https://github.com/zeta-chain/node/issues/1303 // check if the final gas received after swap matches the gas fee defined // if not there might be issues with the pool liquidity and it is safer from an accounting perspective to return an error - //if gasObtained.Cmp(outTxGasFee.BigInt()) != 0 { - // return cosmoserrors.Wrapf(types.ErrInvalidGasAmount, "gas obtained for burn (%s) not equal to gas fee(%s)", gasObtained, outTxGasFee) - //} + if gasObtained.Cmp(outTxGasFee.BigInt()) == -1 { + return cosmoserrors.Wrapf(types.ErrInvalidGasAmount, "gas obtained for burn (%s) is lower than gas fee(%s)", gasObtained, outTxGasFee) + } // burn the gas ZRC20 err = k.fungibleKeeper.CallZRC20Burn(ctx, types.ModuleAddressEVM, gasZRC20, gasObtained, noEthereumTxEvent)