Documentation ¶
Index ¶
- Constants
- Variables
- func RegisterServiceServer(s grpc.ServiceRegistrar, srv ServiceServer)
- type Instruction
- func (*Instruction) Descriptor() ([]byte, []int)deprecated
- func (x *Instruction) GetArgs() []byte
- func (x *Instruction) GetDescription() string
- func (x *Instruction) GetOffset() int32
- func (x *Instruction) GetOpCode() OpCode
- func (*Instruction) ProtoMessage()
- func (x *Instruction) ProtoReflect() protoreflect.Message
- func (x *Instruction) Reset()
- func (x *Instruction) String() string
- type OpCode
- type Request
- func (*Request) Descriptor() ([]byte, []int)deprecated
- func (x *Request) GetAddress() string
- func (x *Request) GetBytecode() []byte
- func (x *Request) GetNetworkId() int64
- func (*Request) ProtoMessage()
- func (x *Request) ProtoReflect() protoreflect.Message
- func (x *Request) Reset()
- func (x *Request) String() string
- type Response
- func (*Response) Descriptor() ([]byte, []int)deprecated
- func (x *Response) GetAddress() string
- func (x *Response) GetBytecode() string
- func (x *Response) GetNetworkId() int64
- func (x *Response) GetRoot() *Root
- func (x *Response) GetStatus() *common.Status
- func (*Response) ProtoMessage()
- func (x *Response) ProtoReflect() protoreflect.Message
- func (x *Response) Reset()
- func (x *Response) String() string
- type Root
- type ServiceClient
- type ServiceServer
- type UnimplementedServiceServer
- type UnsafeServiceServer
Constants ¶
const ( Service_Get_FullMethodName = "/unpack.v1.opcode.Service/Get" Service_Decompile_FullMethodName = "/unpack.v1.opcode.Service/Decompile" Service_GetHealth_FullMethodName = "/unpack.v1.opcode.Service/GetHealth" )
Variables ¶
var ( OpCode_name = map[int32]string{}/* 147 elements not displayed */ OpCode_value = map[string]int32{}/* 147 elements not displayed */ )
Enum value maps for OpCode.
var File_opcode_codes_proto protoreflect.FileDescriptor
var File_opcode_instruction_proto protoreflect.FileDescriptor
var File_opcode_root_proto protoreflect.FileDescriptor
var File_opcode_service_parameters_proto protoreflect.FileDescriptor
var File_opcode_service_proto protoreflect.FileDescriptor
var Service_ServiceDesc = grpc.ServiceDesc{ ServiceName: "unpack.v1.opcode.Service", HandlerType: (*ServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Get", Handler: _Service_Get_Handler, }, { MethodName: "Decompile", Handler: _Service_Decompile_Handler, }, { MethodName: "GetHealth", Handler: _Service_GetHealth_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "opcode/service.proto", }
Service_ServiceDesc is the grpc.ServiceDesc for Service service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterServiceServer ¶
func RegisterServiceServer(s grpc.ServiceRegistrar, srv ServiceServer)
Types ¶
type Instruction ¶
type Instruction struct { // The offset field indicates the position of the instruction in the bytecode. // It's an integer representing the position in the compiled smart contract. Offset int32 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"` // The op_code field is an instance of the OpCode enum. // It represents the specific operation that the instruction will execute. OpCode OpCode `protobuf:"varint,2,opt,name=op_code,json=opCode,proto3,enum=unpack.v1.opcode.OpCode" json:"op_code,omitempty"` // The args field is used to store any arguments or data associated with the instruction. // This field may hold immediate values or additional data required for certain operations. Args []byte `protobuf:"bytes,3,opt,name=args,proto3" json:"args,omitempty"` // The description field is a human-readable string that provides a description of the instruction. // It helps developers understand the purpose of the instruction. Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` // contains filtered or unexported fields }
Define the "Instruction" message, which represents an Ethereum Virtual Machine (EVM) instruction.
func (*Instruction) Descriptor
deprecated
func (*Instruction) Descriptor() ([]byte, []int)
Deprecated: Use Instruction.ProtoReflect.Descriptor instead.
func (*Instruction) GetArgs ¶
func (x *Instruction) GetArgs() []byte
func (*Instruction) GetDescription ¶
func (x *Instruction) GetDescription() string
func (*Instruction) GetOffset ¶
func (x *Instruction) GetOffset() int32
func (*Instruction) GetOpCode ¶
func (x *Instruction) GetOpCode() OpCode
func (*Instruction) ProtoMessage ¶
func (*Instruction) ProtoMessage()
func (*Instruction) ProtoReflect ¶
func (x *Instruction) ProtoReflect() protoreflect.Message
func (*Instruction) Reset ¶
func (x *Instruction) Reset()
func (*Instruction) String ¶
func (x *Instruction) String() string
type OpCode ¶
type OpCode int32
OpCode represents the set of operation codes (opcodes) used in the Ethereum Virtual Machine (EVM). These opcodes are fundamental instructions that the EVM executes.
const ( // STOP halts execution. OpCode_STOP OpCode = 0 // ADD performs addition operation. OpCode_ADD OpCode = 1 // MUL performs multiplication operation. OpCode_MUL OpCode = 2 // SUB performs subtraction operation. OpCode_SUB OpCode = 3 // DIV performs division operation. OpCode_DIV OpCode = 4 // SDIV performs signed division operation. OpCode_SDIV OpCode = 5 // MOD returns the remainder after division. OpCode_MOD OpCode = 6 // SMOD returns the remainder after signed division. OpCode_SMOD OpCode = 7 // ADDMOD performs the modulo addition of two numbers. OpCode_ADDMOD OpCode = 8 // MULMOD performs the modulo multiplication of two numbers. OpCode_MULMOD OpCode = 9 // EXP performs exponential operation. OpCode_EXP OpCode = 10 // SIGNEXTEND extends the sign bit to the left for a signed number. OpCode_SIGNEXTEND OpCode = 11 // LT performs a less-than comparison. OpCode_LT OpCode = 16 // GT performs a greater-than comparison. OpCode_GT OpCode = 17 // SLT performs a signed less-than comparison. OpCode_SLT OpCode = 18 // SGT performs a signed greater-than comparison. OpCode_SGT OpCode = 19 // EQ checks for equality between two values. OpCode_EQ OpCode = 20 // ISZERO checks if a given value is zero. OpCode_ISZERO OpCode = 21 // AND performs a bitwise AND operation. OpCode_AND OpCode = 22 // OR performs a bitwise OR operation. OpCode_OR OpCode = 23 // XOR performs a bitwise XOR operation. OpCode_XOR OpCode = 24 // NOT performs a bitwise NOT operation. OpCode_NOT OpCode = 25 // BYTE returns the Nth byte of the input data. OpCode_BYTE OpCode = 26 // SHL and SHR perform bitwise shift left and shift right operations, respectively. OpCode_SHL OpCode = 27 OpCode_SHR OpCode = 28 OpCode_SAR OpCode = 29 // KECCAK256 computes the Keccak-256 hash of input data. OpCode_KECCAK256 OpCode = 32 // ADDRESS returns the address of the current account. OpCode_ADDRESS OpCode = 48 // BALANCE returns the balance of the given address. OpCode_BALANCE OpCode = 49 // ORIGIN returns the address of the original sender of the transaction. OpCode_ORIGIN OpCode = 50 // CALLER returns the address of the account that initiated the call. OpCode_CALLER OpCode = 51 // CALLVALUE returns the value passed with the call. OpCode_CALLVALUE OpCode = 52 // CALLDATALOAD loads a word of data from the call data. OpCode_CALLDATALOAD OpCode = 53 // CALLDATASIZE returns the size of the call data. OpCode_CALLDATASIZE OpCode = 54 // CALLDATACOPY copies a portion of the call data to memory. OpCode_CALLDATACOPY OpCode = 55 // CODESIZE returns the size of the contract's code. OpCode_CODESIZE OpCode = 56 // CODECOPY copies a portion of the contract's code to memory. OpCode_CODECOPY OpCode = 57 // GASPRICE returns the gas price of the transaction. OpCode_GASPRICE OpCode = 58 // EXTCODESIZE returns the size of the code at the given address. OpCode_EXTCODESIZE OpCode = 59 // EXTCODECOPY copies a portion of the code at the given address to memory. OpCode_EXTCODECOPY OpCode = 60 // RETURNDATASIZE returns the size of the return data buffer. OpCode_RETURNDATASIZE OpCode = 61 // RETURNDATACOPY copies a portion of the return data buffer to memory. OpCode_RETURNDATACOPY OpCode = 62 // EXTCODEHASH returns the hash of the code at the given address. OpCode_EXTCODEHASH OpCode = 63 // BLOCKHASH returns the hash of a specific block. OpCode_BLOCKHASH OpCode = 64 // COINBASE returns the address of the block's beneficiary. OpCode_COINBASE OpCode = 65 // TIMESTAMP returns the timestamp of the current block. OpCode_TIMESTAMP OpCode = 66 // NUMBER returns the block number of the current block. OpCode_NUMBER OpCode = 67 // DIFFICULTY returns the difficulty of the current block. OpCode_DIFFICULTY OpCode = 68 // GASLIMIT returns the gas limit of the current block. OpCode_GASLIMIT OpCode = 69 // CHAINID returns the chain ID of the current chain. OpCode_CHAINID OpCode = 70 // SELFBALANCE returns the balance of the current contract. OpCode_SELFBALANCE OpCode = 71 // BASEFEE returns the base fee of the current block. OpCode_BASEFEE OpCode = 72 // BLOBHASH returns the hash of the provided data. OpCode_BLOBHASH OpCode = 73 // POP removes the top item from the stack. OpCode_POP OpCode = 80 // MLOAD loads a word from memory. OpCode_MLOAD OpCode = 81 // MSTORE stores a word in memory. OpCode_MSTORE OpCode = 82 // MSTORE8 stores a byte in memory. OpCode_MSTORE8 OpCode = 83 // SLOAD loads a word from storage. OpCode_SLOAD OpCode = 84 // SSTORE stores a word to storage. OpCode_SSTORE OpCode = 85 // JUMP transfers control to a different part of the code. OpCode_JUMP OpCode = 86 // JUMPI conditionally transfers control to a different part of the code. OpCode_JUMPI OpCode = 87 // PC returns the program counter. OpCode_PC OpCode = 88 // MSIZE returns the size of the active memory in bytes. OpCode_MSIZE OpCode = 89 // GAS returns the available gas. OpCode_GAS OpCode = 90 // JUMPDEST marks a destination for jumps within the code. OpCode_JUMPDEST OpCode = 91 // PUSH1-PUSH32 place the given number of bytes onto the stack. OpCode_PUSH0 OpCode = 95 OpCode_PUSH1 OpCode = 96 OpCode_PUSH2 OpCode = 97 OpCode_PUSH3 OpCode = 98 OpCode_PUSH4 OpCode = 99 OpCode_PUSH5 OpCode = 100 OpCode_PUSH6 OpCode = 101 OpCode_PUSH7 OpCode = 102 OpCode_PUSH8 OpCode = 103 OpCode_PUSH9 OpCode = 104 OpCode_PUSH10 OpCode = 105 OpCode_PUSH11 OpCode = 106 OpCode_PUSH12 OpCode = 107 OpCode_PUSH13 OpCode = 108 OpCode_PUSH14 OpCode = 109 OpCode_PUSH15 OpCode = 110 OpCode_PUSH16 OpCode = 111 OpCode_PUSH17 OpCode = 112 OpCode_PUSH18 OpCode = 113 OpCode_PUSH19 OpCode = 114 OpCode_PUSH20 OpCode = 115 OpCode_PUSH21 OpCode = 116 OpCode_PUSH22 OpCode = 117 OpCode_PUSH23 OpCode = 118 OpCode_PUSH24 OpCode = 119 OpCode_PUSH25 OpCode = 120 OpCode_PUSH26 OpCode = 121 OpCode_PUSH27 OpCode = 122 OpCode_PUSH28 OpCode = 123 OpCode_PUSH29 OpCode = 124 OpCode_PUSH30 OpCode = 125 OpCode_PUSH31 OpCode = 126 OpCode_PUSH32 OpCode = 127 // DUP1-DUP16 duplicate the Nth item from the stack. OpCode_DUP1 OpCode = 128 OpCode_DUP2 OpCode = 129 OpCode_DUP3 OpCode = 130 OpCode_DUP4 OpCode = 131 OpCode_DUP5 OpCode = 132 OpCode_DUP6 OpCode = 133 OpCode_DUP7 OpCode = 134 OpCode_DUP8 OpCode = 135 OpCode_DUP9 OpCode = 136 OpCode_DUP10 OpCode = 137 OpCode_DUP11 OpCode = 138 OpCode_DUP12 OpCode = 139 OpCode_DUP13 OpCode = 140 OpCode_DUP14 OpCode = 141 OpCode_DUP15 OpCode = 142 OpCode_DUP16 OpCode = 143 // SWAP1-SWAP16 swaps the top stack item with the Nth item. OpCode_SWAP1 OpCode = 144 OpCode_SWAP2 OpCode = 145 OpCode_SWAP3 OpCode = 146 OpCode_SWAP4 OpCode = 147 OpCode_SWAP5 OpCode = 148 OpCode_SWAP6 OpCode = 149 OpCode_SWAP7 OpCode = 150 OpCode_SWAP8 OpCode = 151 OpCode_SWAP9 OpCode = 152 OpCode_SWAP10 OpCode = 153 OpCode_SWAP11 OpCode = 154 OpCode_SWAP12 OpCode = 155 OpCode_SWAP13 OpCode = 156 OpCode_SWAP14 OpCode = 157 OpCode_SWAP15 OpCode = 158 OpCode_SWAP16 OpCode = 159 // LOG0-LOG4 record a log entry. OpCode_LOG0 OpCode = 160 OpCode_LOG1 OpCode = 161 OpCode_LOG2 OpCode = 162 OpCode_LOG3 OpCode = 163 OpCode_LOG4 OpCode = 164 // TLOAD and TSTORE provide access to transaction-specific data. OpCode_TLOAD OpCode = 179 OpCode_TSTORE OpCode = 180 // CREATE creates a new contract. OpCode_CREATE OpCode = 240 // CALL invokes a message call to another contract. OpCode_CALL OpCode = 241 // CALLCODE invokes a message call to another contract using the current code's context. OpCode_CALLCODE OpCode = 242 // RETURN halts execution and returns data from a contract. OpCode_RETURN OpCode = 243 // DELEGATECALL performs a message call to another contract, preserving the caller's context. OpCode_DELEGATECALL OpCode = 244 // CREATE2 creates a new contract with a specified salt. OpCode_CREATE2 OpCode = 245 // STATICCALL performs a static message call to another contract. OpCode_STATICCALL OpCode = 250 // REVERT stops execution and reverts state changes. OpCode_REVERT OpCode = 253 // INVALID is an invalid opcode. OpCode_INVALID OpCode = 254 // SELFDESTRUCT destroys the current contract and sends remaining funds to an address. OpCode_SELFDESTRUCT OpCode = 255 )
func (OpCode) Descriptor ¶
func (OpCode) Descriptor() protoreflect.EnumDescriptor
func (OpCode) EnumDescriptor
deprecated
func (OpCode) Number ¶
func (x OpCode) Number() protoreflect.EnumNumber
func (OpCode) Type ¶
func (OpCode) Type() protoreflect.EnumType
type Request ¶
type Request struct { // Identifier for the blockchain chain. NetworkId int64 `protobuf:"varint,1,opt,name=network_id,json=networkId,proto3" json:"network_id,omitempty"` // Address associated with the transaction. Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` // Bytecode of the transaction. Bytecode []byte `protobuf:"bytes,3,opt,name=bytecode,proto3" json:"bytecode,omitempty"` // contains filtered or unexported fields }
Represents a opcode request message with details about a transaction.
func (*Request) Descriptor
deprecated
func (*Request) GetAddress ¶
func (*Request) GetBytecode ¶
func (*Request) GetNetworkId ¶
func (*Request) ProtoMessage ¶
func (*Request) ProtoMessage()
func (*Request) ProtoReflect ¶
func (x *Request) ProtoReflect() protoreflect.Message
type Response ¶
type Response struct { // Status of the transaction. Status *common.Status `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"` // Identifier for the blockchain chain. NetworkId int64 `protobuf:"varint,2,opt,name=network_id,json=networkId,proto3" json:"network_id,omitempty"` // Address associated with the transaction. Address string `protobuf:"bytes,3,opt,name=address,proto3" json:"address,omitempty"` // Bytecode of the transaction as a string. Bytecode string `protobuf:"bytes,4,opt,name=bytecode,proto3" json:"bytecode,omitempty"` // Root information associated with the opcode. Root *Root `protobuf:"bytes,5,opt,name=root,proto3" json:"root,omitempty"` // contains filtered or unexported fields }
Represents a opcode response message with details about a transaction.
func (*Response) Descriptor
deprecated
func (*Response) GetAddress ¶
func (*Response) GetBytecode ¶
func (*Response) GetNetworkId ¶
func (*Response) ProtoMessage ¶
func (*Response) ProtoMessage()
func (*Response) ProtoReflect ¶
func (x *Response) ProtoReflect() protoreflect.Message
type Root ¶
type Root struct { // The instructions field is a repeated field that can contain multiple instances of the Instruction message. // It represents a collection of Ethereum Virtual Machine (EVM) instructions. Instructions []*Instruction `protobuf:"bytes,1,rep,name=instructions,proto3" json:"instructions,omitempty"` // contains filtered or unexported fields }
Define the "Root" message, which serves as a container for a list of instructions.
func (*Root) Descriptor
deprecated
func (*Root) GetInstructions ¶
func (x *Root) GetInstructions() []*Instruction
func (*Root) ProtoMessage ¶
func (*Root) ProtoMessage()
func (*Root) ProtoReflect ¶
func (x *Root) ProtoReflect() protoreflect.Message
type ServiceClient ¶
type ServiceClient interface { // Retrieves transaction details based on network_id and address. // The HTTP GET method is used, and the network_id and address are passed as path parameters. Get(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) // Decompiles the bytecode associated with a transaction. // The HTTP POST method is used, and the request body contains the transaction details. Decompile(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) // Checks the health status of the opcode service. // The HTTP GET method is used, and the response provides health status details. GetHealth(ctx context.Context, in *health.HealthRequest, opts ...grpc.CallOption) (*health.HealthResponse, error) }
ServiceClient is the client API for Service service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
func NewServiceClient ¶
func NewServiceClient(cc grpc.ClientConnInterface) ServiceClient
type ServiceServer ¶
type ServiceServer interface { // Retrieves transaction details based on network_id and address. // The HTTP GET method is used, and the network_id and address are passed as path parameters. Get(context.Context, *Request) (*Response, error) // Decompiles the bytecode associated with a transaction. // The HTTP POST method is used, and the request body contains the transaction details. Decompile(context.Context, *Request) (*Response, error) // Checks the health status of the opcode service. // The HTTP GET method is used, and the response provides health status details. GetHealth(context.Context, *health.HealthRequest) (*health.HealthResponse, error) // contains filtered or unexported methods }
ServiceServer is the server API for Service service. All implementations must embed UnimplementedServiceServer for forward compatibility
type UnimplementedServiceServer ¶
type UnimplementedServiceServer struct { }
UnimplementedServiceServer must be embedded to have forward compatible implementations.
func (UnimplementedServiceServer) GetHealth ¶
func (UnimplementedServiceServer) GetHealth(context.Context, *health.HealthRequest) (*health.HealthResponse, error)
type UnsafeServiceServer ¶
type UnsafeServiceServer interface {
// contains filtered or unexported methods
}
UnsafeServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ServiceServer will result in compilation errors.