Skip to content

Commit 7b6e305

Browse files
authored
fix(gas-payment): remove check gasObtained == outTxGasFee (#1304)
* add comment mismatch * add comment * change check
1 parent 0a9d506 commit 7b6e305

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

x/crosschain/keeper/gas_payment.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,12 @@ func (k Keeper) PayGasInERC20AndUpdateCctx(
223223
)
224224
gasObtained := amounts[2]
225225

226+
// FIXME: investigate small mismatches between gasObtained and outTxGasFee
227+
// https://github.com/zeta-chain/node/issues/1303
226228
// check if the final gas received after swap matches the gas fee defined
227229
// if not there might be issues with the pool liquidity and it is safer from an accounting perspective to return an error
228-
if gasObtained.Cmp(outTxGasFee.BigInt()) != 0 {
229-
return cosmoserrors.Wrapf(types.ErrInvalidGasAmount, "gas obtained for burn (%s) not equal to gas fee(%s)", gasObtained, outTxGasFee)
230+
if gasObtained.Cmp(outTxGasFee.BigInt()) == -1 {
231+
return cosmoserrors.Wrapf(types.ErrInvalidGasAmount, "gas obtained for burn (%s) is lower than gas fee(%s)", gasObtained, outTxGasFee)
230232
}
231233

232234
// burn the gas ZRC20
@@ -333,6 +335,9 @@ func (k Keeper) PayGasInZetaAndUpdateCctx(
333335
"zetaAmountIn", amounts[0],
334336
"zrc20AmountOut", amounts[1],
335337
)
338+
339+
// FIXME: investigate small mismatches between amounts[1] and outTxGasFee
340+
// https://github.com/zeta-chain/node/issues/1303
336341
err = k.fungibleKeeper.CallZRC20Burn(ctx, types.ModuleAddressEVM, gasZRC20, amounts[1], noEthereumTxEvent)
337342
if err != nil {
338343
return cosmoserrors.Wrap(err, "PayGasInZetaAndUpdateCctx: unable to CallZRC20Burn")

0 commit comments

Comments
 (0)