@tevm/voltaire / index / BrandedOpcode
BrandedOpcode
Functions
_disassemble()
_disassemble(Defined in: src/primitives/Opcode/disassemble.js:22 Disassemble bytecode to human-readable stringsbytecode):string[]
Parameters
bytecode
Uint8Array<ArrayBufferLike>
Raw bytecode bytes
Returns
string[]
Array of formatted instruction strings
Example
_dupPosition()
_dupPosition(Defined in: src/primitives/Opcode/dupPosition.js:17 Get position for DUP instructionopcode):number|undefined
Parameters
opcode
BrandedOpcode
Opcode to query
Returns
number | undefined
Stack position (1-16), or undefined if not a DUP
Example
_format()
_format(Defined in: src/primitives/Opcode/format.js:20 Format instruction to human-readable stringinstruction):string
Parameters
instruction
Instruction
Instruction to format
Returns
string
Human-readable string
Example
_getCategory()
_getCategory(Defined in: src/primitives/Opcode/getCategory.js:18 Get opcode categoryopcode):string
Parameters
opcode
BrandedOpcode
Opcode to query
Returns
string
Category name
Example
_getDescription()
_getDescription(Defined in: src/primitives/Opcode/getDescription.js:140 Get human-readable description of an opcodeopcode):string
Parameters
opcode
BrandedOpcode
Opcode to query
Returns
string
Description or generated description for PUSH/DUP/SWAP
Example
_getGasCost()
_getGasCost(Defined in: src/primitives/Opcode/getGasCost.js:16 Get static gas cost for an opcodeopcode):number|undefined
Parameters
opcode
BrandedOpcode
Opcode to query
Returns
number | undefined
Static gas cost or undefined if invalid
Example
_getName()
_getName(Defined in: src/primitives/Opcode/getName.js:16 Get mnemonic name of an opcode (alias for name)opcode):string
Parameters
opcode
BrandedOpcode
Opcode to query
Returns
string
Opcode name or “UNKNOWN” if invalid
Example
_getPushSize()
_getPushSize(Defined in: src/primitives/Opcode/getPushSize.js:18 Get PUSH data size in bytesopcode):number
Parameters
opcode
BrandedOpcode
Opcode to query
Returns
number
Push size (0 for PUSH0, 1-32 for PUSH1-PUSH32, 0 for non-PUSH)
Example
_getStackEffect()
_getStackEffect(Defined in: src/primitives/Opcode/getStackEffect.js:19 Get stack effect for an opcodeopcode): {pop:number;push:number; } |undefined
Parameters
opcode
BrandedOpcode
Opcode to query
Returns
{pop: number; push: number; } | undefined
Stack items consumed and produced
Example
_getStackInput()
_getStackInput(Defined in: src/primitives/Opcode/getStackInput.js:16 Get number of stack items consumed by an opcodeopcode):number|undefined
Parameters
opcode
BrandedOpcode
Opcode to query
Returns
number | undefined
Number of stack items consumed
Example
_getStackOutput()
_getStackOutput(Defined in: src/primitives/Opcode/getStackOutput.js:16 Get number of stack items produced by an opcodeopcode):number|undefined
Parameters
opcode
BrandedOpcode
Opcode to query
Returns
number | undefined
Number of stack items produced
Example
_info()
_info(Defined in: src/primitives/Opcode/info.js:17 Get metadata for an opcodeopcode):Info|undefined
Parameters
opcode
BrandedOpcode
Opcode to query
Returns
Info | undefined
Metadata with gas cost and stack requirements
Example
_isDup()
_isDup(Defined in: src/primitives/Opcode/isDup.js:16 Check if opcode is a DUP instructionopcode):boolean
Parameters
opcode
BrandedOpcode
Opcode to check
Returns
boolean
True if DUP1-DUP16
Example
_isJump()
_isJump(Defined in: src/primitives/Opcode/isJump.js:17 Check if opcode is a jumpopcode):boolean
Parameters
opcode
BrandedOpcode
Opcode to check
Returns
boolean
True if JUMP or JUMPI
Example
_isJumpDestination()
_isJumpDestination(Defined in: src/primitives/Opcode/isJumpDestination.js:16 Check if opcode is JUMPDESTopcode):boolean
Parameters
opcode
BrandedOpcode
Opcode to check
Returns
boolean
True if JUMPDEST
Example
_isLog()
_isLog(Defined in: src/primitives/Opcode/isLog.js:16 Check if opcode is a LOG instructionopcode):boolean
Parameters
opcode
BrandedOpcode
Opcode to check
Returns
boolean
True if LOG0-LOG4
Example
_isPush()
_isPush(Defined in: src/primitives/Opcode/isPush.js:16 Check if opcode is a PUSH instructionopcode):boolean
Parameters
opcode
BrandedOpcode
Opcode to check
Returns
boolean
True if PUSH0-PUSH32
Example
_isSwap()
_isSwap(Defined in: src/primitives/Opcode/isSwap.js:16 Check if opcode is a SWAP instructionopcode):boolean
Parameters
opcode
BrandedOpcode
Opcode to check
Returns
boolean
True if SWAP1-SWAP16
Example
_isTerminating()
_isTerminating(Defined in: src/primitives/Opcode/isTerminating.js:16 Check if opcode terminates executionopcode):boolean
Parameters
opcode
BrandedOpcode
Opcode to check
Returns
boolean
True if STOP, RETURN, REVERT, INVALID, or SELFDESTRUCT
Example
_isTerminator()
_isTerminator(Defined in: src/primitives/Opcode/isTerminator.js:16 Check if opcode terminates execution (alias for isTerminating)opcode):boolean
Parameters
opcode
BrandedOpcode
Opcode to check
Returns
boolean
True if STOP, RETURN, REVERT, INVALID, or SELFDESTRUCT
Example
_isValid()
_isValid(Defined in: src/primitives/Opcode/isValid.js:16 Check if opcode is validopcode):opcode is BrandedOpcode
Parameters
opcode
number
Byte value to check
Returns
opcode is BrandedOpcode
True if opcode is defined in the EVM
Example
_isValidJumpDest()
_isValidJumpDest(Defined in: src/primitives/Opcode/isValidJumpDest.js:18 Check if offset is a valid jump destinationbytecode,offset):boolean
Parameters
bytecode
Uint8Array<ArrayBufferLike>
Raw bytecode bytes
offset
number
Byte offset to check
Returns
boolean
True if offset is a JUMPDEST and not inside immediate data
Example
_isValidOpcode()
_isValidOpcode(Defined in: src/primitives/Opcode/isValidOpcode.js:17 Check if value is a valid opcode (alias for isValid)value):boolean
Parameters
value
number
Value to check
Returns
boolean
True if valid opcode
Example
_jumpDests()
_jumpDests(Defined in: src/primitives/Opcode/jumpDests.js:17 Find all valid JUMPDEST locationsbytecode):Set<number>
Parameters
bytecode
Uint8Array<ArrayBufferLike>
Raw bytecode bytes
Returns
Set<number>
Set of valid jump destinations (byte offsets)
Example
_logTopics()
_logTopics(Defined in: src/primitives/Opcode/logTopics.js:17 Get number of topics for LOG instructionopcode):number|undefined
Parameters
opcode
BrandedOpcode
Opcode to query
Returns
number | undefined
Number of topics (0-4), or undefined if not a LOG
Example
_name()
_name(Defined in: src/primitives/Opcode/name.js:15 Get name of an opcodeopcode):string
Parameters
opcode
BrandedOpcode
Opcode to query
Returns
string
Opcode name or “UNKNOWN” if invalid
Example
_parse()
_parse(Defined in: src/primitives/Opcode/parse.js:21 Parse bytecode into instructionsbytecode):Instruction[]
Parameters
bytecode
Uint8Array<ArrayBufferLike>
Raw bytecode bytes
Returns
Instruction[]
Array of parsed instructions
Example
_pushBytes()
_pushBytes(Defined in: src/primitives/Opcode/pushBytes.js:18 Get number of bytes pushed by PUSH instructionopcode):number|undefined
Parameters
opcode
BrandedOpcode
Opcode to query
Returns
number | undefined
Number of bytes (0-32), or undefined if not a PUSH
Example
_pushOpcode()
_pushOpcode(Defined in: src/primitives/Opcode/pushOpcode.js:19 Get PUSH opcode for given byte countbytes):BrandedOpcode
Parameters
bytes
number
Number of bytes (0-32)
Returns
BrandedOpcode
PUSH opcode for that size
Throws
If bytes is not 0-32Example
_swapPosition()
_swapPosition(Defined in: src/primitives/Opcode/swapPosition.js:17 Get position for SWAP instructionopcode):number|undefined
Parameters
opcode
BrandedOpcode
Opcode to query
Returns
number | undefined
Stack position (1-16), or undefined if not a SWAP
Example
disassemble()
disassemble(Defined in: src/primitives/Opcode/disassemble.js:22 Disassemble bytecode to human-readable stringsbytecode):string[]
Parameters
bytecode
Uint8Array<ArrayBufferLike>
Raw bytecode bytes
Returns
string[]
Array of formatted instruction strings
Example
dupPosition()
dupPosition(Defined in: src/primitives/Opcode/dupPosition.js:17 Get position for DUP instructionopcode):number|undefined
Parameters
opcode
BrandedOpcode
Opcode to query
Returns
number | undefined
Stack position (1-16), or undefined if not a DUP
Example
format()
format(Defined in: src/primitives/Opcode/format.js:20 Format instruction to human-readable stringinstruction):string
Parameters
instruction
Instruction
Instruction to format
Returns
string
Human-readable string
Example
getCategory()
getCategory(Defined in: src/primitives/Opcode/getCategory.js:18 Get opcode categoryopcode):string
Parameters
opcode
BrandedOpcode
Opcode to query
Returns
string
Category name
Example
getDescription()
getDescription(Defined in: src/primitives/Opcode/getDescription.js:140 Get human-readable description of an opcodeopcode):string
Parameters
opcode
BrandedOpcode
Opcode to query
Returns
string
Description or generated description for PUSH/DUP/SWAP
Example
getGasCost()
getGasCost(Defined in: src/primitives/Opcode/getGasCost.js:16 Get static gas cost for an opcodeopcode):number|undefined
Parameters
opcode
BrandedOpcode
Opcode to query
Returns
number | undefined
Static gas cost or undefined if invalid
Example
getName()
getName(Defined in: src/primitives/Opcode/getName.js:16 Get mnemonic name of an opcode (alias for name)opcode):string
Parameters
opcode
BrandedOpcode
Opcode to query
Returns
string
Opcode name or “UNKNOWN” if invalid
Example
getPushSize()
getPushSize(Defined in: src/primitives/Opcode/getPushSize.js:18 Get PUSH data size in bytesopcode):number
Parameters
opcode
BrandedOpcode
Opcode to query
Returns
number
Push size (0 for PUSH0, 1-32 for PUSH1-PUSH32, 0 for non-PUSH)
Example
getStackEffect()
getStackEffect(Defined in: src/primitives/Opcode/getStackEffect.js:19 Get stack effect for an opcodeopcode): {pop:number;push:number; } |undefined
Parameters
opcode
BrandedOpcode
Opcode to query
Returns
{pop: number; push: number; } | undefined
Stack items consumed and produced
Example
getStackInput()
getStackInput(Defined in: src/primitives/Opcode/getStackInput.js:16 Get number of stack items consumed by an opcodeopcode):number|undefined
Parameters
opcode
BrandedOpcode
Opcode to query
Returns
number | undefined
Number of stack items consumed
Example
getStackOutput()
getStackOutput(Defined in: src/primitives/Opcode/getStackOutput.js:16 Get number of stack items produced by an opcodeopcode):number|undefined
Parameters
opcode
BrandedOpcode
Opcode to query
Returns
number | undefined
Number of stack items produced
Example
info()
info(Defined in: src/primitives/Opcode/info.js:17 Get metadata for an opcodeopcode):Info|undefined
Parameters
opcode
BrandedOpcode
Opcode to query
Returns
Info | undefined
Metadata with gas cost and stack requirements
Example
isDup()
isDup(Defined in: src/primitives/Opcode/isDup.js:16 Check if opcode is a DUP instructionopcode):boolean
Parameters
opcode
BrandedOpcode
Opcode to check
Returns
boolean
True if DUP1-DUP16
Example
isJump()
isJump(Defined in: src/primitives/Opcode/isJump.js:17 Check if opcode is a jumpopcode):boolean
Parameters
opcode
BrandedOpcode
Opcode to check
Returns
boolean
True if JUMP or JUMPI
Example
isJumpDestination()
isJumpDestination(Defined in: src/primitives/Opcode/isJumpDestination.js:16 Check if opcode is JUMPDESTopcode):boolean
Parameters
opcode
BrandedOpcode
Opcode to check
Returns
boolean
True if JUMPDEST
Example
isLog()
isLog(Defined in: src/primitives/Opcode/isLog.js:16 Check if opcode is a LOG instructionopcode):boolean
Parameters
opcode
BrandedOpcode
Opcode to check
Returns
boolean
True if LOG0-LOG4
Example
isPush()
isPush(Defined in: src/primitives/Opcode/isPush.js:16 Check if opcode is a PUSH instructionopcode):boolean
Parameters
opcode
BrandedOpcode
Opcode to check
Returns
boolean
True if PUSH0-PUSH32
Example
isSwap()
isSwap(Defined in: src/primitives/Opcode/isSwap.js:16 Check if opcode is a SWAP instructionopcode):boolean
Parameters
opcode
BrandedOpcode
Opcode to check
Returns
boolean
True if SWAP1-SWAP16
Example
isTerminating()
isTerminating(Defined in: src/primitives/Opcode/isTerminating.js:16 Check if opcode terminates executionopcode):boolean
Parameters
opcode
BrandedOpcode
Opcode to check
Returns
boolean
True if STOP, RETURN, REVERT, INVALID, or SELFDESTRUCT
Example
isTerminator()
isTerminator(Defined in: src/primitives/Opcode/isTerminator.js:16 Check if opcode terminates execution (alias for isTerminating)opcode):boolean
Parameters
opcode
BrandedOpcode
Opcode to check
Returns
boolean
True if STOP, RETURN, REVERT, INVALID, or SELFDESTRUCT
Example
isValid()
isValid(Defined in: src/primitives/Opcode/isValid.js:16 Check if opcode is validopcode):opcode is BrandedOpcode
Parameters
opcode
number
Byte value to check
Returns
opcode is BrandedOpcode
True if opcode is defined in the EVM
Example
isValidJumpDest()
isValidJumpDest(Defined in: src/primitives/Opcode/isValidJumpDest.js:18 Check if offset is a valid jump destinationbytecode,offset):boolean
Parameters
bytecode
Uint8Array<ArrayBufferLike>
Raw bytecode bytes
offset
number
Byte offset to check
Returns
boolean
True if offset is a JUMPDEST and not inside immediate data
Example
isValidOpcode()
isValidOpcode(Defined in: src/primitives/Opcode/isValidOpcode.js:17 Check if value is a valid opcode (alias for isValid)value):boolean
Parameters
value
number
Value to check
Returns
boolean
True if valid opcode
Example
jumpDests()
jumpDests(Defined in: src/primitives/Opcode/jumpDests.js:17 Find all valid JUMPDEST locationsbytecode):Set<number>
Parameters
bytecode
Uint8Array<ArrayBufferLike>
Raw bytecode bytes
Returns
Set<number>
Set of valid jump destinations (byte offsets)
Example
logTopics()
logTopics(Defined in: src/primitives/Opcode/logTopics.js:17 Get number of topics for LOG instructionopcode):number|undefined
Parameters
opcode
BrandedOpcode
Opcode to query
Returns
number | undefined
Number of topics (0-4), or undefined if not a LOG
Example
name()
name(Defined in: src/primitives/Opcode/name.js:15 Get name of an opcodeopcode):string
Parameters
opcode
BrandedOpcode
Opcode to query
Returns
string
Opcode name or “UNKNOWN” if invalid
Example
parse()
parse(Defined in: src/primitives/Opcode/parse.js:21 Parse bytecode into instructionsbytecode):Instruction[]
Parameters
bytecode
Uint8Array<ArrayBufferLike>
Raw bytecode bytes
Returns
Instruction[]
Array of parsed instructions
Example
pushBytes()
pushBytes(Defined in: src/primitives/Opcode/pushBytes.js:18 Get number of bytes pushed by PUSH instructionopcode):number|undefined
Parameters
opcode
BrandedOpcode
Opcode to query
Returns
number | undefined
Number of bytes (0-32), or undefined if not a PUSH
Example
pushOpcode()
pushOpcode(Defined in: src/primitives/Opcode/pushOpcode.js:19 Get PUSH opcode for given byte countbytes):BrandedOpcode
Parameters
bytes
number
Number of bytes (0-32)
Returns
BrandedOpcode
PUSH opcode for that size
Throws
If bytes is not 0-32Example
swapPosition()
swapPosition(Defined in: src/primitives/Opcode/swapPosition.js:17 Get position for SWAP instructionopcode):number|undefined
Parameters
opcode
BrandedOpcode
Opcode to query
Returns
number | undefined
Stack position (1-16), or undefined if not a SWAP

