Expand description
Assembly for the Essential VM.
§Op Table
Opcode | Op | Short Description |
---|---|---|
0x01 | Stack Push | Push one word onto the stack. |
0x02 | Stack Pop | Pop one word from the stack. |
0x03 | Stack Dup | Duplicate the top word on the stack. |
0x04 | Stack DupFrom | Duplicate the word at the given stack depth index. |
0x05 | Stack Swap | Swap top two words on stack. |
0x06 | Stack SwapIndex | Swap the top word on the stack with the word at the given stack depth index. |
0x07 | Stack Select | Conditionally keep one of the top two elements on the stack. |
0x08 | Stack SelectRange | Conditionally keep one of the top two ranges on the stack. |
0x09 | Stack Repeat | Repeat a section of code the number of times. |
0x0A | Stack RepeatEnd | Increment or decrements the top counter on the repeat stack. |
0x0B | Stack Reserve | Reserve space on the stack for len words. |
0x0C | Stack Load | Load the value at the given stack depth index relative to the bottom. |
0x0D | Stack Store | Store the value at the given stack depth index relative to the bottom. |
0x0E | Stack Drop | Drop the top n elements from the stack. |
0x10 | Pred Eq | Check equality of two words. |
0x11 | Pred EqRange | Check equality of two ranges on the stack. |
0x12 | Pred Gt | Check if left-hand side is greater than right-hand side. |
0x13 | Pred Lt | Check if left-hand side is less than right-hand side. |
0x14 | Pred Gte | Check if left-hand side is greater than or equal to right-hand side. |
0x15 | Pred Lte | Check if left-hand side is less than or equal to right-hand side. |
0x16 | Pred And | Logical AND of two words. |
0x17 | Pred Or | Logical OR of two words. |
0x18 | Pred Not | Logical NOT of a word. |
0x19 | Pred EqSet | Pop two sets off the stack and check if they are equal. |
0x1A | Pred BitAnd | Bitwise AND of two words. |
0x1B | Pred BitOr | Bitwise OR of two words. |
0x20 | Alu Add | Add two words. |
0x21 | Alu Sub | Subtract two words. |
0x22 | Alu Mul | Multiply two words. |
0x23 | Alu Div | Integer division. |
0x24 | Alu Mod | Modulus of lhs by rhs. |
0x25 | Alu Shl | Logical shift left by number of bits. |
0x26 | Alu Shr | Logical shift right by number of bits. |
0x27 | Alu ShrI | Arithmetic shift right by number of bits. |
0x30 | Access ThisAddress | Get the content hash of this predicate. |
0x31 | Access ThisContractAddress | Get the content hash of the contract this predicate belongs to. |
0x38 | Access RepeatCounter | Access the top repeat counters current value. |
0x3A | Access PredicateData | Access a range of len words starting from value_ix within the |
0x3B | Access PredicateDataLen | Get the length of a the predicate data value located at slot_ix . |
0x3C | Access PredicateDataSlots | Get the number of predicate data slots. |
0x3D | Access PredicateExists | Check if a solution to a predicate exists within the same solution |
0x50 | Crypto Sha256 | Produce a SHA 256 hash from the specified data. |
0x51 | Crypto VerifyEd25519 | Validate an Ed25519 signature against a public key. |
0x52 | Crypto RecoverSecp256k1 | Recover the public key from a secp256k1 signature. |
0x60 | TotalControlFlow Halt | End the execution of the program. |
0x61 | TotalControlFlow HaltIf | Halt the program if the value is true. |
0x62 | TotalControlFlow JumpIf | Jump the given number of instructions if the value is true. |
0x63 | TotalControlFlow PanicIf | Panic if the condition is true. |
0x70 | Memory Alloc | Allocate a new block of memory to the end. |
0x71 | Memory Free | Truncate memory to the specified new length, freeing all that follows. |
0x72 | Memory Load | Load the value at the given index from memory onto the stack. |
0x73 | Memory Store | Store the value at the given index within memory. |
0x74 | Memory LoadRange | Load a range of words starting at the index within memory. |
0x75 | Memory StoreRange | Store a range of words starting at the index within memory. |
0x7A | ParentMemory Load | Load the value at the given index from parent memory onto the stack. |
0x7B | ParentMemory LoadRange | Load a range of words starting at the index within parent memory. |
0x80 | StateRead KeyRange | Read a range of values at each key from state starting at the key |
0x81 | StateRead KeyRangeExtern | Read a range of values at each key from external state starting at the key |
0x82 | StateRead PostKeyRange | Read a range of values at each key from post state starting at the key |
0x83 | StateRead PostKeyRangeExtern | Read a range of values at each key from external post state starting at the key |
0x90 | Compute Compute | Hand off execution to compute threads until ComputeEnd operation is encountered. |
0x91 | Compute ComputeEnd | End of the execution of the compute program. |
Modules§
- bytes_
iter - Provides the operation type bytes iterators.
- effects
- Determine the effects of a program.
- opcode
- Typed representation of the opcode, without any associated data.
- short
- Short hand names for the operations.
Structs§
- Invalid
Opcode Error - An attempt to parse a byte as an opcode failed.
- NotEnough
Bytes Error - An error occurring within
Opcode::parse_op
in the case that the provided bytes iterator contains insufficient bytes for the expected associated operation data.
Enums§
- Access
- Operations for accessing input data.
- Alu
- Operations for computing arithmetic and logic.
- Compute
- Operations related to VM compute execution.
- Crypto
- Operations providing cryptographic functionality.
- From
Bytes Error - Errors that can occur while parsing ops from bytes.
- Memory
- Operations for memory.
- Op
- All operations available to the Essential VM execution.
- Opcode
- All operations available to the Essential VM execution.
- Parent
Memory - Operations for reading parent memory from within a compute context.
- Pred
- Operations for computing predicates.
- Stack
- Operations related to stack manipulation.
- State
Read - Operations related to reading state.
- Total
Control Flow - Control flow operations that keep the program total.
Traits§
- ToBytes
- Operation types that may be converted to their serialized form in bytes.
- ToOpcode
- Allows for converting an
Op
into its associatedOpcode
. - TryFrom
Bytes - Operation types that may be parsed from a bytecode representation.
Functions§
- from_
bytes - Parse operations from the given iterator yielding bytes.
- to_
bytes - Convert the given iterator yielding operations into and iterator yielding the serialized form in bytes.
Type Aliases§
- Word
- Single unit of data.