@@ -52,6 +52,7 @@ const tx3 = 'lbeIMUvoEqR2q-pKsT4Y5tz6mm9ppemReyLnQ8P7XpM';
52
52
// manifest with paths without trailing slash
53
53
const tx4 = 'sYaO7sklQ8FyObQNLy7kDbEvwUNKKes7mUnv-_Ri9bE' ;
54
54
55
+ // bundle with data item
55
56
const bundle1 = '73QwVewKc0hXmuiaahtGJqHEY5pb85SoqCC33VE0Teg' ;
56
57
57
58
describe ( 'Data' , function ( ) {
@@ -272,7 +273,7 @@ describe('X-Cache header', { skip: isTestFiltered(['flaky']) }, function () {
272
273
} ) ;
273
274
} ) ;
274
275
275
- describe ( 'X-AR-IO-Root-Transaction-Id header ' , function ( ) {
276
+ describe ( 'Data item headers ' , function ( ) {
276
277
let compose : StartedDockerComposeEnvironment ;
277
278
278
279
before ( async function ( ) {
@@ -302,87 +303,126 @@ describe('X-AR-IO-Root-Transaction-Id header', function () {
302
303
await compose . down ( ) ;
303
304
} ) ;
304
305
305
- it ( 'Verifying header for trascation' , async function ( ) {
306
- const bundleRes = await axios . head ( `http://localhost:4000/raw/${ bundle1 } ` ) ;
306
+ describe ( 'X-AR-IO-Root-Transaction-Id header' , function ( ) {
307
+ it ( 'Verifying header for trascation' , async function ( ) {
308
+ const bundleRes = await axios . head (
309
+ `http://localhost:4000/raw/${ bundle1 } ` ,
310
+ ) ;
307
311
308
- assert . equal ( bundleRes . headers [ 'x-ar-io-root-transaction-id' ] , undefined ) ;
309
- } ) ;
312
+ assert . equal ( bundleRes . headers [ 'x-ar-io-root-transaction-id' ] , undefined ) ;
313
+ } ) ;
310
314
311
- it ( 'Verifying header for data item' , async function ( ) {
312
- const datasItemRes = await axios . head ( `http://localhost:4000/raw/${ tx1 } ` ) ;
315
+ it ( 'Verifying header for data item' , async function ( ) {
316
+ const datasItemRes = await axios . head ( `http://localhost:4000/raw/${ tx1 } ` ) ;
313
317
314
- assert . equal ( datasItemRes . headers [ 'x-ar-io-root-transaction-id' ] , bundle1 ) ;
318
+ assert . equal (
319
+ datasItemRes . headers [ 'x-ar-io-root-transaction-id' ] ,
320
+ bundle1 ,
321
+ ) ;
322
+ } ) ;
315
323
} ) ;
316
- } ) ;
317
324
318
- describe ( 'X-AR-IO-Data-Item-Data-Offset header' , function ( ) {
319
- let compose : StartedDockerComposeEnvironment ;
320
- const bundle = '-H3KW7RKTXMg5Miq2jHx36OHSVsXBSYuE2kxgsFj6OQ' ;
321
- const bdi = 'fLxHz2WbpNFL7x1HrOyUlsAVHYaKSyj6IqgCJlFuv9g' ;
322
- const di = 'Dc-q5iChuRWcsjVBFstEqmLTx4SWkGZxcVO9OTEGjkQ' ;
325
+ describe ( 'X-AR-IO-Data-Item-Data-Offset header' , function ( ) {
326
+ it ( 'Verifying header for L1 bundle' , async function ( ) {
327
+ const res = await axios . head ( `http://localhost:4000/raw/${ bundle1 } ` ) ;
323
328
324
- before ( async function ( ) {
325
- await cleanDb ( ) ;
326
-
327
- compose = await composeUp ( {
328
- START_WRITERS : 'false' ,
329
- GET_DATA_CIRCUIT_BREAKER_TIMEOUT_MS : '100000' ,
329
+ assert . equal ( res . headers [ 'x-ar-io-data-item-data-offset' ] , undefined ) ;
330
330
} ) ;
331
331
332
- await axios . post (
333
- 'http://localhost:4000/ar-io/admin/queue-bundle' ,
334
- { id : bundle } ,
335
- {
336
- headers : {
337
- 'Content-Type' : 'application/json' ,
338
- Authorization : 'Bearer secret' ,
339
- } ,
340
- } ,
341
- ) ;
332
+ it ( 'Verifying header for bundle data item' , async function ( ) {
333
+ const res = await axios . head ( `http://localhost:4000/raw/${ tx1 } ` ) ;
342
334
343
- await waitForDataItemToBeIndexed ( { id : di } ) ;
335
+ assert . equal ( res . headers [ 'x-ar-io-data-item-data-offset' ] , '53293' ) ;
336
+ } ) ;
344
337
} ) ;
345
338
346
- after ( async function ( ) {
347
- await compose . down ( ) ;
348
- } ) ;
339
+ describe ( 'X-AR-IO-Data-Item-Owner-Offset header' , function ( ) {
340
+ it ( 'Verifying header for L1 bundle' , async function ( ) {
341
+ const res = await axios . head ( `http://localhost:4000/raw/ ${ bundle1 } ` ) ;
349
342
350
- it ( 'Verifying header for L1 bundle' , async function ( ) {
351
- const res = await axios . head ( `http://localhost:4000/raw/${ bundle } ` ) ;
343
+ assert . equal ( res . headers [ 'x-ar-io-data-item-owner-offset' ] , undefined ) ;
344
+ } ) ;
345
+
346
+ it ( 'Verifying header for bundle data item' , async function ( ) {
347
+ const res = await axios . head ( `http://localhost:4000/raw/${ tx1 } ` ) ;
352
348
353
- assert . equal ( res . headers [ 'x-ar-io-data-item-data-offset' ] , undefined ) ;
349
+ assert . equal ( res . headers [ 'x-ar-io-data-item-owner-offset' ] , '3072' ) ;
350
+ } ) ;
354
351
} ) ;
355
352
356
- it ( 'Verifying header for bundle data item' , async function ( ) {
357
- const res = await axios . head ( `http://localhost:4000/raw/${ bdi } ` ) ;
353
+ describe ( 'X-AR-IO-Data-Item-Signature-Offset header' , function ( ) {
354
+ it ( 'Verifying header for L1 bundle' , async function ( ) {
355
+ const res = await axios . head ( `http://localhost:4000/raw/${ bundle1 } ` ) ;
358
356
359
- assert . equal ( res . headers [ 'x-ar-io-data-item-data-offset' ] , '3072' ) ;
360
- } ) ;
357
+ assert . equal (
358
+ res . headers [ 'x-ar-io-data-item-signature-offset' ] ,
359
+ undefined ,
360
+ ) ;
361
+ } ) ;
361
362
362
- it ( 'Verifying header for data item inside bundle data item' , async function ( ) {
363
- const res = await axios . head ( `http://localhost:4000/raw/${ di } ` ) ;
363
+ it ( 'Verifying header for bundle data item' , async function ( ) {
364
+ const res = await axios . head ( `http://localhost:4000/raw/${ tx1 } ` ) ;
364
365
365
- assert . equal ( res . headers [ 'x-ar-io-data-item-data-offset' ] , '5783' ) ;
366
+ assert . equal ( res . headers [ 'x-ar-io-data-item-signature-offset' ] , '3072' ) ;
367
+ } ) ;
366
368
} ) ;
367
369
368
- it ( 'Comparing data downloaded through L1 tx using offsets and data item data' , async function ( ) {
369
- const dataItem = await axios . get ( `http://localhost:4000/${ di } ` , {
370
- responseType : 'arraybuffer' ,
370
+ describe ( 'Nested data item headers' , function ( ) {
371
+ const bundle = '-H3KW7RKTXMg5Miq2jHx36OHSVsXBSYuE2kxgsFj6OQ' ;
372
+ const bdi = 'fLxHz2WbpNFL7x1HrOyUlsAVHYaKSyj6IqgCJlFuv9g' ;
373
+ const di = 'Dc-q5iChuRWcsjVBFstEqmLTx4SWkGZxcVO9OTEGjkQ' ;
374
+ before ( async function ( ) {
375
+ await axios . post (
376
+ 'http://localhost:4000/ar-io/admin/queue-bundle' ,
377
+ { id : bundle } ,
378
+ {
379
+ headers : {
380
+ 'Content-Type' : 'application/json' ,
381
+ Authorization : 'Bearer secret' ,
382
+ } ,
383
+ } ,
384
+ ) ;
385
+
386
+ await waitForDataItemToBeIndexed ( { id : di } ) ;
371
387
} ) ;
372
- const dataItemOffset = parseInt (
373
- dataItem . headers [ 'x-ar-io-data-item-data-offset' ] ,
374
- 10 ,
375
- ) ;
376
- const dataItemSize = parseInt ( dataItem . headers [ 'content-length' ] , 10 ) ;
377
388
378
- const rangeRequest = await axios . get ( `http://localhost:4000/${ bundle } ` , {
379
- headers : {
380
- Range : `bytes=${ dataItemOffset } -${ dataItemOffset + dataItemSize - 1 } ` ,
381
- } ,
382
- responseType : 'arraybuffer' ,
389
+ it ( 'Verifying header for L1 bundle' , async function ( ) {
390
+ const res = await axios . head ( `http://localhost:4000/raw/${ bundle } ` ) ;
391
+
392
+ assert . equal ( res . headers [ 'x-ar-io-data-item-data-offset' ] , undefined ) ;
383
393
} ) ;
384
394
385
- assert . deepEqual ( rangeRequest . data , dataItem . data ) ;
395
+ it ( 'Verifying header for bundle data item' , async function ( ) {
396
+ const res = await axios . head ( `http://localhost:4000/raw/${ bdi } ` ) ;
397
+
398
+ assert . equal ( res . headers [ 'x-ar-io-data-item-data-offset' ] , '3072' ) ;
399
+ } ) ;
400
+
401
+ it ( 'Verifying header for data item inside bundle data item' , async function ( ) {
402
+ const res = await axios . head ( `http://localhost:4000/raw/${ di } ` ) ;
403
+
404
+ assert . equal ( res . headers [ 'x-ar-io-data-item-data-offset' ] , '5783' ) ;
405
+ } ) ;
406
+
407
+ it ( 'Comparing data downloaded through L1 tx using offsets and data item data' , async function ( ) {
408
+ const dataItem = await axios . get ( `http://localhost:4000/${ di } ` , {
409
+ responseType : 'arraybuffer' ,
410
+ } ) ;
411
+ const dataItemOffset = parseInt (
412
+ dataItem . headers [ 'x-ar-io-data-item-data-offset' ] ,
413
+ 10 ,
414
+ ) ;
415
+ const dataItemSize = parseInt ( dataItem . headers [ 'content-length' ] , 10 ) ;
416
+
417
+ const rangeRequest = await axios . get ( `http://localhost:4000/${ bundle } ` , {
418
+ headers : {
419
+ Range : `bytes=${ dataItemOffset } -${ dataItemOffset + dataItemSize - 1 } ` ,
420
+ } ,
421
+ responseType : 'arraybuffer' ,
422
+ } ) ;
423
+
424
+ assert . deepEqual ( rangeRequest . data , dataItem . data ) ;
425
+ } ) ;
386
426
} ) ;
387
427
} ) ;
388
428
0 commit comments