Commit f8c9ead18a27b0962868bf70b4fa256cb3fb1606
added sstore test
wanderer committed on 7/14/2016, 10:03:05 PMParent: 2c04524fc8e9b757c060e0e2cf80d26d6d411e57
Files changed
README.md | changed |
environment.js | changed |
index.js | changed |
interface.js | changed |
package.json | changed |
tests/sstore.json | added |
tests/sstore.wast | added |
debugInterface.js | added |
README.md | ||
---|---|---|
@@ -1,14 +1,13 @@ | ||
1 | 1 | # SYNOPSIS - WIP |
2 | 2 | [![Gitter](https://img.shields.io/gitter/room/ethereum/ethereumjs-lib.svg?style=flat-square)](https://gitter.im/ethereum/ethereumjs-lib) or #ethereumjs on freenode |
3 | - | |
4 | 3 | [![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard) |
5 | 4 | |
6 | 5 | This is a JS prototype of the [eWASM kernal](https://github.com/ethereum/evm2.0-design). |
7 | 6 | |
8 | 7 | |
9 | 8 | # INSTALL |
10 | -You need to compile [nodejs](https://github.com/nodejs/node) from master to run | |
9 | +You need to compile [nodejs](https://github.com/nodejs/node) from master to run | |
11 | 10 | ~~`npm install ewasm-kernal`~~ |
12 | 11 | |
13 | 12 | clone and run `npm install` |
14 | 13 |
environment.js | ||
---|---|---|
@@ -3,26 +3,32 @@ | ||
3 | 3 | |
4 | 4 | module.exports = class Environment { |
5 | 5 | constructor (data) { |
6 | 6 | const defaults = { |
7 | + // gas tank | |
7 | 8 | gasCounter: 0, // TODO: gasCounter is only 53 bits |
8 | 9 | gas: 0, // The amount of gas this contract has |
9 | 10 | gasPrice: 0, |
10 | 11 | gasLimit: 0, // The gas limit for the block |
12 | + // call infromation | |
11 | 13 | address: new Uint8Array(20), |
12 | 14 | origin: new Uint8Array(20), |
13 | 15 | coinbase: new Uint8Array(20), |
14 | 16 | difficulty: new Uint8Array(20), |
15 | 17 | caller: new Uint8Array(20), |
16 | 18 | callValue: new Uint8Array(MAX_BAL_BYTES), |
17 | 19 | callData: new ArrayBuffer(), |
20 | + // the ROM | |
18 | 21 | code: new ArrayBuffer(), // the current running code |
22 | + // output calls | |
19 | 23 | logs: [], |
20 | - returnValue: new ArrayBuffer(), | |
21 | 24 | suicideAddress: new ArrayBuffer(), |
22 | - accounts: new Map() | |
25 | + // more output calls | |
26 | + returnValue: new ArrayBuffer() | |
23 | 27 | } |
24 | 28 | |
29 | + this.state = new Graph() | |
30 | + | |
25 | 31 | if (data) { |
26 | 32 | data = JSON.parse(data) |
27 | 33 | Object.assign(this, defaults, data) |
28 | 34 | } else { |
@@ -31,9 +37,8 @@ | ||
31 | 37 | |
32 | 38 | if (data.accounts) { |
33 | 39 | this.accounts = new Graph() |
34 | 40 | const self = this |
35 | - debugger | |
36 | 41 | data.accounts.forEach((account) => { |
37 | 42 | self.accounts.set(new Uint8Array(account[0]).toString(), account[1]) |
38 | 43 | }) |
39 | 44 | } |