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
- The name BALANCE alone does not make clear whose balance is being queried
- The name SHA3 evokes the standard SHA-3, which differs from the Keccak-256 actually used
- GASLIMIT is ambiguous as to whether it refers to the block's gas limit or a transaction's gas limit
- The name INVALID refers both to 'any undefined opcode' and to 'a dedicated opcode for intentional termination'
After EIP-1803
- BALANCE is renamed to EXTBALANCE, revealing that it belongs to the same family as EXTCODESIZE and similar opcodes
- SHA3 is renamed to KECCAK256, matching the actual hash function's name
- GASLIMIT is renamed to BLOCKGASLIMIT, distinguishing it from a transaction's gas limit
- INVALID is renamed to ABORT, making clear it is an intentional termination instruction
Who is affected
- Compiler and assembler developers: The opcode mnemonics used in Solidity, Vyper, and similar tools need to be changed
- EVM client teams: Since the bytecode behavior is unchanged, there is no need to change execution logic. Only the disassembler output names change.
- Smart contract educators and security auditors: Clearer opcode names reduce the chance of misunderstanding when explaining or auditing code
- Ordinary users: Since the bytecode and gas costs do not change at all, there is no perceptible impact
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).