1
1
import { describe , it , expect } from "vitest" ;
2
- import { bitLength , maxChunksToDepth , nextPowerOf2 } from "../../src/util/merkleize.js" ;
3
- import { merkleizeInto , LeafNode , zeroHash } from "@chainsafe/persistent-merkle-tree" ;
2
+ import { bitLength , maxChunksToDepth , merkleize , mixInLength , nextPowerOf2 } from "../../src/util/merkleize.js" ;
3
+ import { merkleizeBlocksBytes , LeafNode , zeroHash } from "@chainsafe/persistent-merkle-tree" ;
4
4
5
5
describe ( "util / merkleize / bitLength" , ( ) => {
6
6
const bitLengthByIndex = [ 0 , 1 , 2 , 2 , 3 , 3 , 3 , 3 , 4 , 4 ] ;
@@ -41,7 +41,7 @@ describe("util / merkleize / mixInLength", () => {
41
41
mixInLengthBuffer . set ( root , 0 ) ;
42
42
mixInLengthBuffer . writeUIntLE ( length , 32 , 6 ) ;
43
43
const finalRoot = new Uint8Array ( 32 ) ;
44
- merkleizeInto ( mixInLengthBuffer , 2 , finalRoot , 0 ) ;
44
+ merkleizeBlocksBytes ( mixInLengthBuffer , 2 , finalRoot , 0 ) ;
45
45
const expectedRoot = mixInLength ( root , length ) ;
46
46
expect ( finalRoot ) . to . be . deep . equal ( expectedRoot ) ;
47
47
} ) ;
@@ -58,7 +58,7 @@ describe("merkleize should be equal to merkleizeInto of hasher", () => {
58
58
const roots = nodes . map ( ( node ) => node . root ) ;
59
59
const expectedRoot = Buffer . alloc ( 32 ) ;
60
60
const chunkCount = Math . max ( numNode , 1 ) ;
61
- merkleizeInto ( padData , chunkCount , expectedRoot , 0 ) ;
61
+ merkleizeBlocksBytes ( padData , chunkCount , expectedRoot , 0 ) ;
62
62
expect ( merkleize ( roots , chunkCount ) ) . to . be . deep . equal ( expectedRoot ) ;
63
63
} ) ;
64
64
}
0 commit comments