node
node copied to clipboard
Should use gas limit (and other fees values) from the emitted event when parsing ZEVM inobund
Describe the Issue
File: evm_hooks.go
We currently reread the gasLimit value from the store to set the gasLimit for the inbound
gasLimit, err := k.fungibleKeeper.QueryGasLimit(ctx, ethcommon.HexToAddress(foreignCoin.Zrc20ContractAddress))
if err != nil {
return fmt.Errorf("cannot query gas limit: %s", err.Error())
}
// gasLimit+uint64(event.Raw.Index) to generate different cctx for multiple events in the same tx.
msg := types.NewMsgVoteInbound(
"",
emittingContract.Hex(),
senderChain.ChainId,
txOrigin,
toAddr,
foreignCoin.ForeignChainId,
math.NewUintFromBigInt(event.Value),
"",
event.Raw.TxHash.String(),
event.Raw.BlockNumber,
gasLimit.Uint64(),
foreignCoin.CoinType,
foreignCoin.Asset,
event.Raw.Index,
types.ProtocolContractVersion_V1,
)
For full accuracy and better maintainability, we should put at the smart contract level the values used (fee payment in withdraw) to the withdrawal events. Then the protocol should use this value from the event for the inbound
@lumtis I don't think this is still relevant , should we close it ?
gasLimit := event.CallOptions.GasLimit.Uint64()
if gasLimit == 0 {
gasLimit = gasLimitQueried.Uint64()
}
the gasLimitQueried is only used if the original gasLimit is 0, which I dont think is currently possible as we assign the either the user specified limit or default limit to the call options