index.jsView |
---|
1 | | -const Vertex = require('./deps/kernelVertex') |
| 1 | +const Vertex = require('merkle-trie') |
2 | 2 | |
3 | 3 | const Imports = require('./EVMimports.js') |
4 | 4 | const VM = require('./vm.js') |
5 | 5 | const Environment = require('./environment.js') |
6 | 6 | |
7 | | -module.exports = class Kernel { |
| 7 | +module.exports = class Kernel extends Vertex { |
8 | 8 | constructor (opts = {}) { |
9 | | - this.state = opts.state || new Vertex() |
10 | | - this.parent = opts.parent |
| 9 | + opts.code = opts.value || opts.code |
| 10 | + super(opts) |
11 | 11 | |
12 | 12 | |
13 | 13 | if (opts.code) { |
14 | 14 | this._vm = new VM(opts.code) |
30 | 30 | * run the kernels code with a given enviroment |
31 | 31 | * The Kernel Stores all of its state in the Environment. The Interface is used |
32 | 32 | * to by the VM to retrive infromation from the Environment. |
33 | 33 | */ |
34 | | - async run (environment = new Environment({state: this.state}), imports = this.imports) { |
| 34 | + async run (environment = new Environment({state: this}), imports = this.imports) { |
35 | 35 | await this._vm.run(environment, imports) |
36 | 36 | } |
37 | 37 | |
38 | 38 | async messageReceiver (message) { |