@@ -96,10 +96,6 @@ describe("block production", () => {
96
96
let test : BlockTestService ;
97
97
98
98
beforeEach ( async ( ) => {
99
- // container.reset();
100
-
101
- log . setLevel ( log . levels . DEBUG ) ;
102
-
103
99
const runtimeClass = Runtime . from ( {
104
100
modules : {
105
101
Balance,
@@ -169,6 +165,7 @@ describe("block production", () => {
169
165
170
166
appChain = app ;
171
167
168
+ // @ts -ignore
172
169
( { runtime, sequencer, protocol } = app ) ;
173
170
174
171
test = app . sequencer . dependencyContainer . resolve ( BlockTestService ) ;
@@ -177,8 +174,6 @@ describe("block production", () => {
177
174
it ( "should produce a dummy block proof" , async ( ) => {
178
175
expect . assertions ( 27 ) ;
179
176
180
- log . setLevel ( "TRACE" ) ;
181
-
182
177
const privateKey = PrivateKey . random ( ) ;
183
178
const publicKey = privateKey . toPublicKey ( ) ;
184
179
@@ -265,8 +260,6 @@ describe("block production", () => {
265
260
expect ( block ) . toBeDefined ( ) ;
266
261
267
262
expect ( block ! . transactions ) . toHaveLength ( 1 ) ;
268
- console . log ( block ! . transactions [ 0 ] ) ;
269
- console . log ( block ! . transactions [ 0 ] . statusMessage ) ;
270
263
expect ( block ! . transactions [ 0 ] . status . toBoolean ( ) ) . toBe ( true ) ;
271
264
expect ( block ! . transactions [ 0 ] . statusMessage ) . toBeUndefined ( ) ;
272
265
@@ -282,8 +275,6 @@ describe("block production", () => {
282
275
it ( "should reject tx and not apply the state" , async ( ) => {
283
276
expect . assertions ( 5 ) ;
284
277
285
- log . setLevel ( "INFO" ) ;
286
-
287
278
const privateKey = PrivateKey . random ( ) ;
288
279
289
280
await test . addTransaction ( {
@@ -313,26 +304,20 @@ describe("block production", () => {
313
304
} , 30_000 ) ;
314
305
315
306
it ( "should produce txs in non-consecutive blocks" , async ( ) => {
316
- log . setLevel ( "TRACE" ) ;
317
-
318
307
const privateKey = PrivateKey . random ( ) ;
319
308
const publicKey = privateKey . toPublicKey ( ) ;
320
309
321
310
const privateKey2 = PrivateKey . random ( ) ;
322
311
const publicKey2 = privateKey2 . toPublicKey ( ) ;
323
312
324
- await mempool . add (
325
- createTransaction ( {
326
- runtime,
327
- method : [ "Balance" , "setBalanceIf" ] ,
328
- privateKey,
329
- args : [ publicKey , UInt64 . from ( 100 ) , Bool ( true ) ] ,
330
- nonce : 0 ,
331
- } )
332
- ) ;
313
+ await test . addTransaction ( {
314
+ method : [ "Balance" , "setBalanceIf" ] ,
315
+ privateKey,
316
+ args : [ publicKey , UInt64 . from ( 100 ) , Bool ( true ) ] ,
317
+ } ) ;
333
318
334
319
// let [block, batch] = await blockTrigger.produceBlockAndBatch();
335
- const block = await blockTrigger . produceBlock ( ) ;
320
+ const block = await test . produceBlock ( ) ;
336
321
337
322
expect ( block ) . toBeDefined ( ) ;
338
323
@@ -343,72 +328,52 @@ describe("block production", () => {
343
328
expect ( block ! . transactions [ 0 ] . stateTransitions ) . toHaveLength ( 1 ) ;
344
329
expect ( block ! . transactions [ 0 ] . protocolTransitions ) . toHaveLength ( 2 ) ;
345
330
346
- await blockTrigger . produceBlock ( ) ;
331
+ await test . produceBlock ( ) ;
347
332
348
- await mempool . add (
349
- createTransaction ( {
350
- runtime,
351
- method : [ "Balance" , "setBalanceIf" ] ,
352
- privateKey : privateKey2 ,
353
- args : [ publicKey2 , UInt64 . from ( 100 ) , Bool ( true ) ] ,
354
- nonce : 0 ,
355
- } )
356
- ) ;
357
- await blockTrigger . produceBlock ( ) ;
358
-
359
- await mempool . add (
360
- createTransaction ( {
361
- runtime,
362
- method : [ "Balance" , "setBalanceIf" ] ,
363
- privateKey : privateKey2 ,
364
- args : [ publicKey2 , UInt64 . from ( 100 ) , Bool ( true ) ] ,
365
- nonce : 1 ,
366
- } )
367
- ) ;
368
- await blockTrigger . produceBlock ( ) ;
369
-
370
- await mempool . add (
371
- createTransaction ( {
372
- runtime,
373
- method : [ "Balance" , "setBalanceIf" ] ,
374
- privateKey : privateKey2 ,
375
- args : [ publicKey2 , UInt64 . from ( 100 ) , Bool ( true ) ] ,
376
- nonce : 2 ,
377
- } )
378
- ) ;
379
- await blockTrigger . produceBlock ( ) ;
380
-
381
- await mempool . add (
382
- createTransaction ( {
383
- runtime,
384
- method : [ "Balance" , "setBalanceIf" ] ,
385
- privateKey : privateKey2 ,
386
- args : [ publicKey2 , UInt64 . from ( 100 ) , Bool ( true ) ] ,
387
- nonce : 3 ,
388
- } )
389
- ) ;
390
- await blockTrigger . produceBlock ( ) ;
333
+ await test . addTransaction ( {
334
+ method : [ "Balance" , "setBalanceIf" ] ,
335
+ privateKey : privateKey2 ,
336
+ args : [ publicKey2 , UInt64 . from ( 100 ) , Bool ( true ) ] ,
337
+ } ) ;
338
+ await test . produceBlock ( ) ;
339
+
340
+ await test . addTransaction ( {
341
+ method : [ "Balance" , "setBalanceIf" ] ,
342
+ privateKey : privateKey2 ,
343
+ args : [ publicKey2 , UInt64 . from ( 100 ) , Bool ( true ) ] ,
344
+ } ) ;
345
+
346
+ await test . produceBlock ( ) ;
347
+
348
+ await test . addTransaction ( {
349
+ method : [ "Balance" , "setBalanceIf" ] ,
350
+ privateKey : privateKey2 ,
351
+ args : [ publicKey2 , UInt64 . from ( 100 ) , Bool ( true ) ] ,
352
+ } ) ;
353
+
354
+ await test . produceBlock ( ) ;
355
+
356
+ await test . addTransaction ( {
357
+ method : [ "Balance" , "setBalanceIf" ] ,
358
+ privateKey : privateKey2 ,
359
+ args : [ publicKey2 , UInt64 . from ( 100 ) , Bool ( true ) ] ,
360
+ } ) ;
361
+ await test . produceBlock ( ) ;
391
362
392
363
// Second tx
393
- await mempool . add (
394
- createTransaction ( {
395
- runtime,
396
- method : [ "Balance" , "setBalanceIf" ] ,
397
- privateKey,
398
- args : [ publicKey , UInt64 . from ( 100 ) , Bool ( true ) ] ,
399
- nonce : 1 ,
400
- } )
401
- ) ;
364
+ await test . addTransaction ( {
365
+ method : [ "Balance" , "setBalanceIf" ] ,
366
+ privateKey,
367
+ args : [ publicKey , UInt64 . from ( 100 ) , Bool ( true ) ] ,
368
+ } ) ;
402
369
403
370
log . info ( "Starting second block" ) ;
404
371
405
- const block2 = await blockTrigger . produceBlock ( ) ;
372
+ const block2 = await test . produceBlock ( ) ;
406
373
407
374
expect ( block2 ) . toBeDefined ( ) ;
408
375
409
376
expect ( block2 ! . transactions ) . toHaveLength ( 1 ) ;
410
- console . log ( block2 ! . transactions [ 0 ] ) ;
411
- console . log ( block2 ! . transactions [ 0 ] . statusMessage ) ;
412
377
expect ( block2 ! . transactions [ 0 ] . status . toBoolean ( ) ) . toBe ( true ) ;
413
378
expect ( block2 ! . transactions [ 0 ] . statusMessage ) . toBeUndefined ( ) ;
414
379
} , 60_000 ) ;
@@ -637,8 +602,6 @@ describe("block production", () => {
637
602
} , 360_000 ) ;
638
603
639
604
it ( "regression - should produce block with no STs emitted" , async ( ) => {
640
- log . setLevel ( "TRACE" ) ;
641
-
642
605
const privateKey = PrivateKey . random ( ) ;
643
606
644
607
await test . addTransaction ( {
0 commit comments