EIP-1803 Fixing confusing opcode names (Rename opcodes for clarity)

No call decision · EVM & execution · EIP status Stagnant · created 2017-07-28

A proposal to rename six opcodes, BALANCE, SHA3, NUMBER, GASLIMIT, GAS, and INVALID, to better match their actual behavior. The bytecode and gas costs remain unchanged.

Why it is needed

Some EVM opcode names are misleading relative to their actual behavior, causing confusion. BALANCE alone does not make clear whose balance is being queried. SHA3 actually computes Keccak-256, not the finalized standard SHA-3. NUMBER and GASLIMIT return the block number and the block's gas limit respectively, but their names do not distinguish them from transaction-related values. GAS returns the remaining gas, but the name is ambiguous. INVALID was defined in EIP-141 as 'a dedicated instruction guaranteed to always fail', but the name overlaps with the general sense of 'any undefined opcode'. These names can cause developers to misunderstand code when reading or teaching it, so this proposal renames them for clarity while leaving the bytecode unchanged.

What changes

Today

After EIP-1803

Who is affected

In depth

EXTBALANCE

BALANCE (0x31) is renamed to EXTBALANCE. Like the existing EXTCODESIZE, EXTCODECOPY, and EXTCODEHASH, the EXT prefix meaning 'query external account information' is added to show it belongs to the same opcode family.

KECCAK256

SHA3 (0x20) is renamed to KECCAK256. The hash function Ethereum uses is not the finalized standard SHA-3 but its earlier version, Keccak-256, so the opcode name is aligned with the actual algorithm's name.

BLOCKNUMBER

NUMBER (0x43) is renamed to BLOCKNUMBER, making the name itself reflect that this opcode returns the current block number.

BLOCKGASLIMIT

GASLIMIT (0x45) is renamed to BLOCKGASLIMIT. This opcode returns the gas limit of the entire block, but the name alone is easily mistaken for the gas limit of the currently executing transaction, so BLOCK is added to distinguish it.

GASLEFT

GAS (0x5a) is renamed to GASLEFT. This opcode returns the amount of gas currently remaining, but GAS alone does not make clear what it refers to, so the meaning 'gas remaining' is built into the name.

ABORT

INVALID (0xfe) is renamed to ABORT. EIP-141 designated 0xfe as 'a dedicated instruction guaranteed to always fail', but because the name is INVALID, it gets confused with the sense of 'any undefined opcode that fails'. Renaming it to ABORT makes clear it is a dedicated instruction for intentionally halting execution.

Backward compatibility

This proposal does not change the opcodes' behavior, bytecode, or gas costs at all. Only the names (mnemonics) used by assemblers and disassemblers change, with no effect on actual EVM execution logic.

Progress status

This EIP's status is Stagnant, meaning it has not progressed further since being proposed. In other words, the names given above have never actually been adopted or changed. Current Ethereum clients and tools still use the existing names (BALANCE, SHA3, NUMBER, GASLIMIT, GAS, INVALID).

Original EIP · ← EIPs