git ssb

0+

wanderer🌟 / js-primea-hypervisor



Commit c6e879cecacacc8ce87b4741f02493827fd992c8

Kernel: assume every address is an instance of Address

Alex Beregszaszi committed on 8/23/2016, 12:27:46 AM
Parent: 07abd8f821130e425de30cfb326a51dc64c4bf91

Files changed

index.jschanged
index.jsView
@@ -20,8 +20,9 @@
2020 const Environment = require('./environment.js')
2121
2222 const DebugInterface = require('./debugInterface.js')
2323
24+const Address = require('./address.js')
2425 const Utils = require('./utils.js')
2526
2627 module.exports = class Kernel {
2728 // runs some code in the VM
@@ -67,13 +68,13 @@
6768 if (address === 0) {
6869 if (data) {
6970 let codeHash = sha3(data)
7071 this.environment.state.set(codeHash, data);
71- this.environment.state.set(new Uint8Array(address).toString(), { balance: value, codeHash: codeHash })
72+ this.environment.state.set(address.toString(), { balance: value, codeHash: codeHash })
7273 }
7374 }
7475
75- var account = this.environment.state.get(new Uint8Array(address).toString())
76+ let account = this.environment.state.get(address.toString())
7677 if (!account) {
7778 throw new Error('Account not found')
7879 }
7980
@@ -128,9 +129,9 @@
128129 // { balance, codeHash, stateRoot }
129130 //
130131
131132 // look up sender
132- let fromAccount = this.environment.state.get(new Uint8Array(tx.form).toString())
133+ let fromAccount = this.environment.state.get(tx.from.toString())
133134 if (!fromAccount) {
134135 throw new Error('Sender account not found')
135136 }
136137

Built with git-ssb-web