Skip to content

Commit

Permalink
reduce fuzz size and max leaf count
Browse files Browse the repository at this point in the history
  • Loading branch information
Amxx committed Mar 4, 2024
1 parent 5ab5710 commit 619aeba
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/simple.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)),
Expand Down
4 changes: 2 additions & 2 deletions src/standard.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 619aeba

Please sign in to comment.