From 619aeba52e84f2494db9bfb9db9c073061a8f183 Mon Sep 17 00:00:00 2001 From: Hadrien Croubois Date: Mon, 4 Mar 2024 23:58:15 +0100 Subject: [PATCH] reduce fuzz size and max leaf count --- src/simple.test.ts | 4 ++-- src/standard.test.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/simple.test.ts b/src/simple.test.ts index feaca86..5bfb64c 100644 --- a/src/simple.test.ts +++ b/src/simple.test.ts @@ -5,7 +5,7 @@ import { SimpleMerkleTree } from './simple'; import { BytesLike, HexString, concat, compare, toHex } from './bytes'; import { InvalidArgumentError, InvariantError } from './utils/errors'; -fc.configureGlobal({ numRuns: process.env.CI ? 10000 : 100 }); +fc.configureGlobal({ numRuns: process.env.CI ? 5000 : 100 }); const reverseNodeHash = (a: BytesLike, b: BytesLike): HexString => keccak256(concat([a, b].sort(compare).reverse())); const otherNodeHash = (a: BytesLike, b: BytesLike): HexString => keccak256(reverseNodeHash(a, b)); // double hash @@ -14,7 +14,7 @@ const otherNodeHash = (a: BytesLike, b: BytesLike): HexString => keccak256(rever const leaf = fc .uint8Array({ minLength: 32, maxLength: 32 }) .chain(l => fc.oneof(fc.constant(l), fc.constant(toHex(l)))); -const leaves = fc.array(leaf, { minLength: 1 }); +const leaves = fc.array(leaf, { minLength: 1, maxLength: 1000 }); const options = fc.record({ sortLeaves: fc.oneof(fc.constant(undefined), fc.boolean()), nodeHash: fc.oneof(fc.constant(undefined), fc.constant(reverseNodeHash)), diff --git a/src/standard.test.ts b/src/standard.test.ts index c662c8c..6d7f404 100644 --- a/src/standard.test.ts +++ b/src/standard.test.ts @@ -4,11 +4,11 @@ import { keccak256 } from '@ethersproject/keccak256'; import { StandardMerkleTree } from './standard'; import { InvalidArgumentError, InvariantError } from './utils/errors'; -fc.configureGlobal({ numRuns: process.env.CI ? 10000 : 100 }); +fc.configureGlobal({ numRuns: process.env.CI ? 5000 : 100 }); const leafEncoding = ['uint256', 'string[]']; const leaf = fc.tuple(fc.bigUintN(256), fc.array(fc.string())); -const leaves = fc.array(leaf, { minLength: 1 }); +const leaves = fc.array(leaf, { minLength: 1, maxLength: 1000 }); const options = fc.record({ sortLeaves: fc.oneof(fc.constant(undefined), fc.boolean()) }); const tree = fc