@@ -335,7 +335,7 @@ describe('KVArchiverDataStore', () => {
335335 await store . addCheckpoints ( publishedCheckpoints ) ;
336336 const lastCheckpoint = publishedCheckpoints [ publishedCheckpoints . length - 1 ] ;
337337 const lastBlock = lastCheckpoint . checkpoint . blocks [ 0 ] ;
338- const blockHash = await lastBlock . header . hash ( ) ;
338+ const blockHash = ( await lastBlock . header . hash ( ) ) . toField ( ) ;
339339 const archive = lastBlock . archive . root ;
340340
341341 // Verify block and header exist before removing
@@ -639,7 +639,7 @@ describe('KVArchiverDataStore', () => {
639639 // Check each block by its hash
640640 for ( let i = 0 ; i < checkpoint . checkpoint . blocks . length ; i ++ ) {
641641 const block = checkpoint . checkpoint . blocks [ i ] ;
642- const blockHash = await block . header . hash ( ) ;
642+ const blockHash = ( await block . header . hash ( ) ) . toField ( ) ;
643643 const retrievedBlock = await store . getCheckpointedBlockByHash ( blockHash ) ;
644644
645645 expect ( retrievedBlock ) . toBeDefined ( ) ;
@@ -797,8 +797,8 @@ describe('KVArchiverDataStore', () => {
797797 await store . addProposedBlocks ( [ block1 , block2 ] ) ;
798798
799799 // getBlockByHash should work for uncheckpointed blocks
800- const hash1 = await block1 . header . hash ( ) ;
801- const hash2 = await block2 . header . hash ( ) ;
800+ const hash1 = ( await block1 . header . hash ( ) ) . toField ( ) ;
801+ const hash2 = ( await block2 . header . hash ( ) ) . toField ( ) ;
802802
803803 const retrieved1 = await store . getBlockByHash ( hash1 ) ;
804804 expect ( retrieved1 ! . equals ( block1 ) ) . toBe ( true ) ;
@@ -874,7 +874,7 @@ describe('KVArchiverDataStore', () => {
874874 } ) ;
875875 await store . addProposedBlocks ( [ block1 ] ) ;
876876
877- const hash = await block1 . header . hash ( ) ;
877+ const hash = ( await block1 . header . hash ( ) ) . toField ( ) ;
878878
879879 // getCheckpointedBlockByHash should return undefined
880880 expect ( await store . getCheckpointedBlockByHash ( hash ) ) . toBeUndefined ( ) ;
@@ -1666,7 +1666,7 @@ describe('KVArchiverDataStore', () => {
16661666 it ( 'retrieves a block by its hash' , async ( ) => {
16671667 const expectedCheckpoint = publishedCheckpoints [ 5 ] ;
16681668 const expectedBlock = expectedCheckpoint . checkpoint . blocks [ 0 ] ;
1669- const blockHash = await expectedBlock . header . hash ( ) ;
1669+ const blockHash = ( await expectedBlock . header . hash ( ) ) . toField ( ) ;
16701670 const retrievedBlock = await store . getCheckpointedBlockByHash ( blockHash ) ;
16711671
16721672 expect ( retrievedBlock ) . toBeDefined ( ) ;
@@ -1707,7 +1707,7 @@ describe('KVArchiverDataStore', () => {
17071707
17081708 it ( 'retrieves a block header by its hash' , async ( ) => {
17091709 const expectedBlock = publishedCheckpoints [ 7 ] . checkpoint . blocks [ 0 ] ;
1710- const blockHash = await expectedBlock . header . hash ( ) ;
1710+ const blockHash = ( await expectedBlock . header . hash ( ) ) . toField ( ) ;
17111711 const retrievedHeader = await store . getBlockHeaderByHash ( blockHash ) ;
17121712
17131713 expect ( retrievedHeader ) . toBeDefined ( ) ;
@@ -1833,7 +1833,7 @@ describe('KVArchiverDataStore', () => {
18331833 const expectedTx : IndexedTxEffect = {
18341834 data,
18351835 l2BlockNumber : block . number ,
1836- l2BlockHash : L2BlockHash . fromField ( await block . header . hash ( ) ) ,
1836+ l2BlockHash : await block . header . hash ( ) ,
18371837 txIndexInBlock,
18381838 } ;
18391839 const actualTx = await store . getTxEffect ( data . txHash ) ;
@@ -2732,7 +2732,7 @@ describe('KVArchiverDataStore', () => {
27322732
27332733 it ( 'returns block hash on public log ids' , async ( ) => {
27342734 const targetBlock = publishedCheckpoints [ 0 ] . checkpoint . blocks [ 0 ] ;
2735- const expectedBlockHash = L2BlockHash . fromField ( await targetBlock . header . hash ( ) ) ;
2735+ const expectedBlockHash = await targetBlock . header . hash ( ) ;
27362736
27372737 const logs = ( await store . getPublicLogs ( { fromBlock : targetBlock . number , toBlock : targetBlock . number + 1 } ) ) . logs ;
27382738
@@ -2790,7 +2790,7 @@ describe('KVArchiverDataStore', () => {
27902790 const targetTxIndex = randomInt ( getTxsPerBlock ( targetBlock ) ) ;
27912791 const numLogsInTx = targetBlock . body . txEffects [ targetTxIndex ] . publicLogs . length ;
27922792 const targetLogIndex = numLogsInTx > 0 ? randomInt ( numLogsInTx ) : 0 ;
2793- const targetBlockHash = L2BlockHash . fromField ( await targetBlock . header . hash ( ) ) ;
2793+ const targetBlockHash = await targetBlock . header . hash ( ) ;
27942794
27952795 const afterLog = new LogId (
27962796 BlockNumber ( targetBlockIndex + INITIAL_L2_BLOCK_NUM ) ,
@@ -2882,7 +2882,7 @@ describe('KVArchiverDataStore', () => {
28822882 const targetTxIndex = randomInt ( getTxsPerBlock ( targetBlock ) ) ;
28832883 const numLogsInTx = targetBlock . body . txEffects [ targetTxIndex ] . publicLogs . length ;
28842884 const targetLogIndex = numLogsInTx > 0 ? randomInt ( numLogsInTx ) : 0 ;
2885- const targetBlockHash = L2BlockHash . fromField ( await targetBlock . header . hash ( ) ) ;
2885+ const targetBlockHash = await targetBlock . header . hash ( ) ;
28862886
28872887 const afterLog = new LogId (
28882888 BlockNumber ( targetBlockIndex + INITIAL_L2_BLOCK_NUM ) ,
@@ -2935,7 +2935,7 @@ describe('KVArchiverDataStore', () => {
29352935 expect ( result . logs ) . toHaveLength ( 1 ) ;
29362936
29372937 const [ { id, log } ] = result . logs ;
2938- const expectedBlockHash = L2BlockHash . fromField ( await targetBlock . header . hash ( ) ) ;
2938+ const expectedBlockHash = await targetBlock . header . hash ( ) ;
29392939
29402940 expect ( id . blockHash . equals ( expectedBlockHash ) ) . toBe ( true ) ;
29412941 expect ( id . blockNumber ) . toEqual ( targetBlock . number ) ;
@@ -3320,7 +3320,7 @@ describe('KVArchiverDataStore', () => {
33203320 await store . addProposedBlocks ( [ block1 , block2 ] ) ;
33213321
33223322 // Verify block2 is retrievable by hash and archive before removal
3323- const block2Hash = await block2 . header . hash ( ) ;
3323+ const block2Hash = ( await block2 . header . hash ( ) ) . toField ( ) ;
33243324 const block2Archive = block2 . archive . root ;
33253325
33263326 expect ( await store . getBlockByHash ( block2Hash ) ) . toBeDefined ( ) ;
@@ -3346,7 +3346,7 @@ describe('KVArchiverDataStore', () => {
33463346 }
33473347
33483348 // Verify block1's data is still intact
3349- const block1Hash = await block1 . header . hash ( ) ;
3349+ const block1Hash = ( await block1 . header . hash ( ) ) . toField ( ) ;
33503350 const block1Archive = block1 . archive . root ;
33513351
33523352 expect ( await store . getBlockByHash ( block1Hash ) ) . toBeDefined ( ) ;
0 commit comments