Skip to content

Commit

Permalink
Mine blocks inversely proportional to the number of runs
Browse files Browse the repository at this point in the history
  • Loading branch information
BowTiedRadone committed Jan 7, 2025
1 parent 218d9aa commit e8c552a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
11 changes: 10 additions & 1 deletion invariant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }))
Expand Down
11 changes: 10 additions & 1 deletion property.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }))
Expand Down

0 comments on commit e8c552a

Please sign in to comment.