tests/index.jsView |
---|
74 | 74 | }) |
75 | 75 | |
76 | 76 | tape('basic', async t => { |
77 | 77 | t.plan(2) |
78 | | - const expectedState = Buffer.from('e3669fbd4ee56f958d9090f60617f3a50cd8062b', 'hex') |
| 78 | + const expectedState = Buffer.from('32b919149345b74e431c42a1b7dd65c30c625284', 'hex') |
79 | 79 | const tree = new RadixTree({ |
80 | 80 | db |
81 | 81 | }) |
82 | 82 | |
102 | 102 | }) |
103 | 103 | |
104 | 104 | tape('two communicating actors', async t => { |
105 | 105 | t.plan(2) |
106 | | - const expectedState = Buffer.from('d2ab2c32f5eca6706d72a70d08ba7711ef8dde03', 'hex') |
| 106 | + const expectedState = Buffer.from('7f638e41261bc0238c3e9b34fce11827b6a3cb61', 'hex') |
107 | 107 | |
108 | 108 | const tree = new RadixTree({ |
109 | 109 | db |
110 | 110 | }) |
146 | 146 | }) |
147 | 147 | |
148 | 148 | tape('three communicating actors', async t => { |
149 | 149 | t.plan(3) |
150 | | - const expectedState = Buffer.from('622078699d4688e09c4930b49c6e465c9fbbcc07', 'hex') |
| 150 | + const expectedState = Buffer.from('ae2e8afa84748192064ddebab30d0e9852ceb722', 'hex') |
151 | 151 | const tree = new RadixTree({ |
152 | 152 | db: db |
153 | 153 | }) |
154 | 154 | |
196 | 196 | }) |
197 | 197 | |
198 | 198 | tape('three communicating actors, with tick counting', async t => { |
199 | 199 | t.plan(3) |
200 | | - const expectedState = Buffer.from('622078699d4688e09c4930b49c6e465c9fbbcc07', 'hex') |
| 200 | + const expectedState = Buffer.from('ae2e8afa84748192064ddebab30d0e9852ceb722', 'hex') |
201 | 201 | const tree = new RadixTree({ |
202 | 202 | db: db |
203 | 203 | }) |
204 | 204 | |
246 | 246 | }) |
247 | 247 | |
248 | 248 | tape('errors', async t => { |
249 | 249 | t.plan(3) |
250 | | - const expectedState = Buffer.from('d2ab2c32f5eca6706d72a70d08ba7711ef8dde03', 'hex') |
| 250 | + const expectedState = Buffer.from('7f638e41261bc0238c3e9b34fce11827b6a3cb61', 'hex') |
251 | 251 | const tree = new RadixTree({ |
252 | 252 | db |
253 | 253 | }) |
254 | 254 | |
291 | 291 | }) |
292 | 292 | |
293 | 293 | tape('actor creation', async t => { |
294 | 294 | t.plan(2) |
295 | | - const expectedState = Buffer.from('09ada4d5ccb874b5767ea4aaf6081437eb36b3e0', 'hex') |
| 295 | + const expectedState = Buffer.from('0e6d32f2fe8b5b99f0203eb46bfc7e319a07f700', 'hex') |
296 | 296 | |
297 | 297 | const tree = new RadixTree({ |
298 | 298 | db |
299 | 299 | }) |
338 | 338 | }) |
339 | 339 | |
340 | 340 | tape('simple message arbiter test', async t => { |
341 | 341 | t.plan(4) |
342 | | - const expectedState = Buffer.from('d2ab2c32f5eca6706d72a70d08ba7711ef8dde03', 'hex') |
| 342 | + const expectedState = Buffer.from('7f638e41261bc0238c3e9b34fce11827b6a3cb61', 'hex') |
343 | 343 | const tree = new RadixTree({ |
344 | 344 | db |
345 | 345 | }) |
346 | 346 | |
402 | 402 | t.deepEquals(stateRoot, expectedState, 'expected root!') |
403 | 403 | }) |
404 | 404 | |
405 | 405 | tape('arbiter test for id comparision', async t => { |
406 | | - t.plan(4) |
| 406 | + |
407 | 407 | let message |
408 | | - const expectedState = Buffer.from('622078699d4688e09c4930b49c6e465c9fbbcc07', 'hex') |
| 408 | + const expectedState = Buffer.from('ae2e8afa84748192064ddebab30d0e9852ceb722', 'hex') |
409 | 409 | |
410 | 410 | const tree = new RadixTree({ |
411 | 411 | db: db |
412 | 412 | }) |
450 | 450 | funcRef: moduleB.getFuncRef('main'), |
451 | 451 | funcArguments: ['first'] |
452 | 452 | })) |
453 | 453 | |
| 454 | + const sr1 = await hypervisor.createStateRoot() |
| 455 | + |
454 | 456 | const {module: moduleA0} = hypervisor.createActor(testVMContainerA.typeId) |
455 | 457 | |
456 | 458 | hypervisor.send(new Message({ |
457 | 459 | funcRef: moduleA0.getFuncRef('main'), |
465 | 467 | })) |
466 | 468 | |
467 | 469 | const stateRoot = await hypervisor.createStateRoot() |
468 | 470 | t.deepEquals(stateRoot, expectedState, 'expected root!') |
| 471 | + |
| 472 | + await hypervisor.setStateRoot(sr1) |
| 473 | + t.equals(hypervisor.nonce, 1, 'should get the correct nonce') |
| 474 | + t.end() |
469 | 475 | }) |
470 | 476 | |
471 | 477 | tape('async work', async t => { |
472 | 478 | t.plan(3) |
473 | | - const expectedState = Buffer.from('d2ab2c32f5eca6706d72a70d08ba7711ef8dde03', 'hex') |
| 479 | + const expectedState = Buffer.from('7f638e41261bc0238c3e9b34fce11827b6a3cb61', 'hex') |
474 | 480 | |
475 | 481 | const tree = new RadixTree({ |
476 | 482 | db |
477 | 483 | }) |