Commit c65080ed891e4874c7962a92eb7e6e331964adb3
fixed tests again
wanderer committed on 7/22/2016, 12:49:57 PMParent: 76b626ab5a6d24e48ccefffb8900dc9052b0b36d
Files changed
environment.js | changed |
index.js | changed |
interface.js | changed |
tests/interfaceRunner.js | changed |
environment.js | ||
---|---|---|
@@ -73,8 +73,23 @@ | ||
73 | 73 | |
74 | 74 | getBlockHash (height) { |
75 | 75 | // STUB |
76 | 76 | } |
77 | + | |
78 | + // kernal | |
79 | + create (code, value) { | |
80 | + // STUB | |
81 | + } | |
82 | + | |
83 | + call (gas, address, value, data) { | |
84 | + // STUB | |
85 | + return // result | |
86 | + } | |
87 | + | |
88 | + delegateCall (gas, address, data) { | |
89 | + // STUB | |
90 | + return // result | |
91 | + } | |
77 | 92 | } |
78 | 93 | |
79 | 94 | function hexStr2arrayBuf (string) { |
80 | 95 | const ab = new ArrayBuffer(string.length / 2) |
index.js | ||
---|---|---|
@@ -24,9 +24,9 @@ | ||
24 | 24 | this.environment = environment |
25 | 25 | } |
26 | 26 | |
27 | 27 | // handles running code. |
28 | - static codeHandler (code, ethInterface) { | |
28 | + static codeHandler (code, ethInterface = new Interface(new Environment())) { | |
29 | 29 | const instance = Wasm.instantiateModule(code, { |
30 | 30 | 'ethereum': ethInterface |
31 | 31 | }) |
32 | 32 |
interface.js | ||
---|---|---|
@@ -21,10 +21,10 @@ | ||
21 | 21 | memPrint () { |
22 | 22 | console.log((new Uint8Array(MOD.exports.memory)).toString()) |
23 | 23 | } |
24 | 24 | |
25 | - constructor (kernal) { | |
26 | - ENV = this.environment = kernal.environment | |
25 | + constructor (environment, kernal) { | |
26 | + ENV = this.environment = environment | |
27 | 27 | self = this |
28 | 28 | } |
29 | 29 | |
30 | 30 | setModule (mod) { |
tests/interfaceRunner.js | ||
---|---|---|
@@ -19,10 +19,10 @@ | ||
19 | 19 | const buffer = fs.readFileSync(`${dir}/${testName}.wasm`) |
20 | 20 | const envData = fs.readFileSync(`${dir}/${testName}.json`) |
21 | 21 | |
22 | 22 | const environment = new Environment(envData) |
23 | - const kernel = new Kernel(environment) | |
24 | - const ethInterface = new Interface(kernel) | |
23 | + const kernel = new Kernel() | |
24 | + const ethInterface = new Interface(environment, kernel) | |
25 | 25 | |
26 | 26 | try { |
27 | 27 | const mod = Wasm.instantiateModule(buffer, {'ethereum': ethInterface}) |
28 | 28 | ethInterface.setModule(mod) |
Built with git-ssb-web