-
Notifications
You must be signed in to change notification settings - Fork 413
Description
π Feature Request
π Description
Expose MAX_TRANSACTION_GAS_LIMIT in the system contracts.
π€ Rationale
As of now there's no way to learn what's the maximum gas available for a transaction. block.gaslimit only tells the limit of the entire batch, which is a different thing unlike in EVMs where the transaction gas limit is equal to the block gas limit. The maximum gas usable in a transaction is sometimes a useful piece of information, for example my smart contract uses it for throttling requests of an off-chain resource, the gas cost of requesting it goes up with each call increasing the price until the transaction gas limit is reached and the resource can't be used at all until the cooldown ends.
π Additional Context
Making block.gaslimit return the transaction gas limit feels like the right choice when it comes to porting EVM contracts to ZKsync. In the context of Solidity smart contracts the batch limit isn't a relevant information because their execution is always in the context of a transaction. Having the batch limit which is a strictly ZKsync thing available in the system contract seems right, it doesn't need to be available right in the Solidity syntax. I suspect that this switch probably won't happen though as it may cause compatibility issues in the existing contracts.