foundry icon indicating copy to clipboard operation
foundry copied to clipboard

feat: weight invariant selectors by number of selectors, not number of contracts.

Open mds1 opened this issue 3 years ago • 0 comments

Component

Forge

Describe the feature you would like

Let's say right now my invariant test is setup with two contracts:

  • Contract A has 1 function selector, fn0.
  • Contract B has 20 function selectors, fn1 through fn20.

As I understand it, right now the process is:

  1. First Contract A or Contract B will be chosen randomly
  2. Then we look at the available selectors for each and randomly choose one.

This means fn0 will be chosen ~50% of the time, and fn1 through fn20 are each only chosen 50 / 20 = 2.5% of the time. Ideally, each of the 21 functions would be chosen 100 / 21 = ~4.76% of the time

Additional context

No response

mds1 avatar Aug 28 '22 15:08 mds1