VM is a virtual machine for executing Chain Protocol transactions.
| 16 | |
| 17 | // VM is a virtual machine for executing Chain Protocol transactions. |
| 18 | type VM struct { |
| 19 | // Config/setup fields |
| 20 | txVersion int64 |
| 21 | runlimit int64 |
| 22 | extension bool |
| 23 | stopAfterFinalize bool |
| 24 | onFinalize []func(*VM) |
| 25 | onLog []func(*VM) |
| 26 | beforeStep []func(*VM) |
| 27 | afterStep []func(*VM) |
| 28 | onExit []func(*VM) |
| 29 | |
| 30 | // Runtime fields |
| 31 | argstack stack |
| 32 | run run // TODO(bobg): move run/runstack into txvmutil. |
| 33 | runstack []run |
| 34 | unwinding bool |
| 35 | contract *contract |
| 36 | caller []byte |
| 37 | data []byte |
| 38 | opcode byte |
| 39 | |
| 40 | // Results |
| 41 | |
| 42 | // TxID is the unique id of the transaction. It is only set if |
| 43 | // Finalized is true. |
| 44 | TxID [32]byte |
| 45 | |
| 46 | // Log is the record of the transaction's effects. |
| 47 | Log []Tuple |
| 48 | |
| 49 | // Finalized is true if and only if the finalize instruction was |
| 50 | // executed. |
| 51 | Finalized bool |
| 52 | } |
| 53 | |
| 54 | var ( |
| 55 | // ErrResidue is produced by Validate when execution leaves the |
nothing calls this directly
no outgoing calls
no test coverage detected