This page is a placeholder. All examples on this page are currently AI-generated and are not correct. This documentation will be completed in the future with accurate, tested examples.
Overview
Opcode:0x62Introduced: Frontier (EVM genesis)PUSH3 pushes a 3-byte immediate value from the bytecode onto the stack. The 3 bytes immediately following the opcode are read and zero-padded to 256 bits.
value = read_bytes(pc + 1, 3) // Big-endianstack.push(value)pc += 4
Behavior
PUSH3 reads 3 bytes from bytecode starting at position pc + 1, interprets them as a big-endian unsigned integer, and pushes the result onto the stack.Key characteristics:
Reads exactly 3 bytes following opcode
Big-endian byte order (most significant byte first)
Zero-padded to 256 bits if less than 32 bytes
InvalidOpcode if insufficient bytecode remaining
PC advances by 4 (opcode + data)
Examples
Basic Usage
import { handler_0x62_PUSH3 } from '@tevm/voltaire/evm/stack/handlers';import { createFrame } from '@tevm/voltaire/evm/Frame';// Bytecode with PUSH3const bytecode = new Uint8Array([ 0x62, // PUSH3 0x01, 0x02, 0x03 // 3 bytes: 010203]);const frame = createFrame({ bytecode, pc: 0, stack: [], gasRemaining: 1000n});const err = handler_0x62_PUSH3(frame);console.log(frame.stack); // [0x0102030000000000000000000000000000000000000000000000000000000000n]console.log(frame.pc); // 4console.log(frame.gasRemaining); // 997n (3 gas consumed)
Solidity Compilation
contract Example { // Function selectors use PUSH4 function transfer() public { // PUSH4 0xa9059cbb (4-byte selector) }}