1+ import { randomBytes } from '@libp2p/crypto'
12import { stop , TimeoutError } from '@libp2p/interface'
23import { prefixLogger } from '@libp2p/logger'
34import { expect } from 'aegir/chai'
@@ -10,6 +11,7 @@ import pRetry from 'p-retry'
1011import pWaitFor from 'p-wait-for'
1112import { raceSignal } from 'race-signal'
1213import { Uint8ArrayList } from 'uint8arraylist'
14+ import { concat as uint8ArrayConcat } from 'uint8arrays'
1315import { isValidTick } from '../is-valid-tick.js'
1416import { createPeer , getTransportManager , getUpgrader } from './utils.ts'
1517import type { TestSetup } from '../index.js'
@@ -333,7 +335,7 @@ export default (common: TestSetup<TransportTestFixtures>): void => {
333335
334336 const connection = await dialer . dial ( dialAddrs [ 0 ] )
335337
336- const input = new Uint8Array ( 1024 ) . fill ( 5 )
338+ const input = randomBytes ( 1024 )
337339 const output = await dialer . services . echo . echo ( connection . remotePeer , input , {
338340 signal : AbortSignal . timeout ( timeout )
339341 } )
@@ -349,7 +351,7 @@ export default (common: TestSetup<TransportTestFixtures>): void => {
349351
350352 const connection = await dialer . dial ( dialAddrs [ 0 ] )
351353
352- const input = new Uint8Array ( 1024 * 1024 * 10 ) . fill ( 5 )
354+ const input = uint8ArrayConcat ( new Array ( 160 ) . fill ( 0 ) . map ( ( ) => randomBytes ( 65535 ) ) )
353355 const output = await dialer . services . echo . echo ( connection . remotePeer , input , {
354356 signal : AbortSignal . timeout ( timeout )
355357 } )
0 commit comments