Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(gas-payment): remove check gasObtained == outTxGasFee #1304

Merged
merged 4 commits into from
Oct 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions x/crosschain/keeper/gas_payment.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,12 @@ 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()) == -1 {
return cosmoserrors.Wrapf(types.ErrInvalidGasAmount, "gas obtained for burn (%s) is lower than gas fee(%s)", gasObtained, outTxGasFee)
}

// burn the gas ZRC20
Expand Down Expand Up @@ -333,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")
Expand Down
Loading