---
eip: 1985
label: EIP-1985
title: Sane limits for certain EVM parameters
status: Stagnant
type: Standards Track
category: Core
created: 2018-08-01
official: https://eips.ethereum.org/EIPS/eip-1985
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1985.md
canonical: https://eips.huatuo.xyz/eip-1985/
lang: en
tldr: Proposes explicit value ranges for EVM values such as gas, block number, timestamp, addresses and buffer sizes, so clients can use 64-bit or 32-bit integers safely and tests can skip impossible edge cases.
tags: [evm, limits, core, clients, specification]
---

# EIP-1985: Sane limits for certain EVM parameters

> Introduce an explicit value range for certain EVM parameters (such as gas limit, block number, block timestamp, size field when returning/copying data within EVM). Some of these already have an implicit value range due to various (practical) reasons.

**TL;DR:** Proposes explicit value ranges for EVM values such as gas, block number, timestamp, addresses and buffer sizes, so clients can use 64-bit or 32-bit integers safely and tests can skip impossible edge cases.

## What problem does it solve?

The EVM works on 256-bit words, so in theory instructions like `GAS` or `TIMESTAMP` could return any 256-bit value. In practice clients store these values in 64-bit integers, and some can never get that large because gas makes it impossible. These implicit limits were not written down.

That gap has costs: client authors must guess which limits are safe, implementations may disagree on absurd edge cases, and consensus test suites spend effort on values that can never occur. EIP-1985 proposes stating the ranges explicitly.

## How it works

From a fork block onwards, the values these instructions push onto the stack are guaranteed to fall within:

| Value | Range | Instructions |
| --- | --- | --- |
| Gas, gas limit, block gas limit | `0` to `2**63 - 1` | `GASLIMIT`, `GAS` |
| Block number, timestamp | `0` to `2**63 - 1` | `NUMBER`, `TIMESTAMP` |
| Account address | `0` to `2**160 - 1` (top 96 bits zero) | `ADDRESS`, `ORIGIN`, `CALLER`, `COINBASE`, `CREATE`, `CREATE2` |
| Buffer, code and memory size | `0` to `2**32 - 1` | `CALLDATASIZE`, `CODESIZE`, `EXTCODESIZE`, `RETURNDATASIZE`, `MSIZE`, `PC` |

Why `2**63 - 1` rather than `2**64 - 1`? It fits a **signed** 64-bit integer, which helps languages without unsigned types and makes out-of-gas checks as simple as `gas_counter < 0`.

The memory-size cap is backed by gas cost: memory expansion cost grows quadratically, so reaching 4 GiB is already prohibitively expensive. Code size is already far below the cap thanks to [EIP-170](/eip-170/).

The authors argue there is no behaviour change, since these limits are already enforced in practice, mostly via the block gas limit.

## Sample code

How a client might use the guarantee, in Go-like pseudocode:

```go
const MaxInt63 = 1<<63 - 1

// Safe to keep these as native integers instead of 256-bit words
type BlockContext struct {
    Number    int64  // 0 .. 2**63-1
    Timestamp int64  // 0 .. 2**63-1
    GasLimit  int64  // 0 .. 2**63-1
}

func opMsize(mem *Memory, stack *Stack) {
    stack.Push(uint256.NewInt(uint64(mem.Len()))) // fits in uint32 by this EIP
}
```

## Things to know

- Status is **Stagnant**; it has not been adopted as a consensus rule.
- The spec leaves open whether the gas range also applies to the gas argument of call instructions.
- Even without this EIP, most clients already represent these values with 64-bit integers, so the practical behaviour largely matches what it describes.
- [EIP-1482](/eip-1482/) is a related proposal about bounding the *drift* of block timestamps rather than their numeric range.


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-1985
