Documentation ¶
Overview ¶
Package opcode offers tools for constructing and visualizing opcode execution trees, representing sequences of instructions. It provides structures and methods to format, print, and analyze opcode instructions and their hierarchical relationships.
Index ¶
- Constants
- Variables
- type Decompiler
- func (d *Decompiler) DecodeLOG1() []Instruction
- func (d *Decompiler) DecodeLOG2() []Instruction
- func (d *Decompiler) DecodeLOG3() []Instruction
- func (d *Decompiler) DecodeLOG4() []Instruction
- func (d *Decompiler) Decompile() error
- func (d *Decompiler) GetBytecode() []byte
- func (d *Decompiler) GetBytecodeSize() uint64
- func (d *Decompiler) GetChildrenByOffset(offset int) []Instruction
- func (d *Decompiler) GetEvents() []*EventTreeNode
- func (d *Decompiler) GetFunctions() []*FunctionTreeNode
- func (d *Decompiler) GetInstructionTreeFormatted(instruction Instruction, indent string) string
- func (d *Decompiler) GetInstructions() []Instruction
- func (d *Decompiler) GetInstructionsByOpCode(op OpCode) []Instruction
- func (d *Decompiler) GetStateVariables() ([]*InstructionTree, error)
- func (d *Decompiler) GetTree() *TreeNode
- func (d *Decompiler) IsOpCode(instruction Instruction, op OpCode) bool
- func (d *Decompiler) MatchFunctionSignature(signature string) bool
- func (d *Decompiler) MatchInstruction(instruction Instruction) bool
- func (d *Decompiler) OpCodeFound(op OpCode) bool
- func (d *Decompiler) String() string
- func (d *Decompiler) StringArray() []string
- func (d *Decompiler) ToProto() *opcode_pb.Root
- type EventTreeNode
- type FunctionTreeNode
- type Instruction
- type InstructionTree
- type OpCode
- func (op OpCode) GetDescription() string
- func (op OpCode) IsArithmetic() bool
- func (op OpCode) IsBitwise() bool
- func (op OpCode) IsBlockInformation() bool
- func (op OpCode) IsComparison() bool
- func (op OpCode) IsEvent() bool
- func (op OpCode) IsFlowControl() bool
- func (op OpCode) IsFunctionEnd() bool
- func (op OpCode) IsFunctionStart() bool
- func (op OpCode) IsJump() bool
- func (op OpCode) IsLog() bool
- func (op OpCode) IsMemory() bool
- func (op OpCode) IsPush() bool
- func (op OpCode) IsPush32() bool
- func (op OpCode) IsSelfDestruct() bool
- func (op OpCode) IsStack() bool
- func (op OpCode) IsStorage() bool
- func (op OpCode) IsSystem() bool
- func (op OpCode) String() string
- func (op OpCode) ToProto() opcode_pb.OpCode
- type TreeNode
Constants ¶
const ( // DUP1 duplicates the 1st item from the top of the stack. DUP1 = 0x80 + iota // DUP2 duplicates the 2nd item from the top of the stack. DUP2 // DUP3 duplicates the 3rd item from the top of the stack. DUP3 // DUP4 duplicates the 4th item from the top of the stack. DUP4 // DUP5 duplicates the 5th item from the top of the stack. DUP5 // DUP6 duplicates the 6th item from the top of the stack. DUP6 // DUP7 duplicates the 7th item from the top of the stack. DUP7 // DUP8 duplicates the 8th item from the top of the stack. DUP8 // DUP9 duplicates the 9th item from the top of the stack. DUP9 // DUP10 duplicates the 10th item from the top of the stack. DUP10 // DUP11 duplicates the 11th item from the top of the stack. DUP11 // DUP12 duplicates the 12th item from the top of the stack. DUP12 // DUP13 duplicates the 13th item from the top of the stack. DUP13 // DUP14 duplicates the 14th item from the top of the stack. DUP14 // DUP15 duplicates the 15th item from the top of the stack. DUP15 // DUP16 duplicates the 16th item from the top of the stack. DUP16 )
Duplication operations (0x80)
const ( // SWAP1 swaps the top two items on the stack. SWAP1 = 0x90 + iota // SWAP2 swaps the top item with the 2nd item below it. SWAP2 // SWAP3 swaps the top item with the 3rd item below it. SWAP3 // SWAP4 swaps the top item with the 4th item below it. SWAP4 // SWAP5 swaps the top item with the 5th item below it. SWAP5 // SWAP6 swaps the top item with the 6th item below it. SWAP6 // SWAP7 swaps the top item with the 7th item below it. SWAP7 // SWAP8 swaps the top item with the 8th item below it. SWAP8 // SWAP9 swaps the top item with the 9th item below it. SWAP9 // SWAP10 swaps the top item with the 10th item below it. SWAP10 // SWAP11 swaps the top item with the 11th item below it. SWAP11 // SWAP12 swaps the top item with the 12th item below it. SWAP12 // SWAP13 swaps the top item with the 13th item below it. SWAP13 // SWAP14 swaps the top item with the 14th item below it. SWAP14 // SWAP15 swaps the top item with the 15th item below it. SWAP15 // SWAP16 swaps the top item with the 16th item below it. SWAP16 )
Swap operations (0x90)
Variables ¶
var (
ErrEmptyBytecode = errors.New("bytecode is not set or empty bytecode provided")
)
Functions ¶
This section is empty.
Types ¶
type Decompiler ¶
type Decompiler struct {
// contains filtered or unexported fields
}
Decompiler is responsible for decompiling Ethereum bytecode into a set of instructions.
func NewDecompiler ¶
func NewDecompiler(ctx context.Context, b []byte) (*Decompiler, error)
NewDecompiler initializes a new Decompiler with the given bytecode.
func (*Decompiler) DecodeLOG1 ¶ added in v0.3.5
func (d *Decompiler) DecodeLOG1() []Instruction
DecodeLOG1 returns all instructions with the LOG1 OpCode and decodes their arguments.
func (*Decompiler) DecodeLOG2 ¶ added in v0.3.5
func (d *Decompiler) DecodeLOG2() []Instruction
DecodeLOG2 returns all instructions with the LOG2 OpCode and decodes their arguments.
func (*Decompiler) DecodeLOG3 ¶ added in v0.3.5
func (d *Decompiler) DecodeLOG3() []Instruction
DecodeLOG3 returns all instructions with the LOG3 OpCode and decodes their arguments.
func (*Decompiler) DecodeLOG4 ¶ added in v0.3.5
func (d *Decompiler) DecodeLOG4() []Instruction
DecodeLOG4 returns all instructions with the LOG4 OpCode and decodes their arguments.
func (*Decompiler) Decompile ¶
func (d *Decompiler) Decompile() error
Decompile processes the bytecode, populates the instructions slice, and identifies function entry points.
func (*Decompiler) GetBytecode ¶
func (d *Decompiler) GetBytecode() []byte
GetBytecode returns the bytecode associated with the Decompiler.
func (*Decompiler) GetBytecodeSize ¶
func (d *Decompiler) GetBytecodeSize() uint64
GetBytecodeSize returns the size of the bytecode.
func (*Decompiler) GetChildrenByOffset ¶
func (d *Decompiler) GetChildrenByOffset(offset int) []Instruction
GetChildrenByOffset retrieves a slice of Instructions that are immediate children (subsequent instructions) of the instruction at the provided offset.
func (*Decompiler) GetEvents ¶ added in v0.3.5
func (d *Decompiler) GetEvents() []*EventTreeNode
GetEvents iterates through LOG1 to LOG4 instructions, decodes their arguments, and collects them into EventTreeNode structures.
func (*Decompiler) GetFunctions ¶ added in v0.3.5
func (d *Decompiler) GetFunctions() []*FunctionTreeNode
GetFunctions extracts all functions from the opcode execution tree and returns them as a slice of FunctionTreeNode pointers.
func (*Decompiler) GetInstructionTreeFormatted ¶
func (d *Decompiler) GetInstructionTreeFormatted(instruction Instruction, indent string) string
GetInstructionTreeFormatted returns a formatted string representation of the opcode execution tree starting from the provided instruction. The output is indented based on the provided indent string.
func (*Decompiler) GetInstructions ¶
func (d *Decompiler) GetInstructions() []Instruction
GetInstructions returns all decompiled instructions.
func (*Decompiler) GetInstructionsByOpCode ¶
func (d *Decompiler) GetInstructionsByOpCode(op OpCode) []Instruction
GetInstructionsByOpCode returns all instructions that match the given OpCode.
func (*Decompiler) GetStateVariables ¶ added in v0.3.5
func (d *Decompiler) GetStateVariables() ([]*InstructionTree, error)
GetStateVariables returns the instruction trees for all state variables declared in the bytecode.
func (*Decompiler) GetTree ¶
func (d *Decompiler) GetTree() *TreeNode
GetTree constructs and returns the root of the opcode execution tree based on the instructions present in the Decompiler. If there are no instructions, it returns nil.
func (*Decompiler) IsOpCode ¶
func (d *Decompiler) IsOpCode(instruction Instruction, op OpCode) bool
IsOpCode checks if the given instruction matches the provided OpCode.
func (*Decompiler) MatchFunctionSignature ¶
func (d *Decompiler) MatchFunctionSignature(signature string) bool
MatchFunctionSignature checks if a given function signature matches any of the decompiled instructions.
func (*Decompiler) MatchInstruction ¶
func (d *Decompiler) MatchInstruction(instruction Instruction) bool
func (*Decompiler) OpCodeFound ¶
func (d *Decompiler) OpCodeFound(op OpCode) bool
OpCodeFound checks if the given OpCode exists in the decompiled instructions.
func (*Decompiler) String ¶
func (d *Decompiler) String() string
String provides a string representation of the decompiled instructions.
func (*Decompiler) StringArray ¶ added in v0.3.5
func (d *Decompiler) StringArray() []string
StringArray returns a string representation of the decompiled instructions as an array of strings.
func (*Decompiler) ToProto ¶
func (d *Decompiler) ToProto() *opcode_pb.Root
ToProto converts the decompiled instructions to a protobuf representation.
type EventTreeNode ¶ added in v0.3.5
type EventTreeNode struct { EventSignatureHex string `json:"eventSignatureHex"` EventSignature string `json:"event_signature"` EventBytesHex string `json:"event_bytes_hex"` EventBytes []byte `json:"event_bytes"` HasEventSignature bool `json:"has_event_signature"` *TreeNode }
EventTreeNode represents a node in the opcode execution tree that represents an event.
type FunctionTreeNode ¶ added in v0.3.5
type FunctionTreeNode struct { FunctionSignatureHex string `json:"functionSignatureHex"` FunctionSignature string `json:"function_signature"` FunctionBytesHex string `json:"function_bytes_hex"` FunctionBytes []byte `json:"function_bytes"` HasFunctionSignature bool `json:"has_function_signature"` *TreeNode }
FunctionTreeNode represents a node in the opcode execution tree that represents a function.
type Instruction ¶
type Instruction struct { Offset int `json:"offset"` OpCode OpCode `json:"opcode"` Args []byte `json:"args"` Description string `json:"description"` Data []byte `json:"data"` }
Instruction represents an optcode instruction.
func (Instruction) GetArgs ¶
func (i Instruction) GetArgs() []byte
GetArgs returns the arguments of the instruction.
func (Instruction) GetCode ¶
func (i Instruction) GetCode() OpCode
GetCode returns the opcode of the instruction.
func (Instruction) GetDescription ¶
func (i Instruction) GetDescription() string
GetDescription returns the description of the instruction.
func (Instruction) GetOffset ¶
func (i Instruction) GetOffset() int
GetOffset returns the offset of the instruction.
func (Instruction) String ¶
func (i Instruction) String() string
String returns the string representation of the instruction.
func (Instruction) ToProto ¶
func (i Instruction) ToProto() *opcode_pb.Instruction
ToProto converts the instruction to a protobuf message.
type InstructionTree ¶ added in v0.3.5
type InstructionTree struct { Instruction Instruction Children []*InstructionTree }
func NewInstructionTree ¶ added in v0.3.5
func NewInstructionTree(instruction Instruction) *InstructionTree
type OpCode ¶
type OpCode byte
OpCode represents an Ethereum operation code (opcode). Opcodes are single byte values that represent a specific operation in the EVM. The OpCode type provides methods to retrieve the string representation of the opcode, and to determine if an opcode corresponds to specific operations like PUSH or JUMP.
const ( // STOP halts execution. STOP OpCode = 0x0 // ADD performs addition operation. ADD OpCode = 0x1 // MUL performs multiplication operation. MUL OpCode = 0x2 // SUB performs subtraction operation. SUB OpCode = 0x3 // DIV performs division operation. DIV OpCode = 0x4 // SDIV performs signed division operation. SDIV OpCode = 0x5 // MOD returns the remainder after division. MOD OpCode = 0x6 // SMOD returns the signed remainder after division. SMOD OpCode = 0x7 // ADDMOD performs addition followed by modulo operation. ADDMOD OpCode = 0x8 // MULMOD performs multiplication followed by modulo operation. MULMOD OpCode = 0x9 // EXP performs exponential operation. EXP OpCode = 0xa // SIGNEXTEND extends the sign bit to the left. SIGNEXTEND OpCode = 0xb )
Arithmetic operations (0x0 range).
const ( // LT checks if one value is less than another. LT OpCode = 0x10 // GT checks if one value is greater than another. GT OpCode = 0x11 // SLT checks if one signed value is less than another. SLT OpCode = 0x12 // SGT checks if one signed value is greater than another. SGT OpCode = 0x13 // EQ checks if two values are equal. EQ OpCode = 0x14 // ISZERO checks if a value is zero. ISZERO OpCode = 0x15 // AND performs a bitwise AND operation. AND OpCode = 0x16 // OR performs a bitwise OR operation. OR OpCode = 0x17 // XOR performs a bitwise XOR operation. XOR OpCode = 0x18 // NOT performs a bitwise NOT operation. NOT OpCode = 0x19 // BYTE retrieves a specific byte from a value. BYTE OpCode = 0x1a // SHL shifts a value to the left. SHL OpCode = 0x1b // SHR shifts a value to the right. SHR OpCode = 0x1c // SAR performs an arithmetic right shift. SAR OpCode = 0x1d )
Comparison operations (0x10 range).
const ( // ADDRESS retrieves the address of the current contract. ADDRESS OpCode = 0x30 // BALANCE retrieves the balance of a given address. BALANCE OpCode = 0x31 // ORIGIN retrieves the address that originated the current call. ORIGIN OpCode = 0x32 // CALLER retrieves the address of the caller. CALLER OpCode = 0x33 // CALLVALUE retrieves the value sent with the call. CALLVALUE OpCode = 0x34 // CALLDATALOAD loads data from the call payload. CALLDATALOAD OpCode = 0x35 // CALLDATASIZE retrieves the size of the call data. CALLDATASIZE OpCode = 0x36 // CALLDATACOPY copies call data to memory. CALLDATACOPY OpCode = 0x37 // CODESIZE retrieves the size of the code. CODESIZE OpCode = 0x38 // CODECOPY copies code to memory. CODECOPY OpCode = 0x39 // GASPRICE retrieves the price of gas. GASPRICE OpCode = 0x3a // EXTCODESIZE retrieves the size of an external contract's code. EXTCODESIZE OpCode = 0x3b // EXTCODECOPY copies external contract code to memory. EXTCODECOPY OpCode = 0x3c // RETURNDATASIZE retrieves the size of the return data. RETURNDATASIZE OpCode = 0x3d // RETURNDATACOPY copies return data to memory. RETURNDATACOPY OpCode = 0x3e // EXTCODEHASH retrieves the hash of an external contract's code. EXTCODEHASH OpCode = 0x3f )
Closure state operations (0x30 range).
const ( // BLOCKHASH retrieves the hash of a block. BLOCKHASH OpCode = 0x40 // COINBASE retrieves the address of the block miner. COINBASE OpCode = 0x41 // TIMESTAMP retrieves the timestamp of the block. TIMESTAMP OpCode = 0x42 // NUMBER retrieves the block number. NUMBER OpCode = 0x43 // DIFFICULTY retrieves the difficulty of the block. DIFFICULTY OpCode = 0x44 // RANDOM retrieves a random value. Note: It has the same opcode as DIFFICULTY. RANDOM OpCode = 0x44 // Same as DIFFICULTY // PREVRANDAO retrieves the previous RANDAO value. Note: It has the same opcode as DIFFICULTY. PREVRANDAO OpCode = 0x44 // Same as DIFFICULTY // GASLIMIT retrieves the gas limit for the block. GASLIMIT OpCode = 0x45 // CHAINID retrieves the chain ID. CHAINID OpCode = 0x46 // SELFBALANCE retrieves the balance of the contract itself. SELFBALANCE OpCode = 0x47 // BASEFEE retrieves the base fee for the block. BASEFEE OpCode = 0x48 // BLOBHASH retrieves the blob hash. BLOBHASH OpCode = 0x49 )
Block operations (0x40).
const ( // POP removes the top item from the stack. POP OpCode = 0x50 // MLOAD loads a word from memory at a specific address. MLOAD OpCode = 0x51 // MSTORE stores a word to memory at a specific address. MSTORE OpCode = 0x52 // MSTORE8 stores a byte to memory at a specific address. MSTORE8 OpCode = 0x53 // SLOAD loads a word from storage at a specific address. SLOAD OpCode = 0x54 // SSTORE stores a word to storage at a specific address. SSTORE OpCode = 0x55 // JUMP sets the program counter to a specific address. JUMP OpCode = 0x56 // JUMPI conditionally sets the program counter to a specific address. JUMPI OpCode = 0x57 // PC retrieves the value of the program counter. PC OpCode = 0x58 // MSIZE retrieves the size of active memory. MSIZE OpCode = 0x59 // GAS retrieves the amount of gas remaining. GAS OpCode = 0x5a // JUMPDEST marks a valid destination for jumps. JUMPDEST OpCode = 0x5b // PUSH0 pushes a zero byte onto the stack. PUSH0 OpCode = 0x5f )
Storage and execution operations (0x50).
const ( // PUSH1 pushes a 1-byte item onto the stack. PUSH1 OpCode = 0x60 + iota // PUSH2 pushes a 2-byte item onto the stack. PUSH2 // PUSH3 pushes a 3-byte item onto the stack. PUSH3 // PUSH4 pushes a 4-byte item onto the stack. PUSH4 // PUSH5 pushes a 5-byte item onto the stack. PUSH5 // PUSH6 pushes a 6-byte item onto the stack. PUSH6 // PUSH7 pushes a 7-byte item onto the stack. PUSH7 // PUSH8 pushes an 8-byte item onto the stack. PUSH8 // PUSH9 pushes a 9-byte item onto the stack. PUSH9 // PUSH10 pushes a 10-byte item onto the stack. PUSH10 // PUSH11 pushes an 11-byte item onto the stack. PUSH11 // PUSH12 pushes a 12-byte item onto the stack. PUSH12 // PUSH13 pushes a 13-byte item onto the stack. PUSH13 // PUSH14 pushes a 14-byte item onto the stack. PUSH14 // PUSH15 pushes a 15-byte item onto the stack. PUSH15 // PUSH16 pushes a 16-byte item onto the stack. PUSH16 // PUSH17 pushes a 17-byte item onto the stack. PUSH17 // PUSH18 pushes an 18-byte item onto the stack. PUSH18 // PUSH19 pushes a 19-byte item onto the stack. PUSH19 // PUSH20 pushes a 20-byte item onto the stack. PUSH20 // PUSH21 pushes a 21-byte item onto the stack. PUSH21 // PUSH22 pushes a 22-byte item onto the stack. PUSH22 // PUSH23 pushes a 23-byte item onto the stack. PUSH23 // PUSH24 pushes a 24-byte item onto the stack. PUSH24 // PUSH25 pushes a 25-byte item onto the stack. PUSH25 // PUSH26 pushes a 26-byte item onto the stack. PUSH26 // PUSH27 pushes a 27-byte item onto the stack. PUSH27 // PUSH28 pushes a 28-byte item onto the stack. PUSH28 // PUSH29 pushes a 29-byte item onto the stack. PUSH29 // PUSH30 pushes a 30-byte item onto the stack. PUSH30 // PUSH31 pushes a 31-byte item onto the stack. PUSH31 // PUSH32 pushes a 32-byte item onto the stack. PUSH32 )
Push operations (0x60)
const ( // LOG0 logs a message with 0 indexed topics. LOG0 OpCode = 0xa0 + iota // LOG1 logs a message with 1 indexed topic. LOG1 // LOG2 logs a message with 2 indexed topics. LOG2 // LOG3 logs a message with 3 indexed topics. LOG3 // LOG4 logs a message with 4 indexed topics. LOG4 )
Logging operations (0xa0)
const ( // TLOAD loads from transactional storage. TLOAD OpCode = 0xb3 // TSTORE stores to transactional storage. TSTORE OpCode = 0xb4 )
0xb0 range.
const ( // CREATE creates a new contract. CREATE OpCode = 0xf0 // CALL initiates a new message call. CALL OpCode = 0xf1 // CALLCODE calls a contract with a different code. CALLCODE OpCode = 0xf2 // RETURN halts execution and returns output data. RETURN OpCode = 0xf3 // DELEGATECALL calls a contract as a delegate. DELEGATECALL OpCode = 0xf4 // CREATE2 creates a new contract with a deterministic address. CREATE2 OpCode = 0xf5 // STATICCALL calls a contract without state modification. STATICCALL OpCode = 0xfa // REVERT stops execution and reverts state changes. REVERT OpCode = 0xfd // INVALID represents an invalid opcode. INVALID OpCode = 0xfe // SELFDESTRUCT destroys the current contract. SELFDESTRUCT OpCode = 0xff )
Closure operations (0xf0)
const ( // KECCAK256 computes the Keccak-256 hash. KECCAK256 OpCode = 0x20 )
Cryptographic operations (0x20 range).
func StringToOp ¶
StringToOp finds the opcode whose name is stored in `str`.
func (OpCode) GetDescription ¶
GetDescription retrieves the description of the OpCode. If the opcode is not found in the descriptions map, it returns an empty string.
func (OpCode) IsArithmetic ¶
IsArithmetic checks if the given opcode corresponds to an arithmetic operation. Arithmetic operations in the EVM include addition, multiplication, subtraction, etc.
func (OpCode) IsBitwise ¶
IsBitwise checks if the given opcode corresponds to a bitwise operation. Bitwise operations in the EVM include AND, OR, XOR, NOT, etc.
func (OpCode) IsBlockInformation ¶
IsBlockInformation checks if the given opcode provides information about the current block. These opcodes provide details like the current block's hash, coinbase, timestamp, etc.
func (OpCode) IsComparison ¶
IsComparison checks if the given opcode corresponds to a comparison operation. Comparison operations in the EVM include less than, greater than, equal to, etc.
func (OpCode) IsEvent ¶ added in v0.3.5
IsEvent checks if the given opcode corresponds to an event logging operation. The LOG0 to LOG4 opcodes are used to log events in the EVM.
func (OpCode) IsFlowControl ¶
IsFlowControl checks if the given opcode is related to flow control operations. Flow control operations in the EVM include operations that alter the sequence of execution.
func (OpCode) IsFunctionEnd ¶ added in v0.3.5
IsFunctionEnd checks if the opcode represents the end of a function.
func (OpCode) IsFunctionStart ¶ added in v0.3.5
IsFunctionStart checks if the opcode represents the start of a function.
func (OpCode) IsJump ¶
IsJump determines if an opcode corresponds to a jump operation. Jump operations in the EVM allow for altering the sequence of execution. This method checks for three specific jump-related opcodes: JUMP, JUMPI, and JUMPDEST.
func (OpCode) IsMemory ¶
IsMemory checks if the given opcode is related to memory operations. Memory operations in the EVM include operations that interact with the memory segment.
func (OpCode) IsPush ¶
IsPush checks if the given opcode is a PUSH opcode. In the Ethereum instruction set, there are several PUSH opcodes ranging from PUSH1 to PUSH32. These opcodes are used to place a series of bytes onto the stack.
func (OpCode) IsSelfDestruct ¶
IsSelfDestruct checks if the given opcode corresponds to the SELFDESTRUCT operation. The SELFDESTRUCT opcode is used in the EVM to destroy the current contract, sending its funds to the provided address.
func (OpCode) IsStack ¶
IsStack checks if the given opcode is related to stack operations. Stack operations in the EVM include operations that interact with the main stack.
func (OpCode) IsStorage ¶
IsStorage checks if the given opcode is related to storage operations. Storage operations in the EVM include operations that interact with the contract's storage.
func (OpCode) IsSystem ¶
IsSystem checks if the given opcode is a system operation. System operations in the EVM include operations like contract creation, external calls, etc.
type TreeNode ¶
type TreeNode struct { // Instruction represents the opcode instruction associated with this tree node. Instruction Instruction `json:"instruction"` // Children is a slice of TreeNode pointers, representing the child instructions of this node. Children []*TreeNode `json:"children"` }
TreeNode represents a node in the opcode execution tree. Each node contains an instruction and potentially has multiple children, representing subsequent instructions.