Skip to main content
@tevm/voltaire
@tevm/voltaire / index / BrandedOpcode

BrandedOpcode

Functions

_disassemble()

_disassemble(bytecode): string[]
Defined in: src/primitives/Opcode/disassemble.js:22 Disassemble bytecode to human-readable strings

Parameters

bytecode
Uint8Array<ArrayBufferLike> Raw bytecode bytes

Returns

string[] Array of formatted instruction strings

Example


_dupPosition()

_dupPosition(opcode): number | undefined
Defined in: src/primitives/Opcode/dupPosition.js:17 Get position for DUP instruction

Parameters

opcode
BrandedOpcode Opcode to query

Returns

number | undefined Stack position (1-16), or undefined if not a DUP

Example


_format()

_format(instruction): string
Defined in: src/primitives/Opcode/format.js:20 Format instruction to human-readable string

Parameters

instruction
Instruction Instruction to format

Returns

string Human-readable string

Example


_getCategory()

_getCategory(opcode): string
Defined in: src/primitives/Opcode/getCategory.js:18 Get opcode category

Parameters

opcode
BrandedOpcode Opcode to query

Returns

string Category name

Example


_getDescription()

_getDescription(opcode): string
Defined in: src/primitives/Opcode/getDescription.js:140 Get human-readable description of an opcode

Parameters

opcode
BrandedOpcode Opcode to query

Returns

string Description or generated description for PUSH/DUP/SWAP

Example


_getGasCost()

_getGasCost(opcode): number | undefined
Defined in: src/primitives/Opcode/getGasCost.js:16 Get static gas cost for an opcode

Parameters

opcode
BrandedOpcode Opcode to query

Returns

number | undefined Static gas cost or undefined if invalid

Example


_getName()

_getName(opcode): string
Defined in: src/primitives/Opcode/getName.js:16 Get mnemonic name of an opcode (alias for name)

Parameters

opcode
BrandedOpcode Opcode to query

Returns

string Opcode name or “UNKNOWN” if invalid

Example


_getPushSize()

_getPushSize(opcode): number
Defined in: src/primitives/Opcode/getPushSize.js:18 Get PUSH data size in bytes

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(opcode): { pop: number; push: number; } | undefined
Defined in: src/primitives/Opcode/getStackEffect.js:19 Get stack effect for an opcode

Parameters

opcode
BrandedOpcode Opcode to query

Returns

{ pop: number; push: number; } | undefined Stack items consumed and produced

Example


_getStackInput()

_getStackInput(opcode): number | undefined
Defined in: src/primitives/Opcode/getStackInput.js:16 Get number of stack items consumed by an opcode

Parameters

opcode
BrandedOpcode Opcode to query

Returns

number | undefined Number of stack items consumed

Example


_getStackOutput()

_getStackOutput(opcode): number | undefined
Defined in: src/primitives/Opcode/getStackOutput.js:16 Get number of stack items produced by an opcode

Parameters

opcode
BrandedOpcode Opcode to query

Returns

number | undefined Number of stack items produced

Example


_info()

_info(opcode): Info | undefined
Defined in: src/primitives/Opcode/info.js:17 Get metadata for an opcode

Parameters

opcode
BrandedOpcode Opcode to query

Returns

Info | undefined Metadata with gas cost and stack requirements

Example


_isDup()

_isDup(opcode): boolean
Defined in: src/primitives/Opcode/isDup.js:16 Check if opcode is a DUP instruction

Parameters

opcode
BrandedOpcode Opcode to check

Returns

boolean True if DUP1-DUP16

Example


_isJump()

_isJump(opcode): boolean
Defined in: src/primitives/Opcode/isJump.js:17 Check if opcode is a jump

Parameters

opcode
BrandedOpcode Opcode to check

Returns

boolean True if JUMP or JUMPI

Example


_isJumpDestination()

_isJumpDestination(opcode): boolean
Defined in: src/primitives/Opcode/isJumpDestination.js:16 Check if opcode is JUMPDEST

Parameters

opcode
BrandedOpcode Opcode to check

Returns

boolean True if JUMPDEST

Example


_isLog()

_isLog(opcode): boolean
Defined in: src/primitives/Opcode/isLog.js:16 Check if opcode is a LOG instruction

Parameters

opcode
BrandedOpcode Opcode to check

Returns

boolean True if LOG0-LOG4

Example


_isPush()

_isPush(opcode): boolean
Defined in: src/primitives/Opcode/isPush.js:16 Check if opcode is a PUSH instruction

Parameters

opcode
BrandedOpcode Opcode to check

Returns

boolean True if PUSH0-PUSH32

Example


_isSwap()

_isSwap(opcode): boolean
Defined in: src/primitives/Opcode/isSwap.js:16 Check if opcode is a SWAP instruction

Parameters

opcode
BrandedOpcode Opcode to check

Returns

boolean True if SWAP1-SWAP16

Example


_isTerminating()

_isTerminating(opcode): boolean
Defined in: src/primitives/Opcode/isTerminating.js:16 Check if opcode terminates execution

Parameters

opcode
BrandedOpcode Opcode to check

Returns

boolean True if STOP, RETURN, REVERT, INVALID, or SELFDESTRUCT

Example


_isTerminator()

_isTerminator(opcode): boolean
Defined in: src/primitives/Opcode/isTerminator.js:16 Check if opcode terminates execution (alias for isTerminating)

Parameters

opcode
BrandedOpcode Opcode to check

Returns

boolean True if STOP, RETURN, REVERT, INVALID, or SELFDESTRUCT

Example


_isValid()

_isValid(opcode): opcode is BrandedOpcode
Defined in: src/primitives/Opcode/isValid.js:16 Check if opcode is valid

Parameters

opcode
number Byte value to check

Returns

opcode is BrandedOpcode True if opcode is defined in the EVM

Example


_isValidJumpDest()

_isValidJumpDest(bytecode, offset): boolean
Defined in: src/primitives/Opcode/isValidJumpDest.js:18 Check if offset is a valid jump destination

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(value): boolean
Defined in: src/primitives/Opcode/isValidOpcode.js:17 Check if value is a valid opcode (alias for isValid)

Parameters

value
number Value to check

Returns

boolean True if valid opcode

Example


_jumpDests()

_jumpDests(bytecode): Set<number>
Defined in: src/primitives/Opcode/jumpDests.js:17 Find all valid JUMPDEST locations

Parameters

bytecode
Uint8Array<ArrayBufferLike> Raw bytecode bytes

Returns

Set<number> Set of valid jump destinations (byte offsets)

Example


_logTopics()

_logTopics(opcode): number | undefined
Defined in: src/primitives/Opcode/logTopics.js:17 Get number of topics for LOG instruction

Parameters

opcode
BrandedOpcode Opcode to query

Returns

number | undefined Number of topics (0-4), or undefined if not a LOG

Example


_name()

_name(opcode): string
Defined in: src/primitives/Opcode/name.js:15 Get name of an opcode

Parameters

opcode
BrandedOpcode Opcode to query

Returns

string Opcode name or “UNKNOWN” if invalid

Example


_parse()

_parse(bytecode): Instruction[]
Defined in: src/primitives/Opcode/parse.js:21 Parse bytecode into instructions

Parameters

bytecode
Uint8Array<ArrayBufferLike> Raw bytecode bytes

Returns

Instruction[] Array of parsed instructions

Example


_pushBytes()

_pushBytes(opcode): number | undefined
Defined in: src/primitives/Opcode/pushBytes.js:18 Get number of bytes pushed by PUSH instruction

Parameters

opcode
BrandedOpcode Opcode to query

Returns

number | undefined Number of bytes (0-32), or undefined if not a PUSH

Example


_pushOpcode()

_pushOpcode(bytes): BrandedOpcode
Defined in: src/primitives/Opcode/pushOpcode.js:19 Get PUSH opcode for given byte count

Parameters

bytes
number Number of bytes (0-32)

Returns

BrandedOpcode PUSH opcode for that size

Throws

If bytes is not 0-32

Example


_swapPosition()

_swapPosition(opcode): number | undefined
Defined in: src/primitives/Opcode/swapPosition.js:17 Get position for SWAP instruction

Parameters

opcode
BrandedOpcode Opcode to query

Returns

number | undefined Stack position (1-16), or undefined if not a SWAP

Example


disassemble()

disassemble(bytecode): string[]
Defined in: src/primitives/Opcode/disassemble.js:22 Disassemble bytecode to human-readable strings

Parameters

bytecode
Uint8Array<ArrayBufferLike> Raw bytecode bytes

Returns

string[] Array of formatted instruction strings

Example


dupPosition()

dupPosition(opcode): number | undefined
Defined in: src/primitives/Opcode/dupPosition.js:17 Get position for DUP instruction

Parameters

opcode
BrandedOpcode Opcode to query

Returns

number | undefined Stack position (1-16), or undefined if not a DUP

Example


format()

format(instruction): string
Defined in: src/primitives/Opcode/format.js:20 Format instruction to human-readable string

Parameters

instruction
Instruction Instruction to format

Returns

string Human-readable string

Example


getCategory()

getCategory(opcode): string
Defined in: src/primitives/Opcode/getCategory.js:18 Get opcode category

Parameters

opcode
BrandedOpcode Opcode to query

Returns

string Category name

Example


getDescription()

getDescription(opcode): string
Defined in: src/primitives/Opcode/getDescription.js:140 Get human-readable description of an opcode

Parameters

opcode
BrandedOpcode Opcode to query

Returns

string Description or generated description for PUSH/DUP/SWAP

Example


getGasCost()

getGasCost(opcode): number | undefined
Defined in: src/primitives/Opcode/getGasCost.js:16 Get static gas cost for an opcode

Parameters

opcode
BrandedOpcode Opcode to query

Returns

number | undefined Static gas cost or undefined if invalid

Example


getName()

getName(opcode): string
Defined in: src/primitives/Opcode/getName.js:16 Get mnemonic name of an opcode (alias for name)

Parameters

opcode
BrandedOpcode Opcode to query

Returns

string Opcode name or “UNKNOWN” if invalid

Example


getPushSize()

getPushSize(opcode): number
Defined in: src/primitives/Opcode/getPushSize.js:18 Get PUSH data size in bytes

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(opcode): { pop: number; push: number; } | undefined
Defined in: src/primitives/Opcode/getStackEffect.js:19 Get stack effect for an opcode

Parameters

opcode
BrandedOpcode Opcode to query

Returns

{ pop: number; push: number; } | undefined Stack items consumed and produced

Example


getStackInput()

getStackInput(opcode): number | undefined
Defined in: src/primitives/Opcode/getStackInput.js:16 Get number of stack items consumed by an opcode

Parameters

opcode
BrandedOpcode Opcode to query

Returns

number | undefined Number of stack items consumed

Example


getStackOutput()

getStackOutput(opcode): number | undefined
Defined in: src/primitives/Opcode/getStackOutput.js:16 Get number of stack items produced by an opcode

Parameters

opcode
BrandedOpcode Opcode to query

Returns

number | undefined Number of stack items produced

Example


info()

info(opcode): Info | undefined
Defined in: src/primitives/Opcode/info.js:17 Get metadata for an opcode

Parameters

opcode
BrandedOpcode Opcode to query

Returns

Info | undefined Metadata with gas cost and stack requirements

Example


isDup()

isDup(opcode): boolean
Defined in: src/primitives/Opcode/isDup.js:16 Check if opcode is a DUP instruction

Parameters

opcode
BrandedOpcode Opcode to check

Returns

boolean True if DUP1-DUP16

Example


isJump()

isJump(opcode): boolean
Defined in: src/primitives/Opcode/isJump.js:17 Check if opcode is a jump

Parameters

opcode
BrandedOpcode Opcode to check

Returns

boolean True if JUMP or JUMPI

Example


isJumpDestination()

isJumpDestination(opcode): boolean
Defined in: src/primitives/Opcode/isJumpDestination.js:16 Check if opcode is JUMPDEST

Parameters

opcode
BrandedOpcode Opcode to check

Returns

boolean True if JUMPDEST

Example


isLog()

isLog(opcode): boolean
Defined in: src/primitives/Opcode/isLog.js:16 Check if opcode is a LOG instruction

Parameters

opcode
BrandedOpcode Opcode to check

Returns

boolean True if LOG0-LOG4

Example


isPush()

isPush(opcode): boolean
Defined in: src/primitives/Opcode/isPush.js:16 Check if opcode is a PUSH instruction

Parameters

opcode
BrandedOpcode Opcode to check

Returns

boolean True if PUSH0-PUSH32

Example


isSwap()

isSwap(opcode): boolean
Defined in: src/primitives/Opcode/isSwap.js:16 Check if opcode is a SWAP instruction

Parameters

opcode
BrandedOpcode Opcode to check

Returns

boolean True if SWAP1-SWAP16

Example


isTerminating()

isTerminating(opcode): boolean
Defined in: src/primitives/Opcode/isTerminating.js:16 Check if opcode terminates execution

Parameters

opcode
BrandedOpcode Opcode to check

Returns

boolean True if STOP, RETURN, REVERT, INVALID, or SELFDESTRUCT

Example


isTerminator()

isTerminator(opcode): boolean
Defined in: src/primitives/Opcode/isTerminator.js:16 Check if opcode terminates execution (alias for isTerminating)

Parameters

opcode
BrandedOpcode Opcode to check

Returns

boolean True if STOP, RETURN, REVERT, INVALID, or SELFDESTRUCT

Example


isValid()

isValid(opcode): opcode is BrandedOpcode
Defined in: src/primitives/Opcode/isValid.js:16 Check if opcode is valid

Parameters

opcode
number Byte value to check

Returns

opcode is BrandedOpcode True if opcode is defined in the EVM

Example


isValidJumpDest()

isValidJumpDest(bytecode, offset): boolean
Defined in: src/primitives/Opcode/isValidJumpDest.js:18 Check if offset is a valid jump destination

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(value): boolean
Defined in: src/primitives/Opcode/isValidOpcode.js:17 Check if value is a valid opcode (alias for isValid)

Parameters

value
number Value to check

Returns

boolean True if valid opcode

Example


jumpDests()

jumpDests(bytecode): Set<number>
Defined in: src/primitives/Opcode/jumpDests.js:17 Find all valid JUMPDEST locations

Parameters

bytecode
Uint8Array<ArrayBufferLike> Raw bytecode bytes

Returns

Set<number> Set of valid jump destinations (byte offsets)

Example


logTopics()

logTopics(opcode): number | undefined
Defined in: src/primitives/Opcode/logTopics.js:17 Get number of topics for LOG instruction

Parameters

opcode
BrandedOpcode Opcode to query

Returns

number | undefined Number of topics (0-4), or undefined if not a LOG

Example


name()

name(opcode): string
Defined in: src/primitives/Opcode/name.js:15 Get name of an opcode

Parameters

opcode
BrandedOpcode Opcode to query

Returns

string Opcode name or “UNKNOWN” if invalid

Example


parse()

parse(bytecode): Instruction[]
Defined in: src/primitives/Opcode/parse.js:21 Parse bytecode into instructions

Parameters

bytecode
Uint8Array<ArrayBufferLike> Raw bytecode bytes

Returns

Instruction[] Array of parsed instructions

Example


pushBytes()

pushBytes(opcode): number | undefined
Defined in: src/primitives/Opcode/pushBytes.js:18 Get number of bytes pushed by PUSH instruction

Parameters

opcode
BrandedOpcode Opcode to query

Returns

number | undefined Number of bytes (0-32), or undefined if not a PUSH

Example


pushOpcode()

pushOpcode(bytes): BrandedOpcode
Defined in: src/primitives/Opcode/pushOpcode.js:19 Get PUSH opcode for given byte count

Parameters

bytes
number Number of bytes (0-32)

Returns

BrandedOpcode PUSH opcode for that size

Throws

If bytes is not 0-32

Example


swapPosition()

swapPosition(opcode): number | undefined
Defined in: src/primitives/Opcode/swapPosition.js:17 Get position for SWAP instruction

Parameters

opcode
BrandedOpcode Opcode to query

Returns

number | undefined Stack position (1-16), or undefined if not a SWAP

Example

References

ADD

Re-exports ADD

ADDMOD

Re-exports ADDMOD

ADDRESS

Re-exports ADDRESS

AND

Re-exports AND

AUTH

Re-exports AUTH

AUTHCALL

Re-exports AUTHCALL

BALANCE

Re-exports BALANCE

BASEFEE

Re-exports BASEFEE

BLOBBASEFEE

Re-exports BLOBBASEFEE

BLOBHASH

Re-exports BLOBHASH

BLOCKHASH

Re-exports BLOCKHASH

BrandedOpcode

Re-exports BrandedOpcode

BYTE

Re-exports BYTE

CALL

Re-exports CALL

CALLCODE

Re-exports CALLCODE

CALLDATACOPY

Re-exports CALLDATACOPY

CALLDATALOAD

Re-exports CALLDATALOAD

CALLDATASIZE

Re-exports CALLDATASIZE

CALLER

Re-exports CALLER

CALLVALUE

Re-exports CALLVALUE

CHAINID

Re-exports CHAINID

CODECOPY

Re-exports CODECOPY

CODESIZE

Re-exports CODESIZE

COINBASE

Re-exports COINBASE

CREATE

Re-exports CREATE

CREATE2

Re-exports CREATE2

DELEGATECALL

Re-exports DELEGATECALL

DIFFICULTY

Re-exports DIFFICULTY

DIV

Re-exports DIV

DUP1

Re-exports DUP1

DUP10

Re-exports DUP10

DUP11

Re-exports DUP11

DUP12

Re-exports DUP12

DUP13

Re-exports DUP13

DUP14

Re-exports DUP14

DUP15

Re-exports DUP15

DUP16

Re-exports DUP16

DUP2

Re-exports DUP2

DUP3

Re-exports DUP3

DUP4

Re-exports DUP4

DUP5

Re-exports DUP5

DUP6

Re-exports DUP6

DUP7

Re-exports DUP7

DUP8

Re-exports DUP8

DUP9

Re-exports DUP9

EQ

Re-exports EQ

EXP

Re-exports EXP

EXTCODECOPY

Re-exports EXTCODECOPY

EXTCODEHASH

Re-exports EXTCODEHASH

EXTCODESIZE

Re-exports EXTCODESIZE

GAS

Re-exports GAS

GASLIMIT

Re-exports GASLIMIT

GASPRICE

Re-exports GASPRICE

GT

Re-exports GT

Info

Re-exports Info

Instruction

Re-exports Instruction

INVALID

Re-exports INVALID

ISZERO

Re-exports ISZERO

JUMP

Re-exports JUMP

JUMPDEST

Re-exports JUMPDEST

JUMPI

Re-exports JUMPI

KECCAK256

Re-exports KECCAK256

LOG0

Re-exports LOG0

LOG1

Re-exports LOG1

LOG2

Re-exports LOG2

LOG3

Re-exports LOG3

LOG4

Re-exports LOG4

LT

Re-exports LT

MCOPY

Re-exports MCOPY

MLOAD

Re-exports MLOAD

MOD

Re-exports MOD

MSIZE

Re-exports MSIZE

MSTORE

Re-exports MSTORE

MSTORE8

Re-exports MSTORE8

MUL

Re-exports MUL

MULMOD

Re-exports MULMOD

NOT

Re-exports NOT

NUMBER

Re-exports NUMBER

Opcode

Re-exports Opcode

OR

Re-exports OR

ORIGIN

Re-exports ORIGIN

PC

Re-exports PC

POP

Re-exports POP

PUSH0

Re-exports PUSH0

PUSH1

Re-exports PUSH1

PUSH10

Re-exports PUSH10

PUSH11

Re-exports PUSH11

PUSH12

Re-exports PUSH12

PUSH13

Re-exports PUSH13

PUSH14

Re-exports PUSH14

PUSH15

Re-exports PUSH15

PUSH16

Re-exports PUSH16

PUSH17

Re-exports PUSH17

PUSH18

Re-exports PUSH18

PUSH19

Re-exports PUSH19

PUSH2

Re-exports PUSH2

PUSH20

Re-exports PUSH20

PUSH21

Re-exports PUSH21

PUSH22

Re-exports PUSH22

PUSH23

Re-exports PUSH23

PUSH24

Re-exports PUSH24

PUSH25

Re-exports PUSH25

PUSH26

Re-exports PUSH26

PUSH27

Re-exports PUSH27

PUSH28

Re-exports PUSH28

PUSH29

Re-exports PUSH29

PUSH3

Re-exports PUSH3

PUSH30

Re-exports PUSH30

PUSH31

Re-exports PUSH31

PUSH32

Re-exports PUSH32

PUSH4

Re-exports PUSH4

PUSH5

Re-exports PUSH5

PUSH6

Re-exports PUSH6

PUSH7

Re-exports PUSH7

PUSH8

Re-exports PUSH8

PUSH9

Re-exports PUSH9

RETURN

Re-exports RETURN

RETURNDATACOPY

Re-exports RETURNDATACOPY

RETURNDATASIZE

Re-exports RETURNDATASIZE

REVERT

Re-exports REVERT

SAR

Re-exports SAR

SDIV

Re-exports SDIV

SELFBALANCE

Re-exports SELFBALANCE

SELFDESTRUCT

Re-exports SELFDESTRUCT

SGT

Re-exports SGT

SHL

Re-exports SHL

SHR

Re-exports SHR

SIGNEXTEND

Re-exports SIGNEXTEND

SLOAD

Re-exports SLOAD

SLT

Re-exports SLT

SMOD

Re-exports SMOD

SSTORE

Re-exports SSTORE

STATICCALL

Re-exports STATICCALL

STOP

Re-exports STOP

SUB

Re-exports SUB

SWAP1

Re-exports SWAP1

SWAP10

Re-exports SWAP10

SWAP11

Re-exports SWAP11

SWAP12

Re-exports SWAP12

SWAP13

Re-exports SWAP13

SWAP14

Re-exports SWAP14

SWAP15

Re-exports SWAP15

SWAP16

Re-exports SWAP16

SWAP2

Re-exports SWAP2

SWAP3

Re-exports SWAP3

SWAP4

Re-exports SWAP4

SWAP5

Re-exports SWAP5

SWAP6

Re-exports SWAP6

SWAP7

Re-exports SWAP7

SWAP8

Re-exports SWAP8

SWAP9

Re-exports SWAP9

TIMESTAMP

Re-exports TIMESTAMP

TLOAD

Re-exports TLOAD

TSTORE

Re-exports TSTORE

XOR

Re-exports XOR