EIP-4803 Capping the transaction gas limit upper bound (Limit transaction gas to a maximum of 2^63-1)
No call decision · Fees & gas · EIP status Stagnant · created 2022-02-02
A proposal that defines a transaction as invalid and unable to be included in a block if its gas limit exceeds 2^63-1.
Why it is needed
While the transaction gas limit field allows an arbitrarily long integer by specification, the clients that actually process it each impose their own internal limits. For example, implementations like geth handle gas values as 64-bit integers. When such practical limits are not explicitly fixed in Ethereum's consensus rules, different clients may handle things slightly differently. This is a potential risk to consensus safety, where the entire network must agree on the same result. This proposal pins the gas limit's upper bound at 2^63-1, bringing this implicit discrepancy into the consensus rules.
What changes
Today
- The gas limit field allows an arbitrarily large integer by specification
- RLP encoding itself has no fixed upper bound, and most implementations can represent values up to 256 bits
- Major clients such as geth internally handle gas as a 64-bit integer, but this is not a consensus rule
After EIP-4803
- A transaction whose gas limit exceeds 2^63-1 becomes invalid and cannot be included in a block
- This rule is applied retroactively starting from the genesis block
- The gas limit can now be treated as a signed integer, so whether gas has been exhausted can be checked simply by subtracting and testing whether the result is below zero
Who is affected
- Client developers: This gives a basis in the consensus rules for safely implementing gas-handling logic based on signed 64-bit integers.
- Users and wallet developers: There is no perceptible change since block gas limit constraints already meant gas limit values this large have never actually been used.
- Validators and full node operators: The risk of inconsistency is reduced as gas limit handling, which previously differed implicitly between clients, is now unified as a consensus rule.
In depth
Specification details
Adds one new constraint applied retroactively from genesis. A transaction whose gas limit exceeds 2^63-1 is invalid and cannot be included in a block. In other words, the range of valid gas limit values is fixed between 0 and 2^63-1.
Why 2^63-1
The reason 2^63-1 was chosen instead of another value like 2^64-1 is that it is the maximum value representable as a signed integer. Treating gas values as signed integers allows the logic for checking whether gas has been exhausted to be implemented simply by subtracting and comparing whether the result is below zero.
Why a lower bound of 2^31-1 was not used
A lower value such as 2^31-1 was also considered as an alternative. Since JavaScript handles numbers as floating point and can only represent values exactly up to 2^53-1, a lower value would have had the advantage of being easier to handle in JavaScript environments, but it was not adopted.
The actual state of current implementations
RLP encoding itself does not impose a fixed upper bound, but in practice most implementations only handle values up to 256 bits. In addition, major client implementations including geth internally treat gas values as 64-bit integers. This proposal codifies this de facto standard practice as a consensus rule.
Backward compatibility
This change is technically a breaking change, but it is explained that it should have no visible impact in practice. Before EIP-1559, for transactions with gasPrice of 0, the condition gasLimit × gasPrice ≤ account balance alone could not constrain the gasLimit value, so in theory an arbitrarily large gasLimit could be allowed. However, because of the rule that a transaction list cannot exceed the block gas limit, and the strict rules on how much the block gas limit itself can change, no arbitrarily large gasLimit value has actually existed in past chain state.
Security considerations and current status
The source does not specify separate security considerations and states only "None." This proposal is currently in Stagnant status, halted without active discussion or a fork-inclusion decision.