From e8c552ab0ef3d1650c9e33519d489dafb797b34e Mon Sep 17 00:00:00 2001 From: BowTiedRadone Date: Tue, 7 Jan 2025 13:50:25 +0200 Subject: [PATCH] Mine blocks inversely proportional to the number of runs --- invariant.ts | 11 ++++++++++- property.ts | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/invariant.ts b/invariant.ts index 110f52b1..4c365ec7 100644 --- a/invariant.ts +++ b/invariant.ts @@ -128,7 +128,16 @@ export const checkInvariants = ( fc .record({ burnBlocks: r.canMineBlocks - ? fc.integer({ min: 1, max: 10 }) + ? // This arbitrary produces integers with a maximum value + // inversely proportional to the number of runs: + // - Fewer runs result in a higher maximum burn blocks, + // allowing more blocks to be mined. + // - More runs result in a lower maximum burn blocks, as more + // blocks are mined overall. + fc.integer({ + min: 1, + max: Math.ceil(100_000 / (runs || 100)), + }) : fc.constant(0), }) .map((burnBlocks) => ({ ...r, ...burnBlocks })) diff --git a/property.ts b/property.ts index 4bc32ca3..c1281d0c 100644 --- a/property.ts +++ b/property.ts @@ -144,7 +144,16 @@ export const checkProperties = ( fc .record({ burnBlocks: r.canMineBlocks - ? fc.integer({ min: 1, max: 10 }) + ? // This arbitrary produces integers with a maximum value + // inversely proportional to the number of runs: + // - Fewer runs result in a higher maximum burn blocks, + // allowing more blocks to be mined. + // - More runs result in a lower maximum burn blocks, as more + // blocks are mined overall. + fc.integer({ + min: 1, + max: Math.ceil(100_000 / (runs || 100)), + }) : fc.constant(0), }) .map((burnBlocks) => ({ ...r, ...burnBlocks }))