@@ -41,7 +41,7 @@ describe('p2p client integration block txs protocol ', () => {
4141 let clients : P2PClient [ ] = [ ] ;
4242
4343 const blockNumber = BlockNumber ( 5 ) ;
44- const blockHash = Fr . random ( ) ;
44+ const archiveRoot = Fr . random ( ) ;
4545 let txs : Tx [ ] ;
4646 let txHashes : TxHash [ ] ;
4747 let blockProposal : BlockProposal ;
@@ -100,7 +100,7 @@ describe('p2p client integration block txs protocol ', () => {
100100
101101 txs = await Promise . all ( times ( 5 , i => createMockTxWithMetadata ( p2pBaseConfig , i ) ) ) ;
102102 txHashes = await Promise . all ( txs . map ( tx => tx . getTxHash ( ) ) ) ;
103- blockProposal = await createBlockProposal ( BlockNumber ( blockNumber ) , blockHash , txHashes ) ;
103+ blockProposal = await createBlockProposal ( BlockNumber ( blockNumber ) , archiveRoot , txHashes ) ;
104104 attestationPool . getBlockProposal . mockResolvedValue ( blockProposal ) ;
105105 } ) ;
106106
@@ -122,11 +122,11 @@ describe('p2p client integration block txs protocol ', () => {
122122 await sleep ( 1000 ) ;
123123 } ;
124124
125- const createBlockProposal = ( blockNumber : BlockNumber , blockHash : Fr , txHashes : TxHash [ ] ) => {
125+ const createBlockProposal = ( blockNumber : BlockNumber , archiveRoot : Fr , txHashes : TxHash [ ] ) => {
126126 return makeBlockProposal ( {
127127 signer : Secp256k1Signer . random ( ) ,
128128 blockHeader : makeBlockHeader ( 1 , { blockNumber } ) ,
129- archiveRoot : blockHash ,
129+ archiveRoot,
130130 txHashes,
131131 } ) ;
132132 } ;
@@ -171,11 +171,11 @@ describe('p2p client integration block txs protocol ', () => {
171171 blockProposal ,
172172 txHashes . filter ( ( _ , i ) => requestedIndices . includes ( i ) ) ,
173173 ) ;
174- //const response = await sendBlockTxsRequest(blockHash , requestedIndices, txs.length);
174+ //const response = await sendBlockTxsRequest(archiveRoot , requestedIndices, txs.length);
175175
176176 expect ( response . status ) . toBe ( ReqRespStatus . SUCCESS ) ;
177177 const blockTxsResponse = BlockTxsResponse . fromBuffer ( response . data ) ;
178- expect ( blockTxsResponse . blockHash . equals ( blockHash ) ) . toBe ( true ) ;
178+ expect ( blockTxsResponse . archiveRoot . equals ( archiveRoot ) ) . toBe ( true ) ;
179179 expect ( blockTxsResponse . txs . length ) . toBe ( requestedIndices . length ) ;
180180 expect ( blockTxsResponse . txIndices . getTrueIndices ( ) ) . toEqual ( [ 0 , 1 , 2 , 3 , 4 ] ) ;
181181
@@ -211,7 +211,7 @@ describe('p2p client integration block txs protocol ', () => {
211211
212212 expect ( response . status ) . toBe ( ReqRespStatus . SUCCESS ) ;
213213 const blockTxsResponse = BlockTxsResponse . fromBuffer ( response . data ) ;
214- expect ( blockTxsResponse . blockHash . equals ( blockHash ) ) . toBe ( true ) ;
214+ expect ( blockTxsResponse . archiveRoot . equals ( archiveRoot ) ) . toBe ( true ) ;
215215 expect ( blockTxsResponse . txs . length ) . toBe ( 2 ) ; // Only txs at indices 0 and 2 are returned
216216 expect ( blockTxsResponse . txIndices . getTrueIndices ( ) ) . toEqual ( [ 0 , 2 , 3 ] ) ;
217217
@@ -235,7 +235,7 @@ describe('p2p client integration block txs protocol ', () => {
235235
236236 expect ( response . status ) . toBe ( ReqRespStatus . SUCCESS ) ;
237237 const blockTxsResponse = BlockTxsResponse . fromBuffer ( response . data ) ;
238- expect ( blockTxsResponse . blockHash . equals ( blockHash ) ) . toBe ( true ) ;
238+ expect ( blockTxsResponse . archiveRoot . equals ( archiveRoot ) ) . toBe ( true ) ;
239239 expect ( blockTxsResponse . txs . length ) . toBe ( 0 ) ;
240240 expect ( blockTxsResponse . txIndices . getTrueIndices ( ) ) . toEqual ( [ ] ) ;
241241 } ) ;
@@ -260,7 +260,7 @@ describe('p2p client integration block txs protocol ', () => {
260260
261261 expect ( response . status ) . toBe ( ReqRespStatus . SUCCESS ) ;
262262 const blockTxsResponse = BlockTxsResponse . fromBuffer ( response . data ) ;
263- expect ( blockTxsResponse . blockHash . equals ( blockHash ) ) . toBe ( true ) ;
263+ expect ( blockTxsResponse . archiveRoot . equals ( archiveRoot ) ) . toBe ( true ) ;
264264 expect ( blockTxsResponse . txs . length ) . toBe ( requestedIndices . length ) ;
265265 expect ( blockTxsResponse . txIndices . getTrueIndices ( ) ) . toEqual ( [ 0 , 1 , 2 , 3 , 4 ] ) ;
266266
@@ -297,7 +297,7 @@ describe('p2p client integration block txs protocol ', () => {
297297
298298 expect ( response . status ) . toBe ( ReqRespStatus . SUCCESS ) ;
299299 const blockTxsResponse = BlockTxsResponse . fromBuffer ( response . data ) ;
300- expect ( blockTxsResponse . blockHash . equals ( blockHash ) ) . toBe ( true ) ;
300+ expect ( blockTxsResponse . archiveRoot . equals ( archiveRoot ) ) . toBe ( true ) ;
301301 expect ( blockTxsResponse . txs . length ) . toBe ( 2 ) ; // Only 2 txs returned
302302 expect ( blockTxsResponse . txIndices . getTrueIndices ( ) ) . toEqual ( [ 1 , 3 ] ) ; // Only indices 1 and 3 available
303303
@@ -337,8 +337,8 @@ describe('p2p client integration block txs protocol ', () => {
337337 expect ( response . status ) . toBe ( ReqRespStatus . SUCCESS ) ;
338338 const blockTxsResponse = BlockTxsResponse . fromBuffer ( response . data ) ;
339339
340- // When peer doesn't have proposal but has txs, it returns Fr.ZERO as blockHash
341- expect ( blockTxsResponse . blockHash . equals ( Fr . ZERO ) ) . toBe ( true ) ;
340+ // When peer doesn't have proposal but has txs, it returns Fr.ZERO as archive root
341+ expect ( blockTxsResponse . archiveRoot . equals ( Fr . ZERO ) ) . toBe ( true ) ;
342342 expect ( blockTxsResponse . txs . length ) . toBe ( 2 ) ; // Only 2 txs available
343343 expect ( blockTxsResponse . txIndices . getLength ( ) ) . toBe ( 0 ) ; // Empty BitVector when no proposal
344344
@@ -367,7 +367,7 @@ describe('p2p client integration block txs protocol ', () => {
367367 expect ( response . status ) . toBe ( ReqRespStatus . SUCCESS ) ;
368368 const blockTxsResponse = BlockTxsResponse . fromBuffer ( response . data ) ;
369369
370- expect ( blockTxsResponse . blockHash . equals ( Fr . ZERO ) ) . toBe ( true ) ;
370+ expect ( blockTxsResponse . archiveRoot . equals ( Fr . ZERO ) ) . toBe ( true ) ;
371371 expect ( blockTxsResponse . txs . length ) . toBe ( 1 ) ; // Only 1 tx available
372372 expect ( blockTxsResponse . txIndices . getLength ( ) ) . toBe ( 0 ) ;
373373
@@ -389,7 +389,7 @@ describe('p2p client integration block txs protocol ', () => {
389389 expect ( response . status ) . toBe ( ReqRespStatus . SUCCESS ) ;
390390 const blockTxsResponse = BlockTxsResponse . fromBuffer ( response . data ) ;
391391
392- expect ( blockTxsResponse . blockHash . equals ( Fr . ZERO ) ) . toBe ( true ) ;
392+ expect ( blockTxsResponse . archiveRoot . equals ( Fr . ZERO ) ) . toBe ( true ) ;
393393 expect ( blockTxsResponse . txs . length ) . toBe ( 0 ) ; // No txs available
394394 expect ( blockTxsResponse . txIndices . getLength ( ) ) . toBe ( 0 ) ;
395395 } ) ;
0 commit comments