From 2553f53969628680be0748be4e5be60c6ff7bdbd Mon Sep 17 00:00:00 2001 From: Oleg Date: Thu, 23 Jan 2025 11:15:43 +0400 Subject: [PATCH] Tweak --- examples/anchor.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/anchor.js b/examples/anchor.js index d4b447235..b0db451a7 100644 --- a/examples/anchor.js +++ b/examples/anchor.js @@ -51,7 +51,7 @@ async function main() { const docHashes = [ utf8('{"example": "document"}'), utf8('{"example": 2}'), - randomAsU8a(), + randomAsU8a(Math.floor(Math.random() * 64)), utf8('{"example": 4}'), ].map((bytes) => Anchor.hash(bytes).bytes); const proofs = await anchorBatched(anchor, docHashes); @@ -59,7 +59,7 @@ async function main() { assert((await checkBatched(anchor, docHashes[0], proofs[1])) === null); // single - const single = Anchor.hash(randomAsU8a()).bytes; + const single = Anchor.hash(randomAsU8a(Math.floor(Math.random() * 64))).bytes; assert((await checkBatched(anchor, single, [])) === null); await anchorBatched(anchor, [single]); assert((await checkBatched(anchor, single, [])) !== null); @@ -96,7 +96,7 @@ function benchSingleProofCreation(count) { /* eslint-disable no-unused-vars */ const data = Array(count) .fill(undefined) - .map((_, __) => randomAsU8a()); + .map((_, __) => randomAsU8a(Math.floor(Math.random() * 64))); const start = new Date().getTime(); const hashes = data.map((bytes) => Anchor.hash(bytes).bytes); const pl = pack32(hashes); @@ -118,7 +118,7 @@ function timeProofGeneration(count) { /* eslint-disable no-unused-vars */ const data = Array(count) .fill(undefined) - .map((_, __) => randomAsU8a()); + .map((_, __) => randomAsU8a(Math.floor(Math.random() * 64))); const start = new Date().getTime(); const hashes = data.map((bytes) => Anchor.hash(bytes).bytes); const [root, proofs] = buildMerkleTreeAndProofs(hashes);