Zilliqa / zilliqa-developer

GNU General Public License v3.0
2 stars 5 forks source link

Bridge: Add `gas.price` as relay parameter #335

Open WuBruno opened 11 months ago

WuBruno commented 11 months ago
          What about the `gasPrice` - shouldn't that be included too?

For EIP1559 transactions, I think that would be the max base price and/or the tip/priority payment, but I actually can't find docs on how Eth mainnet RPCs accept them (https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendtransaction still only lists gasPrice which seems outdated for post-London? I may be looking in the wrong place). In any case at least one gas price parameter is likely necessary for all transaction types - unless you want the receiver side (validators for cross-shard, the Relayer contract for cross-chain) to set the fees themselves?

_Originally posted by @theo-zil in https://github.com/Zilliqa/zilliqa-developer/pull/321#discussion_r1426745460_

WuBruno commented 11 months ago

the gasPrice shall be part of the event/interface, but imo it shall not be specified by the user who submitted the transaction on the source chain that requested the cross-chain call. We could use the Zilliqa validators as oracles instead, so that their supermajority signs updates to the gasPrice and the leader informs the relayer/gateway contract on the source chain. -- Zoltan Slack

The contracts on the source chain must choose a gasPrice when they requests a cross-chain call. It's the maximum gasPrice that is allowed to be used in the transaction submitted on the target chain. However, the source-chain contracts don't know when the gasPrice on the target chain goes up or down and would keep requesting cross-chain calls with an outdated gasPrice. The supermajority of ZQ validators could be a reliable source of the current gasPrice of the target chain, any one of them - the current leader - could submit a transaction passing the signatures of the supermajority as an argument to update the gasPrice on the source chain. -- Zoltan Slack

WuBruno commented 11 months ago

For the MVP, the implementation will just feature a maximum gasPrice stored on the Dispatcher contract that can later become a variable updated by the validators.