git ssb

0+

wanderer🌟 / js-primea-hypervisor



Commit 2552686760f62527d142c301b78cb108aa12d0a7

Lint fixes according to standard

Alex Beregszaszi committed on 8/23/2016, 12:39:12 AM
Parent: 3e30632034050031a6800119f8eebd8204b1bc98

Files changed

index.jschanged
test.jschanged
tests/interfaceRunner.jschanged
utils.jschanged
index.jsView
@@ -26,10 +26,10 @@
2626 const Utils = require('./utils.js')
2727 const Transaction = require('./transaction.js')
2828 const Precompile = require('./precompile.js')
2929
30-const meteringContract = new Address("0x000000000000000000000000000000000000000A")
31-const transcompilerContract = new Address("0x000000000000000000000000000000000000000B")
30+const meteringContract = new Address('0x000000000000000000000000000000000000000A')
31+const transcompilerContract = new Address('0x000000000000000000000000000000000000000B')
3232
3333 module.exports = class Kernel {
3434 // runs some code in the VM
3535 constructor (environment = new Environment()) {
@@ -81,9 +81,9 @@
8181 if (!account) {
8282 throw new Error('Account not found: ' + call.to.toString())
8383 }
8484
85- const code = Uint8Array.from(account.get('code'))
85+ let code = Uint8Array.from(account.get('code'))
8686 if (code.length === 0) {
8787 throw new Error('Contract not found')
8888 }
8989
@@ -107,15 +107,15 @@
107107 environment.callData = call.data
108108 environment.callValue = call.value
109109 environment.gasLeft = call.gasLimit
110110
111- //environment.setCallHandler(callHandler)
111+ // environment.setCallHandler(callHandler)
112112
113113 const kernel = new Kernel(this, environment)
114114 kernel.codeHandler(code, new Interface(environment))
115115
116116 // generate new stateroot
117- //this.environment.state.set(address, { stateRoot: stateRoot })
117+ // this.environment.state.set(address, { stateRoot: stateRoot })
118118
119119 return {
120120 executionOutcome: 1, // success
121121 gasLeft: new U256(environment.gasLeft),
test.jsView
@@ -9,9 +9,9 @@
99
1010 const fs = require('fs')
1111
1212 environment.addAccount(new Address('0x1234567890134561111123412341234123412341'), { balance: new U256('100000000000000000') })
13-//environment.addAccount(new Address('0x4123412341234123411234567890134561111123'), { code: Uint8Array.from(fs.readFileSync('identity.wasm')) })
13+// environment.addAccount(new Address('0x4123412341234123411234567890134561111123'), { code: Uint8Array.from(fs.readFileSync('identity.wasm')) })
1414
1515 environment.addAccount(new Address('0xbe862ad9abfe6f22bcb087716c7d89a26051f74c'), { balance: new U256('100000000000000000') })
1616 var tx = new Buffer('f8e380648203e88080b8977f4e616d65526567000000000000000000000000000000000000000000000000003057307f4e616d6552656700000000000000000000000000000000000000000000000000573360455760415160566000396000f20036602259604556330e0f600f5933ff33560f601e5960003356576000335700604158600035560f602b590033560f603659600033565733600035576000353357001ca0b8b9fedc076110cd002224a942e9d7099e4a626ebf66cd9301fc18e2c1181806a04e270be511d42189baf14599eb8d6eb5037ab105032dd3e0fa05b43dad4cb4c2', 'hex')
1717 console.log(kernel.runTx(tx, environment))
@@ -30,9 +30,9 @@
3030
3131 ret = kernel.runTx({
3232 nonce: new U256(4),
3333 from: new Address('0x1234567890134561111123412341234123412341'),
34- to: ret.accountCreated, //new Address('0x4123412341234123411234567890134561111123'),
34+ to: ret.accountCreated, // new Address('0x4123412341234123411234567890134561111123'),
3535 value: new U256('100'),
3636 gasLimit: new U256('1000000000'),
3737 gasPrice: new U256(1),
3838 data: Uint8Array.from(new Buffer('spartaaaa'))
tests/interfaceRunner.jsView
@@ -1,14 +1,16 @@
11 'use strict'
22 const tape = require('tape')
33 const fs = require('fs')
44 const cp = require('child_process')
5+const path = require('path')
56
67 const Kernel = require('../index.js')
78 const TestEnvironment = require('../testEnvironment.js')
89 const Interface = require('../interface.js')
910 const DebugInterface = require('../debugInterface.js')
10-const dir = __dirname + '/interface'
11+
12+const dir = path.join(__dirname, '/interface')
1113 // get the test names
1214 let tests = fs.readdirSync(dir).filter((file) => file.endsWith('.wast'))
1315 // tests = ['balance.wast']
1416 // run the tests
utils.jsView
@@ -10,5 +10,5 @@
1010 Utils.newAccountAddress = function (sender, data) {
1111 return new Address('0x' + ethUtils.sha3(Buffer.concat([ sender.toBuffer(), Buffer.from(data) ])).slice(0, 20).toString('hex'))
1212 }
1313
14-module.exports = Utils
14+module.exports = Utils

Built with git-ssb-web