git ssb

0+

wanderer🌟 / js-primea-hypervisor



Commit 9d0e76ab27a7c7ca239e1ef71f84447d37f4acc4

remove bn.js

Signed-off-by: wanderer <mjbecze@gmail.com>
wanderer committed on 9/10/2017, 6:39:58 AM
Parent: 9e1f4df59ed811983747166e1f3b752a92e9b42a

Files changed

kernel.jschanged
package-lock.jsonchanged
package.jsonchanged
tests/index.jschanged
kernel.jsView
@@ -1,6 +1,5 @@
11 const Message = require('primea-message')
2-const BN = require('bn.js')
32 const PortManager = require('./portManager.js')
43 const DeleteMessage = require('./deleteMessage')
54
65 module.exports = class Kernel {
@@ -143,19 +142,14 @@
143142 return message
144143 }
145144
146145 generateNextId () {
147- let nonce = this.state.nonce
148-
149146 const id = {
150- nonce: nonce,
147+ nonce: this.state.nonce,
151148 parent: this.id
152149 }
153150
154- // incerment the nonce
155- nonce = new BN(nonce)
156- nonce.iaddn(1)
157- this.state.nonce = nonce.toArray()
151+ this.state.nonce++
158152 return id
159153 }
160154
161155 /**
package-lock.jsonView
The diff is too large to show. Use a local git client to view these changes.
Old file size: 495563 bytes
New file size: 495562 bytes
package.jsonView
@@ -30,14 +30,14 @@
3030 "contributors": "Alex Beregszaszi <alex@rtfs.hu>",
3131 "license": "MPL-2.0",
3232 "dependencies": {
3333 "binary-search-insert": "^1.0.3",
34- "bn.js": "^4.11.6",
3534 "chunk": "0.0.2",
3635 "ipld-graph-builder": "1.3.0",
3736 "lockmap": "0.0.0",
3837 "merkle-radix-tree": "0.0.4",
39- "primea-message": "0.0.2"
38+ "primea-message": "0.0.2",
39+ "typedarray-addition": "0.0.0"
4040 },
4141 "devDependencies": {
4242 "primea-abstract-container": "0.0.4",
4343 "coveralls": "^2.13.1",
tests/index.jsView
@@ -24,11 +24,9 @@
2424 node.on('ready', () => {
2525 tape('basic', async t => {
2626 t.plan(3)
2727 let message
28- const expectedState = {
29- '/': 'zdpuAqbcQhgu2T2MBgHbYu1MtHXyZzNsCaQjTPTR6NN9s5hbk'
30- }
28+ const expectedState = { '/': 'zdpuAyCWhqq3v5DWhJCJPBgFkFbMxmD4do98TusonJmw7TyEG' }
3129
3230 class testVMContainer extends BaseContainer {
3331 onMessage (m) {
3432 t.true(m === message, 'should recive a message')
@@ -79,9 +77,9 @@
7977
8078 tape('basic - do not store containers with no ports bound', async t => {
8179 t.plan(1)
8280 const expectedState = {
83- '/': 'zdpuAop4nt8pqzg7duciSYbZmWfDaBiz87RCtGCbb35ewUrbW'
81+ '/': 'zdpuB1nzBk1RfSkZAx783Y54JiwW47WDHBxrBiUWSx1d9XraH'
8482 }
8583
8684 class testVMContainer extends BaseContainer {
8785 onCreation () {}
@@ -129,9 +127,9 @@
129127 tape('one child contract', async t => {
130128 t.plan(4)
131129 let message
132130 const expectedState = {
133- '/': 'zdpuB2Huo3ro3Fv9mpMhnUcL3jjd37T6MJ6jEd8GvA2cpvaYR'
131+ '/': 'zdpuAnJrp8fEQL8NAJ9Jci3AJw6tzUdfhFvMMgtQ6BheL5JSb'
134132 }
135133
136134 let hasResolved = false
137135
@@ -640,9 +638,9 @@
640638 })
641639
642640 tape('port deletion', async t => {
643641 const expectedSr = {
644- '/': 'zdpuAxKfu5nMTfpz6uHPqXdHZFQDZdRUer8zcQ6nvC4pTQsop'
642+ '/': 'zdpuAzmHuZeX37ohQvWheN4mS3B63A3LknRgmsG4dQFcer5Xf'
645643 }
646644
647645 const hypervisor = new Hypervisor(node.dag)
648646 const creationPort = hypervisor.creationService.getPort()
@@ -710,9 +708,9 @@
710708 })
711709
712710 tape('clear unbounded ports', async t => {
713711 const expectedSr = {
714- '/': 'zdpuAxKfu5nMTfpz6uHPqXdHZFQDZdRUer8zcQ6nvC4pTQsop'
712+ '/': 'zdpuAzmHuZeX37ohQvWheN4mS3B63A3LknRgmsG4dQFcer5Xf'
715713 }
716714
717715 const hypervisor = new Hypervisor(node.dag)
718716 const creationPort = hypervisor.creationService.getPort()
@@ -757,9 +755,9 @@
757755 })
758756
759757 tape('should remove subgraphs', async t => {
760758 const expectedSr = {
761- '/': 'zdpuAxKfu5nMTfpz6uHPqXdHZFQDZdRUer8zcQ6nvC4pTQsop'
759+ '/': 'zdpuAzmHuZeX37ohQvWheN4mS3B63A3LknRgmsG4dQFcer5Xf'
762760 }
763761
764762 const hypervisor = new Hypervisor(node.dag)
765763 const creationPort = hypervisor.creationService.getPort()
@@ -828,9 +826,9 @@
828826 })
829827
830828 tape('should not remove connected nodes', async t => {
831829 const expectedSr = {
832- '/': 'zdpuAr4A3i1t6B7BkLT9C7DoxwvFnNg74gEzyqhpFj7nqVBy6'
830+ '/': 'zdpuAnqT3rGwbquWcGP82C9pZGM59uDCdXYBDFaUcmXr3M6fs'
833831 }
834832
835833 const hypervisor = new Hypervisor(node.dag)
836834 const creationPort = hypervisor.creationService.getPort()
@@ -914,9 +912,9 @@
914912 })
915913
916914 tape('should remove multiple subgraphs', async t => {
917915 const expectedSr = {
918- '/': 'zdpuAzYGmZeZsi5Zer7LXCTm1AsmqpUMJAXZnEeFW2UVDZj2P'
916+ '/': 'zdpuAwVszhPYNCas6qfcoLZcyaV6ee1UfbkjFiFyJULeoJR5x'
919917 }
920918
921919 const hypervisor = new Hypervisor(node.dag)
922920 const creationPort = hypervisor.creationService.getPort()
@@ -1143,9 +1141,9 @@
11431141
11441142 const stateRoot = await hypervisor.createStateRoot()
11451143 // await hypervisor.graph.tree(hypervisor.state, Infinity, true)
11461144 const expectedSR = {
1147- '/': 'zdpuAonuhk7ZhdghJh4saaUCskY5mXZ6M9BcV9iAhCanAQx9i'
1145+ '/': 'zdpuAv2aHeZJ7Y3XB4NrrGPSKMfTLcB3Dj8VL7FUvYDVgj3jT'
11481146 }
11491147 t.deepEquals(stateRoot, expectedSR)
11501148 })
11511149

Built with git-ssb-web