Skip to content

Expose MAX_TRANSACTION_GAS_LIMIT in the system contractsΒ #1210

@CodeSandwich

Description

@CodeSandwich

🌟 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions