Skip to content

Commit

Permalink
style: change to camelCase and beginCell()
Browse files Browse the repository at this point in the history
  • Loading branch information
akifoq committed May 2, 2024
1 parent b242b66 commit cd92a5d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/dict/Dictionary.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,12 @@ describe('Dictionary', () => {
d.set(4, 44);
d.set(5, 55);

const dict_hash = new Builder().storeDictDirect(d).endCell().hash();
const dictHash = beginCell().storeDictDirect(d).endCell().hash();
for (let k = 1; k <= 5; k++) {
const proof = d.generateMerkleProof([k]);
Cell.fromBoc(proof.toBoc());
expect(exoticMerkleProof(proof.bits, proof.refs).proofHash).toEqual(
dict_hash
dictHash
);

// todo: parse the pruned dictionary and check the presence of the keys
Expand All @@ -136,7 +136,7 @@ describe('Dictionary', () => {
const proof = d.generateMerkleProof([k, k + 1, k + 2]);
Cell.fromBoc(proof.toBoc());
expect(exoticMerkleProof(proof.bits, proof.refs).proofHash).toEqual(
dict_hash
dictHash
);
}
});
Expand Down
8 changes: 4 additions & 4 deletions src/dict/generateMerkleProof.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,25 +68,25 @@ function doGenerateMerkleProof(
let right = sl.loadRef();
// NOTE: Left and right branches are implicitly contain prefixes '0' and '1'
if (!left.isExotic) {
const left_keys = keys.filter((key) => {
const leftKeys = keys.filter((key) => {
return pp + '0' === key.slice(0, pp.length + 1);
});
left = doGenerateMerkleProof(
pp + '0',
left.beginParse(),
n - prefixLength - 1,
left_keys
leftKeys
);
}
if (!right.isExotic) {
const right_keys = keys.filter((key) => {
const rightKeys = keys.filter((key) => {
return pp + '1' === key.slice(0, pp.length + 1);
});
right = doGenerateMerkleProof(
pp + '1',
right.beginParse(),
n - prefixLength - 1,
right_keys
rightKeys
);
}

Expand Down

0 comments on commit cd92a5d

Please sign in to comment.